ref: refs/heads/master
commit 29131f4bee83ed385dbcaee04f8b42e0b39cba4f
Author: Ján Kupec
Date: Sun Feb 15 21:10:09 2009 +0100
Allow changing URI in media problem prompt.
---
src/callbacks/media.h | 48 +++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 43 insertions(+), 5 deletions(-)
diff --git a/src/callbacks/media.h b/src/callbacks/media.h
index 0cd9b6e..6cd0225 100644
--- a/src/callbacks/media.h
+++ b/src/callbacks/media.h
@@ -64,6 +64,8 @@ namespace ZmartRecipients
const std::vectorstd::string & devices,
unsigned int & index)
{
+ Zypper & zypper = *Zypper::instance();
+
/*std::cout << "detected devices: ";
for (std::vectorstd::string::const_iterator it = devices.begin();
it != devices.end(); ++it)
@@ -71,7 +73,7 @@ namespace ZmartRecipients
cout << std::endl;*/
DBG << "media problem, url: " << url.asString() << std::endl;
- Zypper::instance()->out().error(description);
+ zypper.out().error(description);
if (is_changeable_media(url) && error == MediaChangeReport::WRONG)
{
//cerr << endl; // may be in the middle of RepoReport or ProgressReport \todo check this
@@ -98,14 +100,50 @@ namespace ZmartRecipients
30,action);
}
- Action action = (Action) read_action_ari(
- PROMPT_ARI_MEDIA_PROBLEM, MediaChangeReport::ABORT);
+ // translators: a/r/i/u are replies to the "Abort, retry, ignore?" prompt
+ // Translate the a/r/i part exactly as you did the a/r/i string.
+ // the 'u' reply means 'Change URI'.
+ PromptOptions popts(_("a/r/i/u"), 0);
+ // help text for the "Abort, retry, ignore?" prompt for media errors
+ popts.setOptionHelp(0, _("Skip retrieval of the file and abort current operation."));
+ // help text for the "Abort, retry, ignore?" prompt for media errors
+ popts.setOptionHelp(1, _("Try to retrieve the file again."));
+ // help text for the "Abort, retry, ignore?" prompt for media errors
+ popts.setOptionHelp(2, _("Skip retrieval of the file and try to continue with the operation without the file."));
+ // help text for the "Abort, retry, ignore?" prompt for media errors
+ popts.setOptionHelp(3, _("Change current base URI and try retrieving the file again."));
+ // hide advanced options
+ popts.setShownCount(3);
+
+ // translators: this is a prompt text
+ zypper.out().prompt(PROMPT_ARI_MEDIA_PROBLEM, _("Abort, retry, ignore?"), popts);
+ int reply = get_prompt_reply(zypper, PROMPT_ARI_MEDIA_PROBLEM, popts);
+
+ Action action = MediaChangeReport::ABORT;
+ switch (reply)
+ {
+ case 0: /* abort */
+ break;
+ case 3: /* change url */
+ {
+ // translators: this is a prompt label, will appear as "New URI: "
+ zypp::Url newurl(get_text(_("New URI") + std::string(": "), url.asString()));
+ url = newurl;
+ }
+ case 1: /* retry */
+ action = MediaChangeReport::RETRY;
+ break;
+ case 2: /* ignore */
+ action = MediaChangeReport::IGNORE;
+ default:
+ WAR << "invalid prompt reply: " << reply << std::endl;
+ }
// if an rpm download failed and user chose to ignore that, advice to
// run zypper verify afterwards
if (action == MediaChangeReport::IGNORE
- && Zypper::instance()->runtimeData().action_rpm_download
- && !Zypper::instance()->runtimeData().seen_verify_hint)
+ && zypper.runtimeData().action_rpm_download
+ && !zypper.runtimeData().seen_verify_hint)
print_verify_hint(Zypper::instance()->out());
return action;
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org