summaryrefslogtreecommitdiffabout
path: root/kaddressbook/viewmanager.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/viewmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/viewmanager.cpp66
1 files changed, 34 insertions, 32 deletions
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index e8c5b45..bec1862 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -101,7 +101,7 @@ void ViewManager::restoreSettings()
// Tell the views to reread their config, since they may have
// been modified by global settings
QString _oldgroup = mCore->config()->group();
-
+
QDictIterator<KAddressBookView> it( mViewDict );
for ( it.toFirst(); it.current(); ++it ) {
KConfigGroupSaver saver( mCore->config(), it.currentKey() );
@@ -115,7 +115,7 @@ void ViewManager::restoreSettings()
void ViewManager::saveSettings()
{
QString _oldgroup = mCore->config()->group();
-
+
QDictIterator<KAddressBookView> it( mViewDict );
for ( it.toFirst(); it.current(); ++it ) {
KConfigGroupSaver saver( mCore->config(), it.currentKey() );
@@ -125,7 +125,7 @@ void ViewManager::saveSettings()
(*it).writeConfig( mCore->config() );
#endif
}
-
+
Filter::save( mCore->config(), "Filter", mFilterList );
KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem();
@@ -166,7 +166,7 @@ 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()
{
setSelected( QString::null, true );
@@ -206,13 +206,13 @@ void ViewManager::setActiveView( const QString &name )
KConfigGroupSaver saver( config, name );
QString type = config->readEntry( "Type", "Table" );
-
+
kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl;
ViewFactory *factory = mViewFactoryDict.find( type );
if ( factory )
view = factory->view( mCore->addressBook(), mViewWidgetStack );
-
+
if ( view ) {
view->setCaption( name );
mViewDict.insert( name, view );
@@ -225,17 +225,17 @@ void ViewManager::setActiveView( const QString &name )
SIGNAL( selected( const QString & ) ) );
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* ) ),
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;
@@ -256,12 +256,13 @@ void ViewManager::setActiveView( const QString &name )
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
@@ -271,7 +272,7 @@ 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()
{
refreshView( QString::null );
@@ -303,20 +304,20 @@ void ViewManager::editView()
if ( wdg ) {
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() );
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.
@@ -331,9 +332,10 @@ void ViewManager::editView()
setActiveFilter( pos );
}
mCore->setSearchFields( mActiveView->fields() );
- mActiveView->refresh();
+//US performance optimization. setActiveFilter calls also mActiveView->refresh()
+//US mActiveView->refresh();
}
-
+
}
delete dlg;
}
@@ -344,7 +346,7 @@ void ViewManager::deleteView()
.arg( mActiveView->caption() );
QString caption = i18n( "Confirm Delete" );
-
+
if (QMessageBox::information( this, caption,
text,
i18n("Yes!"), i18n("No"), 0, 0 ) == 0)
@@ -395,13 +397,13 @@ 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 );
mActionSelectView->setCurrentItem( mViewNameList.findIndex( newName ) );
@@ -453,7 +455,7 @@ void ViewManager::createViewFactories()
// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1());
#endif //KAB_EMBEDDED
-
+
}
void ViewManager::dropped( QDropEvent *e )
@@ -461,7 +463,7 @@ void ViewManager::dropped( QDropEvent *e )
kdDebug(5720) << "ViewManager::dropped: got a drop event" << endl;
#ifndef KAB_EMBEDDED
-
+
QString clipText, vcards;
KURL::List urls;
@@ -496,7 +498,7 @@ void ViewManager::dropped( QDropEvent *e )
#else //KAB_EMBEDDED
qDebug("ViewManager::dropped() has to be changed!!" );
#endif //KAB_EMBEDDED
-
+
}
void ViewManager::startDrag()
@@ -591,7 +593,7 @@ int ViewManager::filterPosition( const QString &name ) const
void ViewManager::initActions()
{
-//US <ActionList name="view_loadedviews"/>
+//US <ActionList name="view_loadedviews"/>
//US <Separator/>
#ifdef KAB_EMBEDDED
@@ -599,7 +601,7 @@ void ViewManager::initActions()
QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu();
QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu();
#endif //KAB_EMBEDDED
-
+
mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" );
#if KDE_VERSION >= 309
mActionSelectView->setMenuAccelsEnabled( false );
@@ -607,12 +609,12 @@ void ViewManager::initActions()
connect( mActionSelectView, SIGNAL( activated( const QString& ) ),
SLOT( setActiveView( const QString& ) ) );
-
+
#ifdef KAB_EMBEDDED
mActionSelectView->plug(viewmenu);
viewmenu->insertSeparator();
#endif //KAB_EMBEDDED
-
+
KAction *action;
action = new KAction( i18n( "Modify View..." ), "configure", 0, this,
@@ -658,8 +660,8 @@ void ViewManager::initActions()
SLOT( configureFilters() ), mCore->actionCollection(),
"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 );
#endif
@@ -670,7 +672,7 @@ void ViewManager::initActions()
action->plug(settingsmenu);
mActionSelectFilter->plug(viewmenu);
#endif //KAB_EMBEDDED
-
+
}
void ViewManager::initGUI()