diff options
| author | Peter Penz <[email protected]> | 2008-03-12 22:03:16 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-03-12 22:03:16 +0000 |
| commit | c2e537a8b1a68747f5e5f5a5746b55804e5cf472 (patch) | |
| tree | a4dde3c3a8f45939b44f90f30b83952811119f4d /src | |
| parent | a9ff230a665f82483524d593e7dd4f32751c6d93 (diff) | |
If a user pastes a directory into itself, ask him whether this intended and give him the chance to cancel the operation.
BUG: 159207
svn path=/trunk/KDE/kdebase/apps/; revision=784965
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphinview.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 0cf740cd5..467f4ece4 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -39,6 +39,7 @@ #include <kio/previewjob.h> #include <kjob.h> #include <kmenu.h> +#include <kmessagebox.h> #include <kmimetyperesolver.h> #include <konq_operations.h> #include <konqmimedata.h> @@ -1103,8 +1104,8 @@ void DolphinView::paste() const KUrl::List sourceUrls = KUrl::List::fromMimeData(mimeData); - // per default the pasting is done into the current Url of the view - KUrl destUrl(url()); + // per default the pasting is done into the current URL of the view + KUrl destUrl = url(); // check whether the pasting should be done into a selected directory const KUrl::List selectedUrls = this->selectedUrls(); @@ -1117,6 +1118,17 @@ void DolphinView::paste() // only one item is selected which is a directory, hence paste // into this directory destUrl = selectedUrls.first(); + if (sourceUrls.contains(destUrl)) { + const QString text = i18nc("@info", "The folder <filename>%1</filename> is pasted into itself. Is this intended?", fileItem.name()); + int result = KMessageBox::questionYesNo(window(), + text, + i18nc("@title:window", "Paste into Folder"), + KGuiItem(i18nc("@label", "Paste"), "dialog-ok"), + KGuiItem(i18nc("@label", "Cancel"), "dialog-cancel")); + if (result == KMessageBox::No) { + return; + } + } } } |
