summaryrefslogtreecommitdiffabout
path: root/libkdepim/kprefswidget.cpp
Unidiff
Diffstat (limited to 'libkdepim/kprefswidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kprefswidget.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/libkdepim/kprefswidget.cpp b/libkdepim/kprefswidget.cpp
index be9ad30..f6a0b38 100644
--- a/libkdepim/kprefswidget.cpp
+++ b/libkdepim/kprefswidget.cpp
@@ -99,329 +99,330 @@ KPrefsWidColor::KPrefsWidColor(const QString &text,QColor *reference,
99} 99}
100 100
101KPrefsWidColor::~KPrefsWidColor() 101KPrefsWidColor::~KPrefsWidColor()
102{ 102{
103// kdDebug(5300) << "KPrefsWidColor::~KPrefsWidColor()" << endl; 103// kdDebug(5300) << "KPrefsWidColor::~KPrefsWidColor()" << endl;
104} 104}
105 105
106void KPrefsWidColor::readConfig() 106void KPrefsWidColor::readConfig()
107{ 107{
108 mButton->setColor(*mReference); 108 mButton->setColor(*mReference);
109} 109}
110 110
111void KPrefsWidColor::writeConfig() 111void KPrefsWidColor::writeConfig()
112{ 112{
113 *mReference = mButton->color(); 113 *mReference = mButton->color();
114} 114}
115 115
116QLabel *KPrefsWidColor::label() 116QLabel *KPrefsWidColor::label()
117{ 117{
118 return mLabel; 118 return mLabel;
119} 119}
120 120
121KColorButton *KPrefsWidColor::button() 121KColorButton *KPrefsWidColor::button()
122{ 122{
123 return mButton; 123 return mButton;
124} 124}
125 125
126KPrefsWidFont::KPrefsWidFont(const QString &sampleText,const QString &labelText, 126KPrefsWidFont::KPrefsWidFont(const QString &sampleText,const QString &labelText,
127 QFont *reference,QWidget *parent) 127 QFont *reference,QWidget *parent)
128{ 128{
129 mReference = reference; 129 mReference = reference;
130 130
131 mLabel = new QLabel(labelText, parent); 131 mLabel = new QLabel(labelText, parent);
132 132
133 mPreview = new QLabel(sampleText,parent); 133 mPreview = new QLabel(sampleText,parent);
134 mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken); 134 mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken);
135 135
136 mButton = new QPushButton(i18n("Choose..."), parent); 136 mButton = new QPushButton(i18n("Choose..."), parent);
137 connect(mButton,SIGNAL(clicked()),SLOT(selectFont())); 137 connect(mButton,SIGNAL(clicked()),SLOT(selectFont()));
138 mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 ); 138 mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 );
139 mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 ); 139 mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 );
140} 140}
141 141
142KPrefsWidFont::~KPrefsWidFont() 142KPrefsWidFont::~KPrefsWidFont()
143{ 143{
144} 144}
145 145
146void KPrefsWidFont::readConfig() 146void KPrefsWidFont::readConfig()
147{ 147{
148 mPreview->setFont(*mReference); 148 mPreview->setFont(*mReference);
149} 149}
150 150
151void KPrefsWidFont::writeConfig() 151void KPrefsWidFont::writeConfig()
152{ 152{
153 *mReference = mPreview->font(); 153 *mReference = mPreview->font();
154} 154}
155 155
156QLabel *KPrefsWidFont::label() 156QLabel *KPrefsWidFont::label()
157{ 157{
158 return mLabel; 158 return mLabel;
159} 159}
160 160
161QLabel *KPrefsWidFont::preview() 161QLabel *KPrefsWidFont::preview()
162{ 162{
163 return mPreview; 163 return mPreview;
164} 164}
165 165
166QPushButton *KPrefsWidFont::button() 166QPushButton *KPrefsWidFont::button()
167{ 167{
168 return mButton; 168 return mButton;
169} 169}
170 170
171void KPrefsWidFont::selectFont() 171void KPrefsWidFont::selectFont()
172{ 172{
173 QFont myFont(mPreview->font()); 173 QFont myFont(mPreview->font());
174 bool ok; 174 bool ok;
175 myFont = KFontDialog::getFont(myFont, ok); 175 myFont = KFontDialog::getFont(myFont, ok);
176 if ( ok ) { 176 if ( ok ) {
177 mPreview->setFont(myFont); 177 mPreview->setFont(myFont);
178 emit modified(); 178 emit modified();
179 } 179 }
180} 180}
181 181
182 182
183KPrefsWidTime::KPrefsWidTime(const QString &text,int *reference, 183KPrefsWidTime::KPrefsWidTime(const QString &text,int *reference,
184 QWidget *parent) 184 QWidget *parent)
185{ 185{
186 mReference = reference; 186 mReference = reference;
187 187
188 mLabel = new QLabel(text,parent); 188 mLabel = new QLabel(text,parent);
189 mSpin = new QSpinBox(0,23,1,parent); 189 mSpin = new QSpinBox(0,23,1,parent);
190 mSpin->setSuffix(":00"); 190 mSpin->setSuffix(":00");
191 connect( mSpin, SIGNAL( valueChanged(int)), SIGNAL( modified() ) ); 191 connect( mSpin, SIGNAL( valueChanged(int)), SIGNAL( modified() ) );
192 192
193} 193}
194 194
195void KPrefsWidTime::readConfig() 195void KPrefsWidTime::readConfig()
196{ 196{
197 mSpin->setValue(*mReference); 197 mSpin->setValue(*mReference);
198} 198}
199 199
200void KPrefsWidTime::writeConfig() 200void KPrefsWidTime::writeConfig()
201{ 201{
202 *mReference = mSpin->value(); 202 *mReference = mSpin->value();
203} 203}
204 204
205QLabel *KPrefsWidTime::label() 205QLabel *KPrefsWidTime::label()
206{ 206{
207 return mLabel; 207 return mLabel;
208} 208}
209 209
210QSpinBox *KPrefsWidTime::spinBox() 210QSpinBox *KPrefsWidTime::spinBox()
211{ 211{
212 return mSpin; 212 return mSpin;
213} 213}
214 214
215 215
216KPrefsWidRadios::KPrefsWidRadios(const QString &text,int *reference, 216KPrefsWidRadios::KPrefsWidRadios(const QString &text,int *reference,
217 QWidget *parent) 217 QWidget *parent)
218{ 218{
219 mReference = reference; 219 mReference = reference;
220 220
221 mBox = new QButtonGroup(1,Qt::Horizontal,text,parent); 221 mBox = new QButtonGroup(1,Qt::Horizontal,text,parent);
222 connect( mBox, SIGNAL( clicked(int)), SIGNAL( modified() ) ); 222 connect( mBox, SIGNAL( clicked(int)), SIGNAL( modified() ) );
223} 223}
224 224
225KPrefsWidRadios::~KPrefsWidRadios() 225KPrefsWidRadios::~KPrefsWidRadios()
226{ 226{
227} 227}
228 228
229void KPrefsWidRadios::addRadio(const QString &text) 229void KPrefsWidRadios::addRadio(const QString &text)
230{ 230{
231 new QRadioButton(text,mBox); 231 new QRadioButton(text,mBox);
232} 232}
233 233
234QButtonGroup *KPrefsWidRadios::groupBox() 234QButtonGroup *KPrefsWidRadios::groupBox()
235{ 235{
236 return mBox; 236 return mBox;
237} 237}
238 238
239void KPrefsWidRadios::readConfig() 239void KPrefsWidRadios::readConfig()
240{ 240{
241 mBox->setButton(*mReference); 241 mBox->setButton(*mReference);
242} 242}
243 243
244void KPrefsWidRadios::writeConfig() 244void KPrefsWidRadios::writeConfig()
245{ 245{
246 *mReference = mBox->id(mBox->selected()); 246 *mReference = mBox->id(mBox->selected());
247} 247}
248 248
249 249
250KPrefsWidString::KPrefsWidString(const QString &text,QString *reference, 250KPrefsWidString::KPrefsWidString(const QString &text,QString *reference,
251 QWidget *parent, QLineEdit::EchoMode echomode) 251 QWidget *parent, QLineEdit::EchoMode echomode)
252{ 252{
253 mReference = reference; 253 mReference = reference;
254 254
255 mLabel = new QLabel(text,parent); 255 mLabel = new QLabel(text,parent);
256 mEdit = new QLineEdit(parent); 256 mEdit = new QLineEdit(parent);
257 mEdit->setEchoMode( echomode ); 257 mEdit->setEchoMode( echomode );
258 connect( mEdit, SIGNAL( textChanged(const QString&) ), SIGNAL( modified() ) ); 258 connect( mEdit, SIGNAL( textChanged(const QString&) ), SIGNAL( modified() ) );
259 259
260} 260}
261 261
262KPrefsWidString::~KPrefsWidString() 262KPrefsWidString::~KPrefsWidString()
263{ 263{
264} 264}
265 265
266void KPrefsWidString::readConfig() 266void KPrefsWidString::readConfig()
267{ 267{
268 mEdit->setText(*mReference); 268 mEdit->setText(*mReference);
269} 269}
270 270
271void KPrefsWidString::writeConfig() 271void KPrefsWidString::writeConfig()
272{ 272{
273 *mReference = mEdit->text(); 273 *mReference = mEdit->text();
274} 274}
275 275
276QLabel *KPrefsWidString::label() 276QLabel *KPrefsWidString::label()
277{ 277{
278 return mLabel; 278 return mLabel;
279} 279}
280 280
281QLineEdit *KPrefsWidString::lineEdit() 281QLineEdit *KPrefsWidString::lineEdit()
282{ 282{
283 return mEdit; 283 return mEdit;
284} 284}
285 285
286 286
287KPrefsWidget::KPrefsWidget(KPrefs *prefs,QWidget *parent,const char *name) : 287KPrefsWidget::KPrefsWidget(KPrefs *prefs,QWidget *parent,const char *name) :
288 QWidget(parent, name ) 288 QWidget(parent, name )
289{ 289{
290 mPrefs = prefs; 290 mPrefs = prefs;
291 mPrefsWids.setAutoDelete( true );
291} 292}
292 293
293KPrefsWidget::~KPrefsWidget() 294KPrefsWidget::~KPrefsWidget()
294{ 295{
295} 296}
296 297
297void KPrefsWidget::addWid(KPrefsWid *wid) 298void KPrefsWidget::addWid(KPrefsWid *wid)
298{ 299{
299 mPrefsWids.append(wid); 300 mPrefsWids.append(wid);
300 connect( wid, SIGNAL( modified() ), this, SLOT( modified() ) ); 301 connect( wid, SIGNAL( modified() ), this, SLOT( modified() ) );
301 302
302} 303}
303 304
304KPrefsWidBool *KPrefsWidget::addWidBool(const QString &text,bool *reference,QWidget *parent) 305KPrefsWidBool *KPrefsWidget::addWidBool(const QString &text,bool *reference,QWidget *parent)
305{ 306{
306 KPrefsWidBool *w = new KPrefsWidBool(text,reference,parent); 307 KPrefsWidBool *w = new KPrefsWidBool(text,reference,parent);
307 addWid(w); 308 addWid(w);
308 return w; 309 return w;
309} 310}
310 311
311KPrefsWidTime *KPrefsWidget::addWidTime(const QString &text,int *reference,QWidget *parent) 312KPrefsWidTime *KPrefsWidget::addWidTime(const QString &text,int *reference,QWidget *parent)
312{ 313{
313 KPrefsWidTime *w = new KPrefsWidTime(text,reference,parent); 314 KPrefsWidTime *w = new KPrefsWidTime(text,reference,parent);
314 addWid(w); 315 addWid(w);
315 return w; 316 return w;
316} 317}
317 318
318KPrefsWidColor *KPrefsWidget::addWidColor(const QString &text,QColor *reference,QWidget *parent) 319KPrefsWidColor *KPrefsWidget::addWidColor(const QString &text,QColor *reference,QWidget *parent)
319{ 320{
320 KPrefsWidColor *w = new KPrefsWidColor(text,reference,parent); 321 KPrefsWidColor *w = new KPrefsWidColor(text,reference,parent);
321 addWid(w); 322 addWid(w);
322 return w; 323 return w;
323} 324}
324 325
325KPrefsWidRadios *KPrefsWidget::addWidRadios(const QString &text,int *reference,QWidget *parent) 326KPrefsWidRadios *KPrefsWidget::addWidRadios(const QString &text,int *reference,QWidget *parent)
326{ 327{
327 KPrefsWidRadios *w = new KPrefsWidRadios(text,reference,parent); 328 KPrefsWidRadios *w = new KPrefsWidRadios(text,reference,parent);
328 addWid(w); 329 addWid(w);
329 return w; 330 return w;
330} 331}
331 332
332KPrefsWidString *KPrefsWidget::addWidString(const QString &text,QString *reference,QWidget *parent) 333KPrefsWidString *KPrefsWidget::addWidString(const QString &text,QString *reference,QWidget *parent)
333{ 334{
334 KPrefsWidString *w = new KPrefsWidString(text,reference,parent); 335 KPrefsWidString *w = new KPrefsWidString(text,reference,parent);
335 addWid(w); 336 addWid(w);
336 return w; 337 return w;
337} 338}
338 339
339KPrefsWidString *KPrefsWidget::addWidPassword(const QString &text,QString *reference,QWidget *parent) 340KPrefsWidString *KPrefsWidget::addWidPassword(const QString &text,QString *reference,QWidget *parent)
340{ 341{
341 KPrefsWidString *w = new KPrefsWidString(text,reference,parent,QLineEdit::Password); 342 KPrefsWidString *w = new KPrefsWidString(text,reference,parent,QLineEdit::Password);
342 addWid(w); 343 addWid(w);
343 return w; 344 return w;
344} 345}
345 346
346KPrefsWidFont *KPrefsWidget::addWidFont(const QString &sampleText,const QString &buttonText, 347KPrefsWidFont *KPrefsWidget::addWidFont(const QString &sampleText,const QString &buttonText,
347 QFont *reference,QWidget *parent) 348 QFont *reference,QWidget *parent)
348{ 349{
349 KPrefsWidFont *w = new KPrefsWidFont(sampleText,buttonText,reference,parent); 350 KPrefsWidFont *w = new KPrefsWidFont(sampleText,buttonText,reference,parent);
350 addWid(w); 351 addWid(w);
351 return w; 352 return w;
352} 353}
353 354
354void KPrefsWidget::setDefaults() 355void KPrefsWidget::setDefaults()
355{ 356{
356 mPrefs->setDefaults(); 357 mPrefs->setDefaults();
357 358
358 readConfig(); 359 readConfig();
359} 360}
360 361
361void KPrefsWidget::readConfig() 362void KPrefsWidget::readConfig()
362{ 363{
363// kdDebug(5300) << "KPrefsDialog::readConfig()" << endl; 364// kdDebug(5300) << "KPrefsDialog::readConfig()" << endl;
364 365
365 KPrefsWid *wid; 366 KPrefsWid *wid;
366 for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { 367 for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) {
367 wid->readConfig(); 368 wid->readConfig();
368 } 369 }
369 370
370 usrReadConfig(); 371 usrReadConfig();
371 372
372 emit changed( false ); 373 emit changed( false );
373 374
374} 375}
375 376
376void KPrefsWidget::writeConfig() 377void KPrefsWidget::writeConfig()
377{ 378{
378// kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl; 379// kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl;
379 380
380 KPrefsWid *wid; 381 KPrefsWid *wid;
381 for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { 382 for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) {
382 wid->writeConfig(); 383 wid->writeConfig();
383 } 384 }
384 385
385 usrWriteConfig(); 386 usrWriteConfig();
386 387
387// kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl; 388// kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl;
388 389
389 mPrefs->writeConfig(); 390 mPrefs->writeConfig();
390 391
391 emit changed( false ); 392 emit changed( false );
392 393
393// kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl; 394// kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl;
394} 395}
395 396
396/*US 397/*US
397void KPrefsWidget::slotApply() 398void KPrefsWidget::slotApply()
398{ 399{
399 writeConfig(); 400 writeConfig();
400 emit configChanged(); 401 emit configChanged();
401} 402}
402 403
403void KPrefsDialog::slotOk() 404void KPrefsDialog::slotOk()
404{ 405{
405 slotApply(); 406 slotApply();
406 QDialog::accept(); 407 QDialog::accept();
407} 408}
408void KPrefsDialog::accept() 409void KPrefsDialog::accept()
409{ 410{
410 slotOk(); 411 slotOk();
411} 412}
412 413
413void KPrefsDialog::slotDefault() 414void KPrefsDialog::slotDefault()
414{ 415{
415 if (KMessageBox::warningContinueCancel(this, 416 if (KMessageBox::warningContinueCancel(this,
416 i18n("You are about to set all\npreferences to default values.\nAll " 417 i18n("You are about to set all\npreferences to default values.\nAll "
417 "custom modifications will be lost."),i18n("Setting Default Preferences"), 418 "custom modifications will be lost."),i18n("Setting Default Preferences"),
418 i18n("Continue")) 419 i18n("Continue"))
419 == KMessageBox::Continue) setDefaults(); 420 == KMessageBox::Continue) setDefaults();
420} 421}
421*/ 422*/
422 423
423void KPrefsWidget::modified() 424void KPrefsWidget::modified()
424{ 425{
425 emit changed( true ); 426 emit changed( true );
426} 427}
427 428