-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 @@ -81,7 +81,7 @@ void KAddressBookTableView::reconstructListView() for( it = fieldList.begin(); it != fieldList.end(); ++it ) { mListView->addColumn( (*it)->label() ); mListView->setColumnWidthMode(c++, QListView::Manual); -//US +//US // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); } @@ -103,7 +103,8 @@ void KAddressBookTableView::reconstructListView() connect(mListView, SIGNAL(signalDelete()), this, SLOT(addresseeDeleted())); - refresh(); +//US performceimprovement. Refresh is done from the outside +//US refresh(); mListView->setSorting( 0, true ); mainLayout->addWidget( mListView ); @@ -148,18 +149,18 @@ void KAddressBookTableView::refresh(QString uid) if (uid.isNull()) { // 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(); currentUID = currentItem->addressee().uid(); @@ -191,12 +192,12 @@ void KAddressBookTableView::refresh(QString uid) ContactListViewItem *ceItem; 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(); return; @@ -218,12 +219,12 @@ 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(); } @@ -233,7 +234,7 @@ QStringList KAddressBookTableView::selectedUids() ceItem = (ContactListViewItem*)(mListView->currentItem()) ; uidList << ceItem->addressee().uid(); } - + return uidList; } @@ -250,13 +251,13 @@ 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)) { mListView->setSelected(item, selected); @@ -282,14 +283,14 @@ void KAddressBookTableView::addresseeSelected() if (item->isSelected()) { 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()); } } @@ -302,13 +303,13 @@ 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) { @@ -323,9 +324,9 @@ void KAddressBookTableView::addresseeExecuted(QListViewItem *item) void KAddressBookTableView::addresseeDeleted() { - + emit deleteRequest(); - + } |