summaryrefslogtreecommitdiffabout
path: root/kaddressbook/views/configuretableviewdialog.cpp
Unidiff
Diffstat (limited to 'kaddressbook/views/configuretableviewdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/views/configuretableviewdialog.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/kaddressbook/views/configuretableviewdialog.cpp b/kaddressbook/views/configuretableviewdialog.cpp
index 8bcceb2..0e36abd 100644
--- a/kaddressbook/views/configuretableviewdialog.cpp
+++ b/kaddressbook/views/configuretableviewdialog.cpp
@@ -117,197 +117,201 @@ qDebug("LookAndFeelPage::restoreSettings make base color configurable");
117 117
118 c = colorGroup().background(); 118 c = colorGroup().background();
119 lbColors->insertItem( new ColorListItem( i18n("Background Color"), 119 lbColors->insertItem( new ColorListItem( i18n("Background Color"),
120 config->readColorEntry( "BackgroundColor", &c ) ) ); 120 config->readColorEntry( "BackgroundColor", &c ) ) );
121 c = colorGroup().foreground(); 121 c = colorGroup().foreground();
122 lbColors->insertItem( new ColorListItem( i18n("Text Color"), 122 lbColors->insertItem( new ColorListItem( i18n("Text Color"),
123 config->readColorEntry( "TextColor", &c ) ) ); 123 config->readColorEntry( "TextColor", &c ) ) );
124 c = colorGroup().button(); 124 c = colorGroup().button();
125 lbColors->insertItem( new ColorListItem( i18n("Header Background Color"), 125 lbColors->insertItem( new ColorListItem( i18n("Header Background Color"),
126 config->readColorEntry( "HeaderBackgroundColor", &c ) ) ); 126 config->readColorEntry( "HeaderBackgroundColor", &c ) ) );
127 c = colorGroup().buttonText(); 127 c = colorGroup().buttonText();
128 lbColors->insertItem( new ColorListItem( i18n("Header Text Color"), 128 lbColors->insertItem( new ColorListItem( i18n("Header Text Color"),
129 config->readColorEntry( "HeaderTextColor", &c ) ) ); 129 config->readColorEntry( "HeaderTextColor", &c ) ) );
130 c = colorGroup().highlight(); 130 c = colorGroup().highlight();
131 lbColors->insertItem( new ColorListItem( i18n("Highlight Color"), 131 lbColors->insertItem( new ColorListItem( i18n("Highlight Color"),
132 config->readColorEntry( "HighlightColor", &c ) ) ); 132 config->readColorEntry( "HighlightColor", &c ) ) );
133 c = colorGroup().highlightedText(); 133 c = colorGroup().highlightedText();
134 lbColors->insertItem( new ColorListItem( i18n("Highlighted Text Color"), 134 lbColors->insertItem( new ColorListItem( i18n("Highlighted Text Color"),
135 config->readColorEntry( "HighlightedTextColor", &c ) ) ); 135 config->readColorEntry( "HighlightedTextColor", &c ) ) );
136 c = colorGroup().background(); 136 c = colorGroup().background();
137 lbColors->insertItem( new ColorListItem( i18n("Alternating Background Color"), 137 lbColors->insertItem( new ColorListItem( i18n("Alternating Background Color"),
138 config->readColorEntry( "AlternatingBackgroundColor", &c ) ) ); 138 config->readColorEntry( "AlternatingBackgroundColor", &c ) ) );
139 139
140 enableColors(); 140 enableColors();
141 141
142 // fonts 142 // fonts
143 QFont fnt = font(); 143 QFont fnt = font();
144 updateFontLabel( config->readFontEntry( "TextFont", &fnt ), (QLabel*)lTextFont ); 144 updateFontLabel( config->readFontEntry( "TextFont", &fnt ), (QLabel*)lTextFont );
145 fnt.setBold( true ); 145 fnt.setBold( true );
146 updateFontLabel( config->readFontEntry( "HeaderFont", &fnt ), (QLabel*)lHeaderFont ); 146 updateFontLabel( config->readFontEntry( "HeaderFont", &fnt ), (QLabel*)lHeaderFont );
147 cbEnableCustomFonts->setChecked( config->readBoolEntry( "EnableCustomFonts", false ) ); 147 cbEnableCustomFonts->setChecked( config->readBoolEntry( "EnableCustomFonts", false ) );
148 enableFonts(); 148 enableFonts();
149 149
150} 150}
151 151
152void LookAndFeelPage::saveSettings( KConfig *config ) 152void LookAndFeelPage::saveSettings( KConfig *config )
153{ 153{
154 config->writeEntry("ABackground", mAlternateButton->isChecked()); 154 config->writeEntry("ABackground", mAlternateButton->isChecked());
155 config->writeEntry("SingleLine", mLineButton->isChecked()); 155 config->writeEntry("SingleLine", mLineButton->isChecked());
156 config->writeEntry("ToolTips", mToolTipBox->isChecked()); 156 config->writeEntry("ToolTips", mToolTipBox->isChecked());
157 config->writeEntry("Background", mBackgroundBox->isChecked()); 157 config->writeEntry("Background", mBackgroundBox->isChecked());
158 config->writeEntry("BackgroundName", mBackgroundName->lineEdit()->text()); 158 config->writeEntry("BackgroundName", mBackgroundName->lineEdit()->text());
159 159
160 // colors 160 // colors
161 config->writeEntry( "EnableCustomColors", cbEnableCustomColors->isChecked() ); 161 config->writeEntry( "EnableCustomColors", cbEnableCustomColors->isChecked() );
162 if ( cbEnableCustomColors->isChecked() ) // ?? - Hmmm. 162 if ( cbEnableCustomColors->isChecked() ) // ?? - Hmmm.
163 { 163 {
164 config->writeEntry( "BackgroundColor", lbColors->color( 0 ) ); 164 config->writeEntry( "BackgroundColor", lbColors->color( 0 ) );
165 config->writeEntry( "TextColor", lbColors->color( 1 ) ); 165 config->writeEntry( "TextColor", lbColors->color( 1 ) );
166 config->writeEntry( "HeaderBackgroundColor", lbColors->color( 2 ) ); 166 config->writeEntry( "HeaderBackgroundColor", lbColors->color( 2 ) );
167 config->writeEntry( "HeaderTextColor", lbColors->color( 3 ) ); 167 config->writeEntry( "HeaderTextColor", lbColors->color( 3 ) );
168 config->writeEntry( "HighlightColor", lbColors->color( 4 ) ); 168 config->writeEntry( "HighlightColor", lbColors->color( 4 ) );
169 config->writeEntry( "HighlightedTextColor", lbColors->color( 5 ) ); 169 config->writeEntry( "HighlightedTextColor", lbColors->color( 5 ) );
170 config->writeEntry( "AlternatingBackgroundColor", lbColors->color( 6 ) ); 170 config->writeEntry( "AlternatingBackgroundColor", lbColors->color( 6 ) );
171 } 171 }
172 // fonts 172 // fonts
173 config->writeEntry( "EnableCustomFonts", cbEnableCustomFonts->isChecked() ); 173 config->writeEntry( "EnableCustomFonts", cbEnableCustomFonts->isChecked() );
174 if ( cbEnableCustomFonts->isChecked() ) 174 if ( cbEnableCustomFonts->isChecked() )
175 { 175 {
176 config->writeEntry( "TextFont", lTextFont->font() ); 176 config->writeEntry( "TextFont", lTextFont->font() );
177 config->writeEntry( "HeaderFont", lHeaderFont->font() ); 177 config->writeEntry( "HeaderFont", lHeaderFont->font() );
178 } 178 }
179 179
180} 180}
181 181
182void LookAndFeelPage::setTextFont() 182void LookAndFeelPage::setTextFont()
183{ 183{
184 QFont f( lTextFont->font() ); 184 QFont f( lTextFont->font() );
185#ifndef KAB_EMBEDDED 185#ifndef KAB_EMBEDDED
186 if ( KFontDialog::getFont( f, false, this ) == QDialog::Accepted ) 186 if ( KFontDialog::getFont( f, false, this ) == QDialog::Accepted )
187 updateFontLabel( f, lTextFont ); 187 updateFontLabel( f, lTextFont );
188#else //KAB_EMBEDDED 188#else //KAB_EMBEDDED
189 bool ok; 189 bool ok;
190 QFont fout = KFontDialog::getFont( f, ok); 190 QFont fout = KFontDialog::getFont( f, ok);
191 if ( ok ) 191 if ( ok )
192 updateFontLabel( fout, lTextFont ); 192 updateFontLabel( fout, lTextFont );
193#endif //KAB_EMBEDDED 193#endif //KAB_EMBEDDED
194} 194}
195 195
196void LookAndFeelPage::setHeaderFont() 196void LookAndFeelPage::setHeaderFont()
197{ 197{
198 QFont f( lHeaderFont->font() ); 198 QFont f( lHeaderFont->font() );
199#ifndef KAB_EMBEDDED 199#ifndef KAB_EMBEDDED
200 if ( KFontDialog::getFont( f,false, this ) == QDialog::Accepted ) 200 if ( KFontDialog::getFont( f,false, this ) == QDialog::Accepted )
201 updateFontLabel( f, lHeaderFont ); 201 updateFontLabel( f, lHeaderFont );
202#else //KAB_EMBEDDED 202#else //KAB_EMBEDDED
203 bool ok; 203 bool ok;
204 QFont fout = KFontDialog::getFont( f, ok); 204 QFont fout = KFontDialog::getFont( f, ok);
205 if ( ok ) 205 if ( ok )
206 updateFontLabel( fout, lHeaderFont ); 206 updateFontLabel( fout, lHeaderFont );
207#endif //KAB_EMBEDDED 207#endif //KAB_EMBEDDED
208} 208}
209 209
210void LookAndFeelPage::enableFonts() 210void LookAndFeelPage::enableFonts()
211{ 211{
212 vbFonts->setEnabled( cbEnableCustomFonts->isChecked() ); 212 vbFonts->setEnabled( cbEnableCustomFonts->isChecked() );
213 if ( cbEnableCustomFonts->isChecked() )
214 vbFonts->setFocus();
213} 215}
214 216
215void LookAndFeelPage::enableColors() 217void LookAndFeelPage::enableColors()
216{ 218{
217 lbColors->setEnabled( cbEnableCustomColors->isChecked() ); 219 lbColors->setEnabled( cbEnableCustomColors->isChecked() );
220 if ( cbEnableCustomColors->isChecked() )
221 lbColors->setFocus();
218} 222}
219 223
220void LookAndFeelPage::initGUI() 224void LookAndFeelPage::initGUI()
221{ 225{
222 int spacing = KDialog::spacingHint(); 226 int spacing = KDialog::spacingHint();
223 int margin = KDialog::marginHint(); 227 int margin = KDialog::marginHint();
224 228
225 QTabWidget *tabs = new QTabWidget( this ); 229 QTabWidget *tabs = new QTabWidget( this );
226 230
227 // General 231 // General
228 QVBox *generalTab = new QVBox( this, "generaltab" ); 232 QVBox *generalTab = new QVBox( this, "generaltab" );
229 233
230 generalTab->setSpacing( spacing ); 234 generalTab->setSpacing( spacing );
231 generalTab->setMargin( margin ); 235 generalTab->setMargin( margin );
232 236
233 QButtonGroup *group = new QButtonGroup(1, Qt::Horizontal, 237 QButtonGroup *group = new QButtonGroup(1, Qt::Horizontal,
234 i18n("Row Separator"), generalTab); 238 i18n("Row Separator"), generalTab);
235 239
236 mAlternateButton = new QRadioButton(i18n("Alternating backgrounds"), 240 mAlternateButton = new QRadioButton(i18n("Alternating backgrounds"),
237 group, "mAlternateButton"); 241 group, "mAlternateButton");
238 mLineButton = new QRadioButton(i18n("Single line"), group, "mLineButton"); 242 mLineButton = new QRadioButton(i18n("Single line"), group, "mLineButton");
239 mNoneButton = new QRadioButton(i18n("None"), group, "mNoneButton"); 243 mNoneButton = new QRadioButton(i18n("None"), group, "mNoneButton");
240 244
241 mBackgroundBox = new QCheckBox(i18n("Enable background image:"), generalTab, 245 mBackgroundBox = new QCheckBox(i18n("Enable background image:"), generalTab,
242 "mBackgroundBox"); 246 "mBackgroundBox");
243 connect(mBackgroundBox, SIGNAL(toggled(bool)), 247 connect(mBackgroundBox, SIGNAL(toggled(bool)),
244 SLOT(enableBackgroundToggled(bool))); 248 SLOT(enableBackgroundToggled(bool)));
245 // LR image not implemented 249 // LR image not implemented
246 mBackgroundBox->setEnabled( false ); 250 mBackgroundBox->setEnabled( false );
247 mBackgroundName = new KURLRequester(generalTab, "mBackgroundName"); 251 mBackgroundName = new KURLRequester(generalTab, "mBackgroundName");
248#ifndef KAB_EMBEDDED 252#ifndef KAB_EMBEDDED
249 mBackgroundName->setMode(KFile::File | KFile::ExistingOnly | 253 mBackgroundName->setMode(KFile::File | KFile::ExistingOnly |
250 KFile::LocalOnly); 254 KFile::LocalOnly);
251 mBackgroundName->setFilter(KImageIO::pattern(KImageIO::Reading)); 255 mBackgroundName->setFilter(KImageIO::pattern(KImageIO::Reading));
252#endif //KAB_EMBEDDED 256#endif //KAB_EMBEDDED
253 257
254 // ToolTip Checkbox 258 // ToolTip Checkbox
255 mToolTipBox = new QCheckBox(i18n("Enable contact tooltips"), generalTab, 259 mToolTipBox = new QCheckBox(i18n("Enable contact tooltips"), generalTab,
256 "mToolTipBox"); 260 "mToolTipBox");
257 261
258 tabs->addTab( generalTab, i18n("&General") ); 262 tabs->addTab( generalTab, i18n("&General") );
259 263
260 // Colors 264 // Colors
261 QVBox *colorTab = new QVBox( this, "colortab" ); 265 QVBox *colorTab = new QVBox( this, "colortab" );
262 colorTab->setSpacing( spacing ); 266 colorTab->setSpacing( spacing );
263 colorTab->setMargin( spacing ); 267 colorTab->setMargin( spacing );
264 cbEnableCustomColors = new QCheckBox( i18n("&Enable custom Colors"), colorTab ); 268 cbEnableCustomColors = new QCheckBox( i18n("&Enable custom Colors"), colorTab );
265 connect( cbEnableCustomColors, SIGNAL(clicked()), this, SLOT(enableColors()) ); 269 connect( cbEnableCustomColors, SIGNAL(clicked()), this, SLOT(enableColors()) );
266 lbColors = new ColorListBox( colorTab ); 270 lbColors = new ColorListBox( colorTab );
267 tabs->addTab( colorTab, i18n("&Colors") ); 271 tabs->addTab( colorTab, i18n("&Colors") );
268 272
269 QWhatsThis::add( cbEnableCustomColors, i18n( 273 QWhatsThis::add( cbEnableCustomColors, i18n(
270 "If custom colors are enabled, you may choose the colors for the view below. " 274 "If custom colors are enabled, you may choose the colors for the view below. "
271 "Otherwise colors from your current KDE color scheme are used." 275 "Otherwise colors from your current KDE color scheme are used."
272 ) ); 276 ) );
273 QWhatsThis::add( lbColors, i18n( 277 QWhatsThis::add( lbColors, i18n(
274 "Double click or press RETURN on a item to select a color for the related strings in the view." 278 "Double click or press RETURN on a item to select a color for the related strings in the view."
275 ) ); 279 ) );
276 280
277 // Fonts 281 // Fonts
278 QVBox *fntTab = new QVBox( this, "fonttab" ); 282 QVBox *fntTab = new QVBox( this, "fonttab" );
279 283
280 fntTab->setSpacing( spacing ); 284 fntTab->setSpacing( spacing );
281 fntTab->setMargin( spacing ); 285 fntTab->setMargin( spacing );
282 286
283 cbEnableCustomFonts = new QCheckBox( i18n("&Enable custom fonts"), fntTab ); 287 cbEnableCustomFonts = new QCheckBox( i18n("&Enable custom fonts"), fntTab );
284 connect( cbEnableCustomFonts, SIGNAL(clicked()), this, SLOT(enableFonts()) ); 288 connect( cbEnableCustomFonts, SIGNAL(clicked()), this, SLOT(enableFonts()) );
285 289
286 vbFonts = new QWidget( fntTab ); 290 vbFonts = new QWidget( fntTab );
287 QGridLayout *gFnts = new QGridLayout( vbFonts, 2, 3 ); 291 QGridLayout *gFnts = new QGridLayout( vbFonts, 2, 3 );
288 gFnts->setSpacing( spacing ); 292 gFnts->setSpacing( spacing );
289 gFnts->setAutoAdd( true ); 293 gFnts->setAutoAdd( true );
290 gFnts->setColStretch( 1, 1 ); 294 gFnts->setColStretch( 1, 1 );
291 QLabel *lTFnt = new QLabel( i18n("&Text font:"), vbFonts ); 295 QLabel *lTFnt = new QLabel( i18n("&Text font:"), vbFonts );
292 lTextFont = new QLabel( vbFonts ); 296 lTextFont = new QLabel( vbFonts );
293 lTextFont->setFrameStyle( QFrame::Panel|QFrame::Sunken ); 297 lTextFont->setFrameStyle( QFrame::Panel|QFrame::Sunken );
294#ifndef KAB_EMBEDDED 298#ifndef KAB_EMBEDDED
295 btnFont = new KPushButton( i18n("Choose..."), vbFonts ); 299 btnFont = new KPushButton( i18n("Choose..."), vbFonts );
296#else //KAB_EMBEDDED 300#else //KAB_EMBEDDED
297 btnFont = new QPushButton( i18n("Choose..."), vbFonts ); 301 btnFont = new QPushButton( i18n("Choose..."), vbFonts );
298#endif //KAB_EMBEDDED 302#endif //KAB_EMBEDDED
299 303
300 lTFnt->setBuddy( btnFont ); 304 lTFnt->setBuddy( btnFont );
301 305
302 connect( btnFont, SIGNAL(clicked()), this, SLOT(setTextFont()) ); 306 connect( btnFont, SIGNAL(clicked()), this, SLOT(setTextFont()) );
303 307
304 QLabel *lHFnt = new QLabel( i18n("&Header font:"), vbFonts ); 308 QLabel *lHFnt = new QLabel( i18n("&Header font:"), vbFonts );
305 lHeaderFont = new QLabel( vbFonts ); 309 lHeaderFont = new QLabel( vbFonts );
306 lHeaderFont->setFrameStyle( QFrame::Panel|QFrame::Sunken ); 310 lHeaderFont->setFrameStyle( QFrame::Panel|QFrame::Sunken );
307#ifndef KAB_EMBEDDED 311#ifndef KAB_EMBEDDED
308 btnHeaderFont = new KPushButton( i18n("Choose..."), vbFonts ); 312 btnHeaderFont = new KPushButton( i18n("Choose..."), vbFonts );
309#else //KAB_EMBEDDED 313#else //KAB_EMBEDDED
310 btnHeaderFont = new QPushButton( i18n("Choose..."), vbFonts ); 314 btnHeaderFont = new QPushButton( i18n("Choose..."), vbFonts );
311#endif //KAB_EMBEDDED 315#endif //KAB_EMBEDDED
312 lHFnt->setBuddy( btnHeaderFont ); 316 lHFnt->setBuddy( btnHeaderFont );
313 connect( btnHeaderFont, SIGNAL(clicked()), this, SLOT(setHeaderFont()) ); 317 connect( btnHeaderFont, SIGNAL(clicked()), this, SLOT(setHeaderFont()) );