Author: lslezak Date: Thu Jun 7 12:46:58 2007 New Revision: 38335 URL: http://svn.opensuse.org/viewcvs/yast?rev=38335&view=rev Log: - display licenses in the command line mode properly, fixed prompt when removing packages (#270910) Modified: trunk/yast2/library/packages/src/PackageSystem.ycp trunk/yast2/library/packages/src/common.ycp trunk/yast2/package/yast2.changes Modified: trunk/yast2/library/packages/src/PackageSystem.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/packages/src/PackageSystem.ycp?rev=38335&r1=38334&r2=38335&view=diff ============================================================================== --- trunk/yast2/library/packages/src/PackageSystem.ycp (original) +++ trunk/yast2/library/packages/src/PackageSystem.ycp Thu Jun 7 12:46:58 2007 @@ -123,9 +123,27 @@ if (size (licenses) > 0) { list<string> rt_licenses_l = maplist ( string p, string l, licenses, { - return sformat ("<p><b>%1</b></p>\n%2", p, l); + return Mode::commandline() + ? sformat ("%1\n%2", p, l) + : sformat ("<p><b>%1</b></p>\n%2", p, l); }); - if (! Popup::AnyQuestionRichText ( + + boolean accepted = false; + + if (Mode::commandline()) + { + // print the licenses + CommandLine::Print(mergestring (rt_licenses_l, "\n")); + // print the question + CommandLine::Print(_("Do you accept this license agreement?", + "Do you accept these license agreements?", + size (licenses))); + + accepted = !CommandLine::YesNo(); + } + else + { + accepted = !Popup::AnyQuestionRichText ( // popup heading, with rich text widget and Yes/No buttons _("Do you accept this license agreement?", "Do you accept these license agreements?", @@ -133,19 +151,26 @@ mergestring (rt_licenses_l, "\n"), 70, 20, Label::YesButton (), Label::NoButton (), - `focus_none)) + `focus_none); + } + + y2milestone("Licenses accepted: %1", accepted); + + if (!accepted) { y2milestone("License not accepted: %1", toinstall); last_op_canceled = true; return false; } + + // mark licenses as confirmed foreach (string p, string l, licenses, { Pkg::PkgMarkLicenseConfirmed (p); }); last_op_canceled = false; } - // check if the database os consistent before packages were added + // check if the database is consistent before packages are added boolean packages_consistent = Pkg::PkgSolveCheckTargetOnly(); foreach (string p, toinstall, { Modified: trunk/yast2/library/packages/src/common.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/packages/src/common.ycp?rev=38335&r1=38334&r2=38335&view=diff ============================================================================== --- trunk/yast2/library/packages/src/common.ycp (original) +++ trunk/yast2/library/packages/src/common.ycp Thu Jun 7 12:46:58 2007 @@ -106,10 +106,11 @@ return which != nil; } -boolean AskPackages(list<string> packs) { +boolean AskPackages(list<string> packs, boolean install) { string pkgs = mergestring(packs, ", "); // the message is followed by list of required packages - string text = _("These packages need to be installed:") + " " + pkgs; + string text = (install ? _("These packages need to be installed:") : _("These packages need to be removed:")) + + " " + pkgs; CommandLine::Print(text); return CommandLine::YesNo(); @@ -142,7 +143,7 @@ if (message != nil) text = sformat (message, mergestring (packs, ", ")); - boolean doit = (Mode::commandline()) ? (CommandLine::Interactive() ? AskPackages(packs) : true ) : Popup::AnyQuestionRichText( + boolean doit = (Mode::commandline()) ? (CommandLine::Interactive() ? AskPackages(packs, install) : true ) : Popup::AnyQuestionRichText( "", text, 40, 10, Label::ContinueButton (), Label::CancelButton (), `focus_yes Modified: trunk/yast2/package/yast2.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/package/yast2.changes?rev=38335&r1=38334&r2=38335&view=diff ============================================================================== --- trunk/yast2/package/yast2.changes (original) +++ trunk/yast2/package/yast2.changes Thu Jun 7 12:46:58 2007 @@ -3,6 +3,8 @@ - speed up PackageSystem::InstallKernel() - call rpm directly instead of starting the package manager +- display licenses in the command line mode properly, + fixed prompt when removing packages (#270910) ------------------------------------------------------------------- Tue Jun 5 21:22:50 CEST 2007 - locilka@suse.cz -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org