-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 02fc40a..272f2eb 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -313,52 +313,54 @@ void KAddressBookTableView::refresh(QString uid) | |||
313 | #endif //KAB_EMBEDDED | 313 | #endif //KAB_EMBEDDED |
314 | if ( nextItem ) | 314 | if ( nextItem ) |
315 | nextUID = nextItem->addressee().uid(); | 315 | nextUID = nextItem->addressee().uid(); |
316 | currentUID = currentItem->addressee().uid(); | 316 | currentUID = currentItem->addressee().uid(); |
317 | } | 317 | } |
318 | 318 | ||
319 | mListView->clear(); | 319 | mListView->clear(); |
320 | 320 | ||
321 | currentItem = 0; | 321 | currentItem = 0; |
322 | KABC::Addressee::List addresseeList = addressees(); | 322 | KABC::Addressee::List addresseeList = addressees(); |
323 | KABC::Addressee::List::Iterator it; | 323 | KABC::Addressee::List::Iterator it; |
324 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 324 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
325 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 325 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
326 | continue; | 326 | continue; |
327 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 327 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
328 | if ( (*it).uid() == currentUID ) | 328 | if ( (*it).uid() == currentUID ) |
329 | currentItem = item; | 329 | currentItem = item; |
330 | else if ( (*it).uid() == nextUID && !currentItem ) | 330 | else if ( (*it).uid() == nextUID && !currentItem ) |
331 | currentItem = item; | 331 | currentItem = item; |
332 | } | 332 | } |
333 | 333 | ||
334 | // Sometimes the background pixmap gets messed up when we add lots | 334 | // Sometimes the background pixmap gets messed up when we add lots |
335 | // of items. | 335 | // of items. |
336 | mListView->repaint(); | 336 | mListView->repaint(); |
337 | 337 | if ( !currentItem ) | |
338 | currentItem = (ContactListViewItem *)mListView->firstChild(); | ||
338 | if ( currentItem ) { | 339 | if ( currentItem ) { |
339 | mListView->setCurrentItem( currentItem ); | 340 | mListView->setCurrentItem( currentItem ); |
340 | mListView->ensureItemVisible( currentItem ); | 341 | mListView->ensureItemVisible( currentItem ); |
342 | mListView->setSelected( currentItem, true ); | ||
341 | } | 343 | } |
342 | } else { | 344 | } else { |
343 | // Only need to update on entry. Iterate through and try to find it | 345 | // Only need to update on entry. Iterate through and try to find it |
344 | ContactListViewItem *ceItem; | 346 | ContactListViewItem *ceItem; |
345 | QListViewItemIterator it( mListView ); | 347 | QListViewItemIterator it( mListView ); |
346 | while ( it.current() ) { | 348 | while ( it.current() ) { |
347 | #ifndef KAB_EMBEDDED | 349 | #ifndef KAB_EMBEDDED |
348 | ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); | 350 | ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); |
349 | #else //KAB_EMBEDDED | 351 | #else //KAB_EMBEDDED |
350 | ceItem = (ContactListViewItem*)( it.current() ); | 352 | ceItem = (ContactListViewItem*)( it.current() ); |
351 | #endif //KAB_EMBEDDED | 353 | #endif //KAB_EMBEDDED |
352 | 354 | ||
353 | if ( ceItem && ceItem->addressee().uid() == uid ) { | 355 | if ( ceItem && ceItem->addressee().uid() == uid ) { |
354 | ceItem->refresh(); | 356 | ceItem->refresh(); |
355 | return; | 357 | return; |
356 | } | 358 | } |
357 | ++it; | 359 | ++it; |
358 | } | 360 | } |
359 | 361 | ||
360 | refresh( QString::null ); | 362 | refresh( QString::null ); |
361 | } | 363 | } |
362 | } | 364 | } |
363 | 365 | ||
364 | QStringList KAddressBookTableView::selectedUids() | 366 | QStringList KAddressBookTableView::selectedUids() |