-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 @@ -80,9 +80,9 @@ void KAddressBookTableView::reconstructListView() int c = 0; 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()); } connect(mListView, SIGNAL(selectionChanged()), @@ -102,9 +102,10 @@ void KAddressBookTableView::reconstructListView() this, SLOT(addresseeExecuted(QListViewItem*))); 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 ); mainLayout->activate(); @@ -147,20 +148,20 @@ 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(); } @@ -190,14 +191,14 @@ void KAddressBookTableView::refresh(QString uid) // Only need to update on entry. Iterate through and try to find it 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; } @@ -217,14 +218,14 @@ QStringList KAddressBookTableView::selectedUids() for(item = mListView->firstChild(); item; item = item->itemBelow()) { 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(); } } @@ -232,9 +233,9 @@ QStringList KAddressBookTableView::selectedUids() if ( mListView->currentItem() ) { ceItem = (ContactListViewItem*)(mListView->currentItem()) ; uidList << ceItem->addressee().uid(); } - + return uidList; } void KAddressBookTableView::setSelected(QString uid, bool selected) @@ -249,15 +250,15 @@ void KAddressBookTableView::setSelected(QString uid, bool selected) else { 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); @@ -281,16 +282,16 @@ 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()); } } @@ -301,15 +302,15 @@ void KAddressBookTableView::addresseeSelected() 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) { emit executed(ceItem->addressee().uid()); @@ -322,11 +323,11 @@ void KAddressBookTableView::addresseeExecuted(QListViewItem *item) } void KAddressBookTableView::addresseeDeleted() { - + emit deleteRequest(); - + } |