author | zautrix <zautrix> | 2005-06-10 11:53:12 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-10 11:53:12 (UTC) |
commit | d2f00fc2034450bc9a3cd1d2c3510bef1758d3bc (patch) (unidiff) | |
tree | 0764371abfdb5d663ffebf408d47d49f0ca919f3 /microkde/kdialogbase.cpp | |
parent | e5ca8e0d8d6d08b597253f43de401aa1a99a6abe (diff) | |
download | kdepimpi-d2f00fc2034450bc9a3cd1d2c3510bef1758d3bc.zip kdepimpi-d2f00fc2034450bc9a3cd1d2c3510bef1758d3bc.tar.gz kdepimpi-d2f00fc2034450bc9a3cd1d2c3510bef1758d3bc.tar.bz2 |
config dialog changes
-rw-r--r-- | microkde/kdialogbase.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp index 11635e1..d5c7e61 100644 --- a/microkde/kdialogbase.cpp +++ b/microkde/kdialogbase.cpp | |||
@@ -97,200 +97,205 @@ void KDialogBase::init( const QString &caption, int buttonMask, | |||
97 | } | 97 | } |
98 | 98 | ||
99 | if ( buttonMask & Cancel ) { | 99 | if ( buttonMask & Cancel ) { |
100 | mCancelButton = new QPushButton( i18n("Cancel"), this ); | 100 | mCancelButton = new QPushButton( i18n("Cancel"), this ); |
101 | connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) ); | 101 | connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) ); |
102 | } else { | 102 | } else { |
103 | mCancelButton = 0; | 103 | mCancelButton = 0; |
104 | } | 104 | } |
105 | 105 | ||
106 | if ( buttonMask & Close ) { | 106 | if ( buttonMask & Close ) { |
107 | mCloseButton = new QPushButton( i18n("Close"), this ); | 107 | mCloseButton = new QPushButton( i18n("Close"), this ); |
108 | connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) ); | 108 | connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) ); |
109 | } else { | 109 | } else { |
110 | mCloseButton = 0; | 110 | mCloseButton = 0; |
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
114 | QTabWidget *KDialogBase::tabWidget() | 114 | QTabWidget *KDialogBase::tabWidget() |
115 | { | 115 | { |
116 | if ( !mTabWidget ) { | 116 | if ( !mTabWidget ) { |
117 | mTabWidget = new QTabWidget( this ); | 117 | mTabWidget = new QTabWidget( this ); |
118 | setMainWidget( mTabWidget ); | 118 | setMainWidget( mTabWidget ); |
119 | } | 119 | } |
120 | return mTabWidget; | 120 | return mTabWidget; |
121 | } | 121 | } |
122 | 122 | ||
123 | void KDialogBase::hideButtons() | 123 | void KDialogBase::hideButtons() |
124 | { | 124 | { |
125 | if ( mUser1Button ) mUser1Button->hide() ; | 125 | if ( mUser1Button ) mUser1Button->hide() ; |
126 | if ( mUser2Button ) mUser2Button->hide() ; | 126 | if ( mUser2Button ) mUser2Button->hide() ; |
127 | if ( mOkButton ) mOkButton->hide() ; | 127 | if ( mOkButton ) mOkButton->hide() ; |
128 | if ( mApplyButton ) mApplyButton->hide() ; | 128 | if ( mApplyButton ) mApplyButton->hide() ; |
129 | if ( mDefaultButton ) mDefaultButton->hide(); | 129 | if ( mDefaultButton ) mDefaultButton->hide(); |
130 | if ( mCancelButton ) mCancelButton->hide() ; | 130 | if ( mCancelButton ) mCancelButton->hide() ; |
131 | if ( mCloseButton ) mCloseButton->hide() ; | 131 | if ( mCloseButton ) mCloseButton->hide() ; |
132 | 132 | ||
133 | } | 133 | } |
134 | void KDialogBase::initLayout() | 134 | void KDialogBase::initLayout() |
135 | { | 135 | { |
136 | 136 | ||
137 | delete mTopLayout; | 137 | delete mTopLayout; |
138 | mTopLayout = new QVBoxLayout( this ); | 138 | mTopLayout = new QVBoxLayout( this ); |
139 | mTopLayout->setMargin( marginHintSmall() ); | 139 | mTopLayout->setMargin( marginHintSmall() ); |
140 | mTopLayout->setSpacing( spacingHintSmall() ); | 140 | mTopLayout->setSpacing( spacingHintSmall() ); |
141 | 141 | ||
142 | mTopLayout->addWidget( mMainWidget ); | 142 | mTopLayout->addWidget( mMainWidget ); |
143 | 143 | ||
144 | QBoxLayout *buttonLayout = new QHBoxLayout; | 144 | QBoxLayout *buttonLayout = new QHBoxLayout; |
145 | mTopLayout->addLayout( buttonLayout ); | 145 | mTopLayout->addLayout( buttonLayout ); |
146 | 146 | ||
147 | if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); | 147 | if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); |
148 | if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); | 148 | if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); |
149 | if ( mOkButton ) buttonLayout->addWidget( mOkButton ); | 149 | if ( mOkButton ) buttonLayout->addWidget( mOkButton ); |
150 | if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); | 150 | if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); |
151 | if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); | 151 | if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); |
152 | if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); | 152 | if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); |
153 | if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); | 153 | if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); |
154 | buttonLayout->setMargin( marginHintSmall() ); | 154 | buttonLayout->setMargin( marginHintSmall() ); |
155 | buttonLayout->setSpacing( spacingHintSmall() ); | 155 | buttonLayout->setSpacing( spacingHintSmall() ); |
156 | } | 156 | } |
157 | 157 | ||
158 | QFrame *KDialogBase::addPage( const QString &name ) | 158 | QFrame *KDialogBase::addPage( const QString &name ) |
159 | { | 159 | { |
160 | // kdDebug() << "KDialogBase::addPage(): " << name << endl; | 160 | // kdDebug() << "KDialogBase::addPage(): " << name << endl; |
161 | QFrame *frame = new QFrame( tabWidget() ); | 161 | QFrame *frame = new QFrame( tabWidget() ); |
162 | tabWidget()->addTab( frame, name ); | 162 | tabWidget()->addTab( frame, name ); |
163 | return frame; | 163 | return frame; |
164 | } | 164 | } |
165 | 165 | ||
166 | QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) | 166 | QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) |
167 | { | 167 | { |
168 | return addPage( name ); | 168 | return addPage( name ); |
169 | } | 169 | } |
170 | 170 | ||
171 | 171 | ||
172 | void KDialogBase::setMainWidget( QWidget *widget ) | 172 | void KDialogBase::setMainWidget( QWidget *widget ) |
173 | { | 173 | { |
174 | kdDebug() << "KDialogBase::setMainWidget()" << endl; | 174 | kdDebug() << "KDialogBase::setMainWidget()" << endl; |
175 | 175 | ||
176 | mMainWidget = widget; | 176 | mMainWidget = widget; |
177 | initLayout(); | 177 | initLayout(); |
178 | } | 178 | } |
179 | 179 | ||
180 | void KDialogBase::setButtonText( ButtonCode id, const QString &text ) | 180 | void KDialogBase::setButtonText( ButtonCode id, const QString &text ) |
181 | { | 181 | { |
182 | QPushButton *button = findButton( id ); | 182 | QPushButton *button = findButton( id ); |
183 | if ( button ) { | 183 | if ( button ) { |
184 | button->setText( text ); | 184 | button->setText( text ); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | void KDialogBase::enableButton( ButtonCode id, bool state ) | 188 | void KDialogBase::enableButton( ButtonCode id, bool state ) |
189 | { | 189 | { |
190 | QPushButton *button = findButton( id ); | 190 | QPushButton *button = findButton( id ); |
191 | if ( button ) { | 191 | if ( button ) { |
192 | button->setEnabled( state ); | 192 | button->setEnabled( state ); |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | QPushButton *KDialogBase::findButton( ButtonCode id ) | 196 | QPushButton *KDialogBase::findButton( ButtonCode id ) |
197 | { | 197 | { |
198 | QPushButton *button = 0; | 198 | QPushButton *button = 0; |
199 | switch ( id ) { | 199 | switch ( id ) { |
200 | case Ok: | 200 | case Ok: |
201 | button = mOkButton; | 201 | button = mOkButton; |
202 | break; | 202 | break; |
203 | case Apply: | 203 | case Apply: |
204 | button = mApplyButton; | 204 | button = mApplyButton; |
205 | break; | 205 | break; |
206 | case User1: | 206 | case User1: |
207 | button = mUser1Button; | 207 | button = mUser1Button; |
208 | break; | 208 | break; |
209 | case User2: | 209 | case User2: |
210 | button = mUser2Button; | 210 | button = mUser2Button; |
211 | break; | 211 | break; |
212 | case Cancel: | 212 | case Cancel: |
213 | button = mCancelButton; | 213 | button = mCancelButton; |
214 | break; | 214 | break; |
215 | case Default: | 215 | case Default: |
216 | button = mDefaultButton; | 216 | button = mDefaultButton; |
217 | break; | 217 | break; |
218 | case Close: | 218 | case Close: |
219 | button = mCloseButton; | 219 | button = mCloseButton; |
220 | break; | 220 | break; |
221 | default: | 221 | default: |
222 | break; | 222 | break; |
223 | } | 223 | } |
224 | return button; | 224 | return button; |
225 | } | 225 | } |
226 | 226 | ||
227 | void KDialogBase::enableButtonOK( bool state ) | 227 | void KDialogBase::enableButtonOK( bool state ) |
228 | { | 228 | { |
229 | enableButton( Ok, state ); | 229 | enableButton( Ok, state ); |
230 | } | 230 | } |
231 | 231 | ||
232 | void KDialogBase::enableButtonApply( bool state ) | 232 | void KDialogBase::enableButtonApply( bool state ) |
233 | { | 233 | { |
234 | enableButton( Apply, state ); | 234 | enableButton( Apply, state ); |
235 | } | 235 | } |
236 | 236 | ||
237 | void KDialogBase::showButton( ButtonCode id, bool show ) | 237 | void KDialogBase::showButton( ButtonCode id, bool show ) |
238 | { | 238 | { |
239 | QPushButton *button = findButton( id ); | 239 | QPushButton *button = findButton( id ); |
240 | if ( button ) { | 240 | if ( button ) { |
241 | if ( show ) button->show(); | 241 | if ( show ) button->show(); |
242 | else button->hide(); | 242 | else button->hide(); |
243 | } | 243 | } |
244 | } | 244 | } |
245 | 245 | ||
246 | int KDialogBase::pageIndex( QWidget *widget ) const | 246 | int KDialogBase::pageIndex( QWidget *widget ) const |
247 | { | 247 | { |
248 | return 0; | 248 | return 0; |
249 | } | 249 | } |
250 | 250 | ||
251 | 251 | ||
252 | bool KDialogBase::showPage( int index ) | 252 | bool KDialogBase::showPage( int index ) |
253 | { | 253 | { |
254 | tabWidget()->setCurrentPage( index );return false; | 254 | tabWidget()->setCurrentPage( index );return false; |
255 | } | 255 | } |
256 | 256 | ||
257 | QFrame *KDialogBase::plainPage() | 257 | QFrame *KDialogBase::plainPage() |
258 | { | 258 | { |
259 | if ( !mPlainPage ) { | 259 | if ( !mPlainPage ) { |
260 | mPlainPage = new QFrame( this ); | 260 | mPlainPage = new QFrame( this ); |
261 | setMainWidget( mPlainPage ); | 261 | setMainWidget( mPlainPage ); |
262 | } | 262 | } |
263 | return mPlainPage; | 263 | return mPlainPage; |
264 | } | 264 | } |
265 | 265 | ||
266 | void KDialogBase::slotOk() | 266 | void KDialogBase::slotOk() |
267 | { | 267 | { |
268 | emit okClicked(); | 268 | emit okClicked(); |
269 | accept(); | 269 | accept(); |
270 | } | 270 | } |
271 | 271 | ||
272 | void KDialogBase::slotApply() | 272 | void KDialogBase::slotApply() |
273 | { | 273 | { |
274 | emit applyClicked(); | 274 | emit applyClicked(); |
275 | } | 275 | } |
276 | 276 | ||
277 | void KDialogBase::slotCancel() | 277 | void KDialogBase::slotCancel() |
278 | { | 278 | { |
279 | emit cancelClicked(); | 279 | emit cancelClicked(); |
280 | reject(); | 280 | reject(); |
281 | } | 281 | } |
282 | 282 | ||
283 | void KDialogBase::slotClose() | 283 | void KDialogBase::slotClose() |
284 | { | 284 | { |
285 | emit closeClicked(); | 285 | emit closeClicked(); |
286 | reject(); | 286 | reject(); |
287 | } | 287 | } |
288 | 288 | ||
289 | void KDialogBase::accept () | ||
290 | { | ||
291 | emit acceptClicked(); | ||
292 | KDialog::accept(); | ||
293 | } | ||
289 | void KDialogBase::slotUser1() | 294 | void KDialogBase::slotUser1() |
290 | { | 295 | { |
291 | emit user1Clicked(); | 296 | emit user1Clicked(); |
292 | } | 297 | } |
293 | void KDialogBase::slotUser2() | 298 | void KDialogBase::slotUser2() |
294 | { | 299 | { |
295 | emit user2Clicked(); | 300 | emit user2Clicked(); |
296 | } | 301 | } |