-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 3a39ea9..205c526 100644 --- a/libkdepim/kprefsdialog.cpp +++ b/libkdepim/kprefsdialog.cpp | |||
@@ -1,250 +1,250 @@ | |||
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 <kfontdialog.h> | 50 | #include <kfontdialog.h> |
51 | #include <kmessagebox.h> | 51 | #include <kmessagebox.h> |
52 | #include <kcolordialog.h> | 52 | #include <kcolordialog.h> |
53 | #include <kiconloader.h> | 53 | #include <kiconloader.h> |
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 | ||
60 | KPrefsWidBool::KPrefsWidBool(const QString &text,bool *reference, | 60 | KPrefsWidBool::KPrefsWidBool(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 | ||
68 | void KPrefsWidBool::readConfig() | 68 | void KPrefsWidBool::readConfig() |
69 | { | 69 | { |
70 | mCheck->setChecked(*mReference); | 70 | mCheck->setChecked(*mReference); |
71 | } | 71 | } |
72 | 72 | ||
73 | void KPrefsWidBool::writeConfig() | 73 | void KPrefsWidBool::writeConfig() |
74 | { | 74 | { |
75 | *mReference = mCheck->isChecked(); | 75 | *mReference = mCheck->isChecked(); |
76 | } | 76 | } |
77 | 77 | ||
78 | QCheckBox *KPrefsWidBool::checkBox() | 78 | QCheckBox *KPrefsWidBool::checkBox() |
79 | { | 79 | { |
80 | return mCheck; | 80 | return mCheck; |
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | KPrefsWidColor::KPrefsWidColor(const QString &text,QColor *reference, | 84 | KPrefsWidColor::KPrefsWidColor(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 | ||
96 | KPrefsWidColor::~KPrefsWidColor() | 96 | KPrefsWidColor::~KPrefsWidColor() |
97 | { | 97 | { |
98 | // kdDebug(5300) << "KPrefsWidColor::~KPrefsWidColor()" << endl; | 98 | // kdDebug(5300) << "KPrefsWidColor::~KPrefsWidColor()" << endl; |
99 | } | 99 | } |
100 | 100 | ||
101 | void KPrefsWidColor::readConfig() | 101 | void KPrefsWidColor::readConfig() |
102 | { | 102 | { |
103 | mButton->setColor(*mReference); | 103 | mButton->setColor(*mReference); |
104 | } | 104 | } |
105 | 105 | ||
106 | void KPrefsWidColor::writeConfig() | 106 | void KPrefsWidColor::writeConfig() |
107 | { | 107 | { |
108 | *mReference = mButton->color(); | 108 | *mReference = mButton->color(); |
109 | } | 109 | } |
110 | 110 | ||
111 | QLabel *KPrefsWidColor::label() | 111 | QLabel *KPrefsWidColor::label() |
112 | { | 112 | { |
113 | return mLabel; | 113 | return mLabel; |
114 | } | 114 | } |
115 | 115 | ||
116 | KColorButton *KPrefsWidColor::button() | 116 | KColorButton *KPrefsWidColor::button() |
117 | { | 117 | { |
118 | return mButton; | 118 | return mButton; |
119 | } | 119 | } |
120 | 120 | ||
121 | KPrefsWidFont::KPrefsWidFont(const QString &sampleText,const QString &labelText, | 121 | KPrefsWidFont::KPrefsWidFont(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 | ||
128 | mPreview = new QLabel(sampleText,parent); | 128 | mPreview = new QLabel(sampleText,parent); |
129 | mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 129 | mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
130 | 130 | ||
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 | ||
137 | KPrefsWidFont::~KPrefsWidFont() | 137 | KPrefsWidFont::~KPrefsWidFont() |
138 | { | 138 | { |
139 | } | 139 | } |
140 | 140 | ||
141 | void KPrefsWidFont::readConfig() | 141 | void KPrefsWidFont::readConfig() |
142 | { | 142 | { |
143 | mPreview->setFont(*mReference); | 143 | mPreview->setFont(*mReference); |
144 | } | 144 | } |
145 | 145 | ||
146 | void KPrefsWidFont::writeConfig() | 146 | void KPrefsWidFont::writeConfig() |
147 | { | 147 | { |
148 | *mReference = mPreview->font(); | 148 | *mReference = mPreview->font(); |
149 | } | 149 | } |
150 | 150 | ||
151 | QLabel *KPrefsWidFont::label() | 151 | QLabel *KPrefsWidFont::label() |
152 | { | 152 | { |
153 | return mLabel; | 153 | return mLabel; |
154 | } | 154 | } |
155 | 155 | ||
156 | QLabel *KPrefsWidFont::preview() | 156 | QLabel *KPrefsWidFont::preview() |
157 | { | 157 | { |
158 | return mPreview; | 158 | return mPreview; |
159 | } | 159 | } |
160 | 160 | ||
161 | QPushButton *KPrefsWidFont::button() | 161 | QPushButton *KPrefsWidFont::button() |
162 | { | 162 | { |
163 | return mButton; | 163 | return mButton; |
164 | } | 164 | } |
165 | 165 | ||
166 | void KPrefsWidFont::selectFont() | 166 | void KPrefsWidFont::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 | KPrefsWidTime::KPrefsWidTime(const QString &text,int *reference, | 177 | KPrefsWidTime::KPrefsWidTime(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 KPrefsWidTime::readConfig() | 187 | void KPrefsWidTime::readConfig() |
188 | { | 188 | { |
189 | mSpin->setValue(*mReference); | 189 | mSpin->setValue(*mReference); |
190 | } | 190 | } |
191 | 191 | ||
192 | void KPrefsWidTime::writeConfig() | 192 | void KPrefsWidTime::writeConfig() |
193 | { | 193 | { |
194 | *mReference = mSpin->value(); | 194 | *mReference = mSpin->value(); |
195 | } | 195 | } |
196 | 196 | ||
197 | QLabel *KPrefsWidTime::label() | 197 | QLabel *KPrefsWidTime::label() |
198 | { | 198 | { |
199 | return mLabel; | 199 | return mLabel; |
200 | } | 200 | } |
201 | 201 | ||
202 | QSpinBox *KPrefsWidTime::spinBox() | 202 | QSpinBox *KPrefsWidTime::spinBox() |
203 | { | 203 | { |
204 | return mSpin; | 204 | return mSpin; |
205 | } | 205 | } |
206 | 206 | ||
207 | 207 | ||
208 | KPrefsWidRadios::KPrefsWidRadios(const QString &text,int *reference, | 208 | KPrefsWidRadios::KPrefsWidRadios(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 | KPrefsWidRadios::~KPrefsWidRadios() | 216 | KPrefsWidRadios::~KPrefsWidRadios() |
217 | { | 217 | { |
218 | } | 218 | } |
219 | 219 | ||
220 | void KPrefsWidRadios::addRadio(const QString &text) | 220 | void KPrefsWidRadios::addRadio(const QString &text) |
221 | { | 221 | { |
222 | new QRadioButton(text,mBox); | 222 | new QRadioButton(text,mBox); |
223 | } | 223 | } |
224 | 224 | ||
225 | QButtonGroup *KPrefsWidRadios::groupBox() | 225 | QButtonGroup *KPrefsWidRadios::groupBox() |
226 | { | 226 | { |
227 | return mBox; | 227 | return mBox; |
228 | } | 228 | } |
229 | 229 | ||
230 | void KPrefsWidRadios::readConfig() | 230 | void KPrefsWidRadios::readConfig() |
231 | { | 231 | { |
232 | mBox->setButton(*mReference); | 232 | mBox->setButton(*mReference); |
233 | } | 233 | } |
234 | 234 | ||
235 | void KPrefsWidRadios::writeConfig() | 235 | void KPrefsWidRadios::writeConfig() |
236 | { | 236 | { |
237 | *mReference = mBox->id(mBox->selected()); | 237 | *mReference = mBox->id(mBox->selected()); |
238 | } | 238 | } |
239 | 239 | ||
240 | 240 | ||
241 | KPrefsWidString::KPrefsWidString(const QString &text,QString *reference, | 241 | KPrefsWidString::KPrefsWidString(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 | ||