Bug 273262 - Highlighting menu: Keyboard accelerators wrong when shown the first time
Summary: Highlighting menu: Keyboard accelerators wrong when shown the first time
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kdelibs
Classification: Unmaintained
Component: kdeui (show other bugs)
Version: 3.0
Platform: Ubuntu Linux
: NOR minor
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
: 257960 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-05-14 12:41 UTC by Dmitry Balabka
Modified: 2024-09-14 17:06 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
patch to kdeui (1.13 KB, patch)
2012-11-04 19:49 UTC, Julien Muchembled
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Balabka 2011-05-14 12:41:38 UTC
Version:           3.0 (using KDE 4.6.2) 
OS:                Linux

When I try to access to main menu items using keyboard some items change their access char to first char. Problem appears only in first try to access to menu item

Reproducible: Always

Steps to Reproduce:
Launch KATE window. Now try change highlighting settings for PHP(HTML) scripts:
1. Press "Alt + t";
2. Then press "h". 
3. Then try to press "r". 


Actual Results:  
After "r" has been pressed а "Scripts" list had to appear, but it does not appear, because it access char has been changed to first char "S"(first char is underlined)


OS: Linux (i686) release 2.6.38-8-generic
Compiler: cc
Comment 1 Dominik Haumann 2011-05-15 10:24:38 UTC
When opening the Highlighting menu the first time, the entries "Scientific", "Scripts" and "Sources" all have the accelerator "&S". However, when opening the menu the second time, this issue is solved.

The reason for the multiple assignment of the accelerators is that we use the code
  QMenu *qmenu = new QMenu ('&'+hlSection);
in KateHighlightingMenu::slotAboutToShow().

We do use KAcceleratorManager [1] to automatically solve such clashes. However, the Highlighting menu is created on the fly by filling it in the slot KateHighlightingMenu::slotAboutToShow().

KAcceleratorManager also uses the signal aboutToShow() to handle dynamically chaning menus.

So the problem probably is that the accelerator manager checks clashes too early, i.e. before the highlighting menu is filled.

[1] http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/classKAcceleratorManager.html
Comment 2 Dominik Haumann 2011-05-15 20:33:36 UTC
As followup from the kde-devel mailing list: A possible solution is to make the KAcceleratorManager use the QShowEvent by using an event filter.

Right now, the constructor handling popup menus says (kdelibs/kdeui/shortcuts/kacceleratormanager.cpp):

KPopupAccelManager::KPopupAccelManager(QMenu *popup)
  : QObject(popup), m_popup(popup), m_count(-1)
{
    aboutToShow(); // do one check and then connect to show
    connect(popup, SIGNAL(aboutToShow()), SLOT(aboutToShow()));
}

Here, the event filter has to be installed on the popup menu.

Does anyone have a kdelibs build to try this?
Comment 3 Dominik Haumann 2011-08-16 09:56:24 UTC
*** Bug 257960 has been marked as a duplicate of this bug. ***
Comment 4 Julien Muchembled 2012-11-04 19:49:17 UTC
Created attachment 75007 [details]
patch to kdeui

This patch implements what is suggested on the mailing list:
  http://lists.kde.org/?l=kde-devel&m=130546957219649&w=2
I use KDE with this patch for 10 days now, and I'm not annoyed anymore by this bug :)
However, this is somewhat blind-programming because I don't know Qt/KDE API enough to explain why it seems to fix the bug (hence the lack of commit message in the patch).
Comment 5 Christoph Cullmann 2024-09-14 17:06:48 UTC
Hi,

kdelibs (version 4 and earlier) is no longer maintained since a few years.

KDE Frameworks 5 or 6 might already have resolved this bug.

If not, please re-open against the matching framework if feasible or against the application that shows the issue.

We then can still dispatch it to the right Bugzilla product or component.

Greetings
Christoph Cullmann