┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphincontextmenu.cpp
diff options
context:
space:
mode:
authorJakob Petsovits <[email protected]>2023-05-12 18:13:39 -0400
committerJakob Petsovits <[email protected]>2023-05-16 11:11:51 -0400
commitb5b6762b15564919b32b33cde9961a75a2e3de22 (patch)
tree73ee7951d2a5a61b7b535aca99ce8dd396637773 /src/dolphincontextmenu.cpp
parent1b0caf69a845d0a68c3d8d1a6bdf98568a673501 (diff)
Bring back the "Create New" menu in the menu bar
This commit is the result of a three-way diff that combines my own initial patch with related changes from Felix Ernst's MR !545 and further suggestions by Méven Car. Fixes DolphinMainWindowTest::testNewFileMenuEnabled(). Tests are now passing again for my build. "Create New" was broken by commit c64059bd which switched to the new, non-deprecated KNewFileMenu constructor (kio commit 89bc6bad) that doesn't add itself to the passed KActionCollection parameter. After the switch, hamburger menu and context menu was still working as intended but the menu bar was missing the "Create New" menu. This commit adds the addAction("new_menu") call to the File menu setup that would have previously been called by the deprecated KNewFileMenu constructor. The corresponding test can now find the QObject for the menu's named action again, verifying its existence and enabled-ness like it did before. The DolphinNewFileMenu constructor's unused actionCollection parameter serves no use anymore except to confuse people. We replace it with a single QAction* parameter, createDirAction, which gets passed to setNewFolderShortcutAction(). 2 out of 3 constructor call sites have access to this action, while the remaining call site in dolphinmainwindow.cpp must wait until after it has been initialized by DolphinViewActionHandler. In this case, setNewFolderShortcutAction() is still called manually at a later time.
Diffstat (limited to 'src/dolphincontextmenu.cpp')
-rw-r--r--src/dolphincontextmenu.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp
index 3519d416a..62990cab2 100644
--- a/src/dolphincontextmenu.cpp
+++ b/src/dolphincontextmenu.cpp
@@ -168,8 +168,7 @@ void DolphinContextMenu::addDirectoryItemContextMenu()
addOpenWithActions();
// set up 'Create New' menu
- DolphinNewFileMenu *newFileMenu = new DolphinNewFileMenu(m_mainWindow->actionCollection(), m_mainWindow);
- newFileMenu->setNewFolderShortcutAction(m_mainWindow->actionCollection()->action("create_dir"));
+ DolphinNewFileMenu *newFileMenu = new DolphinNewFileMenu(m_mainWindow->actionCollection()->action(QStringLiteral("create_dir")), m_mainWindow);
newFileMenu->checkUpToDate();
newFileMenu->setWorkingDirectory(m_fileInfo.url());
newFileMenu->setEnabled(selectedItemsProps.supportsWriting());