From 86e3b82efbbcdb287773cdaf6a5f4c1c22bb9fc6 Mon Sep 17 00:00:00 2001 From: Yann Holme-Nielsen Date: Mon, 29 Jun 2020 22:27:33 +0000 Subject: ## 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 --- src/dolphinmainwindow.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index d45b77676..5741e8943 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1129,6 +1129,7 @@ void DolphinMainWindow::updateControlMenu() // Add "Edit" actions bool added = addActionToMenu(ac->action(KStandardAction::name(KStandardAction::Undo)), menu) | + addActionToMenu(ac->action(QString("copy_location")), menu) | addActionToMenu(ac->action(QStringLiteral("copy_to_inactive_split_view")), menu) | addActionToMenu(ac->action(QStringLiteral("move_to_inactive_split_view")), menu) | addActionToMenu(ac->action(KStandardAction::name(KStandardAction::SelectAll)), menu) | @@ -1911,6 +1912,7 @@ void DolphinMainWindow::updateFileAndEditActions() QAction* addToPlacesAction = col->action(QStringLiteral("add_to_places")); QAction* copyToOtherViewAction = col->action(QStringLiteral("copy_to_inactive_split_view")); QAction* moveToOtherViewAction = col->action(QStringLiteral("move_to_inactive_split_view")); + QAction* copyLocation = col->action(QString("copy_location")); if (list.isEmpty()) { stateChanged(QStringLiteral("has_no_selection")); @@ -1918,6 +1920,7 @@ void DolphinMainWindow::updateFileAndEditActions() addToPlacesAction->setEnabled(true); copyToOtherViewAction->setEnabled(false); moveToOtherViewAction->setEnabled(false); + copyLocation->setEnabled(false); } else { stateChanged(QStringLiteral("has_selection")); @@ -1959,6 +1962,7 @@ void DolphinMainWindow::updateFileAndEditActions() deleteAction->setEnabled(capabilitiesSource.supportsDeleting()); deleteWithTrashShortcut->setEnabled(capabilitiesSource.supportsDeleting() && !enableMoveToTrash); cutAction->setEnabled(capabilitiesSource.supportsMoving()); + copyLocation->setEnabled(list.length() == 1); showTarget->setEnabled(list.length() == 1 && list.at(0).isLink()); duplicateAction->setEnabled(capabilitiesSource.supportsWriting()); } -- cgit v1.3