summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/viewmanager.cpp66
-rw-r--r--kaddressbook/views/kaddressbooktableview.cpp65
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
@@ -100,9 +100,9 @@ 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() );
it.current()->readConfig( mCore->config() );
@@ -114,9 +114,9 @@ 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() );
#ifdef DESKTOP_VERSION
@@ -124,9 +124,9 @@ void ViewManager::saveSettings()
#else
(*it).writeConfig( mCore->config() );
#endif
}
-
+
Filter::save( mCore->config(), "Filter", mFilterList );
KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem();
// write the view name list
@@ -165,9 +165,9 @@ 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 );
}
@@ -205,15 +205,15 @@ 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 );
//US my version needs an int as second parameter to addWidget
@@ -224,19 +224,19 @@ void ViewManager::setActiveView( const QString &name )
connect( view, SIGNAL( selected( const QString& ) ),
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;
mViewWidgetStack->raiseWidget( view );
@@ -255,14 +255,15 @@ void ViewManager::setActiveView( const QString &name )
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
{
@@ -270,9 +271,9 @@ void ViewManager::setActiveView( const QString &name )
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.
+//US added another method with no parameter, since my moc compiler does not support default parameters.
void ViewManager::refreshView()
{
refreshView( QString::null );
}
@@ -302,22 +303,22 @@ 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.
if ( mActiveView->defaultFilterType() == KAddressBookView::None ) {
@@ -330,11 +331,12 @@ void ViewManager::editView()
mActionSelectFilter->setCurrentItem( pos );
setActiveFilter( pos );
}
mCore->setSearchFields( mActiveView->fields() );
- mActiveView->refresh();
+//US performance optimization. setActiveFilter calls also mActiveView->refresh()
+//US mActiveView->refresh();
}
-
+
}
delete dlg;
}
@@ -343,9 +345,9 @@ 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)
{
@@ -394,15 +396,15 @@ void ViewManager::addView()
mViewNameList.append( newName );
// 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 ) );
setActiveView( newName );
@@ -452,17 +454,17 @@ void ViewManager::createViewFactories()
mViewFactoryDict.insert( viewFactory->type(), viewFactory );
// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1());
#endif //KAB_EMBEDDED
-
+
}
void ViewManager::dropped( QDropEvent *e )
{
kdDebug(5720) << "ViewManager::dropped: got a drop event" << endl;
#ifndef KAB_EMBEDDED
-
+
QString clipText, vcards;
KURL::List urls;
if ( KURLDrag::decode( e, urls) ) {
@@ -495,9 +497,9 @@ void ViewManager::dropped( QDropEvent *e )
}
#else //KAB_EMBEDDED
qDebug("ViewManager::dropped() has to be changed!!" );
#endif //KAB_EMBEDDED
-
+
}
void ViewManager::startDrag()
{
@@ -590,30 +592,30 @@ 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
QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu();
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 );
#endif
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,
SLOT( editView() ), mCore->actionCollection(), "view_modify" );
@@ -657,10 +659,10 @@ void ViewManager::initActions()
action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this,
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
connect( mActionSelectFilter, SIGNAL( activated( int ) ),
@@ -669,9 +671,9 @@ void ViewManager::initActions()
#ifdef KAB_EMBEDDED
action->plug(settingsmenu);
mActionSelectFilter->plug(viewmenu);
#endif //KAB_EMBEDDED
-
+
}
void ViewManager::initGUI()
{
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();
-
+
}