summaryrefslogtreecommitdiffabout
path: root/microkde/kdialogbase.cpp
Unidiff
Diffstat (limited to 'microkde/kdialogbase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdialogbase.cpp12
1 files changed, 12 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
@@ -68,24 +68,31 @@ void KDialogBase::init( const QString &caption, int buttonMask,
68 mUser2Button = new QPushButton( user2, this ); 68 mUser2Button = new QPushButton( user2, this );
69 connect( mUser2Button, SIGNAL( clicked() ), SLOT( slotUser2() ) ); 69 connect( mUser2Button, SIGNAL( clicked() ), SLOT( slotUser2() ) );
70 } else { 70 } else {
71 mUser2Button = 0; 71 mUser2Button = 0;
72 } 72 }
73 73
74 if ( buttonMask & Ok ) { 74 if ( buttonMask & Ok ) {
75 mOkButton = new QPushButton( i18n("Ok"), this ); 75 mOkButton = new QPushButton( i18n("Ok"), this );
76 connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) ); 76 connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) );
77 } else { 77 } else {
78 mOkButton = 0; 78 mOkButton = 0;
79 } 79 }
80 if ( buttonMask & Default ) {
81 qDebug("buttonMask & Default ");
82 mDefaultButton = new QPushButton( i18n("Default"), this );
83 connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) );
84 } else {
85 mDefaultButton = 0;
86 }
80 87
81 if ( buttonMask & Apply ) { 88 if ( buttonMask & Apply ) {
82 mApplyButton = new QPushButton( i18n("Apply"), this ); 89 mApplyButton = new QPushButton( i18n("Apply"), this );
83 connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); 90 connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) );
84 } else { 91 } else {
85 mApplyButton = 0; 92 mApplyButton = 0;
86 } 93 }
87 94
88 if ( buttonMask & Cancel ) { 95 if ( buttonMask & Cancel ) {
89 mCancelButton = new QPushButton( i18n("Cancel"), this ); 96 mCancelButton = new QPushButton( i18n("Cancel"), this );
90 connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) ); 97 connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) );
91 } else { 98 } else {
@@ -106,45 +113,47 @@ QTabWidget *KDialogBase::tabWidget()
106 mTabWidget = new QTabWidget( this ); 113 mTabWidget = new QTabWidget( this );
107 setMainWidget( mTabWidget ); 114 setMainWidget( mTabWidget );
108 } 115 }
109 return mTabWidget; 116 return mTabWidget;
110} 117}
111 118
112void KDialogBase::hideButtons() 119void KDialogBase::hideButtons()
113{ 120{
114 if ( mUser1Button ) mUser1Button->hide() ; 121 if ( mUser1Button ) mUser1Button->hide() ;
115 if ( mUser2Button ) mUser2Button->hide() ; 122 if ( mUser2Button ) mUser2Button->hide() ;
116 if ( mOkButton ) mOkButton->hide() ; 123 if ( mOkButton ) mOkButton->hide() ;
117 if ( mApplyButton ) mApplyButton->hide() ; 124 if ( mApplyButton ) mApplyButton->hide() ;
125 if ( mDefaultButton ) mDefaultButton->hide();
118 if ( mCancelButton ) mCancelButton->hide() ; 126 if ( mCancelButton ) mCancelButton->hide() ;
119 if ( mCloseButton ) mCloseButton->hide() ; 127 if ( mCloseButton ) mCloseButton->hide() ;
120 128
121} 129}
122void KDialogBase::initLayout() 130void KDialogBase::initLayout()
123{ 131{
124 132
125 delete mTopLayout; 133 delete mTopLayout;
126 mTopLayout = new QVBoxLayout( this ); 134 mTopLayout = new QVBoxLayout( this );
127 mTopLayout->setMargin( marginHint() ); 135 mTopLayout->setMargin( marginHint() );
128 mTopLayout->setSpacing( spacingHint() ); 136 mTopLayout->setSpacing( spacingHint() );
129 137
130 mTopLayout->addWidget( mMainWidget ); 138 mTopLayout->addWidget( mMainWidget );
131 139
132 QBoxLayout *buttonLayout = new QHBoxLayout; 140 QBoxLayout *buttonLayout = new QHBoxLayout;
133 mTopLayout->addLayout( buttonLayout ); 141 mTopLayout->addLayout( buttonLayout );
134 142
135 if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); 143 if ( mUser1Button ) buttonLayout->addWidget( mUser1Button );
136 if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); 144 if ( mUser2Button ) buttonLayout->addWidget( mUser2Button );
137 if ( mOkButton ) buttonLayout->addWidget( mOkButton ); 145 if ( mOkButton ) buttonLayout->addWidget( mOkButton );
138 if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); 146 if ( mApplyButton ) buttonLayout->addWidget( mApplyButton );
147 if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton );
139 if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); 148 if ( mCancelButton ) buttonLayout->addWidget( mCancelButton );
140 if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); 149 if ( mCloseButton ) buttonLayout->addWidget( mCloseButton );
141} 150}
142 151
143QFrame *KDialogBase::addPage( const QString &name ) 152QFrame *KDialogBase::addPage( const QString &name )
144{ 153{
145// kdDebug() << "KDialogBase::addPage(): " << name << endl; 154// kdDebug() << "KDialogBase::addPage(): " << name << endl;
146 QFrame *frame = new QFrame( tabWidget() ); 155 QFrame *frame = new QFrame( tabWidget() );
147 tabWidget()->addTab( frame, name ); 156 tabWidget()->addTab( frame, name );
148 return frame; 157 return frame;
149} 158}
150 159
@@ -187,24 +196,27 @@ QPushButton *KDialogBase::findButton( ButtonCode id )
187 break; 196 break;
188 case Apply: 197 case Apply:
189 button = mApplyButton; 198 button = mApplyButton;
190 break; 199 break;
191 case User1: 200 case User1:
192 button = mUser1Button; 201 button = mUser1Button;
193 break; 202 break;
194 case User2: 203 case User2:
195 button = mUser2Button; 204 button = mUser2Button;
196 break; 205 break;
197 case Cancel: 206 case Cancel:
198 button = mCancelButton; 207 button = mCancelButton;
208 break;
209 case Default:
210 button = mDefaultButton;
199 break; 211 break;
200 case Close: 212 case Close:
201 button = mCloseButton; 213 button = mCloseButton;
202 break; 214 break;
203 default: 215 default:
204 break; 216 break;
205 } 217 }
206 return button; 218 return button;
207} 219}
208 220
209void KDialogBase::enableButtonOK( bool state ) 221void KDialogBase::enableButtonOK( bool state )
210{ 222{