Bug 362134 - Alternative shortcuts breaks primary shortcuts in Krita 3.0 alpha.
Summary: Alternative shortcuts breaks primary shortcuts in Krita 3.0 alpha.
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Usability (show other bugs)
Version: 3.0 Alpha
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-23 12:03 UTC by Tyson Tan
Modified: 2016-05-06 05:17 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tyson Tan 2016-04-23 12:03:12 UTC
In krita3-testing_2+git20160422+r10-67~ubuntu16.04.1_amd64, after adding an alternative shortcut, krita fails to recognize the primary one -- it becomes empty, and remains that way. I cannot change or reset. Alternative ones works fine. Maybe the configuration for primary shortcuts is broken?

Is this related to https://bugs.kde.org/show_bug.cgi?id=361325 ?

Reproducible: Always
Comment 1 wolthera 2016-04-23 15:04:29 UTC
can confirm.
Comment 2 Stefano Bonicatti 2016-04-24 09:49:10 UTC
So i'm trying to fix this since yesterday, but all i can see is a mess with the action and shortcut dealing.
We have a lot of duplicate code that does duplicate stuff and gets called multiple time to do (apparently the same?) thing.
Namely KActionCollection writes the shortcut settings in kritashortcutsrc through writeSettings function when they are changed, though there it loops through the actions and it write both shortcuts (primary and alternate), with a format that is "actionName=primary; alternate".
When Krita loads, readSettings gets called which internally calls loadCustomShortcuts of our KisActionRegistry class and here a first bell rang: we do have a writeCustomShortcuts function in KisActionRegistry but it's not used, moreover it writes the shortcut with a different format, namely only the custom shortcut is written.
But then again even more confusion is added looking at ActionInfoItem, the struct used in writeCustomShortcuts and loadCustomShortcuts.
Is defaultShortcut meant to be the primary shortcut or the actual defaultShortcut that is shown as a "default" option in the shortcut editor?
And if the latter, since we only have one customShortcut key sequence, how can that deal with having a possible primary and alternate shortcut?
And in the end, looking at KisShortcutsDialog_p.cpp, primarySequence and alternateSequence functions we see what the dialog (and probably the rest of the system) expexts, an action with TWO key sequences, but when we load the configs from our kritashortcutsrc we only load one, with the string "primary; alternate".
Comment 3 Michael 2016-04-26 02:05:08 UTC
This patch should help iron out some of the bugs. Let me know if the lastest master helps.

https://phabricator.kde.org/rKRITA520cbbfdfb662a46476a69aa0d24d30507a198c5


Stefano: You're right that the shortcuts configuration code is pretty bad. Unfortunately KisShortcutsDialog, KActionCollection and everything else in XMLGUI ultimately comes from upstream, so if something is confusing or looks poorly designed your guess is as good as mine as to the justification. The patch I wrote basically sticks to modifying KisActionRegistry, to keep the shortcut data in the same format as XMLGUI.

I wr
Comment 4 Dmitry Kazakov 2016-05-03 12:56:23 UTC
Is the bug fixed now?
Comment 5 wolthera 2016-05-05 14:08:52 UTC
It seems fixed here. Resolving this for now.

Tyson, if you still come across it, don't hesitate to reopen.
Comment 6 Tyson Tan 2016-05-06 05:17:19 UTC
Yes, it's fixed. Thank you everyone!