Diffstat (limited to 'kaddressbook/views/configurecardviewdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/views/configurecardviewdialog.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kaddressbook/views/configurecardviewdialog.cpp b/kaddressbook/views/configurecardviewdialog.cpp index 366e54c..e0fbd21 100644 --- a/kaddressbook/views/configurecardviewdialog.cpp +++ b/kaddressbook/views/configurecardviewdialog.cpp | |||
@@ -122,197 +122,201 @@ qDebug("CardViewLookNFeelPage::restoreSettings make base color configurable"); | |||
122 | config->readColorEntry( "HeaderColor", &c ) ) ); | 122 | config->readColorEntry( "HeaderColor", &c ) ) ); |
123 | c = colorGroup().buttonText(); | 123 | c = colorGroup().buttonText(); |
124 | lbColors->insertItem( new ColorListItem( i18n("Header Text Color"), | 124 | lbColors->insertItem( new ColorListItem( i18n("Header Text Color"), |
125 | config->readColorEntry( "HeaderTextColor", &c ) ) ); | 125 | config->readColorEntry( "HeaderTextColor", &c ) ) ); |
126 | c = colorGroup().highlight(); | 126 | c = colorGroup().highlight(); |
127 | lbColors->insertItem( new ColorListItem( i18n("Highlight Color"), | 127 | lbColors->insertItem( new ColorListItem( i18n("Highlight Color"), |
128 | config->readColorEntry( "HighlightColor", &c ) ) ); | 128 | config->readColorEntry( "HighlightColor", &c ) ) ); |
129 | c = colorGroup().highlightedText(); | 129 | c = colorGroup().highlightedText(); |
130 | lbColors->insertItem( new ColorListItem( i18n("Highlighted Text Color"), | 130 | lbColors->insertItem( new ColorListItem( i18n("Highlighted Text Color"), |
131 | config->readColorEntry( "HighlightedTextColor", &c ) ) ); | 131 | config->readColorEntry( "HighlightedTextColor", &c ) ) ); |
132 | 132 | ||
133 | enableColors(); | 133 | enableColors(); |
134 | 134 | ||
135 | // fonts | 135 | // fonts |
136 | QFont fnt = font(); | 136 | QFont fnt = font(); |
137 | updateFontLabel( config->readFontEntry( "TextFont", &fnt ), (QLabel*)lTextFont ); | 137 | updateFontLabel( config->readFontEntry( "TextFont", &fnt ), (QLabel*)lTextFont ); |
138 | fnt.setBold( true ); | 138 | fnt.setBold( true ); |
139 | updateFontLabel( config->readFontEntry( "HeaderFont", &fnt ), (QLabel*)lHeaderFont ); | 139 | updateFontLabel( config->readFontEntry( "HeaderFont", &fnt ), (QLabel*)lHeaderFont ); |
140 | cbEnableCustomFonts->setChecked( config->readBoolEntry( "EnableCustomFonts", false ) ); | 140 | cbEnableCustomFonts->setChecked( config->readBoolEntry( "EnableCustomFonts", false ) ); |
141 | enableFonts(); | 141 | enableFonts(); |
142 | 142 | ||
143 | // layout | 143 | // layout |
144 | sbMargin->setValue( config->readNumEntry( "ItemMargin", 0 ) ); | 144 | sbMargin->setValue( config->readNumEntry( "ItemMargin", 0 ) ); |
145 | sbSpacing->setValue( config->readNumEntry( "ItemSpacing", 10 ) ); | 145 | sbSpacing->setValue( config->readNumEntry( "ItemSpacing", 10 ) ); |
146 | sbSepWidth->setValue( config->readNumEntry( "SeparatorWidth", 2 ) ); | 146 | sbSepWidth->setValue( config->readNumEntry( "SeparatorWidth", 2 ) ); |
147 | cbDrawSeps->setChecked( config->readBoolEntry( "DrawSeparators", true ) ); | 147 | cbDrawSeps->setChecked( config->readBoolEntry( "DrawSeparators", true ) ); |
148 | cbDrawBorders->setChecked( config->readBoolEntry( "DrawBorder", true ) ); | 148 | cbDrawBorders->setChecked( config->readBoolEntry( "DrawBorder", true ) ); |
149 | 149 | ||
150 | // behaviour | 150 | // behaviour |
151 | cbShowFieldLabels->setChecked( config->readBoolEntry( "DrawFieldLabels", false ) ); | 151 | cbShowFieldLabels->setChecked( config->readBoolEntry( "DrawFieldLabels", false ) ); |
152 | cbShowEmptyFields->setChecked( config->readBoolEntry( "ShowEmptyFields", false ) ); | 152 | cbShowEmptyFields->setChecked( config->readBoolEntry( "ShowEmptyFields", false ) ); |
153 | } | 153 | } |
154 | 154 | ||
155 | void CardViewLookNFeelPage::saveSettings( KConfig *config ) | 155 | void CardViewLookNFeelPage::saveSettings( KConfig *config ) |
156 | { | 156 | { |
157 | // colors | 157 | // colors |
158 | config->writeEntry( "EnableCustomColors", cbEnableCustomColors->isChecked() ); | 158 | config->writeEntry( "EnableCustomColors", cbEnableCustomColors->isChecked() ); |
159 | if ( cbEnableCustomColors->isChecked() ) // ?? - Hmmm. | 159 | if ( cbEnableCustomColors->isChecked() ) // ?? - Hmmm. |
160 | { | 160 | { |
161 | config->writeEntry( "BackgroundColor", lbColors->color( 0 ) ); | 161 | config->writeEntry( "BackgroundColor", lbColors->color( 0 ) ); |
162 | config->writeEntry( "TextColor", lbColors->color( 1 ) ); | 162 | config->writeEntry( "TextColor", lbColors->color( 1 ) ); |
163 | config->writeEntry( "HeaderColor", lbColors->color( 2 ) ); | 163 | config->writeEntry( "HeaderColor", lbColors->color( 2 ) ); |
164 | config->writeEntry( "HeaderTextColor", lbColors->color( 3 ) ); | 164 | config->writeEntry( "HeaderTextColor", lbColors->color( 3 ) ); |
165 | config->writeEntry( "HighlightColor", lbColors->color( 4 ) ); | 165 | config->writeEntry( "HighlightColor", lbColors->color( 4 ) ); |
166 | config->writeEntry( "HighlightedTextColor", lbColors->color( 5 ) ); | 166 | config->writeEntry( "HighlightedTextColor", lbColors->color( 5 ) ); |
167 | } | 167 | } |
168 | // fonts | 168 | // fonts |
169 | config->writeEntry( "EnableCustomFonts", cbEnableCustomFonts->isChecked() ); | 169 | config->writeEntry( "EnableCustomFonts", cbEnableCustomFonts->isChecked() ); |
170 | if ( cbEnableCustomFonts->isChecked() ) | 170 | if ( cbEnableCustomFonts->isChecked() ) |
171 | { | 171 | { |
172 | config->writeEntry( "TextFont", lTextFont->font() ); | 172 | config->writeEntry( "TextFont", lTextFont->font() ); |
173 | config->writeEntry( "HeaderFont", lHeaderFont->font() ); | 173 | config->writeEntry( "HeaderFont", lHeaderFont->font() ); |
174 | } | 174 | } |
175 | // layout | 175 | // layout |
176 | config->writeEntry( "ItemMargin", sbMargin->value() ); | 176 | config->writeEntry( "ItemMargin", sbMargin->value() ); |
177 | config->writeEntry( "ItemSpacing", sbSpacing->value() ); | 177 | config->writeEntry( "ItemSpacing", sbSpacing->value() ); |
178 | config->writeEntry( "SeparatorWidth", sbSepWidth->value() ); | 178 | config->writeEntry( "SeparatorWidth", sbSepWidth->value() ); |
179 | config->writeEntry("DrawBorder", cbDrawBorders->isChecked()); | 179 | config->writeEntry("DrawBorder", cbDrawBorders->isChecked()); |
180 | config->writeEntry("DrawSeparators", cbDrawSeps->isChecked()); | 180 | config->writeEntry("DrawSeparators", cbDrawSeps->isChecked()); |
181 | 181 | ||
182 | // behaviour | 182 | // behaviour |
183 | config->writeEntry("DrawFieldLabels", cbShowFieldLabels->isChecked()); | 183 | config->writeEntry("DrawFieldLabels", cbShowFieldLabels->isChecked()); |
184 | config->writeEntry("ShowEmptyFields", cbShowEmptyFields->isChecked()); | 184 | config->writeEntry("ShowEmptyFields", cbShowEmptyFields->isChecked()); |
185 | } | 185 | } |
186 | 186 | ||
187 | void CardViewLookNFeelPage::setTextFont() | 187 | void CardViewLookNFeelPage::setTextFont() |
188 | { | 188 | { |
189 | QFont f( lTextFont->font() ); | 189 | QFont f( lTextFont->font() ); |
190 | #ifndef KAB_EMBEDDED | 190 | #ifndef KAB_EMBEDDED |
191 | if ( KFontDialog::getFont( f, false, this ) == QDialog::Accepted ) | 191 | if ( KFontDialog::getFont( f, false, this ) == QDialog::Accepted ) |
192 | updateFontLabel( f, lTextFont ); | 192 | updateFontLabel( f, lTextFont ); |
193 | #else //KAB_EMBEDDED | 193 | #else //KAB_EMBEDDED |
194 | bool ok; | 194 | bool ok; |
195 | QFont fout = KFontDialog::getFont( f, ok); | 195 | QFont fout = KFontDialog::getFont( f, ok); |
196 | if ( ok ) | 196 | if ( ok ) |
197 | updateFontLabel( fout, lTextFont ); | 197 | updateFontLabel( fout, lTextFont ); |
198 | #endif //KAB_EMBEDDED | 198 | #endif //KAB_EMBEDDED |
199 | } | 199 | } |
200 | 200 | ||
201 | void CardViewLookNFeelPage::setHeaderFont() | 201 | void CardViewLookNFeelPage::setHeaderFont() |
202 | { | 202 | { |
203 | QFont f( lHeaderFont->font() ); | 203 | QFont f( lHeaderFont->font() ); |
204 | #ifndef KAB_EMBEDDED | 204 | #ifndef KAB_EMBEDDED |
205 | if ( KFontDialog::getFont( f,false, this ) == QDialog::Accepted ) | 205 | if ( KFontDialog::getFont( f,false, this ) == QDialog::Accepted ) |
206 | updateFontLabel( f, lHeaderFont ); | 206 | updateFontLabel( f, lHeaderFont ); |
207 | #else //KAB_EMBEDDED | 207 | #else //KAB_EMBEDDED |
208 | bool ok; | 208 | bool ok; |
209 | QFont fout = KFontDialog::getFont( f, ok); | 209 | QFont fout = KFontDialog::getFont( f, ok); |
210 | if ( ok ) | 210 | if ( ok ) |
211 | updateFontLabel( fout, lHeaderFont ); | 211 | updateFontLabel( fout, lHeaderFont ); |
212 | #endif //KAB_EMBEDDED | 212 | #endif //KAB_EMBEDDED |
213 | } | 213 | } |
214 | 214 | ||
215 | void CardViewLookNFeelPage::enableFonts() | 215 | void CardViewLookNFeelPage::enableFonts() |
216 | { | 216 | { |
217 | vbFonts->setEnabled( cbEnableCustomFonts->isChecked() ); | 217 | vbFonts->setEnabled( cbEnableCustomFonts->isChecked() ); |
218 | if ( cbEnableCustomFonts->isChecked() ) | ||
219 | vbFonts->setFocus(); | ||
218 | } | 220 | } |
219 | 221 | ||
220 | void CardViewLookNFeelPage::enableColors() | 222 | void CardViewLookNFeelPage::enableColors() |
221 | { | 223 | { |
222 | lbColors->setEnabled( cbEnableCustomColors->isChecked() ); | 224 | lbColors->setEnabled( cbEnableCustomColors->isChecked() ); |
225 | if ( cbEnableCustomColors->isChecked() ) | ||
226 | lbColors->setFocus(); | ||
223 | } | 227 | } |
224 | 228 | ||
225 | void CardViewLookNFeelPage::initGUI() | 229 | void CardViewLookNFeelPage::initGUI() |
226 | { | 230 | { |
227 | int spacing = KDialog::spacingHint(); | 231 | int spacing = KDialog::spacingHint(); |
228 | int margin = KDialog::marginHint(); | 232 | int margin = KDialog::marginHint(); |
229 | 233 | ||
230 | QTabWidget *tabs = new QTabWidget( this ); | 234 | QTabWidget *tabs = new QTabWidget( this ); |
231 | 235 | ||
232 | // Layout | 236 | // Layout |
233 | QVBox *loTab = new QVBox( this, "layouttab" ); | 237 | QVBox *loTab = new QVBox( this, "layouttab" ); |
234 | 238 | ||
235 | loTab->setSpacing( spacing ); | 239 | loTab->setSpacing( spacing ); |
236 | loTab->setMargin( margin ); | 240 | loTab->setMargin( margin ); |
237 | 241 | ||
238 | QGroupBox *gbGeneral = new QGroupBox( 1, Qt::Horizontal, i18n("General"), loTab ); | 242 | QGroupBox *gbGeneral = new QGroupBox( 1, Qt::Horizontal, i18n("General"), loTab ); |
239 | 243 | ||
240 | cbDrawSeps = new QCheckBox( i18n("Draw &separators"), gbGeneral ); | 244 | cbDrawSeps = new QCheckBox( i18n("Draw &separators"), gbGeneral ); |
241 | 245 | ||
242 | QHBox *hbSW = new QHBox( gbGeneral ); | 246 | QHBox *hbSW = new QHBox( gbGeneral ); |
243 | QLabel *lSW = new QLabel( i18n("Separator &width:"), hbSW ); | 247 | QLabel *lSW = new QLabel( i18n("Separator &width:"), hbSW ); |
244 | sbSepWidth = new QSpinBox( 1, 50, 1, hbSW ); | 248 | sbSepWidth = new QSpinBox( 1, 50, 1, hbSW ); |
245 | lSW->setBuddy( sbSepWidth); | 249 | lSW->setBuddy( sbSepWidth); |
246 | 250 | ||
247 | QHBox *hbPadding = new QHBox( gbGeneral ); | 251 | QHBox *hbPadding = new QHBox( gbGeneral ); |
248 | QLabel *lSpacing = new QLabel( i18n("&Padding:"), hbPadding ); | 252 | QLabel *lSpacing = new QLabel( i18n("&Padding:"), hbPadding ); |
249 | sbSpacing = new QSpinBox( 0, 100, 1, hbPadding ); | 253 | sbSpacing = new QSpinBox( 0, 100, 1, hbPadding ); |
250 | lSpacing->setBuddy( sbSpacing ); | 254 | lSpacing->setBuddy( sbSpacing ); |
251 | 255 | ||
252 | QGroupBox *gbCards = new QGroupBox( 1, Qt::Horizontal, i18n("Cards"), loTab ); | 256 | QGroupBox *gbCards = new QGroupBox( 1, Qt::Horizontal, i18n("Cards"), loTab ); |
253 | 257 | ||
254 | QHBox *hbMargin = new QHBox( gbCards ); | 258 | QHBox *hbMargin = new QHBox( gbCards ); |
255 | QLabel *lMargin = new QLabel( i18n("&Margin:"), hbMargin ); | 259 | QLabel *lMargin = new QLabel( i18n("&Margin:"), hbMargin ); |
256 | sbMargin = new QSpinBox( 0, 100, 1, hbMargin ); | 260 | sbMargin = new QSpinBox( 0, 100, 1, hbMargin ); |
257 | lMargin->setBuddy( sbMargin ); | 261 | lMargin->setBuddy( sbMargin ); |
258 | 262 | ||
259 | cbDrawBorders = new QCheckBox( i18n("Draw &borders"), gbCards ); | 263 | cbDrawBorders = new QCheckBox( i18n("Draw &borders"), gbCards ); |
260 | 264 | ||
261 | loTab->setStretchFactor( new QWidget( loTab ), 1 ); | 265 | loTab->setStretchFactor( new QWidget( loTab ), 1 ); |
262 | 266 | ||
263 | QWhatsThis::add( sbMargin, i18n( | 267 | QWhatsThis::add( sbMargin, i18n( |
264 | "The item margin is the distance (in pixels) between the item edge and the item data. Most noticeably, " | 268 | "The item margin is the distance (in pixels) between the item edge and the item data. Most noticeably, " |
265 | "incrementing the item margin will add space between the focus rectangle and the item data." | 269 | "incrementing the item margin will add space between the focus rectangle and the item data." |
266 | ) ); | 270 | ) ); |
267 | QWhatsThis::add( lMargin, QWhatsThis::textFor( sbMargin ) ); | 271 | QWhatsThis::add( lMargin, QWhatsThis::textFor( sbMargin ) ); |
268 | QWhatsThis::add( sbSpacing, i18n( | 272 | QWhatsThis::add( sbSpacing, i18n( |
269 | "The Item Spacing decides the distance (in pixels) between the items and anything else: the view " | 273 | "The Item Spacing decides the distance (in pixels) between the items and anything else: the view " |
270 | "borders, other items or column separators." | 274 | "borders, other items or column separators." |
271 | ) ); | 275 | ) ); |
272 | QWhatsThis::add( lSpacing, QWhatsThis::textFor( sbSpacing ) ); | 276 | QWhatsThis::add( lSpacing, QWhatsThis::textFor( sbSpacing ) ); |
273 | QWhatsThis::add( sbSepWidth, i18n("Sets the width of column separators") ); | 277 | QWhatsThis::add( sbSepWidth, i18n("Sets the width of column separators") ); |
274 | QWhatsThis::add( lSW, QWhatsThis::textFor( sbSepWidth ) ); | 278 | QWhatsThis::add( lSW, QWhatsThis::textFor( sbSepWidth ) ); |
275 | 279 | ||
276 | tabs->addTab( loTab, i18n("&Layout") ); | 280 | tabs->addTab( loTab, i18n("&Layout") ); |
277 | 281 | ||
278 | // Colors | 282 | // Colors |
279 | QVBox *colorTab = new QVBox( this, "colortab" ); | 283 | QVBox *colorTab = new QVBox( this, "colortab" ); |
280 | colorTab->setSpacing( spacing ); | 284 | colorTab->setSpacing( spacing ); |
281 | colorTab->setMargin( spacing ); | 285 | colorTab->setMargin( spacing ); |
282 | cbEnableCustomColors = new QCheckBox( i18n("&Enable custom Colors"), colorTab ); | 286 | cbEnableCustomColors = new QCheckBox( i18n("&Enable custom Colors"), colorTab ); |
283 | connect( cbEnableCustomColors, SIGNAL(clicked()), this, SLOT(enableColors()) ); | 287 | connect( cbEnableCustomColors, SIGNAL(clicked()), this, SLOT(enableColors()) ); |
284 | lbColors = new ColorListBox( colorTab ); | 288 | lbColors = new ColorListBox( colorTab ); |
285 | tabs->addTab( colorTab, i18n("&Colors") ); | 289 | tabs->addTab( colorTab, i18n("&Colors") ); |
286 | 290 | ||
287 | QWhatsThis::add( cbEnableCustomColors, i18n( | 291 | QWhatsThis::add( cbEnableCustomColors, i18n( |
288 | "If custom colors are enabled, you may choose the colors for the view below. " | 292 | "If custom colors are enabled, you may choose the colors for the view below. " |
289 | "Otherwise colors from your current KDE color scheme are used." | 293 | "Otherwise colors from your current KDE color scheme are used." |
290 | ) ); | 294 | ) ); |
291 | QWhatsThis::add( lbColors, i18n( | 295 | QWhatsThis::add( lbColors, i18n( |
292 | "Double click or press RETURN on a item to select a color for the related strings in the view." | 296 | "Double click or press RETURN on a item to select a color for the related strings in the view." |
293 | ) ); | 297 | ) ); |
294 | 298 | ||
295 | // Fonts | 299 | // Fonts |
296 | QVBox *fntTab = new QVBox( this, "fonttab" ); | 300 | QVBox *fntTab = new QVBox( this, "fonttab" ); |
297 | 301 | ||
298 | fntTab->setSpacing( spacing ); | 302 | fntTab->setSpacing( spacing ); |
299 | fntTab->setMargin( spacing ); | 303 | fntTab->setMargin( spacing ); |
300 | 304 | ||
301 | cbEnableCustomFonts = new QCheckBox( i18n("&Enable custom fonts"), fntTab ); | 305 | cbEnableCustomFonts = new QCheckBox( i18n("&Enable custom fonts"), fntTab ); |
302 | connect( cbEnableCustomFonts, SIGNAL(clicked()), this, SLOT(enableFonts()) ); | 306 | connect( cbEnableCustomFonts, SIGNAL(clicked()), this, SLOT(enableFonts()) ); |
303 | 307 | ||
304 | vbFonts = new QWidget( fntTab ); | 308 | vbFonts = new QWidget( fntTab ); |
305 | QGridLayout *gFnts = new QGridLayout( vbFonts, 2, 3 ); | 309 | QGridLayout *gFnts = new QGridLayout( vbFonts, 2, 3 ); |
306 | gFnts->setSpacing( spacing ); | 310 | gFnts->setSpacing( spacing ); |
307 | gFnts->setAutoAdd( true ); | 311 | gFnts->setAutoAdd( true ); |
308 | gFnts->setColStretch( 1, 1 ); | 312 | gFnts->setColStretch( 1, 1 ); |
309 | QLabel *lTFnt = new QLabel( i18n("&Text font:"), vbFonts ); | 313 | QLabel *lTFnt = new QLabel( i18n("&Text font:"), vbFonts ); |
310 | lTextFont = new QLabel( vbFonts ); | 314 | lTextFont = new QLabel( vbFonts ); |
311 | lTextFont->setFrameStyle( QFrame::Panel|QFrame::Sunken ); | 315 | lTextFont->setFrameStyle( QFrame::Panel|QFrame::Sunken ); |
312 | #ifndef KAB_EMBEDDED | 316 | #ifndef KAB_EMBEDDED |
313 | btnFont = new KPushButton( i18n("Choose..."), vbFonts ); | 317 | btnFont = new KPushButton( i18n("Choose..."), vbFonts ); |
314 | #else //KAB_EMBEDDED | 318 | #else //KAB_EMBEDDED |
315 | btnFont = new QPushButton( i18n("Choose..."), vbFonts ); | 319 | btnFont = new QPushButton( i18n("Choose..."), vbFonts ); |
316 | #endif //KAB_EMBEDDED | 320 | #endif //KAB_EMBEDDED |
317 | 321 | ||
318 | lTFnt->setBuddy( btnFont ); | 322 | lTFnt->setBuddy( btnFont ); |