-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 8d2203e..66a3f0b 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp @@ -120,12 +120,56 @@ void KAddressBookTableView::writeConfig(KConfig *config) } void KAddressBookTableView::readConfig(KConfig *config) { KAddressBookView::readConfig( config ); + // costum colors? + if ( config->readBoolEntry( "EnableCustomColors", false ) ) + { + QPalette p( mListView->palette() ); + QColor c = p.color(QPalette::Normal, QColorGroup::Base ); + p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); + c = p.color(QPalette::Normal, QColorGroup::Text ); + p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); + c = p.color(QPalette::Normal, QColorGroup::Button ); + p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); + c = p.color(QPalette::Normal, QColorGroup::ButtonText ); + p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); + c = p.color(QPalette::Normal, QColorGroup::Highlight ); + p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); + c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); + p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); + c = p.color(QPalette::Normal, QColorGroup::Base ); + p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "AlternatingBackgroundColor", &c ) ); + mListView->viewport()->setPalette( p ); + } + else + { + // needed if turned off during a session. + mListView->viewport()->setPalette( mListView->palette() ); + } + + //custom fonts? + QFont f( font() ); + if ( config->readBoolEntry( "EnableCustomFonts", false ) ) + { + // mListView->setFont( config->readFontEntry( "TextFont", &f) ); + f.setBold( true ); + // mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); + } + else + { + // mListView->setFont( f ); + f.setBold( true ); + // mListView->setHeaderFont( f ); + } + + + + // The config could have changed the fields, so we need to reconstruct // the listview. reconstructListView(); // Set the list view options mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground", |