- if ((addToPlacesAction != 0) && (activatedAction == addToPlacesAction)) {
- const KUrl selectedUrl(m_fileInfo.url());
- if (selectedUrl.isValid()) {
- DolphinSettings::instance().placesModel()->addPlace(selectedUrl.fileName(),
- selectedUrl);
- }
- } else if (openWithActions.contains(activatedAction)) {
- // one of the 'Open With' items has been selected
- if (openWithActions.last() == activatedAction) {
- // the item 'Other...' has been selected
- KRun::displayOpenWithDialog(m_selectedUrls, m_mainWindow);
+ QAction* openParentAction = nullptr;
+ QAction* openParentInNewWindowAction = nullptr;
+ QAction* openParentInNewTabAction = nullptr;
+ const KFileItemListProperties& selectedItemsProps = selectedItemsProperties();
+
+ KFileItemActions fileItemActions;
+ fileItemActions.setParentWidget(this);
+ 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();