┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphincontextmenu.cpp
diff options
context:
space:
mode:
authorMéven Car <[email protected]>2023-09-06 14:24:22 +0200
committerMéven Car <[email protected]>2023-09-06 14:39:15 +0200
commit3aa8cf00ee90b0414fa9b17f01eaade4507c4642 (patch)
tree54407e4f0292c8212d33186e0125d15b417e3349 /src/dolphincontextmenu.cpp
parent0e4d428e84099bf5d76e81640a2417d5457d83a4 (diff)
Add open containing folder options for files in recentlyused:/
Diffstat (limited to 'src/dolphincontextmenu.cpp')
-rw-r--r--src/dolphincontextmenu.cpp35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp
index 705f8e4a5..2eff1017f 100644
--- a/src/dolphincontextmenu.cpp
+++ b/src/dolphincontextmenu.cpp
@@ -75,6 +75,8 @@ void DolphinContextMenu::addAllActions()
m_context |= SearchContext;
} else if (scheme.contains(QLatin1String("timeline"))) {
m_context |= TimelineContext;
+ } else if (scheme == QStringLiteral("recentlyused")) {
+ m_context |= RecentlyUsedContext;
}
if (!m_fileInfo.isNull() && !m_selectedItems.isEmpty()) {
@@ -182,6 +184,23 @@ void DolphinContextMenu::addDirectoryItemContextMenu()
addSeparator();
}
+void DolphinContextMenu::addOpenParentFolderActions()
+{
+ addAction(QIcon::fromTheme(QStringLiteral("document-open-folder")), i18nc("@action:inmenu", "Open Path"), [this]() {
+ m_mainWindow->changeUrl(KIO::upUrl(m_fileInfo.url()));
+ m_mainWindow->activeViewContainer()->view()->markUrlsAsSelected({m_fileInfo.url()});
+ m_mainWindow->activeViewContainer()->view()->markUrlAsCurrent(m_fileInfo.url());
+ });
+
+ addAction(QIcon::fromTheme(QStringLiteral("tab-new")), i18nc("@action:inmenu", "Open Path in New Tab"), [this]() {
+ m_mainWindow->openNewTab(KIO::upUrl(m_fileInfo.url()));
+ });
+
+ addAction(QIcon::fromTheme(QStringLiteral("window-new")), i18nc("@action:inmenu", "Open Path in New Window"), [this]() {
+ Dolphin::openNewWindow({m_fileInfo.url()}, m_mainWindow, Dolphin::OpenNewWindowFlag::Select);
+ });
+}
+
void DolphinContextMenu::addItemContextMenu()
{
Q_ASSERT(!m_fileInfo.isNull());
@@ -194,22 +213,10 @@ void DolphinContextMenu::addItemContextMenu()
// single files
if (m_fileInfo.isDir()) {
addDirectoryItemContextMenu();
- } else if (m_context & TimelineContext || m_context & SearchContext) {
+ } else if (m_context & TimelineContext || m_context & SearchContext || m_context & RecentlyUsedContext) {
addOpenWithActions();
- addAction(QIcon::fromTheme(QStringLiteral("document-open-folder")), i18nc("@action:inmenu", "Open Path"), [this]() {
- m_mainWindow->changeUrl(KIO::upUrl(m_fileInfo.url()));
- m_mainWindow->activeViewContainer()->view()->markUrlsAsSelected({m_fileInfo.url()});
- m_mainWindow->activeViewContainer()->view()->markUrlAsCurrent(m_fileInfo.url());
- });
-
- addAction(QIcon::fromTheme(QStringLiteral("tab-new")), i18nc("@action:inmenu", "Open Path in New Tab"), [this]() {
- m_mainWindow->openNewTab(KIO::upUrl(m_fileInfo.url()));
- });
-
- addAction(QIcon::fromTheme(QStringLiteral("window-new")), i18nc("@action:inmenu", "Open Path in New Window"), [this]() {
- Dolphin::openNewWindow({m_fileInfo.url()}, m_mainWindow, Dolphin::OpenNewWindowFlag::Select);
- });
+ addOpenParentFolderActions();
addSeparator();
} else {