]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphinviewactionhandler.cpp
## Summary
[dolphin.git] / src / views / dolphinviewactionhandler.cpp
index e89e2e62c2b705e32223dca048334d6c22f7f224..29bd530b4e0e0f7ff49d0b70dc3d5a782ff356e9 100644 (file)
@@ -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();
+}