author | ulf69 <ulf69> | 2004-09-03 01:34:57 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-09-03 01:34:57 (UTC) |
commit | f6b72fd55671131cd81a3357940c9337ea5d7494 (patch) (unidiff) | |
tree | 1075a46b4a7e24696eb7945e5f76bef552d75d88 /kaddressbook/views | |
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 | |||
@@ -114,24 +114,68 @@ void KAddressBookTableView::reconstructListView() | |||
114 | 114 | ||
115 | void KAddressBookTableView::writeConfig(KConfig *config) | 115 | void KAddressBookTableView::writeConfig(KConfig *config) |
116 | { | 116 | { |
117 | KAddressBookView::writeConfig(config); | 117 | KAddressBookView::writeConfig(config); |
118 | 118 | ||
119 | mListView->saveLayout(config, config->group()); | 119 | mListView->saveLayout(config, config->group()); |
120 | } | 120 | } |
121 | 121 | ||
122 | void KAddressBookTableView::readConfig(KConfig *config) | 122 | void KAddressBookTableView::readConfig(KConfig *config) |
123 | { | 123 | { |
124 | KAddressBookView::readConfig( config ); | 124 | KAddressBookView::readConfig( config ); |
125 | 125 | ||
126 | // costum colors? | ||
127 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) | ||
128 | { | ||
129 | QPalette p( mListView->palette() ); | ||
130 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); | ||
131 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); | ||
132 | c = p.color(QPalette::Normal, QColorGroup::Text ); | ||
133 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); | ||
134 | c = p.color(QPalette::Normal, QColorGroup::Button ); | ||
135 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); | ||
136 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); | ||
137 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); | ||
138 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); | ||
139 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); | ||
140 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); | ||
141 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); | ||
142 | c = p.color(QPalette::Normal, QColorGroup::Base ); | ||
143 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "AlternatingBackgroundColor", &c ) ); | ||
144 | mListView->viewport()->setPalette( p ); | ||
145 | } | ||
146 | else | ||
147 | { | ||
148 | // needed if turned off during a session. | ||
149 | mListView->viewport()->setPalette( mListView->palette() ); | ||
150 | } | ||
151 | |||
152 | //custom fonts? | ||
153 | QFont f( font() ); | ||
154 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) | ||
155 | { | ||
156 | // mListView->setFont( config->readFontEntry( "TextFont", &f) ); | ||
157 | f.setBold( true ); | ||
158 | // mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); | ||
159 | } | ||
160 | else | ||
161 | { | ||
162 | // mListView->setFont( f ); | ||
163 | f.setBold( true ); | ||
164 | // mListView->setHeaderFont( f ); | ||
165 | } | ||
166 | |||
167 | |||
168 | |||
169 | |||
126 | // The config could have changed the fields, so we need to reconstruct | 170 | // The config could have changed the fields, so we need to reconstruct |
127 | // the listview. | 171 | // the listview. |
128 | reconstructListView(); | 172 | reconstructListView(); |
129 | 173 | ||
130 | // Set the list view options | 174 | // Set the list view options |
131 | mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground", | 175 | mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground", |
132 | true)); | 176 | true)); |
133 | mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false)); | 177 | mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false)); |
134 | mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true)); | 178 | mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true)); |
135 | 179 | ||
136 | if (config->readBoolEntry("Background", false)) | 180 | if (config->readBoolEntry("Background", false)) |
137 | mListView->setBackgroundPixmap(config->readEntry("BackgroundName")); | 181 | mListView->setBackgroundPixmap(config->readEntry("BackgroundName")); |