- addSeparator();
- } else if (m_baseUrl.scheme().contains(QStringLiteral("search")) || m_baseUrl.scheme().contains(QStringLiteral("timeline"))) {
- addOpenWithActions(fileItemActions);
-
- openParentAction = new QAction(QIcon::fromTheme(QStringLiteral("document-open-folder")),
- i18nc("@action:inmenu",
- "Open Path"),
- this);
- addAction(openParentAction);
-
- openParentInNewWindowAction = new QAction(QIcon::fromTheme(QStringLiteral("window-new")),
- i18nc("@action:inmenu",
- "Open Path in New Window"),
- this);
- addAction(openParentInNewWindowAction);
-
- openParentInNewTabAction = new QAction(QIcon::fromTheme(QStringLiteral("tab-new")),
- i18nc("@action:inmenu",
- "Open Path in New Tab"),
- this);
- addAction(openParentInNewTabAction);
+void DolphinContextMenu::addOpenParentFolderActions()
+{
+ addAction(QIcon::fromTheme(QStringLiteral("document-open-folder")), i18nc("@action:inmenu", "Open Path"), [this]() {
+ const QUrl url = m_fileInfo.targetUrl();
+ const QUrl parentUrl = KIO::upUrl(url);
+ m_mainWindow->changeUrl(parentUrl);
+ m_mainWindow->activeViewContainer()->view()->markUrlsAsSelected({url});
+ m_mainWindow->activeViewContainer()->view()->markUrlAsCurrent(url);
+ });
+
+ addAction(QIcon::fromTheme(QStringLiteral("tab-new")), i18nc("@action:inmenu", "Open Path in New Tab"), [this]() {
+ const QUrl url = m_fileInfo.targetUrl();
+ const QUrl parentUrl = KIO::upUrl(url);
+ DolphinTabPage *tabPage = m_mainWindow->openNewTab(parentUrl);
+ tabPage->activeViewContainer()->view()->markUrlsAsSelected({url});
+ tabPage->activeViewContainer()->view()->markUrlAsCurrent(url);
+ });
+
+ addAction(QIcon::fromTheme(QStringLiteral("window-new")), i18nc("@action:inmenu", "Open Path in New Window"), [this]() {
+ Dolphin::openNewWindow({m_fileInfo.targetUrl()}, m_mainWindow, Dolphin::OpenNewWindowFlag::Select);
+ });
+}