-rw-r--r-- | microkde/kdialogbase.cpp | 12 | ||||
-rw-r--r-- | microkde/kdialogbase.h | 4 |
2 files changed, 15 insertions, 1 deletions
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp index 2ea2053..c953058 100644 --- a/microkde/kdialogbase.cpp +++ b/microkde/kdialogbase.cpp @@ -74,12 +74,19 @@ void KDialogBase::init( const QString &caption, int buttonMask, if ( buttonMask & Ok ) { mOkButton = new QPushButton( i18n("Ok"), this ); connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) ); } 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 ); connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); } else { mApplyButton = 0; @@ -112,12 +119,13 @@ QTabWidget *KDialogBase::tabWidget() void KDialogBase::hideButtons() { if ( mUser1Button ) mUser1Button->hide() ; if ( mUser2Button ) mUser2Button->hide() ; if ( mOkButton ) mOkButton->hide() ; if ( mApplyButton ) mApplyButton->hide() ; + if ( mDefaultButton ) mDefaultButton->hide(); if ( mCancelButton ) mCancelButton->hide() ; if ( mCloseButton ) mCloseButton->hide() ; } void KDialogBase::initLayout() { @@ -133,12 +141,13 @@ void KDialogBase::initLayout() mTopLayout->addLayout( buttonLayout ); if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); 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 ); } QFrame *KDialogBase::addPage( const QString &name ) { @@ -193,12 +202,15 @@ QPushButton *KDialogBase::findButton( ButtonCode id ) break; case User2: button = mUser2Button; break; case Cancel: button = mCancelButton; + break; + case Default: + button = mDefaultButton; break; case Close: button = mCloseButton; break; default: break; diff --git a/microkde/kdialogbase.h b/microkde/kdialogbase.h index 199d2fa..7b44bfb 100644 --- a/microkde/kdialogbase.h +++ b/microkde/kdialogbase.h @@ -102,12 +102,13 @@ class KDialogBase : public KDialog /** * The Close button was pressed. This signal is only emitted if * @ref slotClose() is not replaced. */ void closeClicked(); + void defaultClicked(); protected slots: virtual void slotOk(); virtual void slotApply(); virtual void slotCancel(); virtual void slotClose(); @@ -130,10 +131,11 @@ class KDialogBase : public KDialog QPushButton *mUser1Button; QPushButton *mUser2Button; QPushButton *mCloseButton; QPushButton *mOkButton; QPushButton *mApplyButton; - QPushButton *mCancelButton; + QPushButton *mCancelButton; + QPushButton *mDefaultButton; }; #endif |