From: Peter Penz Date: Tue, 26 May 2009 18:24:23 +0000 (+0000) Subject: fixed krazy issues (see http://www.kdedevelopers.org/node/3919) X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/c848b945d44b3621d6418e6589ea5792003fa3c9?ds=sidebyside fixed krazy issues (see http://www.kdedevelopers.org/node/3919) svn path=/trunk/KDE/kdebase/apps/; revision=973269 --- diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index e59f9b282..5cea1bde0 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -648,16 +648,19 @@ void DolphinView::renameSelectedItems() if (itemCount > 1) { // More than one item has been selected for renaming. Open // a rename dialog and rename all items afterwards. - RenameDialog dialog(this, items); - if (dialog.exec() == QDialog::Rejected) { + QPointer dialog = new RenameDialog(this, items); + if (dialog->exec() == QDialog::Rejected) { + delete dialog; return; } - const QString newName = dialog.newName(); + const QString newName = dialog->newName(); if (newName.isEmpty()) { - emit errorMessage(dialog.errorString()); + emit errorMessage(dialog->errorString()); + delete dialog; return; } + delete dialog; // TODO: check how this can be integrated into KIO::FileUndoManager/KonqOperations // as one operation instead of n rename operations like it is done now... @@ -696,16 +699,19 @@ void DolphinView::renameSelectedItems() } else { Q_ASSERT(itemCount == 1); - RenameDialog dialog(this, items); - if (dialog.exec() == QDialog::Rejected) { + QPointer dialog = new RenameDialog(this, items); + if (dialog->exec() == QDialog::Rejected) { + delete dialog; return; } - const QString& newName = dialog.newName(); + const QString newName = dialog->newName(); if (newName.isEmpty()) { - emit errorMessage(dialog.errorString()); + emit errorMessage(dialog->errorString()); + delete dialog; return; } + delete dialog; const KUrl& oldUrl = items.first().url(); KUrl newUrl = oldUrl; diff --git a/src/dolphinviewactionhandler.cpp b/src/dolphinviewactionhandler.cpp index 71e9fd398..0885cceb9 100644 --- a/src/dolphinviewactionhandler.cpp +++ b/src/dolphinviewactionhandler.cpp @@ -539,8 +539,9 @@ void DolphinViewActionHandler::slotSortTriggered(QAction* action) void DolphinViewActionHandler::slotAdjustViewProperties() { emit actionBeingHandled(); - ViewPropertiesDialog dlg(m_currentView); - dlg.exec(); + QPointer dialog = new ViewPropertiesDialog(m_currentView); + dialog->exec(); + delete dialog; } void DolphinViewActionHandler::slotFindFile() diff --git a/src/main.cpp b/src/main.cpp index e7f277181..832ff18b2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -91,7 +91,7 @@ int main(int argc, char **argv) ++n; } } - app.exec(); + app.exec(); // krazy:exclude=crashy return 0; } diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index eb957f7b9..1e3bdb8a6 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -96,15 +96,16 @@ void FoldersPanel::rename(const KFileItem& item) } else { KFileItemList items; items.append(item); - RenameDialog dialog(this, items); - if (dialog.exec() == QDialog::Accepted) { - const QString& newName = dialog.newName(); + QPointer dialog = new RenameDialog(this, items); + if (dialog->exec() == QDialog::Accepted) { + const QString newName = dialog->newName(); if (!newName.isEmpty()) { KUrl newUrl = item.url(); newUrl.setFileName(newName); KonqOperations::rename(this, item.url(), newUrl); } } + delete dialog; } } diff --git a/src/panels/folders/treeviewcontextmenu.cpp b/src/panels/folders/treeviewcontextmenu.cpp index 3bc3ab9fe..32e92e05c 100644 --- a/src/panels/folders/treeviewcontextmenu.cpp +++ b/src/panels/folders/treeviewcontextmenu.cpp @@ -34,8 +34,9 @@ #include "folderspanel.h" -#include -#include +#include +#include +#include TreeViewContextMenu::TreeViewContextMenu(FoldersPanel* parent, const KFileItem& fileInfo) : @@ -182,8 +183,9 @@ void TreeViewContextMenu::deleteItem() void TreeViewContextMenu::showProperties() { - KPropertiesDialog dialog(m_fileInfo.url(), m_parent); - dialog.exec(); + QPointer dialog = new KPropertiesDialog(m_fileInfo.url(), m_parent); + dialog->exec(); + delete dialog; } void TreeViewContextMenu::setShowHiddenFiles(bool show) diff --git a/src/panels/information/newtagdialog.cpp b/src/panels/information/newtagdialog.cpp index 8785d578c..05189ea48 100644 --- a/src/panels/information/newtagdialog.cpp +++ b/src/panels/information/newtagdialog.cpp @@ -64,17 +64,18 @@ void NewTagDialog::slotLabelChanged( const QString& text ) Nepomuk::Tag NewTagDialog::createTag( QWidget* parent ) { - NewTagDialog dlg( parent ); - dlg.m_labelTitle->setText( i18nc( "@title:window", "Create New Tag" ) ); - dlg.m_labelTitle->setComment( i18nc( "@title:window subtitle to previous message", "with optional icon and description" ) ); - dlg.m_labelTitle->setPixmap( KIcon( "nepomuk" ).pixmap( 32, 32 ) ); + QPointer dlg = new NewTagDialog( parent ); + dlg->m_labelTitle->setText( i18nc( "@title:window", "Create New Tag" ) ); + dlg->m_labelTitle->setComment( i18nc( "@title:window subtitle to previous message", "with optional icon and description" ) ); + dlg->m_labelTitle->setPixmap( KIcon( "nepomuk" ).pixmap( 32, 32 ) ); - dlg.m_editTagLabel->setFocus(); + dlg->m_editTagLabel->setFocus(); - if ( dlg.exec() ) { - QString name = dlg.m_editTagLabel->text(); - QString comment = dlg.m_editTagComment->text(); - QString icon = dlg.m_buttonTagIcon->icon(); + if ( dlg->exec() ) { + QString name = dlg->m_editTagLabel->text(); + QString comment = dlg->m_editTagComment->text(); + QString icon = dlg->m_buttonTagIcon->icon(); + delete dlg; Nepomuk::Tag newTag( name ); newTag.setLabel( name ); @@ -88,6 +89,7 @@ Nepomuk::Tag NewTagDialog::createTag( QWidget* parent ) return newTag; } else { + delete dlg; return Nepomuk::Tag(); } } diff --git a/src/renamedialog.h b/src/renamedialog.h index 1eaae2c61..eca5f4d06 100644 --- a/src/renamedialog.h +++ b/src/renamedialog.h @@ -24,11 +24,12 @@ #include #include - class KFileItem; class KFileItemList; class KLineEdit; +#include + /** * @brief Dialog for renaming a variable number of files. * @@ -65,18 +66,12 @@ public: * been deleted by the user, although more than one item should be * renamed). */ - const QString& newName() const - { - return m_newName; - } + QString newName() const; /** * Returns the error string, if Dialog::newName() returned an empty string. */ - const QString& errorString() const - { - return m_errorString; - } + QString errorString() const; protected slots: virtual void slotButtonClicked(int button); @@ -90,4 +85,14 @@ private: friend class RenameDialogTest; // allow access for unit testing }; +inline QString RenameDialog::newName() const +{ + return m_newName; +} + +inline QString RenameDialog::errorString() const +{ + return m_errorString; +} + #endif diff --git a/src/settings/viewpropertiesdialog.cpp b/src/settings/viewpropertiesdialog.cpp index 7bd992ef1..7c5aa7e99 100644 --- a/src/settings/viewpropertiesdialog.cpp +++ b/src/settings/viewpropertiesdialog.cpp @@ -316,11 +316,12 @@ void ViewPropertiesDialog::configureAdditionalInfo() m_viewProps->setAdditionalInfo(info); } - AdditionalInfoDialog dialog(this, info); - if (dialog.exec() == QDialog::Accepted) { - m_viewProps->setAdditionalInfo(dialog.additionalInfo()); + QPointer dialog = new AdditionalInfoDialog(this, info); + if (dialog->exec() == QDialog::Accepted) { + m_viewProps->setAdditionalInfo(dialog->additionalInfo()); markAsDirty(true); } + delete dialog; } void ViewPropertiesDialog::applyViewProperties()