-rw-r--r-- | kaddressbook/views/configuretableviewdialog.cpp | 216 | ||||
-rw-r--r-- | kaddressbook/views/configuretableviewdialog.h | 21 |
2 files changed, 218 insertions, 19 deletions
diff --git a/kaddressbook/views/configuretableviewdialog.cpp b/kaddressbook/views/configuretableviewdialog.cpp index e1cc63e..cd09bcf 100644 --- a/kaddressbook/views/configuretableviewdialog.cpp +++ b/kaddressbook/views/configuretableviewdialog.cpp | |||
@@ -1,155 +1,339 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
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 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qwidget.h> | 25 | #include <qwidget.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlabel.h> | ||
27 | #include <qradiobutton.h> | 28 | #include <qradiobutton.h> |
28 | #include <qcheckbox.h> | 29 | #include <qcheckbox.h> |
29 | #include <qvbox.h> | 30 | #include <qvbox.h> |
30 | #include <qbuttongroup.h> | 31 | #include <qbuttongroup.h> |
32 | #include <qtabwidget.h> | ||
33 | #include <qwhatsthis.h> | ||
34 | #include <qpushbutton.h> | ||
31 | 35 | ||
32 | #include <kglobal.h> | 36 | #include <kglobal.h> |
33 | #include <klocale.h> | 37 | #include <klocale.h> |
34 | #include <klineedit.h> | 38 | #include <klineedit.h> |
35 | #include <kurlrequester.h> | 39 | #include <kurlrequester.h> |
36 | #include <kiconloader.h> | 40 | #include <kiconloader.h> |
41 | #include <kfontdialog.h> | ||
37 | 42 | ||
38 | #ifndef KAB_EMBEDDED | 43 | #ifndef KAB_EMBEDDED |
39 | #include <kimageio.h> | 44 | #include <kimageio.h> |
40 | #else //KAB_EMBEDDED | 45 | #else //KAB_EMBEDDED |
41 | #endif //KAB_EMBEDDED | 46 | #endif //KAB_EMBEDDED |
42 | 47 | ||
43 | #include <kconfig.h> | 48 | #include <kconfig.h> |
44 | 49 | ||
50 | #include "colorlistbox.h" | ||
51 | |||
45 | #include "configuretableviewdialog.h" | 52 | #include "configuretableviewdialog.h" |
46 | 53 | ||
47 | ConfigureTableViewWidget::ConfigureTableViewWidget( KABC::AddressBook *ab, | 54 | ConfigureTableViewWidget::ConfigureTableViewWidget( KABC::AddressBook *ab, |
48 | QWidget *parent, | 55 | QWidget *parent, |
49 | const char *name ) | 56 | const char *name ) |
50 | : ViewConfigureWidget( ab, parent, name ) | 57 | : ViewConfigureWidget( ab, parent, name ) |
51 | { | 58 | { |
52 | QWidget *page = addPage( i18n( "Look & Feel" ), QString::null, | 59 | QWidget *page = addPage( i18n( "Look & Feel" ), QString::null, |
53 | KGlobal::iconLoader()->loadIcon( "looknfeel", | 60 | KGlobal::iconLoader()->loadIcon( "looknfeel", |
54 | KIcon::Panel ) ); | 61 | KIcon::Panel ) ); |
55 | 62 | ||
56 | mPage = new LookAndFeelPage( page ); | 63 | mPage = new LookAndFeelPage( page ); |
57 | } | 64 | } |
58 | 65 | ||
59 | ConfigureTableViewWidget::~ConfigureTableViewWidget() | 66 | ConfigureTableViewWidget::~ConfigureTableViewWidget() |
60 | { | 67 | { |
61 | } | 68 | } |
62 | 69 | ||
63 | void ConfigureTableViewWidget::restoreSettings( KConfig *config ) | 70 | void ConfigureTableViewWidget::restoreSettings( KConfig *config ) |
64 | { | 71 | { |
65 | ViewConfigureWidget::restoreSettings( config ); | 72 | ViewConfigureWidget::restoreSettings( config ); |
66 | 73 | ||
67 | mPage->restoreSettings( config ); | 74 | mPage->restoreSettings( config ); |
68 | } | 75 | } |
69 | 76 | ||
70 | void ConfigureTableViewWidget::saveSettings( KConfig *config ) | 77 | void ConfigureTableViewWidget::saveSettings( KConfig *config ) |
71 | { | 78 | { |
72 | ViewConfigureWidget::saveSettings( config ); | 79 | ViewConfigureWidget::saveSettings( config ); |
73 | 80 | ||
74 | mPage->saveSettings( config ); | 81 | mPage->saveSettings( config ); |
75 | } | 82 | } |
76 | 83 | ||
77 | 84 | ||
78 | 85 | ||
79 | LookAndFeelPage::LookAndFeelPage(QWidget *parent, const char *name) | 86 | LookAndFeelPage::LookAndFeelPage(QWidget *parent, const char *name) |
80 | : QWidget(parent, name) | 87 | : QVBox(parent, name) |
81 | { | 88 | { |
82 | initGUI(); | 89 | initGUI(); |
83 | 90 | ||
84 | // Set initial state | 91 | // Set initial state |
85 | enableBackgroundToggled(mBackgroundBox->isChecked()); | 92 | enableBackgroundToggled(mBackgroundBox->isChecked()); |
86 | } | 93 | } |
87 | 94 | ||
88 | void LookAndFeelPage::restoreSettings( KConfig *config ) | 95 | void LookAndFeelPage::restoreSettings( KConfig *config ) |
89 | { | 96 | { |
90 | mAlternateButton->setChecked(config->readBoolEntry("ABackground", true)); | 97 | mAlternateButton->setChecked(config->readBoolEntry("ABackground", true)); |
91 | mLineButton->setChecked(config->readBoolEntry("SingleLine", false)); | 98 | mLineButton->setChecked(config->readBoolEntry("SingleLine", false)); |
92 | mToolTipBox->setChecked(config->readBoolEntry("ToolTips", true)); | 99 | mToolTipBox->setChecked(config->readBoolEntry("ToolTips", true)); |
93 | 100 | ||
94 | if (!mAlternateButton->isChecked() & !mLineButton->isChecked()) | 101 | if (!mAlternateButton->isChecked() & !mLineButton->isChecked()) |
95 | mNoneButton->setChecked(true); | 102 | mNoneButton->setChecked(true); |
96 | 103 | ||
97 | mBackgroundBox->setChecked(config->readBoolEntry("Background", false)); | 104 | mBackgroundBox->setChecked(config->readBoolEntry("Background", false)); |
98 | mBackgroundName->lineEdit()->setText(config->readEntry("BackgroundName")); | 105 | mBackgroundName->lineEdit()->setText(config->readEntry("BackgroundName")); |
106 | |||
107 | // colors | ||
108 | cbEnableCustomColors->setChecked( config->readBoolEntry( "EnableCustomColors", false ) ); | ||
109 | QColor c; | ||
110 | qDebug("LookAndFeelPage::restoreSettings make base color configurable"); | ||
111 | |||
112 | #ifndef KAB_EMBEDDED | ||
113 | c = KGlobalSettings::baseColor(); | ||
114 | #else //KAB_EMBEDDED | ||
115 | c = QColor(0,0,0); | ||
116 | #endif //KAB_EMBEDDED | ||
117 | |||
118 | lbColors->insertItem( new ColorListItem( i18n("Background Color"), | ||
119 | config->readColorEntry( "BackgroundColor", &c ) ) ); | ||
120 | c = colorGroup().foreground(); | ||
121 | lbColors->insertItem( new ColorListItem( i18n("Text Color"), | ||
122 | config->readColorEntry( "TextColor", &c ) ) ); | ||
123 | c = colorGroup().button(); | ||
124 | lbColors->insertItem( new ColorListItem( i18n("Header Background Color"), | ||
125 | config->readColorEntry( "HeaderBackgroundColor", &c ) ) ); | ||
126 | c = colorGroup().buttonText(); | ||
127 | lbColors->insertItem( new ColorListItem( i18n("Header Text Color"), | ||
128 | config->readColorEntry( "HeaderTextColor", &c ) ) ); | ||
129 | c = colorGroup().highlight(); | ||
130 | lbColors->insertItem( new ColorListItem( i18n("Highlight Color"), | ||
131 | config->readColorEntry( "HighlightColor", &c ) ) ); | ||
132 | c = colorGroup().highlightedText(); | ||
133 | lbColors->insertItem( new ColorListItem( i18n("Highlighted Text Color"), | ||
134 | config->readColorEntry( "HighlightedTextColor", &c ) ) ); | ||
135 | c = colorGroup().background(); | ||
136 | lbColors->insertItem( new ColorListItem( i18n("Alternating Background Color"), | ||
137 | config->readColorEntry( "AlternatingBackgroundColor", &c ) ) ); | ||
138 | |||
139 | enableColors(); | ||
140 | |||
141 | // fonts | ||
142 | QFont fnt = font(); | ||
143 | updateFontLabel( config->readFontEntry( "TextFont", &fnt ), (QLabel*)lTextFont ); | ||
144 | fnt.setBold( true ); | ||
145 | updateFontLabel( config->readFontEntry( "HeaderFont", &fnt ), (QLabel*)lHeaderFont ); | ||
146 | cbEnableCustomFonts->setChecked( config->readBoolEntry( "EnableCustomFonts", false ) ); | ||
147 | enableFonts(); | ||
148 | |||
99 | } | 149 | } |
100 | 150 | ||
101 | void LookAndFeelPage::saveSettings( KConfig *config ) | 151 | void LookAndFeelPage::saveSettings( KConfig *config ) |
102 | { | 152 | { |
103 | config->writeEntry("ABackground", mAlternateButton->isChecked()); | 153 | config->writeEntry("ABackground", mAlternateButton->isChecked()); |
104 | config->writeEntry("SingleLine", mLineButton->isChecked()); | 154 | config->writeEntry("SingleLine", mLineButton->isChecked()); |
105 | config->writeEntry("ToolTips", mToolTipBox->isChecked()); | 155 | config->writeEntry("ToolTips", mToolTipBox->isChecked()); |
106 | config->writeEntry("Background", mBackgroundBox->isChecked()); | 156 | config->writeEntry("Background", mBackgroundBox->isChecked()); |
107 | config->writeEntry("BackgroundName", mBackgroundName->lineEdit()->text()); | 157 | config->writeEntry("BackgroundName", mBackgroundName->lineEdit()->text()); |
158 | |||
159 | // colors | ||
160 | config->writeEntry( "EnableCustomColors", cbEnableCustomColors->isChecked() ); | ||
161 | if ( cbEnableCustomColors->isChecked() ) // ?? - Hmmm. | ||
162 | { | ||
163 | config->writeEntry( "BackgroundColor", lbColors->color( 0 ) ); | ||
164 | config->writeEntry( "TextColor", lbColors->color( 1 ) ); | ||
165 | config->writeEntry( "HeaderBackgroundColor", lbColors->color( 2 ) ); | ||
166 | config->writeEntry( "HeaderTextColor", lbColors->color( 3 ) ); | ||
167 | config->writeEntry( "HighlightColor", lbColors->color( 4 ) ); | ||
168 | config->writeEntry( "HighlightedTextColor", lbColors->color( 5 ) ); | ||
169 | config->writeEntry( "AlternatingBackgroundColor", lbColors->color( 6 ) ); | ||
170 | } | ||
171 | // fonts | ||
172 | config->writeEntry( "EnableCustomFonts", cbEnableCustomFonts->isChecked() ); | ||
173 | if ( cbEnableCustomFonts->isChecked() ) | ||
174 | { | ||
175 | config->writeEntry( "TextFont", lTextFont->font() ); | ||
176 | config->writeEntry( "HeaderFont", lHeaderFont->font() ); | ||
177 | } | ||
178 | |||
179 | } | ||
180 | |||
181 | void LookAndFeelPage::setTextFont() | ||
182 | { | ||
183 | QFont f( lTextFont->font() ); | ||
184 | #ifndef KAB_EMBEDDED | ||
185 | if ( KFontDialog::getFont( f, false, this ) == QDialog::Accepted ) | ||
186 | updateFontLabel( f, lTextFont ); | ||
187 | #else //KAB_EMBEDDED | ||
188 | bool ok; | ||
189 | QFont fout = KFontDialog::getFont( f, ok); | ||
190 | if ( ok ) | ||
191 | updateFontLabel( fout, lTextFont ); | ||
192 | #endif //KAB_EMBEDDED | ||
193 | } | ||
194 | |||
195 | void LookAndFeelPage::setHeaderFont() | ||
196 | { | ||
197 | QFont f( lHeaderFont->font() ); | ||
198 | #ifndef KAB_EMBEDDED | ||
199 | if ( KFontDialog::getFont( f,false, this ) == QDialog::Accepted ) | ||
200 | updateFontLabel( f, lHeaderFont ); | ||
201 | #else //KAB_EMBEDDED | ||
202 | bool ok; | ||
203 | QFont fout = KFontDialog::getFont( f, ok); | ||
204 | if ( ok ) | ||
205 | updateFontLabel( fout, lHeaderFont ); | ||
206 | #endif //KAB_EMBEDDED | ||
207 | } | ||
208 | |||
209 | void LookAndFeelPage::enableFonts() | ||
210 | { | ||
211 | vbFonts->setEnabled( cbEnableCustomFonts->isChecked() ); | ||
212 | } | ||
213 | |||
214 | void LookAndFeelPage::enableColors() | ||
215 | { | ||
216 | lbColors->setEnabled( cbEnableCustomColors->isChecked() ); | ||
108 | } | 217 | } |
109 | 218 | ||
110 | void LookAndFeelPage::initGUI() | 219 | void LookAndFeelPage::initGUI() |
111 | { | 220 | { |
112 | QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialogBase::spacingHint()); | 221 | int spacing = KDialog::spacingHint(); |
113 | 222 | int margin = KDialog::marginHint(); | |
223 | |||
224 | QTabWidget *tabs = new QTabWidget( this ); | ||
225 | |||
226 | // General | ||
227 | QVBox *generalTab = new QVBox( this, "generaltab" ); | ||
228 | |||
229 | generalTab->setSpacing( spacing ); | ||
230 | generalTab->setMargin( margin ); | ||
231 | |||
114 | QButtonGroup *group = new QButtonGroup(1, Qt::Horizontal, | 232 | QButtonGroup *group = new QButtonGroup(1, Qt::Horizontal, |
115 | i18n("Row Separator"), this); | 233 | i18n("Row Separator"), generalTab); |
116 | layout->addWidget(group); | ||
117 | 234 | ||
118 | mAlternateButton = new QRadioButton(i18n("Alternating backgrounds"), | 235 | mAlternateButton = new QRadioButton(i18n("Alternating backgrounds"), |
119 | group, "mAlternateButton"); | 236 | group, "mAlternateButton"); |
120 | mLineButton = new QRadioButton(i18n("Single line"), group, "mLineButton"); | 237 | mLineButton = new QRadioButton(i18n("Single line"), group, "mLineButton"); |
121 | mNoneButton = new QRadioButton(i18n("None"), group, "mNoneButton"); | 238 | mNoneButton = new QRadioButton(i18n("None"), group, "mNoneButton"); |
122 | 239 | ||
123 | // Background Checkbox/Selector | 240 | mBackgroundBox = new QCheckBox(i18n("Enable background image:"), generalTab, |
124 | QHBoxLayout *backgroundLayout = new QHBoxLayout(); | ||
125 | layout->addLayout(backgroundLayout); | ||
126 | |||
127 | mBackgroundBox = new QCheckBox(i18n("Enable background image:"), this, | ||
128 | "mBackgroundBox"); | 241 | "mBackgroundBox"); |
129 | connect(mBackgroundBox, SIGNAL(toggled(bool)), | 242 | connect(mBackgroundBox, SIGNAL(toggled(bool)), |
130 | SLOT(enableBackgroundToggled(bool))); | 243 | SLOT(enableBackgroundToggled(bool))); |
131 | backgroundLayout->addWidget(mBackgroundBox); | ||
132 | 244 | ||
133 | mBackgroundName = new KURLRequester(this, "mBackgroundName"); | 245 | mBackgroundName = new KURLRequester(generalTab, "mBackgroundName"); |
134 | #ifndef KAB_EMBEDDED | 246 | #ifndef KAB_EMBEDDED |
135 | mBackgroundName->setMode(KFile::File | KFile::ExistingOnly | | 247 | mBackgroundName->setMode(KFile::File | KFile::ExistingOnly | |
136 | KFile::LocalOnly); | 248 | KFile::LocalOnly); |
137 | mBackgroundName->setFilter(KImageIO::pattern(KImageIO::Reading)); | 249 | mBackgroundName->setFilter(KImageIO::pattern(KImageIO::Reading)); |
138 | #endif //KAB_EMBEDDED | 250 | #endif //KAB_EMBEDDED |
139 | 251 | ||
140 | backgroundLayout->addWidget(mBackgroundName); | ||
141 | |||
142 | // ToolTip Checkbox | 252 | // ToolTip Checkbox |
143 | mToolTipBox = new QCheckBox(i18n("Enable contact tooltips"), this, | 253 | mToolTipBox = new QCheckBox(i18n("Enable contact tooltips"), generalTab, |
144 | "mToolTipBox"); | 254 | "mToolTipBox"); |
145 | layout->addWidget(mToolTipBox); | 255 | |
256 | tabs->addTab( generalTab, i18n("&General") ); | ||
257 | |||
258 | // Colors | ||
259 | QVBox *colorTab = new QVBox( this, "colortab" ); | ||
260 | colorTab->setSpacing( spacing ); | ||
261 | colorTab->setMargin( spacing ); | ||
262 | cbEnableCustomColors = new QCheckBox( i18n("&Enable custom Colors"), colorTab ); | ||
263 | connect( cbEnableCustomColors, SIGNAL(clicked()), this, SLOT(enableColors()) ); | ||
264 | lbColors = new ColorListBox( colorTab ); | ||
265 | tabs->addTab( colorTab, i18n("&Colors") ); | ||
266 | |||
267 | QWhatsThis::add( cbEnableCustomColors, i18n( | ||
268 | "If custom colors are enabled, you may choose the colors for the view below. " | ||
269 | "Otherwise colors from your current KDE color scheme are used." | ||
270 | ) ); | ||
271 | QWhatsThis::add( lbColors, i18n( | ||
272 | "Double click or press RETURN on a item to select a color for the related strings in the view." | ||
273 | ) ); | ||
274 | |||
275 | // Fonts | ||
276 | QVBox *fntTab = new QVBox( this, "fonttab" ); | ||
277 | |||
278 | fntTab->setSpacing( spacing ); | ||
279 | fntTab->setMargin( spacing ); | ||
280 | |||
281 | cbEnableCustomFonts = new QCheckBox( i18n("&Enable custom fonts"), fntTab ); | ||
282 | connect( cbEnableCustomFonts, SIGNAL(clicked()), this, SLOT(enableFonts()) ); | ||
283 | |||
284 | vbFonts = new QWidget( fntTab ); | ||
285 | QGridLayout *gFnts = new QGridLayout( vbFonts, 2, 3 ); | ||
286 | gFnts->setSpacing( spacing ); | ||
287 | gFnts->setAutoAdd( true ); | ||
288 | gFnts->setColStretch( 1, 1 ); | ||
289 | QLabel *lTFnt = new QLabel( i18n("&Text font:"), vbFonts ); | ||
290 | lTextFont = new QLabel( vbFonts ); | ||
291 | lTextFont->setFrameStyle( QFrame::Panel|QFrame::Sunken ); | ||
292 | #ifndef KAB_EMBEDDED | ||
293 | btnFont = new KPushButton( i18n("Choose..."), vbFonts ); | ||
294 | #else //KAB_EMBEDDED | ||
295 | btnFont = new QPushButton( i18n("Choose..."), vbFonts ); | ||
296 | #endif //KAB_EMBEDDED | ||
297 | |||
298 | lTFnt->setBuddy( btnFont ); | ||
299 | |||
300 | connect( btnFont, SIGNAL(clicked()), this, SLOT(setTextFont()) ); | ||
301 | |||
302 | QLabel *lHFnt = new QLabel( i18n("&Header font:"), vbFonts ); | ||
303 | lHeaderFont = new QLabel( vbFonts ); | ||
304 | lHeaderFont->setFrameStyle( QFrame::Panel|QFrame::Sunken ); | ||
305 | #ifndef KAB_EMBEDDED | ||
306 | btnHeaderFont = new KPushButton( i18n("Choose..."), vbFonts ); | ||
307 | #else //KAB_EMBEDDED | ||
308 | btnHeaderFont = new QPushButton( i18n("Choose..."), vbFonts ); | ||
309 | #endif //KAB_EMBEDDED | ||
310 | lHFnt->setBuddy( btnHeaderFont ); | ||
311 | connect( btnHeaderFont, SIGNAL(clicked()), this, SLOT(setHeaderFont()) ); | ||
312 | |||
313 | fntTab->setStretchFactor( new QWidget( fntTab ), 1 ); | ||
314 | |||
315 | QWhatsThis::add( cbEnableCustomFonts, i18n( | ||
316 | "If custom fonts are enabled, you may choose which fonts to use for this view below. " | ||
317 | "Otherwise the default KDE font will be used, in bold style for the header and " | ||
318 | "normal style for the data." | ||
319 | ) ); | ||
320 | |||
321 | tabs->addTab( fntTab, i18n("&Fonts") ); | ||
322 | |||
146 | } | 323 | } |
147 | 324 | ||
148 | void LookAndFeelPage::enableBackgroundToggled(bool enabled) | 325 | void LookAndFeelPage::enableBackgroundToggled(bool enabled) |
149 | { | 326 | { |
150 | mBackgroundName->setEnabled(enabled); | 327 | mBackgroundName->setEnabled(enabled); |
151 | } | 328 | } |
152 | 329 | ||
330 | |||
331 | void LookAndFeelPage::updateFontLabel( QFont fnt, QLabel *l ) | ||
332 | { | ||
333 | l->setFont( fnt ); | ||
334 | l->setText( QString( fnt.family() + " %1" ).arg( fnt.pointSize() ) ); | ||
335 | } | ||
336 | |||
153 | #ifndef KAB_EMBEDDED | 337 | #ifndef KAB_EMBEDDED |
154 | #include "configuretableviewdialog.moc" | 338 | #include "configuretableviewdialog.moc" |
155 | #endif //KAB_EMBEDDED | 339 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/configuretableviewdialog.h b/kaddressbook/views/configuretableviewdialog.h index 8392710..003ccf8 100644 --- a/kaddressbook/views/configuretableviewdialog.h +++ b/kaddressbook/views/configuretableviewdialog.h | |||
@@ -1,88 +1,103 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
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 | #ifndef CONFIGURETABLEVIEWDIALOG_H | 24 | #ifndef CONFIGURETABLEVIEWDIALOG_H |
25 | #define CONFIGURETABLEVIEWDIALOG_H | 25 | #define CONFIGURETABLEVIEWDIALOG_H |
26 | 26 | ||
27 | #include "viewconfigurewidget.h" | 27 | #include "viewconfigurewidget.h" |
28 | 28 | ||
29 | #include <qvbox.h> | ||
30 | |||
29 | class QString; | 31 | class QString; |
30 | class QWidget; | 32 | class QWidget; |
31 | class QRadioButton; | 33 | class QRadioButton; |
32 | class QCheckBox; | 34 | class QCheckBox; |
33 | class KURLRequester; | 35 | class KURLRequester; |
34 | class KConfig; | 36 | class KConfig; |
37 | class QLabel; | ||
35 | 38 | ||
36 | namespace KABC { class AddressBook; } | 39 | namespace KABC { class AddressBook; } |
37 | 40 | ||
38 | class LookAndFeelPage; | 41 | class LookAndFeelPage; |
39 | 42 | ||
40 | /** | 43 | /** |
41 | Configure dialog for the table view. This dialog inherits from the | 44 | Configure dialog for the table view. This dialog inherits from the |
42 | standard view dialog in order to add a custom page for the table | 45 | standard view dialog in order to add a custom page for the table |
43 | view. | 46 | view. |
44 | */ | 47 | */ |
45 | class ConfigureTableViewWidget : public ViewConfigureWidget | 48 | class ConfigureTableViewWidget : public ViewConfigureWidget |
46 | { | 49 | { |
47 | public: | 50 | public: |
48 | ConfigureTableViewWidget( KABC::AddressBook *ab, QWidget *parent, const char *name ); | 51 | ConfigureTableViewWidget( KABC::AddressBook *ab, QWidget *parent, const char *name ); |
49 | virtual ~ConfigureTableViewWidget(); | 52 | virtual ~ConfigureTableViewWidget(); |
50 | 53 | ||
51 | virtual void restoreSettings( KConfig* ); | 54 | virtual void restoreSettings( KConfig* ); |
52 | virtual void saveSettings( KConfig* ); | 55 | virtual void saveSettings( KConfig* ); |
53 | 56 | ||
54 | private: | 57 | private: |
55 | void initGUI(); | 58 | void initGUI(); |
56 | 59 | ||
57 | LookAndFeelPage *mPage; | 60 | LookAndFeelPage *mPage; |
58 | }; | 61 | }; |
59 | 62 | ||
60 | /** | 63 | /** |
61 | Internal class. It is only defined here for moc | 64 | Internal class. It is only defined here for moc |
62 | */ | 65 | */ |
63 | class LookAndFeelPage : public QWidget | 66 | class LookAndFeelPage : public QVBox |
64 | { | 67 | { |
65 | Q_OBJECT | 68 | Q_OBJECT |
66 | 69 | ||
67 | public: | 70 | public: |
68 | LookAndFeelPage( QWidget *parent, const char *name = 0 ); | 71 | LookAndFeelPage( QWidget *parent, const char *name = 0 ); |
69 | ~LookAndFeelPage() {} | 72 | ~LookAndFeelPage() {} |
70 | 73 | ||
71 | void restoreSettings( KConfig* ); | 74 | void restoreSettings( KConfig* ); |
72 | void saveSettings( KConfig* ); | 75 | void saveSettings( KConfig* ); |
73 | 76 | ||
74 | protected slots: | 77 | protected slots: |
75 | void enableBackgroundToggled( bool ); | 78 | void enableBackgroundToggled( bool ); |
76 | 79 | void setTextFont(); | |
80 | void setHeaderFont(); | ||
81 | void enableFonts(); | ||
82 | void enableColors(); | ||
83 | |||
77 | private: | 84 | private: |
78 | void initGUI(); | 85 | void initGUI(); |
79 | 86 | void updateFontLabel( QFont, QLabel * ); | |
87 | |||
88 | QCheckBox *cbEnableCustomFonts, | ||
89 | *cbEnableCustomColors; | ||
90 | class ColorListBox *lbColors; | ||
91 | QLabel *lTextFont, *lHeaderFont; | ||
92 | class QPushButton *btnFont, *btnHeaderFont; | ||
93 | class QWidget* vbFonts; | ||
94 | |||
80 | QRadioButton *mAlternateButton; | 95 | QRadioButton *mAlternateButton; |
81 | QRadioButton *mLineButton; | 96 | QRadioButton *mLineButton; |
82 | QRadioButton *mNoneButton; | 97 | QRadioButton *mNoneButton; |
83 | QCheckBox *mToolTipBox; | 98 | QCheckBox *mToolTipBox; |
84 | KURLRequester *mBackgroundName; | 99 | KURLRequester *mBackgroundName; |
85 | QCheckBox *mBackgroundBox; | 100 | QCheckBox *mBackgroundBox; |
86 | }; | 101 | }; |
87 | 102 | ||
88 | #endif | 103 | #endif |