X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/5c99790c945c827d45ce8bd9e1b7acd6657e6be3..fc56fb60c19301952bccd69ffad822914880d368:/src/dolphincontextmenu.cpp diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index dcf4b9b45..91e9d8238 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -103,7 +103,6 @@ DolphinContextMenu::Command DolphinContextMenu::open() } else if (m_context & ItemContext) { openItemContextMenu(); } else { - Q_ASSERT(m_context == NoContext); openViewportContextMenu(); } @@ -433,23 +432,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)); } } }