- // insert 'Open in new window' and 'Open in new tab' entries
- addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_new_window")));
- addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_new_tab")));
-
- // Insert 'Open With' entries
- addOpenWithActions(fileItemActions);
-
- // set up 'Create New' menu
- DolphinNewFileMenu* newFileMenu = new DolphinNewFileMenu(m_mainWindow->actionCollection(), m_mainWindow);
- const DolphinView* view = m_mainWindow->activeViewContainer()->view();
- newFileMenu->setViewShowsHiddenFiles(view->hiddenFilesShown());
- newFileMenu->checkUpToDate();
- newFileMenu->setPopupFiles(m_fileInfo.url());
- newFileMenu->setEnabled(selectedItemsProps.supportsWriting());
- connect(newFileMenu, &DolphinNewFileMenu::fileCreated, newFileMenu, &DolphinNewFileMenu::deleteLater);
- connect(newFileMenu, &DolphinNewFileMenu::directoryCreated, newFileMenu, &DolphinNewFileMenu::deleteLater);
-
- QMenu* menu = newFileMenu->menu();
- menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
- menu->setIcon(QIcon::fromTheme(QStringLiteral("document-new")));
- addMenu(menu);
-
- addSeparator();
- } else if (m_baseUrl.scheme().contains(QLatin1String("search")) || m_baseUrl.scheme().contains(QLatin1String("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);
+ addDirectoryItemContextMenu();
+ } else if (m_context & TimelineContext || m_context & SearchContext) {
+ 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);
+ });