-rw-r--r-- | kaddressbook/viewmanager.cpp | 66 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 65 |
2 files changed, 67 insertions, 64 deletions
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index e8c5b45..bec1862 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp @@ -102,5 +102,5 @@ void ViewManager::restoreSettings() // been modified by global settings QString _oldgroup = mCore->config()->group(); - + QDictIterator<KAddressBookView> it( mViewDict ); for ( it.toFirst(); it.current(); ++it ) { @@ -116,5 +116,5 @@ void ViewManager::saveSettings() { QString _oldgroup = mCore->config()->group(); - + QDictIterator<KAddressBookView> it( mViewDict ); for ( it.toFirst(); it.current(); ++it ) { @@ -126,5 +126,5 @@ void ViewManager::saveSettings() #endif } - + Filter::save( mCore->config(), "Filter", mFilterList ); KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem(); @@ -167,5 +167,5 @@ KABC::Addressee::List ViewManager::selectedAddressees() const return list; } -//US added another method with no parameter, since my moc compiler does not support default parameters. +//US added another method with no parameter, since my moc compiler does not support default parameters. void ViewManager::setSelected() { @@ -207,5 +207,5 @@ void ViewManager::setActiveView( const QString &name ) QString type = config->readEntry( "Type", "Table" ); - + kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl; @@ -213,5 +213,5 @@ void ViewManager::setActiveView( const QString &name ) if ( factory ) view = factory->view( mCore->addressBook(), mViewWidgetStack ); - + if ( view ) { view->setCaption( name ); @@ -226,8 +226,8 @@ void ViewManager::setActiveView( const QString &name ) connect( view, SIGNAL( executed( const QString& ) ), SIGNAL( executed( const QString& ) ) ); - + connect( view, SIGNAL( deleteRequest( ) ), SIGNAL( deleteRequest( ) ) ); - + connect( view, SIGNAL( modified() ), SIGNAL( modified() ) ); connect( view, SIGNAL( dropped( QDropEvent* ) ), @@ -236,5 +236,5 @@ void ViewManager::setActiveView( const QString &name ) } } - + // If we found or created the view, raise it and refresh it if ( view ) { @@ -257,10 +257,11 @@ void ViewManager::setActiveView( const QString &name ) } //US qDebug("ViewManager::setActiveView 6" ); - + // Update the inc search widget to show the fields in the new active // view. mCore->setSearchFields( mActiveView->fields() ); - mActiveView->refresh(); +//US performance optimization. setActiveFilter calls also mActiveView->refresh() +//US mActiveView->refresh(); } @@ -272,5 +273,5 @@ void ViewManager::setActiveView( const QString &name ) } -//US added another method with no parameter, since my moc compiler does not support default parameters. +//US added another method with no parameter, since my moc compiler does not support default parameters. void ViewManager::refreshView() { @@ -304,12 +305,12 @@ void ViewManager::editView() dlg->setWidget( wdg ); -#ifndef DESKTOP_VERSION +#ifndef DESKTOP_VERSION //dlg.setMaximumSize( 640, 480 ); //dlg->setGeometry( 40,40, 400, 300); dlg->showMaximized(); #endif - + KConfigGroupSaver saver( mCore->config(), mActiveView->caption() ); - + dlg->restoreSettings( mCore->config() ); @@ -317,5 +318,5 @@ void ViewManager::editView() dlg->saveSettings( mCore->config() ); mActiveView->readConfig( mCore->config() ); - + // Set the proper filter in the view. By setting the combo // box, the activated slot will be called, which will push @@ -332,7 +333,8 @@ void ViewManager::editView() } mCore->setSearchFields( mActiveView->fields() ); - mActiveView->refresh(); +//US performance optimization. setActiveFilter calls also mActiveView->refresh() +//US mActiveView->refresh(); } - + } delete dlg; @@ -345,5 +347,5 @@ void ViewManager::deleteView() QString caption = i18n( "Confirm Delete" ); - + if (QMessageBox::information( this, caption, text, @@ -396,11 +398,11 @@ void ViewManager::addView() // write the view to the config file, KConfig *config = mCore->config(); - + config->deleteGroup( newName ); KConfigGroupSaver saver( config, newName ); - + config->writeEntry( "Type", type ); - + // try to set the active view mActionSelectView->setItems( mViewNameList ); @@ -454,5 +456,5 @@ void ViewManager::createViewFactories() #endif //KAB_EMBEDDED - + } @@ -462,5 +464,5 @@ void ViewManager::dropped( QDropEvent *e ) #ifndef KAB_EMBEDDED - + QString clipText, vcards; KURL::List urls; @@ -497,5 +499,5 @@ void ViewManager::dropped( QDropEvent *e ) qDebug("ViewManager::dropped() has to be changed!!" ); #endif //KAB_EMBEDDED - + } @@ -592,5 +594,5 @@ int ViewManager::filterPosition( const QString &name ) const void ViewManager::initActions() { -//US <ActionList name="view_loadedviews"/> +//US <ActionList name="view_loadedviews"/> //US <Separator/> @@ -600,5 +602,5 @@ void ViewManager::initActions() QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); #endif //KAB_EMBEDDED - + mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); #if KDE_VERSION >= 309 @@ -608,10 +610,10 @@ void ViewManager::initActions() SLOT( setActiveView( const QString& ) ) ); - + #ifdef KAB_EMBEDDED mActionSelectView->plug(viewmenu); viewmenu->insertSeparator(); #endif //KAB_EMBEDDED - + KAction *action; @@ -659,6 +661,6 @@ void ViewManager::initActions() "options_edit_filters" ); - mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); - + mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); + #if KDE_VERSION >= 309 mActionSelectFilter->setMenuAccelsEnabled( false ); @@ -671,5 +673,5 @@ void ViewManager::initActions() mActionSelectFilter->plug(viewmenu); #endif //KAB_EMBEDDED - + } 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(); - + } |