Author: sh-sh-sh Date: Wed Dec 12 15:50:08 2007 New Revision: 43023 URL: http://svn.opensuse.org/viewcvs/yast?rev=43023&view=rev Log: moved default button handling to base class Modified: trunk/core/libyui/src/YPushButton.cc trunk/qt/src/YQGenericButton.cc trunk/qt/src/YQGenericButton.h Modified: trunk/core/libyui/src/YPushButton.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YPushButton.cc?rev=43023&r1=43022&r2=43023&view=diff ============================================================================== --- trunk/core/libyui/src/YPushButton.cc (original) +++ trunk/core/libyui/src/YPushButton.cc Wed Dec 12 15:50:08 2007 @@ -85,9 +85,22 @@ } -void YPushButton::setDefaultButton( bool def ) +void YPushButton::setDefaultButton( bool isDefaultButton ) { - priv->isDefaultButton = def; + priv->isDefaultButton = isDefaultButton; + + YDialog * dialog = findDialog(); + + if ( dialog ) + { + if ( isDefaultButton ) + dialog->setDefaultButton( this ); + else + { + if ( dialog->defaultButton() == this ) + dialog->setDefaultButton( 0 ); + } + } } Modified: trunk/qt/src/YQGenericButton.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQGenericButton.cc?rev=43023&r1=43022&r2=43023&view=diff ============================================================================== --- trunk/qt/src/YQGenericButton.cc (original) +++ trunk/qt/src/YQGenericButton.cc Wed Dec 12 15:50:08 2007 @@ -39,7 +39,6 @@ , YPushButton( parent, label ) , _dialog( 0 ) , _qPushButton( 0 ) - , _setDefaultButtonRecursive( false ) { setWidgetRep( 0 ); } @@ -91,23 +90,6 @@ } -void -YQGenericButton::setDefaultButton( bool def ) -{ - YPushButton::setDefaultButton( def ); - - if ( ! _setDefaultButtonRecursive ) - { - _setDefaultButtonRecursive = true; - - if ( _dialog && def ) - dialog()->setDefaultButton( this ); - - _setDefaultButtonRecursive = true; - } -} - - void YQGenericButton::setEnabled( bool enabled ) { if ( _qPushButton ) Modified: trunk/qt/src/YQGenericButton.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQGenericButton.h?rev=43023&r1=43022&r2=43023&view=diff ============================================================================== --- trunk/qt/src/YQGenericButton.h (original) +++ trunk/qt/src/YQGenericButton.h Wed Dec 12 15:50:08 2007 @@ -96,13 +96,6 @@ bool isShownAsDefault() const; /** - * Set this button's default button state. - * - * Reimplemented from YPushButton. - **/ - virtual void setDefaultButton( bool def = true ); - - /** * Accept the keyboard focus. **/ virtual bool setKeyboardFocus(); @@ -164,7 +157,6 @@ YQDialog * _dialog; QPushButton * _qPushButton; - bool _setDefaultButtonRecursive; }; #endif // YQGenericButton_h -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org