From 1114d8efa4a045da87a56ab56d19dcd8fc1eefb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 17 Dec 2009 21:04:32 +0000 Subject: [PATCH] Less Krazy warnings please: Using QPointers when showing modal dialogs via exec(). svn path=/trunk/KDE/kdebase/workspace/; revision=1063328 --- kcmkwin/kwindesktop/main.cpp | 20 +++++++++++--------- kcmkwin/kwinrules/ruleswidget.cpp | 16 +++++++++------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/kcmkwin/kwindesktop/main.cpp b/kcmkwin/kwindesktop/main.cpp index 09fef69101..15b08adea0 100644 --- a/kcmkwin/kwindesktop/main.cpp +++ b/kcmkwin/kwindesktop/main.cpp @@ -587,8 +587,9 @@ void KWinDesktopConfig::slotAboutEffectClicked() i++; } } - KAboutApplicationDialog aboutPlugin( &aboutData, this ); - aboutPlugin.exec(); + QPointer 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 diff --git a/kcmkwin/kwinrules/ruleswidget.cpp b/kcmkwin/kwinrules/ruleswidget.cpp index 52d489b522..6572826d0d 100644 --- a/kcmkwin/kwinrules/ruleswidget.cpp +++ b/kcmkwin/kwinrules/ruleswidget.cpp @@ -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 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()