summaryrefslogtreecommitdiffabout
path: root/libkdepim/kprefsdialog.cpp
authorulf69 <ulf69>2004-09-21 19:50:27 (UTC)
committer ulf69 <ulf69>2004-09-21 19:50:27 (UTC)
commit93313aa8d66c01aa0e4562449020af20b5cef0a7 (patch) (unidiff)
tree7bf9930c58b4651a29b5aa4210742340c9439bc8 /libkdepim/kprefsdialog.cpp
parentc2cce86fdb2d0b291c3d3bdfa9fac47452153d1a (diff)
downloadkdepimpi-93313aa8d66c01aa0e4562449020af20b5cef0a7.zip
kdepimpi-93313aa8d66c01aa0e4562449020af20b5cef0a7.tar.gz
kdepimpi-93313aa8d66c01aa0e4562449020af20b5cef0a7.tar.bz2
added edit elements for global prefs
Diffstat (limited to 'libkdepim/kprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kprefsdialog.cpp106
1 files changed, 53 insertions, 53 deletions
diff --git a/libkdepim/kprefsdialog.cpp b/libkdepim/kprefsdialog.cpp
index 205c526..dd9a602 100644
--- a/libkdepim/kprefsdialog.cpp
+++ b/libkdepim/kprefsdialog.cpp
@@ -54,74 +54,74 @@
54 54
55#include "kprefs.h" 55#include "kprefs.h"
56 56
57#include "kprefsdialog.h" 57#include "kprefsdialog.h"
58//#include "kprefsdialog.moc" 58//#include "kprefsdialog.moc"
59 59
60KPrefsWidBool::KPrefsWidBool(const QString &text,bool *reference, 60KPrefsDialogWidBool::KPrefsDialogWidBool(const QString &text,bool *reference,
61 QWidget *parent) 61 QWidget *parent)
62{ 62{
63 mReference = reference; 63 mReference = reference;
64 64
65 mCheck = new QCheckBox(text,parent); 65 mCheck = new QCheckBox(text,parent);
66} 66}
67 67
68void KPrefsWidBool::readConfig() 68void KPrefsDialogWidBool::readConfig()
69{ 69{
70 mCheck->setChecked(*mReference); 70 mCheck->setChecked(*mReference);
71} 71}
72 72
73void KPrefsWidBool::writeConfig() 73void KPrefsDialogWidBool::writeConfig()
74{ 74{
75 *mReference = mCheck->isChecked(); 75 *mReference = mCheck->isChecked();
76} 76}
77 77
78QCheckBox *KPrefsWidBool::checkBox() 78QCheckBox *KPrefsDialogWidBool::checkBox()
79{ 79{
80 return mCheck; 80 return mCheck;
81} 81}
82 82
83 83
84KPrefsWidColor::KPrefsWidColor(const QString &text,QColor *reference, 84KPrefsDialogWidColor::KPrefsDialogWidColor(const QString &text,QColor *reference,
85 QWidget *parent) 85 QWidget *parent)
86{ 86{
87 mReference = reference; 87 mReference = reference;
88 88
89 mButton = new KColorButton(parent); 89 mButton = new KColorButton(parent);
90 mLabel = new QLabel(mButton, text, parent); 90 mLabel = new QLabel(mButton, text, parent);
91 mButton->setColor( *mReference ); 91 mButton->setColor( *mReference );
92 mButton->setColor( Qt::red ); 92 mButton->setColor( Qt::red );
93 93
94} 94}
95 95
96KPrefsWidColor::~KPrefsWidColor() 96KPrefsDialogWidColor::~KPrefsDialogWidColor()
97{ 97{
98// kdDebug(5300) << "KPrefsWidColor::~KPrefsWidColor()" << endl; 98// kdDebug(5300) << "KPrefsDialogWidColor::~KPrefsDialogWidColor()" << endl;
99} 99}
100 100
101void KPrefsWidColor::readConfig() 101void KPrefsDialogWidColor::readConfig()
102{ 102{
103 mButton->setColor(*mReference); 103 mButton->setColor(*mReference);
104} 104}
105 105
106void KPrefsWidColor::writeConfig() 106void KPrefsDialogWidColor::writeConfig()
107{ 107{
108 *mReference = mButton->color(); 108 *mReference = mButton->color();
109} 109}
110 110
111QLabel *KPrefsWidColor::label() 111QLabel *KPrefsDialogWidColor::label()
112{ 112{
113 return mLabel; 113 return mLabel;
114} 114}
115 115
116KColorButton *KPrefsWidColor::button() 116KColorButton *KPrefsDialogWidColor::button()
117{ 117{
118 return mButton; 118 return mButton;
119} 119}
120 120
121KPrefsWidFont::KPrefsWidFont(const QString &sampleText,const QString &labelText, 121KPrefsDialogWidFont::KPrefsDialogWidFont(const QString &sampleText,const QString &labelText,
122 QFont *reference,QWidget *parent) 122 QFont *reference,QWidget *parent)
123{ 123{
124 mReference = reference; 124 mReference = reference;
125 125
126 mLabel = new QLabel(labelText, parent); 126 mLabel = new QLabel(labelText, parent);
127 127
@@ -131,146 +131,146 @@ KPrefsWidFont::KPrefsWidFont(const QString &sampleText,const QString &labelText,
131 mButton = new QPushButton(i18n("Choose..."), parent); 131 mButton = new QPushButton(i18n("Choose..."), parent);
132 connect(mButton,SIGNAL(clicked()),SLOT(selectFont())); 132 connect(mButton,SIGNAL(clicked()),SLOT(selectFont()));
133 mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 ); 133 mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 );
134 mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 ); 134 mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 );
135} 135}
136 136
137KPrefsWidFont::~KPrefsWidFont() 137KPrefsDialogWidFont::~KPrefsDialogWidFont()
138{ 138{
139} 139}
140 140
141void KPrefsWidFont::readConfig() 141void KPrefsDialogWidFont::readConfig()
142{ 142{
143 mPreview->setFont(*mReference); 143 mPreview->setFont(*mReference);
144} 144}
145 145
146void KPrefsWidFont::writeConfig() 146void KPrefsDialogWidFont::writeConfig()
147{ 147{
148 *mReference = mPreview->font(); 148 *mReference = mPreview->font();
149} 149}
150 150
151QLabel *KPrefsWidFont::label() 151QLabel *KPrefsDialogWidFont::label()
152{ 152{
153 return mLabel; 153 return mLabel;
154} 154}
155 155
156QLabel *KPrefsWidFont::preview() 156QLabel *KPrefsDialogWidFont::preview()
157{ 157{
158 return mPreview; 158 return mPreview;
159} 159}
160 160
161QPushButton *KPrefsWidFont::button() 161QPushButton *KPrefsDialogWidFont::button()
162{ 162{
163 return mButton; 163 return mButton;
164} 164}
165 165
166void KPrefsWidFont::selectFont() 166void 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
177KPrefsWidTime::KPrefsWidTime(const QString &text,int *reference, 177KPrefsDialogWidTime::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
187void KPrefsWidTime::readConfig() 187void KPrefsDialogWidTime::readConfig()
188{ 188{
189 mSpin->setValue(*mReference); 189 mSpin->setValue(*mReference);
190} 190}
191 191
192void KPrefsWidTime::writeConfig() 192void KPrefsDialogWidTime::writeConfig()
193{ 193{
194 *mReference = mSpin->value(); 194 *mReference = mSpin->value();
195} 195}
196 196
197QLabel *KPrefsWidTime::label() 197QLabel *KPrefsDialogWidTime::label()
198{ 198{
199 return mLabel; 199 return mLabel;
200} 200}
201 201
202QSpinBox *KPrefsWidTime::spinBox() 202QSpinBox *KPrefsDialogWidTime::spinBox()
203{ 203{
204 return mSpin; 204 return mSpin;
205} 205}
206 206
207 207
208KPrefsWidRadios::KPrefsWidRadios(const QString &text,int *reference, 208KPrefsDialogWidRadios::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
216KPrefsWidRadios::~KPrefsWidRadios() 216KPrefsDialogWidRadios::~KPrefsDialogWidRadios()
217{ 217{
218} 218}
219 219
220void KPrefsWidRadios::addRadio(const QString &text) 220void KPrefsDialogWidRadios::addRadio(const QString &text)
221{ 221{
222 new QRadioButton(text,mBox); 222 new QRadioButton(text,mBox);
223} 223}
224 224
225QButtonGroup *KPrefsWidRadios::groupBox() 225QButtonGroup *KPrefsDialogWidRadios::groupBox()
226{ 226{
227 return mBox; 227 return mBox;
228} 228}
229 229
230void KPrefsWidRadios::readConfig() 230void KPrefsDialogWidRadios::readConfig()
231{ 231{
232 mBox->setButton(*mReference); 232 mBox->setButton(*mReference);
233} 233}
234 234
235void KPrefsWidRadios::writeConfig() 235void KPrefsDialogWidRadios::writeConfig()
236{ 236{
237 *mReference = mBox->id(mBox->selected()); 237 *mReference = mBox->id(mBox->selected());
238} 238}
239 239
240 240
241KPrefsWidString::KPrefsWidString(const QString &text,QString *reference, 241KPrefsDialogWidString::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
251KPrefsWidString::~KPrefsWidString() 251KPrefsDialogWidString::~KPrefsDialogWidString()
252{ 252{
253} 253}
254 254
255void KPrefsWidString::readConfig() 255void KPrefsDialogWidString::readConfig()
256{ 256{
257 mEdit->setText(*mReference); 257 mEdit->setText(*mReference);
258} 258}
259 259
260void KPrefsWidString::writeConfig() 260void KPrefsDialogWidString::writeConfig()
261{ 261{
262 *mReference = mEdit->text(); 262 *mReference = mEdit->text();
263} 263}
264 264
265QLabel *KPrefsWidString::label() 265QLabel *KPrefsDialogWidString::label()
266{ 266{
267 return mLabel; 267 return mLabel;
268} 268}
269 269
270QLineEdit *KPrefsWidString::lineEdit() 270QLineEdit *KPrefsDialogWidString::lineEdit()
271{ 271{
272 return mEdit; 272 return mEdit;
273} 273}
274 274
275 275
276KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) : 276KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) :
@@ -288,63 +288,63 @@ KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal)
288} 288}
289 289
290KPrefsDialog::~KPrefsDialog() 290KPrefsDialog::~KPrefsDialog()
291{ 291{
292} 292}
293 293
294void KPrefsDialog::addWid(KPrefsWid *wid) 294void KPrefsDialog::addWid(KPrefsDialogWid *wid)
295{ 295{
296 mPrefsWids.append(wid); 296 mPrefsWids.append(wid);
297} 297}
298 298
299KPrefsWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent) 299KPrefsDialogWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent)
300{ 300{
301 KPrefsWidBool *w = new KPrefsWidBool(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
306KPrefsWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent) 306KPrefsDialogWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent)
307{ 307{
308 KPrefsWidTime *w = new KPrefsWidTime(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
313KPrefsWidColor *KPrefsDialog::addWidColor(const QString &text,QColor *reference,QWidget *parent) 313KPrefsDialogWidColor *KPrefsDialog::addWidColor(const QString &text,QColor *reference,QWidget *parent)
314{ 314{
315 KPrefsWidColor *w = new KPrefsWidColor(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
320KPrefsWidRadios *KPrefsDialog::addWidRadios(const QString &text,int *reference,QWidget *parent) 320KPrefsDialogWidRadios *KPrefsDialog::addWidRadios(const QString &text,int *reference,QWidget *parent)
321{ 321{
322 KPrefsWidRadios *w = new KPrefsWidRadios(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
327KPrefsWidString *KPrefsDialog::addWidString(const QString &text,QString *reference,QWidget *parent) 327KPrefsDialogWidString *KPrefsDialog::addWidString(const QString &text,QString *reference,QWidget *parent)
328{ 328{
329 KPrefsWidString *w = new KPrefsWidString(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
334KPrefsWidString *KPrefsDialog::addWidPassword(const QString &text,QString *reference,QWidget *parent) 334KPrefsDialogWidString *KPrefsDialog::addWidPassword(const QString &text,QString *reference,QWidget *parent)
335{ 335{
336 KPrefsWidString *w = new KPrefsWidString(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
341KPrefsWidFont *KPrefsDialog::addWidFont(const QString &sampleText,const QString &buttonText, 341KPrefsDialogWidFont *KPrefsDialog::addWidFont(const QString &sampleText,const QString &buttonText,
342 QFont *reference,QWidget *parent) 342 QFont *reference,QWidget *parent)
343{ 343{
344 KPrefsWidFont *w = new KPrefsWidFont(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
349void KPrefsDialog::setDefaults() 349void KPrefsDialog::setDefaults()
350{ 350{
@@ -354,25 +354,25 @@ void KPrefsDialog::setDefaults()
354} 354}
355 355
356void KPrefsDialog::readConfig() 356void KPrefsDialog::readConfig()
357{ 357{
358// kdDebug(5300) << "KPrefsDialog::readConfig()" << endl; 358// kdDebug(5300) << "KPrefsDialog::readConfig()" << endl;
359 359
360 KPrefsWid *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
368void KPrefsDialog::writeConfig() 368void KPrefsDialog::writeConfig()
369{ 369{
370// kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl; 370// kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl;
371 371
372 KPrefsWid *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