-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index ee2fcf8..8d2203e 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp @@ -82,5 +82,5 @@ void KAddressBookTableView::reconstructListView() mListView->addColumn( (*it)->label() ); mListView->setColumnWidthMode(c++, QListView::Manual); -//US +//US // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); } @@ -104,5 +104,6 @@ void KAddressBookTableView::reconstructListView() this, SLOT(addresseeDeleted())); - refresh(); +//US performceimprovement. Refresh is done from the outside +//US refresh(); mListView->setSorting( 0, true ); @@ -149,16 +150,16 @@ void KAddressBookTableView::refresh(QString uid) // Clear the list view QString currentUID, nextUID; -#ifndef KAB_EMBEDDED +#ifndef KAB_EMBEDDED ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); -#else //KAB_EMBEDDED +#else //KAB_EMBEDDED ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() ); -#endif //KAB_EMBEDDED - +#endif //KAB_EMBEDDED + if ( currentItem ) { -#ifndef KAB_EMBEDDED +#ifndef KAB_EMBEDDED ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() ); -#else //KAB_EMBEDDED +#else //KAB_EMBEDDED ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() ); -#endif //KAB_EMBEDDED +#endif //KAB_EMBEDDED if ( nextItem ) nextUID = nextItem->addressee().uid(); @@ -192,10 +193,10 @@ void KAddressBookTableView::refresh(QString uid) QListViewItemIterator it( mListView ); while ( it.current() ) { -#ifndef KAB_EMBEDDED +#ifndef KAB_EMBEDDED ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); -#else //KAB_EMBEDDED +#else //KAB_EMBEDDED ceItem = (ContactListViewItem*)( it.current() ); -#endif //KAB_EMBEDDED - +#endif //KAB_EMBEDDED + if ( ceItem && ceItem->addressee().uid() == uid ) { ceItem->refresh(); @@ -219,10 +220,10 @@ QStringList KAddressBookTableView::selectedUids() if (mListView->isSelected( item )) { -#ifndef KAB_EMBEDDED +#ifndef KAB_EMBEDDED ceItem = dynamic_cast<ContactListViewItem*>(item); -#else //KAB_EMBEDDED +#else //KAB_EMBEDDED ceItem = (ContactListViewItem*)(item); -#endif //KAB_EMBEDDED - +#endif //KAB_EMBEDDED + if (ceItem != 0L) uidList << ceItem->addressee().uid(); @@ -234,5 +235,5 @@ QStringList KAddressBookTableView::selectedUids() uidList << ceItem->addressee().uid(); } - + return uidList; } @@ -251,11 +252,11 @@ void KAddressBookTableView::setSelected(QString uid, bool selected) for(item = mListView->firstChild(); item; item = item->itemBelow()) { -#ifndef KAB_EMBEDDED +#ifndef KAB_EMBEDDED ceItem = dynamic_cast<ContactListViewItem*>(item); -#else //KAB_EMBEDDED +#else //KAB_EMBEDDED ceItem = (ContactListViewItem*)(item); -#endif //KAB_EMBEDDED - - +#endif //KAB_EMBEDDED + + if ((ceItem != 0L) && (ceItem->addressee().uid() == uid)) { @@ -283,12 +284,12 @@ void KAddressBookTableView::addresseeSelected() { found = true; -#ifndef KAB_EMBEDDED +#ifndef KAB_EMBEDDED ContactListViewItem *ceItem = dynamic_cast<ContactListViewItem*>(item); -#else //KAB_EMBEDDED +#else //KAB_EMBEDDED ContactListViewItem *ceItem = (ContactListViewItem*)(item); -#endif //KAB_EMBEDDED - +#endif //KAB_EMBEDDED + if ( ceItem ) emit selected(ceItem->addressee().uid()); } @@ -303,11 +304,11 @@ void KAddressBookTableView::addresseeExecuted(QListViewItem *item) if (item) { -#ifndef KAB_EMBEDDED +#ifndef KAB_EMBEDDED ContactListViewItem *ceItem = dynamic_cast<ContactListViewItem*>(item); -#else //KAB_EMBEDDED +#else //KAB_EMBEDDED ContactListViewItem *ceItem = (ContactListViewItem*)(item); -#endif //KAB_EMBEDDED +#endif //KAB_EMBEDDED if (ceItem) @@ -324,7 +325,7 @@ void KAddressBookTableView::addresseeExecuted(QListViewItem *item) void KAddressBookTableView::addresseeDeleted() { - + emit deleteRequest(); - + } |