-rw-r--r-- | kaddressbook/viewmanager.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index e8c5b45..bec1862 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp @@ -240,49 +240,50 @@ void ViewManager::setActiveView( const QString &name ) if ( view ) { mActiveView = view; mViewWidgetStack->raiseWidget( view ); // Set the proper filter in the view. By setting the combo // box, the activated slot will be called, which will push // the filter to the view and refresh it. if ( view->defaultFilterType() == KAddressBookView::None ) { mActionSelectFilter->setCurrentItem( 0 ); setActiveFilter( 0 ); } else if ( view->defaultFilterType() == KAddressBookView::Active ) { setActiveFilter( mActionSelectFilter->currentItem() ); } else { uint pos = filterPosition( view->defaultFilterName() ); mActionSelectFilter->setCurrentItem( pos ); setActiveFilter( pos ); } //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(); } else { qDebug("ViewManager::setActiveView: unable to find view" ); kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n"; } } //US added another method with no parameter, since my moc compiler does not support default parameters. void ViewManager::refreshView() { refreshView( QString::null ); } void ViewManager::refreshView( const QString &uid ) { if ( mActiveView ) mActiveView->refresh( uid ); } void ViewManager::editView() { if ( !mActiveView ) @@ -310,49 +311,50 @@ void ViewManager::editView() #endif KConfigGroupSaver saver( mCore->config(), mActiveView->caption() ); dlg->restoreSettings( mCore->config() ); if ( dlg->exec() ) { 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 // the filter to the view and refresh it. if ( mActiveView->defaultFilterType() == KAddressBookView::None ) { mActionSelectFilter->setCurrentItem( 0 ); setActiveFilter( 0 ); } else if ( mActiveView->defaultFilterType() == KAddressBookView::Active ) { setActiveFilter( mActionSelectFilter->currentItem() ); } else { uint pos = filterPosition( mActiveView->defaultFilterName() ); mActionSelectFilter->setCurrentItem( pos ); setActiveFilter( pos ); } mCore->setSearchFields( mActiveView->fields() ); - mActiveView->refresh(); +//US performance optimization. setActiveFilter calls also mActiveView->refresh() +//US mActiveView->refresh(); } } delete dlg; } void ViewManager::deleteView() { QString text = i18n( "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>" ) .arg( mActiveView->caption() ); QString caption = i18n( "Confirm Delete" ); if (QMessageBox::information( this, caption, text, i18n("Yes!"), i18n("No"), 0, 0 ) == 0) { mViewNameList.remove( mActiveView->caption() ); // remove the view from the config file KConfig *config = mCore->config(); config->deleteGroup( mActiveView->caption() ); mViewDict.remove( mActiveView->caption() ); 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,49 +82,50 @@ void KAddressBookTableView::reconstructListView() mListView->addColumn( (*it)->label() ); mListView->setColumnWidthMode(c++, QListView::Manual); //US // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); } connect(mListView, SIGNAL(selectionChanged()), this, SLOT(addresseeSelected())); connect(mListView, SIGNAL(startAddresseeDrag()), this, SIGNAL(startDrag())); connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, SIGNAL(dropped(QDropEvent*))); if (KABPrefs::instance()->mHonorSingleClick) connect(mListView, SIGNAL(executed(QListViewItem*)), this, SLOT(addresseeExecuted(QListViewItem*))); else connect(mListView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(addresseeExecuted(QListViewItem*))); connect(mListView, SIGNAL(returnPressed(QListViewItem*)), 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(); mListView->show(); } void KAddressBookTableView::writeConfig(KConfig *config) { KAddressBookView::writeConfig(config); mListView->saveLayout(config, config->group()); } void KAddressBookTableView::readConfig(KConfig *config) { KAddressBookView::readConfig( config ); // The config could have changed the fields, so we need to reconstruct // the listview. reconstructListView(); // Set the list view options mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground", |