Author: sh-sh-sh Date: Thu Sep 4 14:50:17 2008 New Revision: 50669 URL: http://svn.opensuse.org/viewcvs/yast?rev=50669&view=rev Log: Allow ButtonBox sanity check to be relaxed (bnc #422612) Modified: trunk/libyui/VERSION trunk/libyui/package/yast2-libyui.changes trunk/libyui/src/YButtonBox.cc trunk/libyui/src/YButtonBox.h Modified: trunk/libyui/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/VERSION?rev=50669&r1=5... ============================================================================== --- trunk/libyui/VERSION (original) +++ trunk/libyui/VERSION Thu Sep 4 14:50:17 2008 @@ -1 +1 @@ -2.17.6 +2.17.7 Modified: trunk/libyui/package/yast2-libyui.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/package/yast2-libyui.chang... ============================================================================== --- trunk/libyui/package/yast2-libyui.changes (original) +++ trunk/libyui/package/yast2-libyui.changes Thu Sep 4 14:50:17 2008 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Thu Sep 4 14:47:46 CEST 2008 - sh@suse.de + +- Allow ButtonBox sanity check to be relaxed (bnc #422612) +- V 2.17.7 + +------------------------------------------------------------------- Thu Aug 21 15:28:14 CEST 2008 - sh@suse.de - Added YButtonBox widget (fate #303446) Modified: trunk/libyui/src/YButtonBox.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YButtonBox.cc?rev=5066... ============================================================================== --- trunk/libyui/src/YButtonBox.cc (original) +++ trunk/libyui/src/YButtonBox.cc Thu Sep 4 14:50:17 2008 @@ -44,14 +44,16 @@ * Constructor **/ YButtonBoxPrivate() - : margins( YButtonBox::_defaultMargins ) + : sanityCheckRelaxed( false ) + , margins( YButtonBox::_defaultMargins ) {} // // Data members // - YButtonBoxMargins margins; + bool sanityCheckRelaxed; + YButtonBoxMargins margins; }; @@ -569,6 +571,20 @@ void +YButtonBox::setSanityCheckRelaxed( bool relaxed ) +{ + priv->sanityCheckRelaxed = relaxed; +} + + +bool +YButtonBox::sanityCheckRelaxed() const +{ + return priv->sanityCheckRelaxed; +} + + +void YButtonBox::sanityCheck() { YPushButton * okButton = 0; @@ -608,7 +624,7 @@ } } - if ( childrenCount() > 1 ) + if ( childrenCount() > 1 && ! sanityCheckRelaxed() ) { if ( ! okButton || ! cancelButton ) YUI_THROW( YUIButtonRoleMismatchException( "Button role mismatch: Must have both [OK] and [Cancel] roles" ) ); Modified: trunk/libyui/src/YButtonBox.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YButtonBox.h?rev=50669... ============================================================================== --- trunk/libyui/src/YButtonBox.h (original) +++ trunk/libyui/src/YButtonBox.h Thu Sep 4 14:50:17 2008 @@ -266,6 +266,33 @@ void sanityCheck(); /** + * Relax the sanity check done in sanityCheck(): Do not enforce that there + * has to be a YOKButton and a YCancelButton if there is more than one + * button. + * + * In very rare cases, it might be neccessary to have a less stringent + * sanity check: There are some very few legitimate cases for having a + * YButtonBox with multiple buttons, yet without a YCancelButton. + * + * Examples: + * + * ...message... + * <Countdown> + * [OK] [Stop] + * + * ...message... + * [OK] [Details] + * + * In those cases, it makes sense to relax the sanity check. + **/ + void setSanityCheckRelaxed( bool relax = true ); + + /** + * Return 'true' if sanity checks are currently relaxed, 'false' if not. + **/ + bool sanityCheckRelaxed() const; + + /** * Preferred width of the widget. * * Reimplemented from YWidget. This default method returns the sum of -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org