[yast-commit] r60396 - in /trunk/yast2: VERSION library/modules/Popup.ycp library/modules/Report.ycp package/yast2.changes
Author: aschnell Date: Fri Jan 15 13:50:06 2010 New Revision: 60396 URL: http://svn.opensuse.org/viewcvs/yast?rev=60396&view=rev Log: - extended Report and Popup module (needed for fate #304500) Modified: trunk/yast2/VERSION trunk/yast2/library/modules/Popup.ycp trunk/yast2/library/modules/Report.ycp trunk/yast2/package/yast2.changes Modified: trunk/yast2/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/VERSION?rev=60396&r1=60395&r2=60396&view=diff ============================================================================== --- trunk/yast2/VERSION (original) +++ trunk/yast2/VERSION Fri Jan 15 13:50:06 2010 @@ -1 +1 @@ -2.19.3 +2.19.4 Modified: trunk/yast2/library/modules/Popup.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/modules/Popup.ycp?rev=60396&r1=60395&r2=60396&view=diff ============================================================================== --- trunk/yast2/library/modules/Popup.ycp (original) +++ trunk/yast2/library/modules/Popup.ycp Fri Jan 15 13:50:06 2010 @@ -346,6 +346,52 @@ /** + * Generic error question popup with two buttons. + * + * Style guide hint: The first button has to have the semantics of "yes", + * "OK", "continue" etc., the second its opposite ("no", "cancel", ...). + * NEVER use this generic question popup to simply exchange the order of + * yes/no, continue/cancel or ok/cancel buttons! + * + * @param headline headline or Popup::NoHeadline() + * @param message message string + * @param yes_button_message label on affirmative buttons (on left side) + * @param no_button_message label on negating button (on right side) + * @param focus `focus_yes (first button) or `focus_no (second button) + * @screenshot screenshots/AnyQuestion.png + * + * @return true: first button has been clicked + * false: second button has been clicked + * + * @see YesNo + * @see ContinueCancel + * + * @example Popup::ErrorAnyQuestion( Label::WarningMsg(), "Do really want to ...?", "Install", "Don't do it", `focus_no ); + */ +global boolean ErrorAnyQuestion(string headline, + string message, + string yes_button_message, + string no_button_message, + symbol focus) +{ + term button_box = AnyQuestionButtonBox ( yes_button_message, no_button_message, focus); + boolean success = (boolean) UI::OpenDialog( + `opt(`decorated), + popupLayoutInternal( headline, message, Icon::IconPath ("error"), button_box ) + ); + + any ret = nil; + + if (success == true) { + ret = UI::UserInput(); + UI::CloseDialog(); + } + + return ret == `yes; +} + + +/** * Timed question popup with two buttons and time display * * @param headline headline or Popup::NoHeadline() @@ -411,6 +457,71 @@ /** + * Timed error question popup with two buttons and time display + * + * @param headline headline or Popup::NoHeadline() + * @param message message string + * @param yes_button_message label on affirmative buttons (on left side) + * @param no_button_message label on negating button (on right side) + * @param focus `focus_yes (first button) or `focus_no (second button) + * @param timeout_seconds timeout, if 0, normal behaviour + * @return boolean True if Yes, False if no + * @see AnyQuestion + */ +global boolean TimedErrorAnyQuestion( string headline, + string message, + string yes_button_message, + string no_button_message, + symbol focus , + integer timeout_seconds) +{ + term button_box = AnyQuestionButtonBox ( yes_button_message, no_button_message, focus); + term timed = + `ReplacePoint(`id(`replace_buttons) , + `VBox( + `HCenter( + `Label(`id(`remaining_time), "" + timeout_seconds) + ), + `ButtonBox ( + // FIXME: BNC #422612, Use `opt(`noSanityCheck) later + `PushButton (`id (`timed_stop), `opt (`cancelButton), Label::StopButton()), + `PushButton (`id (`timed_ok), `opt (`default, `key_F10, `okButton), Label::OKButton()) + ), + `VSpacing(0.2) + ) + ); + + + boolean success = (boolean) UI::OpenDialog( + `opt(`decorated), + popupLayoutInternal( headline, message, Icon::IconPath ("error"), timed ) + ); + + any which_input = nil; + + while (timeout_seconds > 0) { + which_input = UI::TimeoutUserInput( 1000 ); + + if (which_input == `timed_ok) + break; + if (which_input == `timed_stop) + { + UI::ReplaceWidget(`id(`replace_buttons), button_box); + while (which_input == `timed_stop) + which_input = UI::UserInput(); + break; + } + timeout_seconds = timeout_seconds - 1; + if (success == true) UI::ChangeWidget (`id(`remaining_time), `Value, ""+timeout_seconds); + } + + if (success == true) UI::CloseDialog(); + + return which_input == `yes; +} + + +/** * Dialog which displays the "message" and has a <b>Continue</b> * and a <b>Cancel</b> button. * Modified: trunk/yast2/library/modules/Report.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/modules/Report.ycp?rev=60396&r1=60395&r2=60396&view=diff ============================================================================== --- trunk/yast2/library/modules/Report.ycp (original) +++ trunk/yast2/library/modules/Report.ycp Fri Jan 15 13:50:06 2010 @@ -328,6 +328,57 @@ return ret; } + +/** + * Question with headline and Yes/No Buttons + * @param headline Popup Headline + * @param message Popup Message + * @param yes_button_message Yes Button Message + * @param no_button_message No Button Message + * @param focus Which Button has the focus + * @return boolean True if Yes is pressed, otherwise false + */ +global boolean ErrorAnyQuestion(string headline, + string message, + string yes_button_message, + string no_button_message, + symbol focus) +{ + if (log_yesno_messages) + { + y2milestone(1, "%1", message); + } + + boolean ret = false; + if (display_yesno_messages) + { + if (timeout_yesno_messages > 0) + { + ret = Popup::TimedErrorAnyQuestion( + headline, + message, + yes_button_message, + no_button_message, + focus, + timeout_yesno_messages); + } + else + { + ret = Popup::ErrorAnyQuestion( + headline, + message, + yes_button_message, + no_button_message, + focus ); + + } + } + + yesno_messages = add(yesno_messages, message); + return ret; +} + + /** * Store new message text * @param message_string message text, it can contain new line characters ("\n") Modified: trunk/yast2/package/yast2.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/package/yast2.changes?rev=60396&r1=60395&r2=60396&view=diff ============================================================================== --- trunk/yast2/package/yast2.changes (original) +++ trunk/yast2/package/yast2.changes Fri Jan 15 13:50:06 2010 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Fri Jan 15 11:44:39 CET 2010 - aschnell@suse.de + +- extended Report and Popup module (needed for fate #304500) +- 2.19.4 + +------------------------------------------------------------------- Thu Jan 14 17:53:48 CET 2010 - mzugec@suse.cz - NetworkStorage: adapt functions needed for iBFT (bnc#551380) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
aschnell@svn.opensuse.org