author | zautrix <zautrix> | 2005-06-10 10:31:22 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-10 10:31:22 (UTC) |
commit | e5ca8e0d8d6d08b597253f43de401aa1a99a6abe (patch) (unidiff) | |
tree | c319ba89abbe5cd90647bc38deb0ab1ce46f48e5 /libkdepim/kprefsdialog.cpp | |
parent | 89c5159208fd982f527117e49d67ea1f90553dbe (diff) | |
download | kdepimpi-e5ca8e0d8d6d08b597253f43de401aa1a99a6abe.zip kdepimpi-e5ca8e0d8d6d08b597253f43de401aa1a99a6abe.tar.gz kdepimpi-e5ca8e0d8d6d08b597253f43de401aa1a99a6abe.tar.bz2 |
config dialog fixes
-rw-r--r-- | libkdepim/kprefsdialog.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libkdepim/kprefsdialog.cpp b/libkdepim/kprefsdialog.cpp index b6ae775..6dc741d 100644 --- a/libkdepim/kprefsdialog.cpp +++ b/libkdepim/kprefsdialog.cpp | |||
@@ -1,410 +1,440 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | // $Id$ | 24 | // $Id$ |
25 | 25 | ||
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qgroupbox.h> | 28 | #include <qgroupbox.h> |
29 | #include <qbuttongroup.h> | 29 | #include <qbuttongroup.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qfont.h> | 31 | #include <qfont.h> |
32 | #include <qslider.h> | 32 | #include <qslider.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
35 | #include <qvbox.h> | 35 | #include <qvbox.h> |
36 | #include <qhbox.h> | 36 | #include <qhbox.h> |
37 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qframe.h> | 39 | #include <qframe.h> |
40 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
41 | #include <qcheckbox.h> | 41 | #include <qcheckbox.h> |
42 | #include <qradiobutton.h> | 42 | #include <qradiobutton.h> |
43 | #include <qpushbutton.h> | 43 | #include <qpushbutton.h> |
44 | #include <qapplication.h> | 44 | #include <qapplication.h> |
45 | 45 | ||
46 | #include <kcolorbutton.h> | 46 | #include <kcolorbutton.h> |
47 | #include <kdebug.h> | 47 | #include <kdebug.h> |
48 | #include <klocale.h> | 48 | #include <klocale.h> |
49 | #include <kglobal.h> | 49 | #include <kglobal.h> |
50 | #include <kglobalsettings.h> | ||
50 | #include <kfontdialog.h> | 51 | #include <kfontdialog.h> |
51 | #include <kmessagebox.h> | 52 | #include <kmessagebox.h> |
52 | #include <kcolordialog.h> | 53 | #include <kcolordialog.h> |
53 | #include <kiconloader.h> | 54 | #include <kiconloader.h> |
54 | 55 | ||
55 | #include "kprefs.h" | 56 | #include "kprefs.h" |
57 | #include "kpimglobalprefs.h" | ||
56 | 58 | ||
57 | #include "kprefsdialog.h" | 59 | #include "kprefsdialog.h" |
58 | //#include "kprefsdialog.moc" | 60 | //#include "kprefsdialog.moc" |
59 | 61 | ||
60 | KPrefsDialogWidBool::KPrefsDialogWidBool(const QString &text,bool *reference, | 62 | KPrefsDialogWidBool::KPrefsDialogWidBool(const QString &text,bool *reference, |
61 | QWidget *parent) | 63 | QWidget *parent) |
62 | { | 64 | { |
63 | mReference = reference; | 65 | mReference = reference; |
64 | 66 | ||
65 | mCheck = new QCheckBox(text,parent); | 67 | mCheck = new QCheckBox(text,parent); |
66 | } | 68 | } |
67 | 69 | ||
68 | void KPrefsDialogWidBool::readConfig() | 70 | void KPrefsDialogWidBool::readConfig() |
69 | { | 71 | { |
70 | mCheck->setChecked(*mReference); | 72 | mCheck->setChecked(*mReference); |
71 | } | 73 | } |
72 | 74 | ||
73 | void KPrefsDialogWidBool::writeConfig() | 75 | void KPrefsDialogWidBool::writeConfig() |
74 | { | 76 | { |
75 | *mReference = mCheck->isChecked(); | 77 | *mReference = mCheck->isChecked(); |
76 | } | 78 | } |
77 | 79 | ||
78 | QCheckBox *KPrefsDialogWidBool::checkBox() | 80 | QCheckBox *KPrefsDialogWidBool::checkBox() |
79 | { | 81 | { |
80 | return mCheck; | 82 | return mCheck; |
81 | } | 83 | } |
82 | 84 | ||
83 | 85 | ||
84 | KPrefsDialogWidColor::KPrefsDialogWidColor(const QString &text,QColor *reference, | 86 | KPrefsDialogWidColor::KPrefsDialogWidColor(const QString &text,QColor *reference, |
85 | QWidget *parent) | 87 | QWidget *parent) |
86 | { | 88 | { |
87 | mReference = reference; | 89 | mReference = reference; |
88 | 90 | ||
89 | mButton = new KColorButton(parent); | 91 | mButton = new KColorButton(parent); |
90 | mLabel = new QLabel(mButton, text, parent); | 92 | mLabel = new QLabel(mButton, text, parent); |
91 | mButton->setColor( *mReference ); | 93 | mButton->setColor( *mReference ); |
92 | mButton->setColor( Qt::red ); | 94 | mButton->setColor( Qt::red ); |
93 | 95 | ||
94 | } | 96 | } |
95 | 97 | ||
96 | KPrefsDialogWidColor::~KPrefsDialogWidColor() | 98 | KPrefsDialogWidColor::~KPrefsDialogWidColor() |
97 | { | 99 | { |
98 | // kdDebug(5300) << "KPrefsDialogWidColor::~KPrefsDialogWidColor()" << endl; | 100 | // kdDebug(5300) << "KPrefsDialogWidColor::~KPrefsDialogWidColor()" << endl; |
99 | } | 101 | } |
100 | 102 | ||
101 | void KPrefsDialogWidColor::readConfig() | 103 | void KPrefsDialogWidColor::readConfig() |
102 | { | 104 | { |
103 | mButton->setColor(*mReference); | 105 | mButton->setColor(*mReference); |
104 | } | 106 | } |
105 | 107 | ||
106 | void KPrefsDialogWidColor::writeConfig() | 108 | void KPrefsDialogWidColor::writeConfig() |
107 | { | 109 | { |
108 | *mReference = mButton->color(); | 110 | *mReference = mButton->color(); |
109 | } | 111 | } |
110 | 112 | ||
111 | QLabel *KPrefsDialogWidColor::label() | 113 | QLabel *KPrefsDialogWidColor::label() |
112 | { | 114 | { |
113 | return mLabel; | 115 | return mLabel; |
114 | } | 116 | } |
115 | 117 | ||
116 | KColorButton *KPrefsDialogWidColor::button() | 118 | KColorButton *KPrefsDialogWidColor::button() |
117 | { | 119 | { |
118 | return mButton; | 120 | return mButton; |
119 | } | 121 | } |
120 | 122 | ||
121 | KPrefsDialogWidFont::KPrefsDialogWidFont(const QString &sampleText,const QString &labelText, | 123 | KPrefsDialogWidFont::KPrefsDialogWidFont(const QString &sampleText,const QString &labelText, |
122 | QFont *reference,QWidget *parent) | 124 | QFont *reference,QWidget *parent) |
123 | { | 125 | { |
124 | mReference = reference; | 126 | mReference = reference; |
125 | 127 | ||
126 | mLabel = new QLabel(labelText, parent); | 128 | mLabel = new QLabel(labelText, parent); |
127 | 129 | ||
128 | mPreview = new QLabel(sampleText,parent); | 130 | mPreview = new QLabel(sampleText,parent); |
129 | mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 131 | mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
130 | 132 | ||
131 | mButton = new QPushButton(i18n("Choose..."), parent); | 133 | mButton = new QPushButton(i18n("Choose..."), parent); |
132 | connect(mButton,SIGNAL(clicked()),SLOT(selectFont())); | 134 | connect(mButton,SIGNAL(clicked()),SLOT(selectFont())); |
133 | mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 ); | 135 | mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 ); |
134 | mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 ); | 136 | mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 ); |
135 | } | 137 | } |
136 | 138 | ||
137 | KPrefsDialogWidFont::~KPrefsDialogWidFont() | 139 | KPrefsDialogWidFont::~KPrefsDialogWidFont() |
138 | { | 140 | { |
139 | } | 141 | } |
140 | 142 | ||
141 | void KPrefsDialogWidFont::readConfig() | 143 | void KPrefsDialogWidFont::readConfig() |
142 | { | 144 | { |
143 | mPreview->setFont(*mReference); | 145 | mPreview->setFont(*mReference); |
144 | } | 146 | } |
145 | 147 | ||
146 | void KPrefsDialogWidFont::writeConfig() | 148 | void KPrefsDialogWidFont::writeConfig() |
147 | { | 149 | { |
148 | *mReference = mPreview->font(); | 150 | *mReference = mPreview->font(); |
149 | } | 151 | } |
150 | 152 | ||
151 | QLabel *KPrefsDialogWidFont::label() | 153 | QLabel *KPrefsDialogWidFont::label() |
152 | { | 154 | { |
153 | return mLabel; | 155 | return mLabel; |
154 | } | 156 | } |
155 | 157 | ||
156 | QLabel *KPrefsDialogWidFont::preview() | 158 | QLabel *KPrefsDialogWidFont::preview() |
157 | { | 159 | { |
158 | return mPreview; | 160 | return mPreview; |
159 | } | 161 | } |
160 | 162 | ||
161 | QPushButton *KPrefsDialogWidFont::button() | 163 | QPushButton *KPrefsDialogWidFont::button() |
162 | { | 164 | { |
163 | return mButton; | 165 | return mButton; |
164 | } | 166 | } |
165 | 167 | ||
166 | void KPrefsDialogWidFont::selectFont() | 168 | void KPrefsDialogWidFont::selectFont() |
167 | { | 169 | { |
168 | QFont myFont(mPreview->font()); | 170 | QFont myFont(mPreview->font()); |
169 | bool ok; | 171 | bool ok; |
170 | myFont = KFontDialog::getFont(myFont, ok); | 172 | myFont = KFontDialog::getFont(myFont, ok); |
171 | if ( ok ) { | 173 | if ( ok ) { |
172 | mPreview->setFont(myFont); | 174 | mPreview->setFont(myFont); |
173 | } | 175 | } |
174 | } | 176 | } |
175 | 177 | ||
176 | 178 | ||
177 | KPrefsDialogWidTime::KPrefsDialogWidTime(const QString &text,int *reference, | 179 | KPrefsDialogWidTime::KPrefsDialogWidTime(const QString &text,int *reference, |
178 | QWidget *parent) | 180 | QWidget *parent) |
179 | { | 181 | { |
180 | mReference = reference; | 182 | mReference = reference; |
181 | 183 | ||
182 | mLabel = new QLabel(text,parent); | 184 | mLabel = new QLabel(text,parent); |
183 | mSpin = new QSpinBox(0,23,1,parent); | 185 | mSpin = new QSpinBox(0,23,1,parent); |
184 | mSpin->setSuffix(":00"); | 186 | mSpin->setSuffix(":00"); |
185 | } | 187 | } |
186 | 188 | ||
187 | void KPrefsDialogWidTime::readConfig() | 189 | void KPrefsDialogWidTime::readConfig() |
188 | { | 190 | { |
189 | mSpin->setValue(*mReference); | 191 | mSpin->setValue(*mReference); |
190 | } | 192 | } |
191 | 193 | ||
192 | void KPrefsDialogWidTime::writeConfig() | 194 | void KPrefsDialogWidTime::writeConfig() |
193 | { | 195 | { |
194 | *mReference = mSpin->value(); | 196 | *mReference = mSpin->value(); |
195 | } | 197 | } |
196 | 198 | ||
197 | QLabel *KPrefsDialogWidTime::label() | 199 | QLabel *KPrefsDialogWidTime::label() |
198 | { | 200 | { |
199 | return mLabel; | 201 | return mLabel; |
200 | } | 202 | } |
201 | 203 | ||
202 | QSpinBox *KPrefsDialogWidTime::spinBox() | 204 | QSpinBox *KPrefsDialogWidTime::spinBox() |
203 | { | 205 | { |
204 | return mSpin; | 206 | return mSpin; |
205 | } | 207 | } |
206 | 208 | ||
207 | 209 | ||
208 | KPrefsDialogWidRadios::KPrefsDialogWidRadios(const QString &text,int *reference, | 210 | KPrefsDialogWidRadios::KPrefsDialogWidRadios(const QString &text,int *reference, |
209 | QWidget *parent) | 211 | QWidget *parent) |
210 | { | 212 | { |
211 | mReference = reference; | 213 | mReference = reference; |
212 | 214 | ||
213 | mBox = new QButtonGroup(1,Qt::Horizontal,text,parent); | 215 | mBox = new QButtonGroup(1,Qt::Horizontal,text,parent); |
214 | } | 216 | } |
215 | 217 | ||
216 | KPrefsDialogWidRadios::~KPrefsDialogWidRadios() | 218 | KPrefsDialogWidRadios::~KPrefsDialogWidRadios() |
217 | { | 219 | { |
218 | } | 220 | } |
219 | 221 | ||
220 | void KPrefsDialogWidRadios::addRadio(const QString &text) | 222 | void KPrefsDialogWidRadios::addRadio(const QString &text) |
221 | { | 223 | { |
222 | new QRadioButton(text,mBox); | 224 | new QRadioButton(text,mBox); |
223 | } | 225 | } |
224 | 226 | ||
225 | QButtonGroup *KPrefsDialogWidRadios::groupBox() | 227 | QButtonGroup *KPrefsDialogWidRadios::groupBox() |
226 | { | 228 | { |
227 | return mBox; | 229 | return mBox; |
228 | } | 230 | } |
229 | 231 | ||
230 | void KPrefsDialogWidRadios::readConfig() | 232 | void KPrefsDialogWidRadios::readConfig() |
231 | { | 233 | { |
232 | mBox->setButton(*mReference); | 234 | mBox->setButton(*mReference); |
233 | } | 235 | } |
234 | 236 | ||
235 | void KPrefsDialogWidRadios::writeConfig() | 237 | void KPrefsDialogWidRadios::writeConfig() |
236 | { | 238 | { |
237 | *mReference = mBox->id(mBox->selected()); | 239 | *mReference = mBox->id(mBox->selected()); |
238 | } | 240 | } |
239 | 241 | ||
240 | 242 | ||
241 | KPrefsDialogWidString::KPrefsDialogWidString(const QString &text,QString *reference, | 243 | KPrefsDialogWidString::KPrefsDialogWidString(const QString &text,QString *reference, |
242 | QWidget *parent, QLineEdit::EchoMode echomode) | 244 | QWidget *parent, QLineEdit::EchoMode echomode) |
243 | { | 245 | { |
244 | mReference = reference; | 246 | mReference = reference; |
245 | 247 | ||
246 | mLabel = new QLabel(text,parent); | 248 | mLabel = new QLabel(text,parent); |
247 | mEdit = new QLineEdit(parent); | 249 | mEdit = new QLineEdit(parent); |
248 | mEdit->setEchoMode( echomode ); | 250 | mEdit->setEchoMode( echomode ); |
249 | } | 251 | } |
250 | 252 | ||
251 | KPrefsDialogWidString::~KPrefsDialogWidString() | 253 | KPrefsDialogWidString::~KPrefsDialogWidString() |
252 | { | 254 | { |
253 | } | 255 | } |
254 | 256 | ||
255 | void KPrefsDialogWidString::readConfig() | 257 | void KPrefsDialogWidString::readConfig() |
256 | { | 258 | { |
257 | mEdit->setText(*mReference); | 259 | mEdit->setText(*mReference); |
258 | } | 260 | } |
259 | 261 | ||
260 | void KPrefsDialogWidString::writeConfig() | 262 | void KPrefsDialogWidString::writeConfig() |
261 | { | 263 | { |
262 | *mReference = mEdit->text(); | 264 | *mReference = mEdit->text(); |
263 | } | 265 | } |
264 | 266 | ||
265 | QLabel *KPrefsDialogWidString::label() | 267 | QLabel *KPrefsDialogWidString::label() |
266 | { | 268 | { |
267 | return mLabel; | 269 | return mLabel; |
268 | } | 270 | } |
269 | 271 | ||
270 | QLineEdit *KPrefsDialogWidString::lineEdit() | 272 | QLineEdit *KPrefsDialogWidString::lineEdit() |
271 | { | 273 | { |
272 | return mEdit; | 274 | return mEdit; |
273 | } | 275 | } |
274 | 276 | ||
275 | 277 | ||
276 | KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) : | 278 | KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) : |
277 | KDialogBase(IconList,i18n("Preferences"),Ok|Cancel|Default,Ok,parent, | 279 | KDialogBase(IconList,i18n("Preferences"),Ok|Cancel|Default,Ok,parent, |
278 | name,modal,true) | 280 | name,modal,true) |
279 | { | 281 | { |
280 | mPrefs = prefs; | 282 | mPrefs = prefs; |
281 | 283 | ||
282 | // This seems to cause a crash on exit. Investigate later. | 284 | // This seems to cause a crash on exit. Investigate later. |
283 | mPrefsWids.setAutoDelete(true); | 285 | mPrefsWids.setAutoDelete(true); |
284 | 286 | ||
285 | connect(this,SIGNAL(defaultClicked()),SLOT(slotDefault())); | 287 | connect(this,SIGNAL(defaultClicked()),SLOT(slotDefault())); |
286 | //connect(this,SIGNAL(cancelClicked()),SLOT(slotDefault())); | 288 | //connect(this,SIGNAL(cancelClicked()),SLOT(slotDefault())); |
287 | //connect(this,SIGNAL(cancelClicked()),SLOT(reject())); | 289 | //connect(this,SIGNAL(cancelClicked()),SLOT(reject())); |
288 | } | 290 | } |
289 | 291 | ||
290 | KPrefsDialog::~KPrefsDialog() | 292 | KPrefsDialog::~KPrefsDialog() |
291 | { | 293 | { |
292 | } | 294 | } |
293 | 295 | ||
294 | void KPrefsDialog::addWid(KPrefsDialogWid *wid) | 296 | void KPrefsDialog::addWid(KPrefsDialogWid *wid) |
295 | { | 297 | { |
296 | mPrefsWids.append(wid); | 298 | mPrefsWids.append(wid); |
297 | } | 299 | } |
298 | 300 | ||
299 | KPrefsDialogWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent) | 301 | KPrefsDialogWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent) |
300 | { | 302 | { |
301 | KPrefsDialogWidBool *w = new KPrefsDialogWidBool(text,reference,parent); | 303 | KPrefsDialogWidBool *w = new KPrefsDialogWidBool(text,reference,parent); |
302 | addWid(w); | 304 | addWid(w); |
303 | return w; | 305 | return w; |
304 | } | 306 | } |
305 | 307 | ||
306 | KPrefsDialogWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent) | 308 | KPrefsDialogWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent) |
307 | { | 309 | { |
308 | KPrefsDialogWidTime *w = new KPrefsDialogWidTime(text,reference,parent); | 310 | KPrefsDialogWidTime *w = new KPrefsDialogWidTime(text,reference,parent); |
309 | addWid(w); | 311 | addWid(w); |
310 | return w; | 312 | return w; |
311 | } | 313 | } |
312 | 314 | ||
313 | KPrefsDialogWidColor *KPrefsDialog::addWidColor(const QString &text,QColor *reference,QWidget *parent) | 315 | KPrefsDialogWidColor *KPrefsDialog::addWidColor(const QString &text,QColor *reference,QWidget *parent) |
314 | { | 316 | { |
315 | KPrefsDialogWidColor *w = new KPrefsDialogWidColor(text,reference,parent); | 317 | KPrefsDialogWidColor *w = new KPrefsDialogWidColor(text,reference,parent); |
316 | addWid(w); | 318 | addWid(w); |
317 | return w; | 319 | return w; |
318 | } | 320 | } |
319 | 321 | ||
320 | KPrefsDialogWidRadios *KPrefsDialog::addWidRadios(const QString &text,int *reference,QWidget *parent) | 322 | KPrefsDialogWidRadios *KPrefsDialog::addWidRadios(const QString &text,int *reference,QWidget *parent) |
321 | { | 323 | { |
322 | KPrefsDialogWidRadios *w = new KPrefsDialogWidRadios(text,reference,parent); | 324 | KPrefsDialogWidRadios *w = new KPrefsDialogWidRadios(text,reference,parent); |
323 | addWid(w); | 325 | addWid(w); |
324 | return w; | 326 | return w; |
325 | } | 327 | } |
326 | 328 | ||
327 | KPrefsDialogWidString *KPrefsDialog::addWidString(const QString &text,QString *reference,QWidget *parent) | 329 | KPrefsDialogWidString *KPrefsDialog::addWidString(const QString &text,QString *reference,QWidget *parent) |
328 | { | 330 | { |
329 | KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent); | 331 | KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent); |
330 | addWid(w); | 332 | addWid(w); |
331 | return w; | 333 | return w; |
332 | } | 334 | } |
333 | 335 | ||
334 | KPrefsDialogWidString *KPrefsDialog::addWidPassword(const QString &text,QString *reference,QWidget *parent) | 336 | KPrefsDialogWidString *KPrefsDialog::addWidPassword(const QString &text,QString *reference,QWidget *parent) |
335 | { | 337 | { |
336 | KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent,QLineEdit::Password); | 338 | KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent,QLineEdit::Password); |
337 | addWid(w); | 339 | addWid(w); |
338 | return w; | 340 | return w; |
339 | } | 341 | } |
340 | 342 | ||
341 | KPrefsDialogWidFont *KPrefsDialog::addWidFont(const QString &sampleText,const QString &buttonText, | 343 | KPrefsDialogWidFont *KPrefsDialog::addWidFont(const QString &sampleText,const QString &buttonText, |
342 | QFont *reference,QWidget *parent) | 344 | QFont *reference,QWidget *parent) |
343 | { | 345 | { |
344 | KPrefsDialogWidFont *w = new KPrefsDialogWidFont(sampleText,buttonText,reference,parent); | 346 | KPrefsDialogWidFont *w = new KPrefsDialogWidFont(sampleText,buttonText,reference,parent); |
345 | addWid(w); | 347 | addWid(w); |
346 | return w; | 348 | return w; |
347 | } | 349 | } |
348 | 350 | ||
349 | void KPrefsDialog::setDefaults() | 351 | void KPrefsDialog::setDefaults() |
350 | { | 352 | { |
351 | mPrefs->setDefaults(); | 353 | mPrefs->setDefaults(); |
352 | 354 | ||
353 | readConfig(); | 355 | readConfig(); |
354 | } | 356 | } |
355 | 357 | ||
356 | void KPrefsDialog::readConfig() | 358 | void KPrefsDialog::readConfig() |
357 | { | 359 | { |
358 | // kdDebug(5300) << "KPrefsDialog::readConfig()" << endl; | 360 | // kdDebug(5300) << "KPrefsDialog::readConfig()" << endl; |
359 | 361 | ||
360 | KPrefsDialogWid *wid; | 362 | KPrefsDialogWid *wid; |
361 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { | 363 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { |
362 | wid->readConfig(); | 364 | wid->readConfig(); |
363 | } | 365 | } |
364 | 366 | ||
365 | usrReadConfig(); | 367 | usrReadConfig(); |
366 | } | 368 | } |
367 | 369 | ||
368 | void KPrefsDialog::writeConfig() | 370 | void KPrefsDialog::writeConfig() |
369 | { | 371 | { |
370 | // kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl; | 372 | // kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl; |
371 | 373 | ||
372 | KPrefsDialogWid *wid; | 374 | KPrefsDialogWid *wid; |
373 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { | 375 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { |
374 | wid->writeConfig(); | 376 | wid->writeConfig(); |
375 | } | 377 | } |
376 | 378 | ||
377 | usrWriteConfig(); | 379 | usrWriteConfig(); |
378 | 380 | ||
379 | // kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl; | 381 | // kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl; |
380 | 382 | ||
381 | mPrefs->writeConfig(); | 383 | mPrefs->writeConfig(); |
382 | 384 | ||
383 | // kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl; | 385 | // kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl; |
384 | } | 386 | } |
385 | 387 | ||
386 | 388 | ||
387 | void KPrefsDialog::slotApply() | 389 | void KPrefsDialog::slotApply() |
388 | { | 390 | { |
389 | writeConfig(); | 391 | writeConfig(); |
390 | emit configChanged(); | 392 | emit configChanged(); |
391 | } | 393 | } |
392 | 394 | ||
393 | void KPrefsDialog::slotOk() | 395 | void KPrefsDialog::slotOk() |
394 | { | 396 | { |
395 | slotApply(); | 397 | slotApply(); |
396 | QDialog::accept(); | 398 | QDialog::accept(); |
397 | } | 399 | } |
398 | void KPrefsDialog::accept() | 400 | void KPrefsDialog::accept() |
399 | { | 401 | { |
400 | slotOk(); | 402 | slotOk(); |
401 | } | 403 | } |
402 | 404 | ||
403 | void KPrefsDialog::slotDefault() | 405 | void KPrefsDialog::slotDefault() |
404 | { | 406 | { |
405 | if (KMessageBox::warningContinueCancel(this, | 407 | if (KMessageBox::warningContinueCancel(this, |
406 | i18n("You are about to set all\npreferences to default values.\nAll " | 408 | i18n("You are about to set all\npreferences to default values.\nAll " |
407 | "custom modifications will be lost."),i18n("Setting Default Preferences"), | 409 | "custom modifications will be lost."),i18n("Setting Default Preferences"), |
408 | i18n("Continue")) | 410 | i18n("Continue")) |
409 | == KMessageBox::Continue) setDefaults(); | 411 | == KMessageBox::Continue) setDefaults(); |
410 | } | 412 | } |
413 | |||
414 | KPimPrefsGlobalDialog::KPimPrefsGlobalDialog(QWidget *parent,char *name,bool modal): KPrefsDialog( KPimGlobalPrefs::instance() ,parent, name, modal ) | ||
415 | { | ||
416 | setFont( KGlobalSettings::generalMaxFont() ); | ||
417 | kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), this, "KPrefsGlobalDialog" ); | ||
418 | setMainWidget( kdelibcfg ); | ||
419 | setCaption( i18n("KDE-Pim Global Settings")); | ||
420 | kdelibcfg->readConfig(); | ||
421 | #ifndef DESKTOP_VERSION | ||
422 | if ( QApplication::desktop()->height() <= 480 ) | ||
423 | hideButtons(); | ||
424 | showMaximized(); | ||
425 | #endif | ||
426 | } | ||
427 | void KPimPrefsGlobalDialog::showTZconfig() | ||
428 | { | ||
429 | kdelibcfg->showTimeZoneTab() ; | ||
430 | } | ||
431 | void KPimPrefsGlobalDialog::usrReadConfig() | ||
432 | { | ||
433 | kdelibcfg->readConfig(); | ||
434 | } | ||
435 | |||
436 | void KPimPrefsGlobalDialog::usrWriteConfig() | ||
437 | { | ||
438 | kdelibcfg->writeConfig(); | ||
439 | } | ||
440 | |||