Bug 443512 - Unable to create a folder on desktop via F10 keyboard shortcut
Summary: Unable to create a folder on desktop via F10 keyboard shortcut
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: 5.22.90
Platform: Archlinux Linux
: VHI normal
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-10-09 11:32 UTC by Patrick Silva
Modified: 2021-10-19 14:45 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.23.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2021-10-09 11:32:49 UTC
STEPS TO REPRODUCE
1. minimize all windows
2. press F10 key
3. 

OBSERVED RESULT
nothing happens

EXPECTED RESULT
the dialog to create a new folder should open

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.22.90
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.2
Graphics Platform: Wayland

ADDITIONAL INFORMATION
F10 key works with Dolphin
Comment 1 Nate Graham 2021-10-10 16:35:46 UTC
Can reproduce.
Comment 2 Nate Graham 2021-10-10 22:26:33 UTC
Seems to be caused by the event filter added in https://invent.kde.org/plasma/plasma-desktop/-/commit/1b9b49b9fa823246c1880232e063c97fd7a916eb

If I comment out these lines in foldermodel.cpp, it starts working again:

    if (RemoveAction *removeAction = qobject_cast<RemoveAction *>(m_actionCollection.action(QStringLiteral("remove")))) {
        menu->installEventFilter(removeAction);
        QCoreApplication::instance()->installEventFilter(removeAction);
    }

Derek, would you be able to take a look? Thanks!
Comment 3 nl.smart 2021-10-11 17:11:46 UTC
Hi,

I reproduced your steps, no issue, tested on the desktop and dolphin.

Operating System: Manjaro 21.1.5 Pahvo
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.2
Kernel Version: x86_64 Linux 5.10.70-1-MANJARO
GTK Theme: Breeze [GTK2/3]
Icon Theme: oxygen
Graphics Platform: X11
Processors: Intel Core i7-10510U @ 8x 4.9GHz
Graphics Processor: Mesa Intel(R) UHD Graphics (CML GT2)
Comment 4 Nate Graham 2021-10-11 19:53:56 UTC
That makes sense because you're using Plasma 5.22.5 and this is a regression in 5.22.90 (aka 5.23 beta). :) Dolphin is also not relevant here since the bug is specific to Folder View, which handles the desktop icons. Dolphin isn't involved in that.
Comment 5 Derek Christ 2021-10-16 10:33:47 UTC
> Derek, would you be able to take a look? Thanks!

Sorry, I must have missed this. Will have a look
Comment 6 David Edmundson 2021-10-16 22:37:58 UTC
Please try to get rid of 
`    QApplication::instance()->installEventFilter(this);`

It will be causing a sizable amount of overhead for every interaction.
Comment 7 Derek Christ 2021-10-17 13:11:12 UTC
(In reply to David Edmundson from comment #6)
> Please try to get rid of 
> `    QApplication::instance()->installEventFilter(this);`
> 
> It will be causing a sizable amount of overhead for every interaction.

Sadly this is needed to fix bug 425997.
What do you think about removing the filter as soon as the context menu closes? So that it is only installed on QAppliaction when the menu is actually open.
Comment 8 David Edmundson 2021-10-17 15:55:08 UTC
>So that it is only installed on QAppliaction when the menu is actually open.

Yes, scoping it would be suitable for me.
Comment 9 Bug Janitor Service 2021-10-18 18:16:04 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/607
Comment 10 Nate Graham 2021-10-19 14:43:51 UTC
Git commit 12350fb1242c4dbfdb547926bdb093eb8da96b4b by Nate Graham, on behalf of Derek Christ.
Committed on 19/10/2021 at 14:42.
Pushed by ngraham into branch 'master'.

Fix create-folder-shortcut (F10)

The create folder shortcut worked as long as the user did not right-
click into an empty space on the desktop to invoke the context menu.

The problem was that the create-folder-action was set to not visible
so that it is not shown in the context menu. But as soon as the context
menu is opened, the action is set to not visible in the plasmoid
contextual action list. The reason it works before opening the menu is
because the action for the plasmoid is created without setting it to
not visible.

This commit fixes the bug by using an already existing workaround class
that uses an event filter to respond to the
KStandardShortcut::createFolder key sequence.

M  +5    -0    containments/desktop/package/contents/ui/FolderView.qml
M  +1    -1    containments/desktop/package/contents/ui/FolderViewLayer.qml
M  +0    -6    containments/desktop/plugins/folder/foldermodel.cpp
M  +2    -0    containments/desktop/plugins/folder/shortcut.cpp
M  +1    -0    containments/desktop/plugins/folder/shortcut.h

https://invent.kde.org/plasma/plasma-desktop/commit/12350fb1242c4dbfdb547926bdb093eb8da96b4b
Comment 11 Nate Graham 2021-10-19 14:44:50 UTC
Git commit d7bcf6dee0c764cf2fdbd022fd0ba4d278ff314e by Nate Graham, on behalf of Derek Christ.
Committed on 19/10/2021 at 14:44.
Pushed by ngraham into branch 'Plasma/5.23'.

Fix create-folder-shortcut (F10)

The create folder shortcut worked as long as the user did not right-
click into an empty space on the desktop to invoke the context menu.

The problem was that the create-folder-action was set to not visible
so that it is not shown in the context menu. But as soon as the context
menu is opened, the action is set to not visible in the plasmoid
contextual action list. The reason it works before opening the menu is
because the action for the plasmoid is created without setting it to
not visible.

This commit fixes the bug by using an already existing workaround class
that uses an event filter to respond to the
KStandardShortcut::createFolder key sequence.


(cherry picked from commit 12350fb1242c4dbfdb547926bdb093eb8da96b4b)

M  +5    -0    containments/desktop/package/contents/ui/FolderView.qml
M  +1    -1    containments/desktop/package/contents/ui/FolderViewLayer.qml
M  +0    -6    containments/desktop/plugins/folder/foldermodel.cpp
M  +2    -0    containments/desktop/plugins/folder/shortcut.cpp
M  +1    -0    containments/desktop/plugins/folder/shortcut.h

https://invent.kde.org/plasma/plasma-desktop/commit/d7bcf6dee0c764cf2fdbd022fd0ba4d278ff314e