author | ulf69 <ulf69> | 2004-09-03 01:34:57 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-09-03 01:34:57 (UTC) |
commit | f6b72fd55671131cd81a3357940c9337ea5d7494 (patch) (side-by-side diff) | |
tree | 1075a46b4a7e24696eb7945e5f76bef552d75d88 /kaddressbook | |
parent | 7d5e6ab1868753f1f6a3b0831ba2e3c9d6ba411c (diff) | |
download | kdepimpi-f6b72fd55671131cd81a3357940c9337ea5d7494.zip kdepimpi-f6b72fd55671131cd81a3357940c9337ea5d7494.tar.gz kdepimpi-f6b72fd55671131cd81a3357940c9337ea5d7494.tar.bz2 |
sourceforge 1014886: first change to allow customized tableview
-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 @@ -124,4 +124,48 @@ 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. |