Bug 345411

Summary: Secondary shortcuts are not persisted correctly
Product: [Frameworks and Libraries] frameworks-kxmlgui Reporter: Mike Smith <kde>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: major CC: aroth, kde, linds.r, msx, peter, tim
Priority: NOR    
Version: 5.0.0   
Target Milestone: ---   
Platform: Archlinux   
OS: Linux   
Latest Commit: Version Fixed In: 5.10.0

Description Mike Smith 2015-03-22 04:41:57 UTC
Changing the secondary shortcut for an action which has two results in the primary shortcut being cleared.

Reproducible: Always

Steps to Reproduce:
1. Open the Configure Shortcuts dialog in an affected application (I've reproduced this in Kate and Konsole).
2. Find an action which by default has two key bindings (for example, Kate's Cut action has ctrl-X and shift-delete).
3. Change or remove the secondary binding.
4. Restart the application and open the Configure Shortcuts dialog again.

Actual Results:  
The primary shortcut is cleared (set to Custom, with the custom binding set to None). The secondary shortcut is reset to its default.

Expected Results:  
The key bindings I set are saved and restored the next time I run the application.

By experimenting with strace I've found that this is (as far as I can tell) stored in ~/.local/share/kxmlgui5/katepart/katepart5ui.rc. The following is added to that file after making the change:

 <ActionProperties scheme="Default">
  <Action shortcut="Ctrl+X; " name="edit_cut"/>
 </ActionProperties>

However, Kate's UI still displays "Custom: None" and "Default: Shift+Del".
Comment 1 Peter Cordes 2015-04-21 05:35:41 UTC
I'm seeing this too, on Kubuntu 15.04.  (KDE 5.9.0)
libkf5xmlgui5:amd64 5.9.0-0ubuntu1

I hadn't figured out yet that it was only multiple keybindings that were causing problems, so that's a help to be able to at least pick one.
Comment 2 Lindsay Roberts 2015-04-26 13:04:53 UTC
Confirmed on git master. Believe this bug is the cause behind the Konsole bugs:

https://bugs.kde.org/show_bug.cgi?id=340803
https://bugs.kde.org/show_bug.cgi?id=339243
https://bugs.kde.org/show_bug.cgi?id=337131
Comment 3 Andreas Roth 2015-04-28 05:01:17 UTC
I build kxmlgui with the patch from https://git.reviewboard.kde.org/r/123508/ and it works fine. Thanks Lindsay to track this down.
Comment 4 Lindsay Roberts 2015-05-02 09:04:57 UTC
Git commit c7b1b1b89e388779356a5dcde291d6e6eac7705b by Lindsay Roberts.
Committed on 02/05/2015 at 08:57.
Pushed by roberts into branch 'master'.

Fix shortcuts when secondary shortcut set.

If a user defined secondary ("alternate") shortcut is set, an issue in
KXMLGUIFactory causes reloading of both primary and secondary from the
RC file's DOM to fail, resulting in no effective shortcuts available for
the action. Fix by checking for the correct type in the shortcut
property for QActions.

REVIEW: 123508

M  +36   -0    autotests/kxmlgui_unittest.cpp
M  +1    -0    autotests/kxmlgui_unittest.h
M  +3    -2    src/kxmlguifactory.cpp

http://commits.kde.org/kxmlgui/c7b1b1b89e388779356a5dcde291d6e6eac7705b
Comment 5 Lindsay Roberts 2015-05-02 09:13:50 UTC
*** Bug 339243 has been marked as a duplicate of this bug. ***
Comment 6 Lindsay Roberts 2015-05-02 09:15:34 UTC
*** Bug 340803 has been marked as a duplicate of this bug. ***
Comment 7 Christoph Cullmann 2015-06-08 20:20:07 UTC
*** Bug 346950 has been marked as a duplicate of this bug. ***