Less Krazy warnings please: Using QPointers when showing modal dialogs via exec().

svn path=/trunk/KDE/kdebase/workspace/; revision=1063328
This commit is contained in:
Martin Gräßlin 2009-12-17 21:04:32 +00:00
parent 5744a0c0f2
commit 1114d8efa4
2 changed files with 20 additions and 16 deletions

View file

@ -587,8 +587,9 @@ void KWinDesktopConfig::slotAboutEffectClicked()
i++;
}
}
KAboutApplicationDialog aboutPlugin( &aboutData, this );
aboutPlugin.exec();
QPointer<KAboutApplicationDialog> aboutPlugin = new KAboutApplicationDialog( &aboutData, this );
aboutPlugin->exec();
delete aboutPlugin;
}
void KWinDesktopConfig::slotConfigureEffectClicked()
@ -603,19 +604,19 @@ void KWinDesktopConfig::slotConfigureEffectClicked()
return;
}
KCModuleProxy* proxy = new KCModuleProxy( effect );
KDialog configDialog( this );
configDialog.setWindowTitle( m_ui->effectComboBox->currentText() );
configDialog.setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Default );
connect(&configDialog, SIGNAL(defaultClicked()), proxy, SLOT(defaults()));
QPointer< KDialog > configDialog = new KDialog( this );
configDialog->setWindowTitle( m_ui->effectComboBox->currentText() );
configDialog->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Default );
connect(configDialog, SIGNAL(defaultClicked()), proxy, SLOT(defaults()));
QWidget *showWidget = new QWidget( &configDialog );
QWidget *showWidget = new QWidget( configDialog );
QVBoxLayout *layout = new QVBoxLayout;
showWidget->setLayout( layout );
layout->addWidget( proxy );
layout->insertSpacing( -1, KDialog::marginHint() );
configDialog.setMainWidget( showWidget );
configDialog->setMainWidget( showWidget );
if( configDialog.exec() == QDialog::Accepted )
if( configDialog->exec() == QDialog::Accepted )
{
proxy->save();
}
@ -623,6 +624,7 @@ void KWinDesktopConfig::slotConfigureEffectClicked()
{
proxy->load();
}
delete configDialog;
}
} // namespace

View file

@ -696,10 +696,11 @@ void RulesWidget::prepareWindowSpecific( WId window )
void RulesWidget::shortcutEditClicked()
{
EditShortcutDialog dlg( window());
dlg.setShortcut( shortcut->text());
if( dlg.exec() == QDialog::Accepted )
shortcut->setText( dlg.shortcut());
QPointer<EditShortcutDialog> dlg = new EditShortcutDialog( window());
dlg->setShortcut( shortcut->text());
if( dlg->exec() == QDialog::Accepted )
shortcut->setText( dlg->shortcut());
delete dlg;
}
RulesDialog::RulesDialog( QWidget* parent, const char* name )
@ -757,9 +758,10 @@ EditShortcut::EditShortcut( QWidget* parent )
void EditShortcut::editShortcut()
{
ShortcutDialog dlg( QKeySequence( shortcut->text()), window());
if( dlg.exec() == QDialog::Accepted )
shortcut->setText( dlg.shortcut().toString());
QPointer< ShortcutDialog > dlg = new ShortcutDialog( QKeySequence( shortcut->text()), window());
if( dlg->exec() == QDialog::Accepted )
shortcut->setText( dlg->shortcut().toString());
delete dlg;
}
void EditShortcut::clearShortcut()