summaryrefslogtreecommitdiffabout
path: root/kaddressbook/viewmanager.cpp
authorulf69 <ulf69>2004-08-20 22:13:00 (UTC)
committer ulf69 <ulf69>2004-08-20 22:13:00 (UTC)
commitbc33238f8038a03e04f25ea608c53e784616fee6 (patch) (side-by-side diff)
tree6b0ce40b7f05a62b26df5eca19f9fdf4cc2cffba /kaddressbook/viewmanager.cpp
parent0b6f4c58076a92ad81085db87358fab8666276d9 (diff)
downloadkdepimpi-bc33238f8038a03e04f25ea608c53e784616fee6.zip
kdepimpi-bc33238f8038a03e04f25ea608c53e784616fee6.tar.gz
kdepimpi-bc33238f8038a03e04f25ea608c53e784616fee6.tar.bz2
performanceenhancements by removing unnecessary refreshs
Diffstat (limited to 'kaddressbook/viewmanager.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/viewmanager.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index e8c5b45..bec1862 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -232,65 +232,66 @@ void ViewManager::setActiveView( const QString &name )
connect( view, SIGNAL( modified() ), SIGNAL( modified() ) );
connect( view, SIGNAL( dropped( QDropEvent* ) ),
SLOT( dropped( QDropEvent* ) ) );
connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) );
}
}
// If we found or created the view, raise it and refresh it
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 )
return;
ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() );
ViewConfigureWidget *wdg = 0;
ViewConfigureDialog* dlg = 0;
if ( factory ) {
// Save the filters so the dialog has the latest set
Filter::save( mCore->config(), "Filter", mFilterList );
@@ -302,65 +303,66 @@ void ViewManager::editView()
}
if ( wdg ) {
dlg->setWidget( wdg );
#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() );
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() );
mActiveView = 0;
// we are in an invalid state now, but that should be fixed after
// we emit the signal
mActionSelectView->setItems( mViewNameList );
if ( mViewNameList.count() > 0 ) {
mActionSelectView->setCurrentItem( 0 );
setActiveView( mViewNameList[ 0 ] );