]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Re-allow to paste files via context menu
authorMéven Car <meven29@gmail.com>
Mon, 30 Nov 2020 08:01:27 +0000 (09:01 +0100)
committerMéven Car <meven29@gmail.com>
Mon, 30 Nov 2020 21:18:48 +0000 (22:18 +0100)
BUG: 429762

src/dolphincontextmenu.cpp

index dcf4b9b45f789cc3ffc4ffe4ddd344f64701ca33..283f5256509cd85346d52a3947642b18e8f02730 100644 (file)
@@ -433,23 +433,23 @@ QAction* DolphinContextMenu::createPasteAction()
 {
     QAction* action = nullptr;
     KFileItem destItem;
-    if (!m_fileInfo.isNull()) {
+    if (!m_fileInfo.isNull() && m_selectedItems.count() <= 1) {
         destItem = m_fileInfo;
     } else {
         destItem = baseFileItem();
     }
 
     if (!destItem.isNull() && destItem.isDir()) {
-        if (m_selectedItems.count() <= 1) {
-            const QMimeData *mimeData = QApplication::clipboard()->mimeData();
-            bool canPaste;
-            const QString text = KIO::pasteActionText(mimeData, &canPaste, destItem);
-            action = new QAction(QIcon::fromTheme(QStringLiteral("edit-paste")), text, this);
-            if (canPaste) {
+        const QMimeData *mimeData = QApplication::clipboard()->mimeData();
+        bool canPaste;
+        const QString text = KIO::pasteActionText(mimeData, &canPaste, destItem);
+        if (canPaste) {
+            if (destItem == m_fileInfo) {
+                // if paste destination is a selected folder
+                action = new QAction(QIcon::fromTheme(QStringLiteral("edit-paste")), text, this);
                 connect(action, &QAction::triggered, m_mainWindow, &DolphinMainWindow::pasteIntoFolder);
             } else {
-                // don't add the unavailable action
-                action = nullptr;
+                action = m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::Paste));
             }
         }
     }