Bug 440366

Summary: 'Create New' submenu disabled/enabled status does not update correctly when switching between tabs
Product: [Applications] dolphin Reporter: nttkde <watisthispoo>
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: 08_mention.raddled, bugseforuns, kfm-devel, nate, oiiu19, philipihmurray, watisthispoo
Priority: NOR    
Version: 21.04.3   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 24.02
Sentry Crash Report:

Description nttkde 2021-07-28 17:38:33 UTC
'Create New' submenu disabled/enabled status does not update correctly when switching between tabs.

Steps to reproduce:
-have a folder open where you have write permissions
-right-click on the background (not on top of a file/folder) and observe that the Create New submenu is accessible, as it should

-then open a folder where you do not have write permissions (eg. Root) to a new tab and switch into it
-right-click on the background (not on top of a file/folder) and observe that the Create New submenu is disabled, as it should

-then switch back to the first tab and again right-click on background
-> the Create New submenu is still disabled!

-Pressing F5 will enable the submenu again. And then in turn it will stay enabled for the non-write-permission tab..




Same seems to apply to the Create New in File menu.

In contrast, the "Compress" submenu seems to work correctly. And all others seem to work when right-clicked on top of a file/folder.
Comment 1 Patrick Silva 2021-07-31 16:17:21 UTC
Can reproduce with Dolphin 21.08 RC on Arch Linux.
Comment 2 Patrick Silva 2021-09-07 12:54:28 UTC
*** Bug 441931 has been marked as a duplicate of this bug. ***
Comment 3 nttkde 2021-09-26 17:36:19 UTC
I think this is because sometimes DolphinView::setActive() doesn't emit the writeStateChanged signal. 
It seems some other call to the function at wrong time messes it up and the signal doesn't get emitted and/or then the active==m_active ends up being equal and returns.

Especially FocusIn event that calls it somewhere inbetween is maybe a bit sus?
If I (for the sake of testing) comment out the line "setActive(true)" in DolphinView::eventFilter in "case QEvent::FocusIn" (dolphinview.cpp:903), the menu seems to start working again.

There is a bug that perhaps might be related; see https://bugs.kde.org/show_bug.cgi?id=379135 and search/dolphinsearchbox.cpp:219.


It affects Create New submenus in the background-context menu, File menu and the hamburger menu, since those use the same DolphinNewFileMenu/KNewFileMenu object.
Right-click menu above a folder seems to create a separate DolphinNewFileMenu instance and selectedItemsProperties.supportsWriting() etc are used for setting other actions' enabled/disabled state so they're not affected.
Comment 4 Patrick Silva 2021-11-25 17:20:09 UTC
*** Bug 446070 has been marked as a duplicate of this bug. ***
Comment 5 Philip Murray 2023-10-05 16:35:29 UTC
I've been getting this quite often in Debian 12 whereas I didn't in Debian 11.

Additionally, I can fix the issue by navigating a folder in the the tab I expect to be able to create a directory in, but if I then go back to the tab with the directory I shouldn't be able to create files in - the context menu allows me to select Create New, but then the warning bar appears at the top saying "Could not make folder /... blah"

Debian 12 details:
Operating System: Debian GNU/Linux 12
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.0-11-amd64 (64-bit)
Graphics Platform: X11
Comment 6 Philip Murray 2023-10-05 16:42:30 UTC
Ah, my 'additionally' bit was already mentioned by nttkde.
Comment 7 Bug Janitor Service 2023-10-08 23:09:38 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/625
Comment 8 Felix Ernst 2023-10-12 09:49:31 UTC
Git commit 2f39eb51b6d92172905a4c39f3c1bcd8053f593b by Felix Ernst, on behalf of Amol Godbole.
Committed on 12/10/2023 at 11:43.
Pushed by felixernst into branch 'master'.

DolphinView: get rid of writeStateChanged signal in setActive()

The signal writeStateChanged() was not working because it is not connected
to slotWriteStateChanged() slots when the active view changes. Replace the
signal with direct calls to the slots.

Also, do not delay openRequest signal in DolphinSearchBox::slotSearchTextChanged.
It's no longer required.

M  +1    -0    src/dolphinmainwindow.cpp
M  +1    -3    src/search/dolphinsearchbox.cpp
M  +5    -1    src/views/dolphinview.cpp
M  +6    -1    src/views/dolphinview.h
M  +1    -0    src/views/dolphinviewactionhandler.cpp

https://invent.kde.org/system/dolphin/-/commit/2f39eb51b6d92172905a4c39f3c1bcd8053f593b