Diffstat (limited to 'kaddressbook/views/kaddressbooktableview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 89053c2..61703ee 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -142,49 +142,49 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) | |||
142 | return; | 142 | return; |
143 | } | 143 | } |
144 | QString pattern = s.lower()+"*"; | 144 | QString pattern = s.lower()+"*"; |
145 | QRegExp re; | 145 | QRegExp re; |
146 | re.setWildcard(true); // most people understand these better. | 146 | re.setWildcard(true); // most people understand these better. |
147 | re.setCaseSensitive(false); | 147 | re.setCaseSensitive(false); |
148 | re.setPattern( pattern ); | 148 | re.setPattern( pattern ); |
149 | if (!re.isValid()) | 149 | if (!re.isValid()) |
150 | return; | 150 | return; |
151 | KABC::Addressee::List addresseeList = addressees(); | 151 | KABC::Addressee::List addresseeList = addressees(); |
152 | KABC::Addressee::List::Iterator it; | 152 | KABC::Addressee::List::Iterator it; |
153 | if ( field ) { | 153 | if ( field ) { |
154 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 154 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
155 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 155 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
156 | continue; | 156 | continue; |
157 | #if QT_VERSION >= 300 | 157 | #if QT_VERSION >= 300 |
158 | if (re.search(field->value( *it ).lower()) != -1) | 158 | if (re.search(field->value( *it ).lower()) != -1) |
159 | #else | 159 | #else |
160 | if (re.match(field->value( *it ).lower()) != -1) | 160 | if (re.match(field->value( *it ).lower()) != -1) |
161 | #endif | 161 | #endif |
162 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 162 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
163 | 163 | ||
164 | } | 164 | } |
165 | } else { | 165 | } else { |
166 | KABC::Field::List fieldList = fields(); | 166 | KABC::Field::List fieldList = allFields(); |
167 | KABC::Field::List::ConstIterator fieldIt; | 167 | KABC::Field::List::ConstIterator fieldIt; |
168 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 168 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
169 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 169 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
170 | continue; | 170 | continue; |
171 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 171 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
172 | #if QT_VERSION >= 300 | 172 | #if QT_VERSION >= 300 |
173 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 173 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
174 | #else | 174 | #else |
175 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 175 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
176 | #endif | 176 | #endif |
177 | { | 177 | { |
178 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 178 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
179 | break; | 179 | break; |
180 | } | 180 | } |
181 | } | 181 | } |
182 | } | 182 | } |
183 | } | 183 | } |
184 | // Sometimes the background pixmap gets messed up when we add lots | 184 | // Sometimes the background pixmap gets messed up when we add lots |
185 | // of items. | 185 | // of items. |
186 | mListView->repaint(); | 186 | mListView->repaint(); |
187 | if ( mListView->firstChild() ) { | 187 | if ( mListView->firstChild() ) { |
188 | mListView->setCurrentItem ( mListView->firstChild() ); | 188 | mListView->setCurrentItem ( mListView->firstChild() ); |
189 | mListView->setSelected ( mListView->firstChild(), true ); | 189 | mListView->setSelected ( mListView->firstChild(), true ); |
190 | } | 190 | } |
@@ -237,52 +237,48 @@ void KAddressBookTableView::readConfig(KConfig *config) | |||
237 | else | 237 | else |
238 | { | 238 | { |
239 | // needed if turned off during a session. | 239 | // needed if turned off during a session. |
240 | //US mListView->viewport()->setPalette( mListView->palette() ); | 240 | //US mListView->viewport()->setPalette( mListView->palette() ); |
241 | mListView->setPalette( mListView->palette() ); | 241 | mListView->setPalette( mListView->palette() ); |
242 | } | 242 | } |
243 | 243 | ||
244 | //custom fonts? | 244 | //custom fonts? |
245 | QFont f( font() ); | 245 | QFont f( font() ); |
246 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) | 246 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) |
247 | { | 247 | { |
248 | mListView->setFont( config->readFontEntry( "TextFont", &f) ); | 248 | mListView->setFont( config->readFontEntry( "TextFont", &f) ); |
249 | f.setBold( true ); | 249 | f.setBold( true ); |
250 | //US mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); | 250 | //US mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); |
251 | mListView->header()->setFont( config->readFontEntry( "HeaderFont", &f ) ); | 251 | mListView->header()->setFont( config->readFontEntry( "HeaderFont", &f ) ); |
252 | } | 252 | } |
253 | else | 253 | else |
254 | { | 254 | { |
255 | mListView->setFont( f ); | 255 | mListView->setFont( f ); |
256 | f.setBold( true ); | 256 | f.setBold( true ); |
257 | //US mListView->setHeaderFont( f ); | 257 | //US mListView->setHeaderFont( f ); |
258 | mListView->header()->setFont( f ); | 258 | mListView->header()->setFont( f ); |
259 | } | 259 | } |
260 | 260 | ||
261 | |||
262 | |||
263 | |||
264 | |||
265 | // Set the list view options | 261 | // Set the list view options |
266 | mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground", | 262 | mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground", |
267 | true)); | 263 | true)); |
268 | mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false)); | 264 | mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false)); |
269 | mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true)); | 265 | mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true)); |
270 | 266 | ||
271 | if (config->readBoolEntry("Background", false)) | 267 | if (config->readBoolEntry("Background", false)) |
272 | mListView->setBackgroundPixmap(config->readEntry("BackgroundName")); | 268 | mListView->setBackgroundPixmap(config->readEntry("BackgroundName")); |
273 | 269 | ||
274 | // Restore the layout of the listview | 270 | // Restore the layout of the listview |
275 | mListView->restoreLayout(config, config->group()); | 271 | mListView->restoreLayout(config, config->group()); |
276 | } | 272 | } |
277 | 273 | ||
278 | void KAddressBookTableView::refresh(QString uid) | 274 | void KAddressBookTableView::refresh(QString uid) |
279 | { | 275 | { |
280 | // For now just repopulate. In reality this method should | 276 | // For now just repopulate. In reality this method should |
281 | // check the value of uid, and if valid iterate through | 277 | // check the value of uid, and if valid iterate through |
282 | // the listview to find the entry, then tell it to refresh. | 278 | // the listview to find the entry, then tell it to refresh. |
283 | 279 | ||
284 | if (uid.isNull()) { | 280 | if (uid.isNull()) { |
285 | // Clear the list view | 281 | // Clear the list view |
286 | QString currentUID, nextUID; | 282 | QString currentUID, nextUID; |
287 | #ifndef KAB_EMBEDDED | 283 | #ifndef KAB_EMBEDDED |
288 | ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); | 284 | ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); |