author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /libkdepim/kprefswidget.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | libkdepim/kprefswidget.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libkdepim/kprefswidget.cpp b/libkdepim/kprefswidget.cpp index f6a0b38..51431e2 100644 --- a/libkdepim/kprefswidget.cpp +++ b/libkdepim/kprefswidget.cpp | |||
@@ -1,428 +1,429 @@ | |||
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 <q3groupbox.h> |
29 | #include <qbuttongroup.h> | 29 | #include <q3buttongroup.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 <q3textstream.h> |
35 | #include <qvbox.h> | 35 | #include <q3vbox.h> |
36 | #include <qhbox.h> | 36 | #include <q3hbox.h> |
37 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qframe.h> | 39 | #include <q3frame.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 | #include <QDesktopWidget> | ||
45 | 46 | ||
46 | #include <kcolorbutton.h> | 47 | #include <kcolorbutton.h> |
47 | #include <kdebug.h> | 48 | #include <kdebug.h> |
48 | #include <klocale.h> | 49 | #include <klocale.h> |
49 | #include <kglobal.h> | 50 | #include <kglobal.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" |
56 | 57 | ||
57 | #include "kprefswidget.h" | 58 | #include "kprefswidget.h" |
58 | //#include "kprefsdialog.moc" | 59 | //#include "kprefsdialog.moc" |
59 | 60 | ||
60 | KPrefsWidBool::KPrefsWidBool(const QString &text,bool *reference, | 61 | KPrefsWidBool::KPrefsWidBool(const QString &text,bool *reference, |
61 | QWidget *parent) | 62 | QWidget *parent) |
62 | { | 63 | { |
63 | mReference = reference; | 64 | mReference = reference; |
64 | 65 | ||
65 | mCheck = new QCheckBox(text,parent); | 66 | mCheck = new QCheckBox(text,parent); |
66 | 67 | ||
67 | connect( mCheck, SIGNAL( toggled( bool ) ), SIGNAL( modified() ) ); | 68 | connect( mCheck, SIGNAL( toggled( bool ) ), SIGNAL( modified() ) ); |
68 | 69 | ||
69 | } | 70 | } |
70 | 71 | ||
71 | void KPrefsWidBool::readConfig() | 72 | void KPrefsWidBool::readConfig() |
72 | { | 73 | { |
73 | mCheck->setChecked(*mReference); | 74 | mCheck->setChecked(*mReference); |
74 | } | 75 | } |
75 | 76 | ||
76 | void KPrefsWidBool::writeConfig() | 77 | void KPrefsWidBool::writeConfig() |
77 | { | 78 | { |
78 | *mReference = mCheck->isChecked(); | 79 | *mReference = mCheck->isChecked(); |
79 | } | 80 | } |
80 | 81 | ||
81 | QCheckBox *KPrefsWidBool::checkBox() | 82 | QCheckBox *KPrefsWidBool::checkBox() |
82 | { | 83 | { |
83 | return mCheck; | 84 | return mCheck; |
84 | } | 85 | } |
85 | 86 | ||
86 | 87 | ||
87 | KPrefsWidColor::KPrefsWidColor(const QString &text,QColor *reference, | 88 | KPrefsWidColor::KPrefsWidColor(const QString &text,QColor *reference, |
88 | QWidget *parent) | 89 | QWidget *parent) |
89 | { | 90 | { |
90 | mReference = reference; | 91 | mReference = reference; |
91 | 92 | ||
92 | mButton = new KColorButton(parent); | 93 | mButton = new KColorButton(parent); |
93 | mLabel = new QLabel(mButton, text, parent); | 94 | mLabel = new QLabel(mButton, text, parent); |
94 | mButton->setColor( *mReference ); | 95 | mButton->setColor( *mReference ); |
95 | mButton->setColor( Qt::red ); | 96 | mButton->setColor( Qt::red ); |
96 | 97 | ||
97 | connect( mButton, SIGNAL( changed(const QColor &)), SIGNAL( modified() ) ); | 98 | connect( mButton, SIGNAL( changed(const QColor &)), SIGNAL( modified() ) ); |
98 | 99 | ||
99 | } | 100 | } |
100 | 101 | ||
101 | KPrefsWidColor::~KPrefsWidColor() | 102 | KPrefsWidColor::~KPrefsWidColor() |
102 | { | 103 | { |
103 | // kdDebug(5300) << "KPrefsWidColor::~KPrefsWidColor()" << endl; | 104 | // kdDebug(5300) << "KPrefsWidColor::~KPrefsWidColor()" << endl; |
104 | } | 105 | } |
105 | 106 | ||
106 | void KPrefsWidColor::readConfig() | 107 | void KPrefsWidColor::readConfig() |
107 | { | 108 | { |
108 | mButton->setColor(*mReference); | 109 | mButton->setColor(*mReference); |
109 | } | 110 | } |
110 | 111 | ||
111 | void KPrefsWidColor::writeConfig() | 112 | void KPrefsWidColor::writeConfig() |
112 | { | 113 | { |
113 | *mReference = mButton->color(); | 114 | *mReference = mButton->color(); |
114 | } | 115 | } |
115 | 116 | ||
116 | QLabel *KPrefsWidColor::label() | 117 | QLabel *KPrefsWidColor::label() |
117 | { | 118 | { |
118 | return mLabel; | 119 | return mLabel; |
119 | } | 120 | } |
120 | 121 | ||
121 | KColorButton *KPrefsWidColor::button() | 122 | KColorButton *KPrefsWidColor::button() |
122 | { | 123 | { |
123 | return mButton; | 124 | return mButton; |
124 | } | 125 | } |
125 | 126 | ||
126 | KPrefsWidFont::KPrefsWidFont(const QString &sampleText,const QString &labelText, | 127 | KPrefsWidFont::KPrefsWidFont(const QString &sampleText,const QString &labelText, |
127 | QFont *reference,QWidget *parent) | 128 | QFont *reference,QWidget *parent) |
128 | { | 129 | { |
129 | mReference = reference; | 130 | mReference = reference; |
130 | 131 | ||
131 | mLabel = new QLabel(labelText, parent); | 132 | mLabel = new QLabel(labelText, parent); |
132 | 133 | ||
133 | mPreview = new QLabel(sampleText,parent); | 134 | mPreview = new QLabel(sampleText,parent); |
134 | mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 135 | mPreview->setFrameStyle(Q3Frame::Panel|Q3Frame::Sunken); |
135 | 136 | ||
136 | mButton = new QPushButton(i18n("Choose..."), parent); | 137 | mButton = new QPushButton(i18n("Choose..."), parent); |
137 | connect(mButton,SIGNAL(clicked()),SLOT(selectFont())); | 138 | connect(mButton,SIGNAL(clicked()),SLOT(selectFont())); |
138 | mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 ); | 139 | mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 ); |
139 | mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 ); | 140 | mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 ); |
140 | } | 141 | } |
141 | 142 | ||
142 | KPrefsWidFont::~KPrefsWidFont() | 143 | KPrefsWidFont::~KPrefsWidFont() |
143 | { | 144 | { |
144 | } | 145 | } |
145 | 146 | ||
146 | void KPrefsWidFont::readConfig() | 147 | void KPrefsWidFont::readConfig() |
147 | { | 148 | { |
148 | mPreview->setFont(*mReference); | 149 | mPreview->setFont(*mReference); |
149 | } | 150 | } |
150 | 151 | ||
151 | void KPrefsWidFont::writeConfig() | 152 | void KPrefsWidFont::writeConfig() |
152 | { | 153 | { |
153 | *mReference = mPreview->font(); | 154 | *mReference = mPreview->font(); |
154 | } | 155 | } |
155 | 156 | ||
156 | QLabel *KPrefsWidFont::label() | 157 | QLabel *KPrefsWidFont::label() |
157 | { | 158 | { |
158 | return mLabel; | 159 | return mLabel; |
159 | } | 160 | } |
160 | 161 | ||
161 | QLabel *KPrefsWidFont::preview() | 162 | QLabel *KPrefsWidFont::preview() |
162 | { | 163 | { |
163 | return mPreview; | 164 | return mPreview; |
164 | } | 165 | } |
165 | 166 | ||
166 | QPushButton *KPrefsWidFont::button() | 167 | QPushButton *KPrefsWidFont::button() |
167 | { | 168 | { |
168 | return mButton; | 169 | return mButton; |
169 | } | 170 | } |
170 | 171 | ||
171 | void KPrefsWidFont::selectFont() | 172 | void KPrefsWidFont::selectFont() |
172 | { | 173 | { |
173 | QFont myFont(mPreview->font()); | 174 | QFont myFont(mPreview->font()); |
174 | bool ok; | 175 | bool ok; |
175 | myFont = KFontDialog::getFont(myFont, ok); | 176 | myFont = KFontDialog::getFont(myFont, ok); |
176 | if ( ok ) { | 177 | if ( ok ) { |
177 | mPreview->setFont(myFont); | 178 | mPreview->setFont(myFont); |
178 | emit modified(); | 179 | emit modified(); |
179 | } | 180 | } |
180 | } | 181 | } |
181 | 182 | ||
182 | 183 | ||
183 | KPrefsWidTime::KPrefsWidTime(const QString &text,int *reference, | 184 | KPrefsWidTime::KPrefsWidTime(const QString &text,int *reference, |
184 | QWidget *parent) | 185 | QWidget *parent) |
185 | { | 186 | { |
186 | mReference = reference; | 187 | mReference = reference; |
187 | 188 | ||
188 | mLabel = new QLabel(text,parent); | 189 | mLabel = new QLabel(text,parent); |
189 | mSpin = new QSpinBox(0,23,1,parent); | 190 | mSpin = new QSpinBox(0,23,1,parent); |
190 | mSpin->setSuffix(":00"); | 191 | mSpin->setSuffix(":00"); |
191 | connect( mSpin, SIGNAL( valueChanged(int)), SIGNAL( modified() ) ); | 192 | connect( mSpin, SIGNAL( valueChanged(int)), SIGNAL( modified() ) ); |
192 | 193 | ||
193 | } | 194 | } |
194 | 195 | ||
195 | void KPrefsWidTime::readConfig() | 196 | void KPrefsWidTime::readConfig() |
196 | { | 197 | { |
197 | mSpin->setValue(*mReference); | 198 | mSpin->setValue(*mReference); |
198 | } | 199 | } |
199 | 200 | ||
200 | void KPrefsWidTime::writeConfig() | 201 | void KPrefsWidTime::writeConfig() |
201 | { | 202 | { |
202 | *mReference = mSpin->value(); | 203 | *mReference = mSpin->value(); |
203 | } | 204 | } |
204 | 205 | ||
205 | QLabel *KPrefsWidTime::label() | 206 | QLabel *KPrefsWidTime::label() |
206 | { | 207 | { |
207 | return mLabel; | 208 | return mLabel; |
208 | } | 209 | } |
209 | 210 | ||
210 | QSpinBox *KPrefsWidTime::spinBox() | 211 | QSpinBox *KPrefsWidTime::spinBox() |
211 | { | 212 | { |
212 | return mSpin; | 213 | return mSpin; |
213 | } | 214 | } |
214 | 215 | ||
215 | 216 | ||
216 | KPrefsWidRadios::KPrefsWidRadios(const QString &text,int *reference, | 217 | KPrefsWidRadios::KPrefsWidRadios(const QString &text,int *reference, |
217 | QWidget *parent) | 218 | QWidget *parent) |
218 | { | 219 | { |
219 | mReference = reference; | 220 | mReference = reference; |
220 | 221 | ||
221 | mBox = new QButtonGroup(1,Qt::Horizontal,text,parent); | 222 | mBox = new Q3ButtonGroup(1,Qt::Horizontal,text,parent); |
222 | connect( mBox, SIGNAL( clicked(int)), SIGNAL( modified() ) ); | 223 | connect( mBox, SIGNAL( clicked(int)), SIGNAL( modified() ) ); |
223 | } | 224 | } |
224 | 225 | ||
225 | KPrefsWidRadios::~KPrefsWidRadios() | 226 | KPrefsWidRadios::~KPrefsWidRadios() |
226 | { | 227 | { |
227 | } | 228 | } |
228 | 229 | ||
229 | void KPrefsWidRadios::addRadio(const QString &text) | 230 | void KPrefsWidRadios::addRadio(const QString &text) |
230 | { | 231 | { |
231 | new QRadioButton(text,mBox); | 232 | new QRadioButton(text,mBox); |
232 | } | 233 | } |
233 | 234 | ||
234 | QButtonGroup *KPrefsWidRadios::groupBox() | 235 | Q3ButtonGroup *KPrefsWidRadios::groupBox() |
235 | { | 236 | { |
236 | return mBox; | 237 | return mBox; |
237 | } | 238 | } |
238 | 239 | ||
239 | void KPrefsWidRadios::readConfig() | 240 | void KPrefsWidRadios::readConfig() |
240 | { | 241 | { |
241 | mBox->setButton(*mReference); | 242 | mBox->setButton(*mReference); |
242 | } | 243 | } |
243 | 244 | ||
244 | void KPrefsWidRadios::writeConfig() | 245 | void KPrefsWidRadios::writeConfig() |
245 | { | 246 | { |
246 | *mReference = mBox->id(mBox->selected()); | 247 | *mReference = mBox->id(mBox->selected()); |
247 | } | 248 | } |
248 | 249 | ||
249 | 250 | ||
250 | KPrefsWidString::KPrefsWidString(const QString &text,QString *reference, | 251 | KPrefsWidString::KPrefsWidString(const QString &text,QString *reference, |
251 | QWidget *parent, QLineEdit::EchoMode echomode) | 252 | QWidget *parent, QLineEdit::EchoMode echomode) |
252 | { | 253 | { |
253 | mReference = reference; | 254 | mReference = reference; |
254 | 255 | ||
255 | mLabel = new QLabel(text,parent); | 256 | mLabel = new QLabel(text,parent); |
256 | mEdit = new QLineEdit(parent); | 257 | mEdit = new QLineEdit(parent); |
257 | mEdit->setEchoMode( echomode ); | 258 | mEdit->setEchoMode( echomode ); |
258 | connect( mEdit, SIGNAL( textChanged(const QString&) ), SIGNAL( modified() ) ); | 259 | connect( mEdit, SIGNAL( textChanged(const QString&) ), SIGNAL( modified() ) ); |
259 | 260 | ||
260 | } | 261 | } |
261 | 262 | ||
262 | KPrefsWidString::~KPrefsWidString() | 263 | KPrefsWidString::~KPrefsWidString() |
263 | { | 264 | { |
264 | } | 265 | } |
265 | 266 | ||
266 | void KPrefsWidString::readConfig() | 267 | void KPrefsWidString::readConfig() |
267 | { | 268 | { |
268 | mEdit->setText(*mReference); | 269 | mEdit->setText(*mReference); |
269 | } | 270 | } |
270 | 271 | ||
271 | void KPrefsWidString::writeConfig() | 272 | void KPrefsWidString::writeConfig() |
272 | { | 273 | { |
273 | *mReference = mEdit->text(); | 274 | *mReference = mEdit->text(); |
274 | } | 275 | } |
275 | 276 | ||
276 | QLabel *KPrefsWidString::label() | 277 | QLabel *KPrefsWidString::label() |
277 | { | 278 | { |
278 | return mLabel; | 279 | return mLabel; |
279 | } | 280 | } |
280 | 281 | ||
281 | QLineEdit *KPrefsWidString::lineEdit() | 282 | QLineEdit *KPrefsWidString::lineEdit() |
282 | { | 283 | { |
283 | return mEdit; | 284 | return mEdit; |
284 | } | 285 | } |
285 | 286 | ||
286 | 287 | ||
287 | KPrefsWidget::KPrefsWidget(KPrefs *prefs,QWidget *parent,const char *name) : | 288 | KPrefsWidget::KPrefsWidget(KPrefs *prefs,QWidget *parent,const char *name) : |
288 | QWidget(parent, name ) | 289 | QWidget(parent, name ) |
289 | { | 290 | { |
290 | mPrefs = prefs; | 291 | mPrefs = prefs; |
291 | mPrefsWids.setAutoDelete( true ); | 292 | mPrefsWids.setAutoDelete( true ); |
292 | } | 293 | } |
293 | 294 | ||
294 | KPrefsWidget::~KPrefsWidget() | 295 | KPrefsWidget::~KPrefsWidget() |
295 | { | 296 | { |
296 | } | 297 | } |
297 | 298 | ||
298 | void KPrefsWidget::addWid(KPrefsWid *wid) | 299 | void KPrefsWidget::addWid(KPrefsWid *wid) |
299 | { | 300 | { |
300 | mPrefsWids.append(wid); | 301 | mPrefsWids.append(wid); |
301 | connect( wid, SIGNAL( modified() ), this, SLOT( modified() ) ); | 302 | connect( wid, SIGNAL( modified() ), this, SLOT( modified() ) ); |
302 | 303 | ||
303 | } | 304 | } |
304 | 305 | ||
305 | KPrefsWidBool *KPrefsWidget::addWidBool(const QString &text,bool *reference,QWidget *parent) | 306 | KPrefsWidBool *KPrefsWidget::addWidBool(const QString &text,bool *reference,QWidget *parent) |
306 | { | 307 | { |
307 | KPrefsWidBool *w = new KPrefsWidBool(text,reference,parent); | 308 | KPrefsWidBool *w = new KPrefsWidBool(text,reference,parent); |
308 | addWid(w); | 309 | addWid(w); |
309 | return w; | 310 | return w; |
310 | } | 311 | } |
311 | 312 | ||
312 | KPrefsWidTime *KPrefsWidget::addWidTime(const QString &text,int *reference,QWidget *parent) | 313 | KPrefsWidTime *KPrefsWidget::addWidTime(const QString &text,int *reference,QWidget *parent) |
313 | { | 314 | { |
314 | KPrefsWidTime *w = new KPrefsWidTime(text,reference,parent); | 315 | KPrefsWidTime *w = new KPrefsWidTime(text,reference,parent); |
315 | addWid(w); | 316 | addWid(w); |
316 | return w; | 317 | return w; |
317 | } | 318 | } |
318 | 319 | ||
319 | KPrefsWidColor *KPrefsWidget::addWidColor(const QString &text,QColor *reference,QWidget *parent) | 320 | KPrefsWidColor *KPrefsWidget::addWidColor(const QString &text,QColor *reference,QWidget *parent) |
320 | { | 321 | { |
321 | KPrefsWidColor *w = new KPrefsWidColor(text,reference,parent); | 322 | KPrefsWidColor *w = new KPrefsWidColor(text,reference,parent); |
322 | addWid(w); | 323 | addWid(w); |
323 | return w; | 324 | return w; |
324 | } | 325 | } |
325 | 326 | ||
326 | KPrefsWidRadios *KPrefsWidget::addWidRadios(const QString &text,int *reference,QWidget *parent) | 327 | KPrefsWidRadios *KPrefsWidget::addWidRadios(const QString &text,int *reference,QWidget *parent) |
327 | { | 328 | { |
328 | KPrefsWidRadios *w = new KPrefsWidRadios(text,reference,parent); | 329 | KPrefsWidRadios *w = new KPrefsWidRadios(text,reference,parent); |
329 | addWid(w); | 330 | addWid(w); |
330 | return w; | 331 | return w; |
331 | } | 332 | } |
332 | 333 | ||
333 | KPrefsWidString *KPrefsWidget::addWidString(const QString &text,QString *reference,QWidget *parent) | 334 | KPrefsWidString *KPrefsWidget::addWidString(const QString &text,QString *reference,QWidget *parent) |
334 | { | 335 | { |
335 | KPrefsWidString *w = new KPrefsWidString(text,reference,parent); | 336 | KPrefsWidString *w = new KPrefsWidString(text,reference,parent); |
336 | addWid(w); | 337 | addWid(w); |
337 | return w; | 338 | return w; |
338 | } | 339 | } |
339 | 340 | ||
340 | KPrefsWidString *KPrefsWidget::addWidPassword(const QString &text,QString *reference,QWidget *parent) | 341 | KPrefsWidString *KPrefsWidget::addWidPassword(const QString &text,QString *reference,QWidget *parent) |
341 | { | 342 | { |
342 | KPrefsWidString *w = new KPrefsWidString(text,reference,parent,QLineEdit::Password); | 343 | KPrefsWidString *w = new KPrefsWidString(text,reference,parent,QLineEdit::Password); |
343 | addWid(w); | 344 | addWid(w); |
344 | return w; | 345 | return w; |
345 | } | 346 | } |
346 | 347 | ||
347 | KPrefsWidFont *KPrefsWidget::addWidFont(const QString &sampleText,const QString &buttonText, | 348 | KPrefsWidFont *KPrefsWidget::addWidFont(const QString &sampleText,const QString &buttonText, |
348 | QFont *reference,QWidget *parent) | 349 | QFont *reference,QWidget *parent) |
349 | { | 350 | { |
350 | KPrefsWidFont *w = new KPrefsWidFont(sampleText,buttonText,reference,parent); | 351 | KPrefsWidFont *w = new KPrefsWidFont(sampleText,buttonText,reference,parent); |
351 | addWid(w); | 352 | addWid(w); |
352 | return w; | 353 | return w; |
353 | } | 354 | } |
354 | 355 | ||
355 | void KPrefsWidget::setDefaults() | 356 | void KPrefsWidget::setDefaults() |
356 | { | 357 | { |
357 | mPrefs->setDefaults(); | 358 | mPrefs->setDefaults(); |
358 | 359 | ||
359 | readConfig(); | 360 | readConfig(); |
360 | } | 361 | } |
361 | 362 | ||
362 | void KPrefsWidget::readConfig() | 363 | void KPrefsWidget::readConfig() |
363 | { | 364 | { |
364 | // kdDebug(5300) << "KPrefsDialog::readConfig()" << endl; | 365 | // kdDebug(5300) << "KPrefsDialog::readConfig()" << endl; |
365 | 366 | ||
366 | KPrefsWid *wid; | 367 | KPrefsWid *wid; |
367 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { | 368 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { |
368 | wid->readConfig(); | 369 | wid->readConfig(); |
369 | } | 370 | } |
370 | 371 | ||
371 | usrReadConfig(); | 372 | usrReadConfig(); |
372 | 373 | ||
373 | emit changed( false ); | 374 | emit changed( false ); |
374 | 375 | ||
375 | } | 376 | } |
376 | 377 | ||
377 | void KPrefsWidget::writeConfig() | 378 | void KPrefsWidget::writeConfig() |
378 | { | 379 | { |
379 | // kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl; | 380 | // kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl; |
380 | 381 | ||
381 | KPrefsWid *wid; | 382 | KPrefsWid *wid; |
382 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { | 383 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { |
383 | wid->writeConfig(); | 384 | wid->writeConfig(); |
384 | } | 385 | } |
385 | 386 | ||
386 | usrWriteConfig(); | 387 | usrWriteConfig(); |
387 | 388 | ||
388 | // kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl; | 389 | // kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl; |
389 | 390 | ||
390 | mPrefs->writeConfig(); | 391 | mPrefs->writeConfig(); |
391 | 392 | ||
392 | emit changed( false ); | 393 | emit changed( false ); |
393 | 394 | ||
394 | // kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl; | 395 | // kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl; |
395 | } | 396 | } |
396 | 397 | ||
397 | /*US | 398 | /*US |
398 | void KPrefsWidget::slotApply() | 399 | void KPrefsWidget::slotApply() |
399 | { | 400 | { |
400 | writeConfig(); | 401 | writeConfig(); |
401 | emit configChanged(); | 402 | emit configChanged(); |
402 | } | 403 | } |
403 | 404 | ||
404 | void KPrefsDialog::slotOk() | 405 | void KPrefsDialog::slotOk() |
405 | { | 406 | { |
406 | slotApply(); | 407 | slotApply(); |
407 | QDialog::accept(); | 408 | QDialog::accept(); |
408 | } | 409 | } |
409 | void KPrefsDialog::accept() | 410 | void KPrefsDialog::accept() |
410 | { | 411 | { |
411 | slotOk(); | 412 | slotOk(); |
412 | } | 413 | } |
413 | 414 | ||
414 | void KPrefsDialog::slotDefault() | 415 | void KPrefsDialog::slotDefault() |
415 | { | 416 | { |
416 | if (KMessageBox::warningContinueCancel(this, | 417 | if (KMessageBox::warningContinueCancel(this, |
417 | i18n("You are about to set all\npreferences to default values.\nAll " | 418 | i18n("You are about to set all\npreferences to default values.\nAll " |
418 | "custom modifications will be lost."),i18n("Setting Default Preferences"), | 419 | "custom modifications will be lost."),i18n("Setting Default Preferences"), |
419 | i18n("Continue")) | 420 | i18n("Continue")) |
420 | == KMessageBox::Continue) setDefaults(); | 421 | == KMessageBox::Continue) setDefaults(); |
421 | } | 422 | } |
422 | */ | 423 | */ |
423 | 424 | ||
424 | void KPrefsWidget::modified() | 425 | void KPrefsWidget::modified() |
425 | { | 426 | { |
426 | emit changed( true ); | 427 | emit changed( true ); |
427 | } | 428 | } |
428 | 429 | ||