Bug 405780 - "Create New..." button can't appear in the toolbar
Summary: "Create New..." button can't appear in the toolbar
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 18.12.3
Platform: OpenSUSE Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
: 406635 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-03-23 11:59 UTC by kde
Modified: 2019-04-18 19:17 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 19.04.1


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kde 2019-03-23 11:59:23 UTC
SUMMARY
The "Create New..." button is never shown in Dolphin's toolbar

STEPS TO REPRODUCE
- configure toolbar to have a "Create New..." button

OBSERVED RESULT
- there is no button

EXPECTED RESULT
- button should be there

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20190320
KDE Plasma Version: 5.15.3
KDE Frameworks Version: 5.55.0
Qt Version: 5.12.0
Kernel Version: 5.0.2-1-default
OS Type: 64-bit
Processors: 4 × Intel® Core™ i5-2540M CPU @ 2.60GHz
Memory: 15,5 GiB

ADDITIONAL INFORMATION
On another PC (also latest TW with Plasma 5.15.3 and Frameworks 5.55.0), there _is_ a "Create New..." button, despite not being configured in the toolbar's settings.
Enabling it does nothing (still just one button), disabling it again also has no effect (button _still_ shown despite not being enabled).
Comment 1 Mike Krutov 2019-03-23 15:33:39 UTC
Can confirm, I don't have the button either.
Comment 2 Rog131 2019-04-17 19:48:30 UTC
*** Bug 406635 has been marked as a duplicate of this bug. ***
Comment 3 Nate Graham 2019-04-17 19:54:49 UTC
We have a report that this worked in 17.12.3, so it seems to have regressed recently. I'll see if I can figure out how and why.
Comment 4 Nate Graham 2019-04-17 21:13:25 UTC
with git bisect, I found that this broke with https://cgit.kde.org/dolphin.git/commit/?id=dec7016c0d52129340a5b47f6de4df8af5115e21

Specifically, this bit:


diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 3e3803d..a93405f 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -1066,6 +1066,7 @@ void DolphinMainWindow::setupActions()
 {
     // setup 'File' menu
     m_newFileMenu = new DolphinNewFileMenu(actionCollection(), this);
+    m_newFileMenu->setObjectName("newFileMenu");
     QMenu* menu = m_newFileMenu->menu();
     menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
     menu->setIcon(QIcon::fromTheme(QStringLiteral("document-new")));
Comment 5 Kai Uwe Broulik 2019-04-18 09:36:28 UTC
Adding an action to KActionCollection sets its objectName to the given name. 
DolphinNewFileMenu calls KNewFileMenu with "new_menu". I think the line Nate identified as causing the issue can be removed and the unittest adjusted to just look findChild("new_menu") instead of "newFileMenu".
Comment 6 Nate Graham 2019-04-18 13:46:25 UTC
Thanks Kai, that makes perfect sense. Patch: https://phabricator.kde.org/D20664
Comment 7 Nate Graham 2019-04-18 19:17:08 UTC
Git commit 48c082767e3124b1ac6575f83bfcdcdc3e3e9b62 by Nate Graham.
Committed on 18/04/2019 at 19:17.
Pushed by ngraham into branch 'Applications/19.04'.

Fix adding "Create New..." menu to toolbar

Summary:
Access the object by its existing name rather than renaming it.
FIXED-IN: 19.04.1

Test Plan:
- Add {nav Create New} item to toolbar; it now works
- Verify that {nav Create New} menu and toolbar items are disabled when in the trash
- All tests still pass

Reviewers: elvisangelaccio, broulik, #dolphin, cfeck

Reviewed By: cfeck

Subscribers: cfeck, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D20664

M  +0    -1    src/dolphinmainwindow.cpp
M  +1    -1    src/tests/dolphinmainwindowtest.cpp

https://commits.kde.org/dolphin/48c082767e3124b1ac6575f83bfcdcdc3e3e9b62