┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/dolphinviewactionhandler.cpp
diff options
context:
space:
mode:
authorYann Holme-Nielsen <[email protected]>2020-06-29 22:27:33 +0000
committerElvis Angelaccio <[email protected]>2020-06-29 22:27:33 +0000
commit86e3b82efbbcdb287773cdaf6a5f4c1c22bb9fc6 (patch)
tree7ce105d0ca28e4de8e019bc3dd36a050a5c05013 /src/views/dolphinviewactionhandler.cpp
parentd1baf3398e53931735b724672d5ae48649b44a18 (diff)
## Summary
* Adds a "Copy location" item, after the "Copy" Context item and Edit Menu, which will attempt to copy the path of the fist item into clipboard. ## Reasoning Most File Managers have this option through one or another way. Also using the default Copy option often results in different behaviour depending on the target software, Konsole will take the path. Other Programs will use the URI. Which ultimately could lead to non optimal User Experience. ## Notes * Should the target file **not** be on a local hard drive, this fallback to using the remote URL, feedback is wanted on that matter. FEATURE: 407004
Diffstat (limited to 'src/views/dolphinviewactionhandler.cpp')
-rw-r--r--src/views/dolphinviewactionhandler.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp
index e89e2e62c..29bd530b4 100644
--- a/src/views/dolphinviewactionhandler.cpp
+++ b/src/views/dolphinviewactionhandler.cpp
@@ -34,7 +34,6 @@
#include <KNewFileMenu>
#include <KPropertiesDialog>
#include <KProtocolManager>
-
#include <QMenu>
#include <QPointer>
@@ -156,6 +155,17 @@ void DolphinViewActionHandler::createActions()
m_actionCollection->setDefaultShortcuts(propertiesAction, {Qt::ALT + Qt::Key_Return, Qt::ALT + Qt::Key_Enter});
connect(propertiesAction, &QAction::triggered, this, &DolphinViewActionHandler::slotProperties);
+ QAction *copyPathAction = m_actionCollection->addAction( QStringLiteral("copy_location") );
+ copyPathAction->setText(i18nc("@action:incontextmenu", "Copy location"));
+ copyPathAction->setWhatsThis(i18nc("@info:whatsthis copy_location",
+ "This will copy the path of the first selected item into the clipboard."
+ ));
+
+ copyPathAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy")));
+ m_actionCollection->setDefaultShortcuts(copyPathAction, {Qt::CTRL + Qt::SHIFT + Qt::Key_C});
+ connect(copyPathAction, &QAction::triggered, this, &DolphinViewActionHandler::slotCopyPath);
+
+
// View menu
KToggleAction* iconsAction = iconsModeAction();
KToggleAction* compactAction = compactModeAction();
@@ -709,3 +719,8 @@ void DolphinViewActionHandler::slotProperties()
dialog->raise();
dialog->activateWindow();
}
+
+void DolphinViewActionHandler::slotCopyPath()
+{
+ m_currentView->copyPathToClipboard();
+}