]> cloud.milkyroute.net Git - dolphin.git/commit
Bring back the "Create New" menu in the menu bar
authorJakob Petsovits <jpetso@petsovits.com>
Fri, 12 May 2023 22:13:39 +0000 (18:13 -0400)
committerJakob Petsovits <jpetso@petsovits.com>
Tue, 16 May 2023 15:11:51 +0000 (11:11 -0400)
commitb5b6762b15564919b32b33cde9961a75a2e3de22
tree73ee7951d2a5a61b7b535aca99ce8dd396637773
parent1b0caf69a845d0a68c3d8d1a6bdf98568a673501
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.
src/dolphincontextmenu.cpp
src/dolphinmainwindow.cpp
src/dolphinnewfilemenu.cpp
src/dolphinnewfilemenu.h
src/dolphinpart.cpp