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