- Q_ASSERT(popup != 0);
- const KActionCollection* collection = m_mainWindow->actionCollection();
-
- // insert 'Cut', 'Copy' and 'Paste'
- QAction* cutAction = collection->action(KStandardAction::name(KStandardAction::Cut));
- QAction* copyAction = collection->action(KStandardAction::name(KStandardAction::Copy));
- QAction* pasteAction = createPasteAction();
-
- popup->addAction(cutAction);
- popup->addAction(copyAction);
- popup->addAction(pasteAction);
- popup->addSeparator();
-
- // insert 'Rename'
- QAction* renameAction = collection->action("rename");
- popup->addAction(renameAction);
-
- // insert 'Move to Trash' and (optionally) 'Delete'
- KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::IncludeGlobals);
- KConfigGroup configGroup(globalConfig, "KDE");
- bool showDeleteCommand = configGroup.readEntry("ShowDeleteCommand", false);
-
- const KUrl& url = m_mainWindow->activeViewContainer()->url();
- if (url.isLocalFile()) {
- QAction* moveToTrashAction = collection->action("move_to_trash");
- popup->addAction(moveToTrashAction);
- } else {
- showDeleteCommand = true;
+ const KFileItemListProperties baseUrlProperties(KFileItemList() << baseFileItem());
+ m_fileItemActions->setItemListProperties(baseUrlProperties);
+
+ // Set up and insert 'Create New' menu
+ KNewFileMenu *newFileMenu = m_mainWindow->newFileMenu();
+ newFileMenu->checkUpToDate();
+ newFileMenu->setWorkingDirectory(m_baseUrl);
+ addMenu(newFileMenu->menu());
+
+ // Show "open with" menu items even if the dir is empty, because there are legitimate
+ // use cases for this, such as opening an empty dir in Kate or VSCode or something
+ addOpenWithActions();
+
+ QAction *pasteAction = createPasteAction();
+ if (pasteAction) {
+ addAction(pasteAction);