+ QAction* openParentAction = nullptr;
+ QAction* openParentInNewWindowAction = nullptr;
+ QAction* openParentInNewTabAction = nullptr;
+ const KFileItemListProperties& selectedItemsProps = selectedItemsProperties();
+
+ KFileItemActions fileItemActions;
+ fileItemActions.setParentWidget(m_mainWindow);
+ fileItemActions.setItemListProperties(selectedItemsProps);
+
+ if (m_selectedItems.count() == 1) {
+ // single files
+ if (m_fileInfo.isDir()) {
+ addDirectoryItemContextMenu(fileItemActions);
+ } else if (m_context & TimelineContext || m_context & SearchContext) {
+ 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);
+
+ addSeparator();
+ } else {
+ // Insert 'Open With" entries
+ addOpenWithActions(fileItemActions);
+ }
+ if (m_fileInfo.isLink()) {
+ addAction(m_mainWindow->actionCollection()->action(QStringLiteral("show_target")));
+ addSeparator();
+ }
+ } else {
+ // multiple files
+ bool selectionHasOnlyDirs = true;
+ for (const auto &item : qAsConst(m_selectedItems)) {
+ const QUrl& url = DolphinView::openItemAsFolderUrl(item);
+ if (url.isEmpty()) {
+ selectionHasOnlyDirs = false;
+ break;
+ }
+ }