-rw-r--r-- | microkde/kdialogbase.cpp | 12 | ||||
-rw-r--r-- | microkde/kdialogbase.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp index 2ea2053..c953058 100644 --- a/microkde/kdialogbase.cpp +++ b/microkde/kdialogbase.cpp @@ -77,6 +77,13 @@ void KDialogBase::init( const QString &caption, int buttonMask, } else { mOkButton = 0; } + if ( buttonMask & Default ) { + qDebug("buttonMask & Default "); + mDefaultButton = new QPushButton( i18n("Default"), this ); + connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); + } else { + mDefaultButton = 0; + } if ( buttonMask & Apply ) { mApplyButton = new QPushButton( i18n("Apply"), this ); @@ -115,6 +122,7 @@ void KDialogBase::hideButtons() if ( mUser2Button ) mUser2Button->hide() ; if ( mOkButton ) mOkButton->hide() ; if ( mApplyButton ) mApplyButton->hide() ; + if ( mDefaultButton ) mDefaultButton->hide(); if ( mCancelButton ) mCancelButton->hide() ; if ( mCloseButton ) mCloseButton->hide() ; @@ -136,6 +144,7 @@ void KDialogBase::initLayout() if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); if ( mOkButton ) buttonLayout->addWidget( mOkButton ); if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); + if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); } @@ -197,6 +206,9 @@ QPushButton *KDialogBase::findButton( ButtonCode id ) case Cancel: button = mCancelButton; break; + case Default: + button = mDefaultButton; + break; case Close: button = mCloseButton; break; diff --git a/microkde/kdialogbase.h b/microkde/kdialogbase.h index 199d2fa..7b44bfb 100644 --- a/microkde/kdialogbase.h +++ b/microkde/kdialogbase.h @@ -105,6 +105,7 @@ class KDialogBase : public KDialog * @ref slotClose() is not replaced. */ void closeClicked(); + void defaultClicked(); protected slots: virtual void slotOk(); @@ -134,6 +135,7 @@ class KDialogBase : public KDialog QPushButton *mOkButton; QPushButton *mApplyButton; QPushButton *mCancelButton; + QPushButton *mDefaultButton; }; #endif |