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.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index bec1862..45c7b55 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -289,96 +289,101 @@ 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 );
dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" );
wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" );
} else {
qDebug("ViewManager::editView()::cannot find viewfactory ");
return;
}
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() );
//US performance optimization. setActiveFilter calls also mActiveView->refresh()
//US mActiveView->refresh();
+
+
+ //US this is a bugfix, that we get notified if we change a views configuration
+ emit modified();
+
}
}
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 ] );
}
mActionDeleteView->setEnabled( mViewNameList.count() > 1 );
}
}
void ViewManager::addView()
{
AddViewDialog dialog( &mViewFactoryDict, this );
if ( dialog.exec() ) {
QString newName = dialog.viewName();
QString type = dialog.viewType();
// Check for name conflicts
bool firstConflict = true;
int numTries = 1;