From 4d7c3c717c80f1e85efeae728f145e4b656505a4 Mon Sep 17 00:00:00 2001 From: Jan Kupec Date: Fri, 14 Mar 2008 09:47:45 +0000 Subject: [PATCH] - compile --- src/output/OutNormal.cc | 3 ++- src/output/OutXML.cc | 2 +- src/zypper-prompt.cc | 12 +++++++----- src/zypper-utils.cc | 3 ++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/output/OutNormal.cc b/src/output/OutNormal.cc index bbd167a..18b4fe2 100644 --- a/src/output/OutNormal.cc +++ b/src/output/OutNormal.cc @@ -200,10 +200,11 @@ void OutNormal::prompt(PromptId id, { string option_str; PromptOptions::OptionList::const_iterator it; - if (poptions.options().begin() != poptions.end()) + if ((it = poptions.options().begin()) != poptions.options().end()) { //if (is_default) // TODO option_str += *it; + ++it; } for (; it != poptions.options().end(); ++it) diff --git a/src/output/OutXML.cc b/src/output/OutXML.cc index d86886d..517d61c 100644 --- a/src/output/OutXML.cc +++ b/src/output/OutXML.cc @@ -199,7 +199,7 @@ void OutXML::prompt(PromptId id, { string option = *it; cout << "" << endl; diff --git a/src/zypper-prompt.cc b/src/zypper-prompt.cc index f3b6e8c..33b2caa 100644 --- a/src/zypper-prompt.cc +++ b/src/zypper-prompt.cc @@ -16,7 +16,7 @@ using namespace boost; PromptOptions::PromptOptions(const std::string option_str, unsigned int default_opt) { - zypp::str::split(answer_hint, back_inserter(_options), "/"); + zypp::str::split(option_str, back_inserter(_options), "/"); if (_options.size() <= default_opt) INT << "Invalid default option index " << default_opt << endl; @@ -41,7 +41,8 @@ int read_action_ari (PromptId pid, int default_action) { // the anserws must be separated by slash characters '/' and must // correspond to abort/retry/ignore in that order. // The answers should be lower case letters. - out.prompt(pid, _("Abort, retry, ignore?"), _("a/r/i")); + PromptOptions popts(_("a/r/i"), 0); + out.prompt(pid, _("Abort, retry, ignore?"), popts); // choose abort if no default has been specified if (default_action == -1) { @@ -79,7 +80,7 @@ int read_action_ari (PromptId pid, int default_action) { ostringstream s; s << format(_("Invalid answer '%s'.")) % c << " " << _("Choose letter 'a', 'r', or 'i'"); - out.prompt(pid, s.str(), _("a/r/i")); //! \todo remove this, handle invalid answers within the first prompt() + out.prompt(pid, s.str(), popts); //! \todo remove this, handle invalid answers within the first prompt() DBG << "invalid answer" << endl; } @@ -95,7 +96,8 @@ bool read_bool_answer(PromptId pid, const string & question, bool default_answer string yn = string(_("yes")) + "/" + _("no"); - out.prompt(pid, question, yn); + PromptOptions popts(yn, default_answer ? 0 : 1); + out.prompt(pid, question, popts); // non-interactive mode: print the answer for convenience (only for normal // output) and return default @@ -121,7 +123,7 @@ bool read_bool_answer(PromptId pid, const string & question, bool default_answer // The second and the third %s is the translated 'yes' and 'no' string (lowercase). _("Enter 'y' for '%s' or 'n' for '%s' if nothing else works for you")) % _("yes") % _("no"); - out.prompt(pid, s.str(), yn); //! \todo remove this, handle invalid answers within the first prompt() + out.prompt(pid, s.str(), popts); //! \todo remove this, handle invalid answers within the first prompt() } c = zypp::str::getline (stm, zypp::str::TRIM); been_here_before = true; diff --git a/src/zypper-utils.cc b/src/zypper-utils.cc index c81a37f..c29c847 100644 --- a/src/zypper-utils.cc +++ b/src/zypper-utils.cc @@ -9,9 +9,10 @@ #include "zypp/media/MediaManager.h" #include "zypp/parser/xml_escape_parser.hpp" +#include "zypper.h" #include "zypper-main.h" #include "zypper-utils.h" -//#include "zypper-callbacks.h" + using namespace std; using namespace zypp; -- 2.7.4