Bug 427072

Summary: Global and Global Alternate columns are present in "Configure keyboard shortcuts" window even when not supported
Product: [Applications] Elisa Reporter: Patrick Silva <bugseforuns>
Component: generalAssignee: Matthieu Gallien <matthieu_gallien>
Status: RESOLVED FIXED    
Severity: normal CC: nate
Priority: NOR Keywords: junior-jobs
Version: 20.08.1   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=427129
Latest Commit: Version Fixed In: 20.12
Attachments: screenshot

Description Patrick Silva 2020-09-28 14:03:41 UTC
Created attachment 131983 [details]
screenshot

SUMMARY
As we can see in the attached screenshot, Global and Global Alternate columns are present in "Configure keyboard shortcuts" window. But it's impossible to set these types of shortcuts.

EXPECTED RESULT
only columns of supported keyboard shortcuts types should be present in "Configure keyboard shortcuts" window.

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.20.80
KDE Frameworks Version: 5.75.0
Qt Version: 5.15.0
Comment 1 Nate Graham 2020-09-29 17:49:51 UTC
This seems to be an issue with the keyboard shortcut configuration window in general, as now that you've called attention to this, I realize that it's affecting all other apps too.
Comment 2 Nate Graham 2020-09-29 19:22:09 UTC
in kshortcutseditor.cpp, there is already some code which can hide these columns if kglobalaccel is missing:

#if HAVE_GLOBALACCEL
    bool hideGlobals = !(actionTypes & KShortcutsEditor::GlobalAction);
#else
    bool hideGlobals = true;
#endif

    if (hideGlobals) {
        ui.list->header()->hideSection(GlobalPrimary);
        ui.list->header()->hideSection(GlobalAlternate);


I guess we just need to hook this up to something that knows it's being used to display application-specific shortcuts. Unclear if the dialog itself can know this, or if it needs to be told, in which case all applications using it would need to be ported to tell it so.
Comment 3 Nate Graham 2020-09-29 19:26:23 UTC
Oh I guess it's already there, but the apps need to be setting KShortcutsEditor::ActionTypes correctly.
Comment 4 Nate Graham 2020-09-29 19:35:52 UTC
Heh, and Elisa is setting it wrong:

#if defined KF5XmlGui_FOUND && KF5XmlGui_FOUND
    KShortcutsDialog dlg(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, nullptr);
    dlg.setModal(true);
    dlg.addCollection(&d->mCollection);
    dlg.configure();
#endif

Fixing momentarily.
Comment 5 Nate Graham 2020-09-29 20:01:22 UTC
Git commit 0ebd0242012a89e07fcb2682a6bc7b02d731b767 by Nate Graham.
Committed on 29/09/2020 at 19:58.
Pushed by ngraham into branch 'master'.

Don't show unnecessary global shortcuts columns in keyboard shortcuts window

Elisa doesn't set any global shortcuts, so the columns are blank and
waste space.
FIXED-IN: 20.12

M  +1    -1    src/elisaapplication.cpp

https://invent.kde.org/multimedia/elisa/commit/0ebd0242012a89e07fcb2682a6bc7b02d731b767