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<RenameDialog> 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...
} else {
Q_ASSERT(itemCount == 1);
- RenameDialog dialog(this, items);
- if (dialog.exec() == QDialog::Rejected) {
+ QPointer<RenameDialog> 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;
void DolphinViewActionHandler::slotAdjustViewProperties()
{
emit actionBeingHandled();
- ViewPropertiesDialog dlg(m_currentView);
- dlg.exec();
+ QPointer<ViewPropertiesDialog> dialog = new ViewPropertiesDialog(m_currentView);
+ dialog->exec();
+ delete dialog;
}
void DolphinViewActionHandler::slotFindFile()
++n;
}
}
- app.exec();
+ app.exec(); // krazy:exclude=crashy
return 0;
}
} else {
KFileItemList items;
items.append(item);
- RenameDialog dialog(this, items);
- if (dialog.exec() == QDialog::Accepted) {
- const QString& newName = dialog.newName();
+ QPointer<RenameDialog> 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;
}
}
#include "folderspanel.h"
-#include <QtGui/QApplication>
-#include <QtGui/QClipboard>
+#include <QApplication>
+#include <QClipboard>
+#include <QPointer>
TreeViewContextMenu::TreeViewContextMenu(FoldersPanel* parent,
const KFileItem& fileInfo) :
void TreeViewContextMenu::showProperties()
{
- KPropertiesDialog dialog(m_fileInfo.url(), m_parent);
- dialog.exec();
+ QPointer<KPropertiesDialog> dialog = new KPropertiesDialog(m_fileInfo.url(), m_parent);
+ dialog->exec();
+ delete dialog;
}
void TreeViewContextMenu::setShowHiddenFiles(bool show)
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<NewTagDialog> 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 );
return newTag;
}
else {
+ delete dlg;
return Nepomuk::Tag();
}
}
#include <kdialog.h>
#include <kurl.h>
-
class KFileItem;
class KFileItemList;
class KLineEdit;
+#include <QString>
+
/**
* @brief Dialog for renaming a variable number of files.
*
* 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);
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
m_viewProps->setAdditionalInfo(info);
}
- AdditionalInfoDialog dialog(this, info);
- if (dialog.exec() == QDialog::Accepted) {
- m_viewProps->setAdditionalInfo(dialog.additionalInfo());
+ QPointer<AdditionalInfoDialog> dialog = new AdditionalInfoDialog(this, info);
+ if (dialog->exec() == QDialog::Accepted) {
+ m_viewProps->setAdditionalInfo(dialog->additionalInfo());
markAsDirty(true);
}
+ delete dialog;
}
void ViewPropertiesDialog::applyViewProperties()