-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index e322473..565cd1d 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -141,97 +141,97 @@ void KAddressBookTableView::reconstructListView() | |||
141 | } | 141 | } |
142 | 142 | ||
143 | void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) | 143 | void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) |
144 | { | 144 | { |
145 | mListView->clear(); | 145 | mListView->clear(); |
146 | if ( s.isEmpty() || s == "*" ) { | 146 | if ( s.isEmpty() || s == "*" ) { |
147 | refresh(); | 147 | refresh(); |
148 | return; | 148 | return; |
149 | } | 149 | } |
150 | QRegExp re = getRegExp( s ); | 150 | QRegExp re = getRegExp( s ); |
151 | if (!re.isValid()) | 151 | if (!re.isValid()) |
152 | return; | 152 | return; |
153 | KABC::Addressee::List addresseeList = addressees(); | 153 | KABC::Addressee::List addresseeList = addressees(); |
154 | KABC::Addressee::List::Iterator it; | 154 | KABC::Addressee::List::Iterator it; |
155 | if ( field ) { | 155 | if ( field ) { |
156 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 156 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
157 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 157 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
158 | continue; | 158 | continue; |
159 | #if QT_VERSION >= 0x030000 | 159 | #if QT_VERSION >= 0x030000 |
160 | if (re.search(field->value( *it ).lower()) == 0) | 160 | if (re.search(field->value( *it ).lower()) == 0) |
161 | #else | 161 | #else |
162 | if (re.match(field->value( *it ).lower()) != -1) | 162 | if (re.match(field->value( *it ).lower()) != -1) |
163 | #endif | 163 | #endif |
164 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 164 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
165 | 165 | ||
166 | } | 166 | } |
167 | } else { | 167 | } else { |
168 | KABC::Field::List fieldList = allFields(); | 168 | KABC::Field::List fieldList = allFields(); |
169 | KABC::Field::List::ConstIterator fieldIt; | 169 | KABC::Field::List::ConstIterator fieldIt; |
170 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 170 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
171 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 171 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
172 | continue; | 172 | continue; |
173 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 173 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
174 | #if QT_VERSION >= 0x030000 | 174 | #if QT_VERSION >= 0x030000 |
175 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 175 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
176 | #else | 176 | #else |
177 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 177 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
178 | #endif | 178 | #endif |
179 | { | 179 | { |
180 | //qDebug("match %s %s %s", pattern.latin1(), (*fieldIt)->value( *it ).latin1(), (*fieldIt)->label().latin1() ); | 180 | //qDebug("match %s %s %s", pattern.latin1(), (*fieldIt)->value( *it ).latin1(), (*fieldIt)->label().latin1() ); |
181 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 181 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
182 | break; | 182 | break; |
183 | } | 183 | } |
184 | } | 184 | } |
185 | } | 185 | } |
186 | } | 186 | } |
187 | // Sometimes the background pixmap gets messed up when we add lots | 187 | // Sometimes the background pixmap gets messed up when we add lots |
188 | // of items. | 188 | // of items. |
189 | mListView->repaint(); | 189 | //mListView->repaint(); |
190 | if ( mListView->firstChild() ) { | 190 | if ( mListView->firstChild() ) { |
191 | mListView->setCurrentItem ( mListView->firstChild() ); | 191 | mListView->setCurrentItem ( mListView->firstChild() ); |
192 | mListView->setSelected ( mListView->firstChild(), true ); | 192 | mListView->setSelected ( mListView->firstChild(), true ); |
193 | } | 193 | } |
194 | else | 194 | else |
195 | emit selected(QString::null); | 195 | emit selected(QString::null); |
196 | 196 | ||
197 | } | 197 | } |
198 | void KAddressBookTableView::writeConfig(KConfig *config) | 198 | void KAddressBookTableView::writeConfig(KConfig *config) |
199 | { | 199 | { |
200 | KAddressBookView::writeConfig(config); | 200 | KAddressBookView::writeConfig(config); |
201 | 201 | ||
202 | mListView->saveLayout(config, config->group()); | 202 | mListView->saveLayout(config, config->group()); |
203 | } | 203 | } |
204 | 204 | ||
205 | void KAddressBookTableView::readConfig(KConfig *config) | 205 | void KAddressBookTableView::readConfig(KConfig *config) |
206 | { | 206 | { |
207 | KAddressBookView::readConfig( config ); | 207 | KAddressBookView::readConfig( config ); |
208 | // The config could have changed the fields, so we need to reconstruct | 208 | // The config could have changed the fields, so we need to reconstruct |
209 | // the listview. | 209 | // the listview. |
210 | reconstructListView(); | 210 | reconstructListView(); |
211 | 211 | ||
212 | // costum colors? | 212 | // costum colors? |
213 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) | 213 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) |
214 | { | 214 | { |
215 | QPalette p( mListView->palette() ); | 215 | QPalette p( mListView->palette() ); |
216 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); | 216 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); |
217 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); | 217 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); |
218 | c = p.color(QPalette::Normal, QColorGroup::Text ); | 218 | c = p.color(QPalette::Normal, QColorGroup::Text ); |
219 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); | 219 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); |
220 | c = p.color(QPalette::Normal, QColorGroup::Button ); | 220 | c = p.color(QPalette::Normal, QColorGroup::Button ); |
221 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); | 221 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); |
222 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); | 222 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); |
223 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); | 223 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); |
224 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); | 224 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); |
225 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); | 225 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); |
226 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); | 226 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); |
227 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); | 227 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); |
228 | #ifndef KAB_EMBEDDED | 228 | #ifndef KAB_EMBEDDED |
229 | c = KGlobalSettings::alternateBackgroundColor(); | 229 | c = KGlobalSettings::alternateBackgroundColor(); |
230 | #else //KAB_EMBEDDED | 230 | #else //KAB_EMBEDDED |
231 | c = QColor(240, 240, 240); | 231 | c = QColor(240, 240, 240); |
232 | #endif //KAB_EMBEDDED | 232 | #endif //KAB_EMBEDDED |
233 | c = config->readColorEntry ("AlternatingBackgroundColor", &c); | 233 | c = config->readColorEntry ("AlternatingBackgroundColor", &c); |
234 | mListView->setAlternateColor(c); | 234 | mListView->setAlternateColor(c); |
235 | 235 | ||
236 | 236 | ||
237 | //US mListView->viewport()->setPalette( p ); | 237 | //US mListView->viewport()->setPalette( p ); |