Use a QPointer for modal dialogs in kcmtabbox (Krazy issue no 5) and make some dialogs modal which should be modal.

svn path=/trunk/KDE/kdebase/workspace/; revision=1023767
This commit is contained in:
Martin Gräßlin 2009-09-15 10:31:52 +00:00
parent eb95fc7cba
commit c6a1918d97

View file

@ -523,8 +523,9 @@ void KWinTabBoxConfig::aboutEffectClicked( KWinTabBoxConfigForm* ui )
i++; i++;
} }
} }
KAboutApplicationDialog aboutPlugin( &aboutData, this ); QPointer< KAboutApplicationDialog > aboutPlugin = new KAboutApplicationDialog( &aboutData, this );
aboutPlugin.exec(); aboutPlugin->exec();
delete aboutPlugin;
} }
void KWinTabBoxConfig::slotConfigureEffectClicked() void KWinTabBoxConfig::slotConfigureEffectClicked()
@ -558,19 +559,19 @@ void KWinTabBoxConfig::configureEffectClicked( KWinTabBoxConfigForm* ui )
return; return;
} }
KCModuleProxy* proxy = new KCModuleProxy( effect ); KCModuleProxy* proxy = new KCModuleProxy( effect );
KDialog configDialog( this ); QPointer< KDialog > configDialog = new KDialog( this );
configDialog.setWindowTitle( ui->effectCombo->currentText() ); configDialog->setWindowTitle( ui->effectCombo->currentText() );
configDialog.setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Default ); configDialog->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Default );
connect(&configDialog, SIGNAL(defaultClicked()), proxy, SLOT(defaults())); connect(configDialog, SIGNAL(defaultClicked()), proxy, SLOT(defaults()));
QWidget *showWidget = new QWidget( &configDialog ); QWidget *showWidget = new QWidget( configDialog );
QVBoxLayout *layout = new QVBoxLayout; QVBoxLayout *layout = new QVBoxLayout;
showWidget->setLayout( layout ); showWidget->setLayout( layout );
layout->addWidget( proxy ); layout->addWidget( proxy );
layout->insertSpacing( -1, KDialog::marginHint() ); layout->insertSpacing( -1, KDialog::marginHint() );
configDialog.setMainWidget( showWidget ); configDialog->setMainWidget( showWidget );
if( configDialog.exec() == QDialog::Accepted ) if( configDialog->exec() == QDialog::Accepted )
{ {
proxy->save(); proxy->save();
} }
@ -578,11 +579,12 @@ void KWinTabBoxConfig::configureEffectClicked( KWinTabBoxConfigForm* ui )
{ {
proxy->load(); proxy->load();
} }
delete configDialog;
} }
void KWinTabBoxConfig::slotConfigureLayoutClicked() void KWinTabBoxConfig::slotConfigureLayoutClicked()
{ {
KDialog* dialog = new KDialog( this ); QPointer<KDialog> dialog = new KDialog( this );
dialog->setCaption( i18n("Configure Layout") ); dialog->setCaption( i18n("Configure Layout") );
dialog->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Default ); dialog->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Default );
connect( dialog, SIGNAL(okClicked()), this, SLOT(slotLayoutChanged())); connect( dialog, SIGNAL(okClicked()), this, SLOT(slotLayoutChanged()));
@ -590,8 +592,8 @@ void KWinTabBoxConfig::slotConfigureLayoutClicked()
m_configForm->setConfig( m_tabBoxConfig ); m_configForm->setConfig( m_tabBoxConfig );
dialog->setMainWidget( m_configForm ); dialog->setMainWidget( m_configForm );
dialog->enableButtonApply( false ); dialog->exec();
dialog->show(); delete dialog;
} }
void KWinTabBoxConfig::slotLayoutChanged() void KWinTabBoxConfig::slotLayoutChanged()
@ -602,7 +604,7 @@ void KWinTabBoxConfig::slotLayoutChanged()
void KWinTabBoxConfig::slotConfigureLayoutClickedAlternative() void KWinTabBoxConfig::slotConfigureLayoutClickedAlternative()
{ {
KDialog* dialog = new KDialog( this ); QPointer<KDialog> dialog = new KDialog( this );
dialog->setCaption( i18n("Configure Layout") ); dialog->setCaption( i18n("Configure Layout") );
dialog->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Default ); dialog->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Default );
connect( dialog, SIGNAL(okClicked()), this, SLOT(slotLayoutChangedAlternative())); connect( dialog, SIGNAL(okClicked()), this, SLOT(slotLayoutChangedAlternative()));
@ -610,8 +612,8 @@ void KWinTabBoxConfig::slotConfigureLayoutClickedAlternative()
m_configForm->setConfig( m_tabBoxAlternativeConfig ); m_configForm->setConfig( m_tabBoxAlternativeConfig );
dialog->setMainWidget( m_configForm ); dialog->setMainWidget( m_configForm );
dialog->enableButtonApply( false ); dialog->exec();
dialog->show(); delete dialog;
} }
void KWinTabBoxConfig::slotLayoutChangedAlternative() void KWinTabBoxConfig::slotLayoutChangedAlternative()