diff options
| author | David Faure <[email protected]> | 2014-10-21 20:44:37 +0200 |
|---|---|---|
| committer | David Faure <[email protected]> | 2014-10-21 21:59:05 +0200 |
| commit | 9bf03a3c48f4847b5e0417e3529bf071108cbf1e (patch) | |
| tree | 7a0e06ebb453498a51e69af723527fb63bd177bc /src/dolphincontextmenu.cpp | |
| parent | 0ce1c983b55fb79574fd4764e3ae8355f82ebf20 (diff) | |
Dolphin: port to KIO::pasteInfoText().
DolphinContextMenu::createPasteAction used to be precise about destination
("Paste To Folder"), while now it's precise about the source (what to paste).
It was decided that this was more useful and consistent anyway.
REVIEW: 120695
Diffstat (limited to 'src/dolphincontextmenu.cpp')
| -rw-r--r-- | src/dolphincontextmenu.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index b01346985..cb389b19c 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -34,8 +34,8 @@ #include <KIO/RestoreJob> #include <KIO/EmptyTrashJob> #include <KIO/JobUiDelegate> +#include <KIO/Paste> #include <KJobWidgets> -#include <QMenu> #include <KMimeTypeTrader> #include <KNewFileMenu> #include <konq_operations.h> @@ -44,7 +44,11 @@ #include <KStandardAction> #include <KToolBar> +#include <QApplication> +#include <QClipboard> #include <QMenuBar> +#include <QMenu> + #include <panels/places/placesitem.h> #include <panels/places/placesitemmodel.h> @@ -439,9 +443,11 @@ QAction* DolphinContextMenu::createPasteAction() QAction* action = 0; const bool isDir = !m_fileInfo.isNull() && m_fileInfo.isDir(); if (isDir && (m_selectedItems.count() == 1)) { - const QPair<bool, QString> pasteInfo = KonqOperations::pasteInfo(m_fileInfo.url()); - action = new QAction(QIcon::fromTheme("edit-paste"), i18nc("@action:inmenu", "Paste Into Folder"), this); - action->setEnabled(pasteInfo.first); + const QMimeData *mimeData = QApplication::clipboard()->mimeData(); + bool canPaste; + const QString text = KIO::pasteActionText(mimeData, &canPaste, m_fileInfo); + action = new QAction(QIcon::fromTheme("edit-paste"), text, this); + action->setEnabled(canPaste); connect(action, &QAction::triggered, m_mainWindow, &DolphinMainWindow::pasteIntoFolder); } else { action = m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::Paste)); |
