diff options
| author | Peter Penz <[email protected]> | 2008-03-29 07:44:03 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-03-29 07:44:03 +0000 |
| commit | fc1503986032918ad84d420209c948b45c8bb375 (patch) | |
| tree | 06250b28b25778c0cc0c29f30a7855625cdf5ce1 /src/dolphinview.cpp | |
| parent | 2fdeb4f5bbbbb10ed98d43616740a52ed2fc14f7 (diff) | |
The paste operation should ignore the current selection to behave similar as Konqueror and other file managers. Only if a context menu for a folder is opened, a pasting should be done into this folder.
Some internal cleanups are still required (see TODO comments), so that after finishing the operation an indication can be given to the user in the statusbar (must go for breakfast now, otherwise I'll eat my keyboard...).
BUG: 159862
svn path=/trunk/KDE/kdebase/apps/; revision=791354
Diffstat (limited to 'src/dolphinview.cpp')
| -rw-r--r-- | src/dolphinview.cpp | 46 |
1 files changed, 2 insertions, 44 deletions
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 3f8933bd3..d905e5cab 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -1102,41 +1102,12 @@ void DolphinView::paste() const QMimeData* mimeData = clipboard->mimeData(); const KUrl::List sourceUrls = KUrl::List::fromMimeData(mimeData); - - // 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(); - if (selectedUrls.count() == 1) { - const KFileItem fileItem(S_IFDIR, - KFileItem::Unknown, - selectedUrls.first(), - true); - if (fileItem.isDir()) { - // 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("@action:button", "Paste"), "dialog-ok"), - KGuiItem(i18nc("@action:button", "Cancel"), "dialog-cancel")); - if (result == KMessageBox::No) { - return; - } - } - } - } - if (KonqMimeData::decodeIsCutSelection(mimeData)) { - KonqOperations::copy(this, KonqOperations::MOVE, sourceUrls, destUrl); + KonqOperations::copy(this, KonqOperations::MOVE, sourceUrls, url()); emit doingOperation(KonqFileUndoManager::MOVE); clipboard->clear(); } else { - KonqOperations::copy(this, KonqOperations::COPY, sourceUrls, destUrl); + KonqOperations::copy(this, KonqOperations::COPY, sourceUrls, url()); emit doingOperation(KonqFileUndoManager::COPY); } } @@ -1163,19 +1134,6 @@ QPair<bool, QString> DolphinView::pasteInfo() const ret.second = i18nc("@action:inmenu", "Paste"); } - if (ret.first) { - const KFileItemList items = selectedItems(); - const uint count = items.count(); - if (count > 1) { - // pasting should not be allowed when more than one file - // is selected - ret.first = false; - } else if (count == 1) { - // Only one file is selected. Pasting is only allowed if this - // file is a directory. - ret.first = items.first().isDir(); - } - } return ret; } |
