author | zautrix <zautrix> | 2005-04-20 10:43:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-20 10:43:07 (UTC) |
commit | f23afbb9c09b4ee0f00af8f04ee4458181792cd0 (patch) (unidiff) | |
tree | 807bcaf329d257ec2a0c5c6e3a6afc7ab53a6078 /libkdepim/kprefsdialog.cpp | |
parent | 03f7f26ad34f50dd86f335c7c5a25a292d642793 (diff) | |
download | kdepimpi-f23afbb9c09b4ee0f00af8f04ee4458181792cd0.zip kdepimpi-f23afbb9c09b4ee0f00af8f04ee4458181792cd0.tar.gz kdepimpi-f23afbb9c09b4ee0f00af8f04ee4458181792cd0.tar.bz2 |
fixes
-rw-r--r-- | libkdepim/kprefsdialog.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libkdepim/kprefsdialog.cpp b/libkdepim/kprefsdialog.cpp index dd9a602..b6ae775 100644 --- a/libkdepim/kprefsdialog.cpp +++ b/libkdepim/kprefsdialog.cpp | |||
@@ -155,256 +155,256 @@ QLabel *KPrefsDialogWidFont::label() | |||
155 | 155 | ||
156 | QLabel *KPrefsDialogWidFont::preview() | 156 | QLabel *KPrefsDialogWidFont::preview() |
157 | { | 157 | { |
158 | return mPreview; | 158 | return mPreview; |
159 | } | 159 | } |
160 | 160 | ||
161 | QPushButton *KPrefsDialogWidFont::button() | 161 | QPushButton *KPrefsDialogWidFont::button() |
162 | { | 162 | { |
163 | return mButton; | 163 | return mButton; |
164 | } | 164 | } |
165 | 165 | ||
166 | void KPrefsDialogWidFont::selectFont() | 166 | void KPrefsDialogWidFont::selectFont() |
167 | { | 167 | { |
168 | QFont myFont(mPreview->font()); | 168 | QFont myFont(mPreview->font()); |
169 | bool ok; | 169 | bool ok; |
170 | myFont = KFontDialog::getFont(myFont, ok); | 170 | myFont = KFontDialog::getFont(myFont, ok); |
171 | if ( ok ) { | 171 | if ( ok ) { |
172 | mPreview->setFont(myFont); | 172 | mPreview->setFont(myFont); |
173 | } | 173 | } |
174 | } | 174 | } |
175 | 175 | ||
176 | 176 | ||
177 | KPrefsDialogWidTime::KPrefsDialogWidTime(const QString &text,int *reference, | 177 | KPrefsDialogWidTime::KPrefsDialogWidTime(const QString &text,int *reference, |
178 | QWidget *parent) | 178 | QWidget *parent) |
179 | { | 179 | { |
180 | mReference = reference; | 180 | mReference = reference; |
181 | 181 | ||
182 | mLabel = new QLabel(text,parent); | 182 | mLabel = new QLabel(text,parent); |
183 | mSpin = new QSpinBox(0,23,1,parent); | 183 | mSpin = new QSpinBox(0,23,1,parent); |
184 | mSpin->setSuffix(":00"); | 184 | mSpin->setSuffix(":00"); |
185 | } | 185 | } |
186 | 186 | ||
187 | void KPrefsDialogWidTime::readConfig() | 187 | void KPrefsDialogWidTime::readConfig() |
188 | { | 188 | { |
189 | mSpin->setValue(*mReference); | 189 | mSpin->setValue(*mReference); |
190 | } | 190 | } |
191 | 191 | ||
192 | void KPrefsDialogWidTime::writeConfig() | 192 | void KPrefsDialogWidTime::writeConfig() |
193 | { | 193 | { |
194 | *mReference = mSpin->value(); | 194 | *mReference = mSpin->value(); |
195 | } | 195 | } |
196 | 196 | ||
197 | QLabel *KPrefsDialogWidTime::label() | 197 | QLabel *KPrefsDialogWidTime::label() |
198 | { | 198 | { |
199 | return mLabel; | 199 | return mLabel; |
200 | } | 200 | } |
201 | 201 | ||
202 | QSpinBox *KPrefsDialogWidTime::spinBox() | 202 | QSpinBox *KPrefsDialogWidTime::spinBox() |
203 | { | 203 | { |
204 | return mSpin; | 204 | return mSpin; |
205 | } | 205 | } |
206 | 206 | ||
207 | 207 | ||
208 | KPrefsDialogWidRadios::KPrefsDialogWidRadios(const QString &text,int *reference, | 208 | KPrefsDialogWidRadios::KPrefsDialogWidRadios(const QString &text,int *reference, |
209 | QWidget *parent) | 209 | QWidget *parent) |
210 | { | 210 | { |
211 | mReference = reference; | 211 | mReference = reference; |
212 | 212 | ||
213 | mBox = new QButtonGroup(1,Qt::Horizontal,text,parent); | 213 | mBox = new QButtonGroup(1,Qt::Horizontal,text,parent); |
214 | } | 214 | } |
215 | 215 | ||
216 | KPrefsDialogWidRadios::~KPrefsDialogWidRadios() | 216 | KPrefsDialogWidRadios::~KPrefsDialogWidRadios() |
217 | { | 217 | { |
218 | } | 218 | } |
219 | 219 | ||
220 | void KPrefsDialogWidRadios::addRadio(const QString &text) | 220 | void KPrefsDialogWidRadios::addRadio(const QString &text) |
221 | { | 221 | { |
222 | new QRadioButton(text,mBox); | 222 | new QRadioButton(text,mBox); |
223 | } | 223 | } |
224 | 224 | ||
225 | QButtonGroup *KPrefsDialogWidRadios::groupBox() | 225 | QButtonGroup *KPrefsDialogWidRadios::groupBox() |
226 | { | 226 | { |
227 | return mBox; | 227 | return mBox; |
228 | } | 228 | } |
229 | 229 | ||
230 | void KPrefsDialogWidRadios::readConfig() | 230 | void KPrefsDialogWidRadios::readConfig() |
231 | { | 231 | { |
232 | mBox->setButton(*mReference); | 232 | mBox->setButton(*mReference); |
233 | } | 233 | } |
234 | 234 | ||
235 | void KPrefsDialogWidRadios::writeConfig() | 235 | void KPrefsDialogWidRadios::writeConfig() |
236 | { | 236 | { |
237 | *mReference = mBox->id(mBox->selected()); | 237 | *mReference = mBox->id(mBox->selected()); |
238 | } | 238 | } |
239 | 239 | ||
240 | 240 | ||
241 | KPrefsDialogWidString::KPrefsDialogWidString(const QString &text,QString *reference, | 241 | KPrefsDialogWidString::KPrefsDialogWidString(const QString &text,QString *reference, |
242 | QWidget *parent, QLineEdit::EchoMode echomode) | 242 | QWidget *parent, QLineEdit::EchoMode echomode) |
243 | { | 243 | { |
244 | mReference = reference; | 244 | mReference = reference; |
245 | 245 | ||
246 | mLabel = new QLabel(text,parent); | 246 | mLabel = new QLabel(text,parent); |
247 | mEdit = new QLineEdit(parent); | 247 | mEdit = new QLineEdit(parent); |
248 | mEdit->setEchoMode( echomode ); | 248 | mEdit->setEchoMode( echomode ); |
249 | } | 249 | } |
250 | 250 | ||
251 | KPrefsDialogWidString::~KPrefsDialogWidString() | 251 | KPrefsDialogWidString::~KPrefsDialogWidString() |
252 | { | 252 | { |
253 | } | 253 | } |
254 | 254 | ||
255 | void KPrefsDialogWidString::readConfig() | 255 | void KPrefsDialogWidString::readConfig() |
256 | { | 256 | { |
257 | mEdit->setText(*mReference); | 257 | mEdit->setText(*mReference); |
258 | } | 258 | } |
259 | 259 | ||
260 | void KPrefsDialogWidString::writeConfig() | 260 | void KPrefsDialogWidString::writeConfig() |
261 | { | 261 | { |
262 | *mReference = mEdit->text(); | 262 | *mReference = mEdit->text(); |
263 | } | 263 | } |
264 | 264 | ||
265 | QLabel *KPrefsDialogWidString::label() | 265 | QLabel *KPrefsDialogWidString::label() |
266 | { | 266 | { |
267 | return mLabel; | 267 | return mLabel; |
268 | } | 268 | } |
269 | 269 | ||
270 | QLineEdit *KPrefsDialogWidString::lineEdit() | 270 | QLineEdit *KPrefsDialogWidString::lineEdit() |
271 | { | 271 | { |
272 | return mEdit; | 272 | return mEdit; |
273 | } | 273 | } |
274 | 274 | ||
275 | 275 | ||
276 | KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) : | 276 | KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) : |
277 | KDialogBase(IconList,i18n("Preferences"),Ok|Cancel|Default,Ok,parent, | 277 | KDialogBase(IconList,i18n("Preferences"),Ok|Cancel|Default,Ok,parent, |
278 | name,modal,true) | 278 | name,modal,true) |
279 | { | 279 | { |
280 | mPrefs = prefs; | 280 | mPrefs = prefs; |
281 | 281 | ||
282 | // This seems to cause a crash on exit. Investigate later. | 282 | // This seems to cause a crash on exit. Investigate later. |
283 | // mPrefsWids.setAutoDelete(true); | 283 | mPrefsWids.setAutoDelete(true); |
284 | 284 | ||
285 | connect(this,SIGNAL(defaultClicked()),SLOT(slotDefault())); | 285 | connect(this,SIGNAL(defaultClicked()),SLOT(slotDefault())); |
286 | //connect(this,SIGNAL(cancelClicked()),SLOT(slotDefault())); | 286 | //connect(this,SIGNAL(cancelClicked()),SLOT(slotDefault())); |
287 | //connect(this,SIGNAL(cancelClicked()),SLOT(reject())); | 287 | //connect(this,SIGNAL(cancelClicked()),SLOT(reject())); |
288 | } | 288 | } |
289 | 289 | ||
290 | KPrefsDialog::~KPrefsDialog() | 290 | KPrefsDialog::~KPrefsDialog() |
291 | { | 291 | { |
292 | } | 292 | } |
293 | 293 | ||
294 | void KPrefsDialog::addWid(KPrefsDialogWid *wid) | 294 | void KPrefsDialog::addWid(KPrefsDialogWid *wid) |
295 | { | 295 | { |
296 | mPrefsWids.append(wid); | 296 | mPrefsWids.append(wid); |
297 | } | 297 | } |
298 | 298 | ||
299 | KPrefsDialogWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent) | 299 | KPrefsDialogWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent) |
300 | { | 300 | { |
301 | KPrefsDialogWidBool *w = new KPrefsDialogWidBool(text,reference,parent); | 301 | KPrefsDialogWidBool *w = new KPrefsDialogWidBool(text,reference,parent); |
302 | addWid(w); | 302 | addWid(w); |
303 | return w; | 303 | return w; |
304 | } | 304 | } |
305 | 305 | ||
306 | KPrefsDialogWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent) | 306 | KPrefsDialogWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent) |
307 | { | 307 | { |
308 | KPrefsDialogWidTime *w = new KPrefsDialogWidTime(text,reference,parent); | 308 | KPrefsDialogWidTime *w = new KPrefsDialogWidTime(text,reference,parent); |
309 | addWid(w); | 309 | addWid(w); |
310 | return w; | 310 | return w; |
311 | } | 311 | } |
312 | 312 | ||
313 | KPrefsDialogWidColor *KPrefsDialog::addWidColor(const QString &text,QColor *reference,QWidget *parent) | 313 | KPrefsDialogWidColor *KPrefsDialog::addWidColor(const QString &text,QColor *reference,QWidget *parent) |
314 | { | 314 | { |
315 | KPrefsDialogWidColor *w = new KPrefsDialogWidColor(text,reference,parent); | 315 | KPrefsDialogWidColor *w = new KPrefsDialogWidColor(text,reference,parent); |
316 | addWid(w); | 316 | addWid(w); |
317 | return w; | 317 | return w; |
318 | } | 318 | } |
319 | 319 | ||
320 | KPrefsDialogWidRadios *KPrefsDialog::addWidRadios(const QString &text,int *reference,QWidget *parent) | 320 | KPrefsDialogWidRadios *KPrefsDialog::addWidRadios(const QString &text,int *reference,QWidget *parent) |
321 | { | 321 | { |
322 | KPrefsDialogWidRadios *w = new KPrefsDialogWidRadios(text,reference,parent); | 322 | KPrefsDialogWidRadios *w = new KPrefsDialogWidRadios(text,reference,parent); |
323 | addWid(w); | 323 | addWid(w); |
324 | return w; | 324 | return w; |
325 | } | 325 | } |
326 | 326 | ||
327 | KPrefsDialogWidString *KPrefsDialog::addWidString(const QString &text,QString *reference,QWidget *parent) | 327 | KPrefsDialogWidString *KPrefsDialog::addWidString(const QString &text,QString *reference,QWidget *parent) |
328 | { | 328 | { |
329 | KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent); | 329 | KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent); |
330 | addWid(w); | 330 | addWid(w); |
331 | return w; | 331 | return w; |
332 | } | 332 | } |
333 | 333 | ||
334 | KPrefsDialogWidString *KPrefsDialog::addWidPassword(const QString &text,QString *reference,QWidget *parent) | 334 | KPrefsDialogWidString *KPrefsDialog::addWidPassword(const QString &text,QString *reference,QWidget *parent) |
335 | { | 335 | { |
336 | KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent,QLineEdit::Password); | 336 | KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent,QLineEdit::Password); |
337 | addWid(w); | 337 | addWid(w); |
338 | return w; | 338 | return w; |
339 | } | 339 | } |
340 | 340 | ||
341 | KPrefsDialogWidFont *KPrefsDialog::addWidFont(const QString &sampleText,const QString &buttonText, | 341 | KPrefsDialogWidFont *KPrefsDialog::addWidFont(const QString &sampleText,const QString &buttonText, |
342 | QFont *reference,QWidget *parent) | 342 | QFont *reference,QWidget *parent) |
343 | { | 343 | { |
344 | KPrefsDialogWidFont *w = new KPrefsDialogWidFont(sampleText,buttonText,reference,parent); | 344 | KPrefsDialogWidFont *w = new KPrefsDialogWidFont(sampleText,buttonText,reference,parent); |
345 | addWid(w); | 345 | addWid(w); |
346 | return w; | 346 | return w; |
347 | } | 347 | } |
348 | 348 | ||
349 | void KPrefsDialog::setDefaults() | 349 | void KPrefsDialog::setDefaults() |
350 | { | 350 | { |
351 | mPrefs->setDefaults(); | 351 | mPrefs->setDefaults(); |
352 | 352 | ||
353 | readConfig(); | 353 | readConfig(); |
354 | } | 354 | } |
355 | 355 | ||
356 | void KPrefsDialog::readConfig() | 356 | void KPrefsDialog::readConfig() |
357 | { | 357 | { |
358 | // kdDebug(5300) << "KPrefsDialog::readConfig()" << endl; | 358 | // kdDebug(5300) << "KPrefsDialog::readConfig()" << endl; |
359 | 359 | ||
360 | KPrefsDialogWid *wid; | 360 | KPrefsDialogWid *wid; |
361 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { | 361 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { |
362 | wid->readConfig(); | 362 | wid->readConfig(); |
363 | } | 363 | } |
364 | 364 | ||
365 | usrReadConfig(); | 365 | usrReadConfig(); |
366 | } | 366 | } |
367 | 367 | ||
368 | void KPrefsDialog::writeConfig() | 368 | void KPrefsDialog::writeConfig() |
369 | { | 369 | { |
370 | // kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl; | 370 | // kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl; |
371 | 371 | ||
372 | KPrefsDialogWid *wid; | 372 | KPrefsDialogWid *wid; |
373 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { | 373 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { |
374 | wid->writeConfig(); | 374 | wid->writeConfig(); |
375 | } | 375 | } |
376 | 376 | ||
377 | usrWriteConfig(); | 377 | usrWriteConfig(); |
378 | 378 | ||
379 | // kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl; | 379 | // kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl; |
380 | 380 | ||
381 | mPrefs->writeConfig(); | 381 | mPrefs->writeConfig(); |
382 | 382 | ||
383 | // kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl; | 383 | // kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl; |
384 | } | 384 | } |
385 | 385 | ||
386 | 386 | ||
387 | void KPrefsDialog::slotApply() | 387 | void KPrefsDialog::slotApply() |
388 | { | 388 | { |
389 | writeConfig(); | 389 | writeConfig(); |
390 | emit configChanged(); | 390 | emit configChanged(); |
391 | } | 391 | } |
392 | 392 | ||
393 | void KPrefsDialog::slotOk() | 393 | void KPrefsDialog::slotOk() |
394 | { | 394 | { |
395 | slotApply(); | 395 | slotApply(); |
396 | QDialog::accept(); | 396 | QDialog::accept(); |
397 | } | 397 | } |
398 | void KPrefsDialog::accept() | 398 | void KPrefsDialog::accept() |
399 | { | 399 | { |
400 | slotOk(); | 400 | slotOk(); |
401 | } | 401 | } |
402 | 402 | ||
403 | void KPrefsDialog::slotDefault() | 403 | void KPrefsDialog::slotDefault() |
404 | { | 404 | { |
405 | if (KMessageBox::warningContinueCancel(this, | 405 | if (KMessageBox::warningContinueCancel(this, |
406 | i18n("You are about to set all\npreferences to default values.\nAll " | 406 | i18n("You are about to set all\npreferences to default values.\nAll " |
407 | "custom modifications will be lost."),i18n("Setting Default Preferences"), | 407 | "custom modifications will be lost."),i18n("Setting Default Preferences"), |
408 | i18n("Continue")) | 408 | i18n("Continue")) |
409 | == KMessageBox::Continue) setDefaults(); | 409 | == KMessageBox::Continue) setDefaults(); |
410 | } | 410 | } |