X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/f4e6647cdc652a550b61a0b9c075b93e935197d9..fbe257768cf88efb65064b3302aa88c074eaf719:/src/dolphinview.cpp diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 0cf740cd5..4800b9e9a 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -39,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -49,6 +49,7 @@ #include "dolphinmodel.h" #include "dolphincolumnview.h" #include "dolphincontroller.h" +#include "dolphinfileitemdelegate.h" #include "dolphinsortfilterproxymodel.h" #include "dolphindetailsview.h" #include "dolphiniconsview.h" @@ -865,11 +866,9 @@ void DolphinView::emitContentsMoved() void DolphinView::showHoverInformation(const KFileItem& item) { - if (hasSelection() || !m_active) { - return; + if (!hasSelection()) { + emit requestItemInfo(item); } - - emit requestItemInfo(item); } void DolphinView::clearHoverInformation() @@ -910,7 +909,7 @@ void DolphinView::createView() m_controller->setItemView(view); - m_fileItemDelegate = new KFileItemDelegate(view); + m_fileItemDelegate = new DolphinFileItemDelegate(view); view->setItemDelegate(m_fileItemDelegate); view->setModel(m_proxyModel); @@ -1103,8 +1102,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 +1116,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 %1 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; + } + } } } @@ -1139,7 +1149,14 @@ QPair DolphinView::pasteInfo() const KUrl::List urls = KUrl::List::fromMimeData(mimeData); if (!urls.isEmpty()) { ret.first = true; - ret.second = i18ncp("@action:inmenu", "Paste One File", "Paste %1 Files", urls.count()); + if (urls.count() == 1) { + const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, urls.first(), true); + ret.second = item.isDir() ? i18nc("@action:inmenu", "Paste One Folder") : + i18nc("@action:inmenu", "Paste One File"); + + } else { + ret.second = i18ncp("@action:inmenu", "Paste One Item", "Paste %1 Items", urls.count()); + } } else { ret.first = false; ret.second = i18nc("@action:inmenu", "Paste");