From 72860f2b84ba97de9223238d9fb97edc0804cc68 Mon Sep 17 00:00:00 2001 From: ulf69 Date: Thu, 09 Sep 2004 18:55:32 +0000 Subject: sourceforge 1014886: select fonts and colors for tableview --- (limited to 'kaddressbook/views') diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp index 9804e28..4cc22ea 100644 --- a/kaddressbook/views/contactlistview.cpp +++ b/kaddressbook/views/contactlistview.cpp @@ -250,6 +250,11 @@ ContactListView::ContactListView(KAddressBookTableView *view, new DynamicTip( this ); } +void ContactListView::setAlternateColor(const QColor &m_AlternateColor) +{ + mAlternateColor = m_AlternateColor; +} + void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) { QBrush b = palette().brush(QPalette::Active, QColorGroup::Base); diff --git a/kaddressbook/views/contactlistview.h b/kaddressbook/views/contactlistview.h index ae9c994..fad7f38 100644 --- a/kaddressbook/views/contactlistview.h +++ b/kaddressbook/views/contactlistview.h @@ -83,6 +83,7 @@ public: void setSingleLineEnabled(bool enabled) { mSingleLine = enabled; } const QColor &alternateColor() const { return mAlternateColor; } + void setAlternateColor(const QColor &mAlternateColor); /** Sets the background pixmap to filename. If the * QString is empty (QString::isEmpty()), then the background diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 0847b64..ab11e2a 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp @@ -32,7 +32,7 @@ #include "viewmanager.h" #include - +#include #include "kaddressbooktableview.h" @@ -142,29 +142,40 @@ void KAddressBookTableView::readConfig(KConfig *config) 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 ); +#ifndef KAB_EMBEDDED + c = KGlobalSettings::alternateBackgroundColor(); +#else //KAB_EMBEDDED + c = QColor(240, 240, 240); +#endif //KAB_EMBEDDED + c = config->readColorEntry ("AlternatingBackgroundColor", &c); + mListView->setAlternateColor(c); + + + //US mListView->viewport()->setPalette( p ); + mListView->setPalette( p ); } else { // needed if turned off during a session. - mListView->viewport()->setPalette( mListView->palette() ); + //US mListView->viewport()->setPalette( mListView->palette() ); + mListView->setPalette( mListView->palette() ); } //custom fonts? QFont f( font() ); if ( config->readBoolEntry( "EnableCustomFonts", false ) ) { - // mListView->setFont( config->readFontEntry( "TextFont", &f) ); + mListView->setFont( config->readFontEntry( "TextFont", &f) ); f.setBold( true ); - // mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); + //US mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); + mListView->header()->setFont( config->readFontEntry( "HeaderFont", &f ) ); } else { - // mListView->setFont( f ); + mListView->setFont( f ); f.setBold( true ); - // mListView->setHeaderFont( f ); + //US mListView->setHeaderFont( f ); + mListView->header()->setFont( f ); } -- cgit v0.9.0.2