Reload UI XML files on tab change for shortcut updates
ClosedPublic

Authored by sdepiets on Aug 20 2018, 2:45 AM.

Details

Summary

This patch will reload the .ui files of the tabs (editor tab/tm/project) if a newer version exists.
This will allow propagation of the shortcut updates to the KActionCollections and new shortcuts won't be lost anymore on tab change.

https://bugs.kde.org/show_bug.cgi?id=323238
Shortcut settings being lost on every file tab switch
Steps to reproduce:

  1. Open two .po files.
  2. Change any shortcut settings.
  3. Switch to another file tab.
  4. Check the shortcut settings again.

https://bugs.kde.org/show_bug.cgi?id=302853
Customized shortcut resetting when switching to TM tab

BUG: 302853
BUG: 323238

Test Plan
  1. Open two .po files.
  2. Change any shortcut settings.
  3. Switch to another file tab.
  4. Check the shortcut settings again.

Diff Detail

Repository
R456 Lokalize
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
sdepiets requested review of this revision.Aug 20 2018, 2:45 AM
sdepiets created this revision.
sdepiets retitled this revision from Reload UI XML files on shortcut updates to Reload UI XML files on tab change for shortcut updates.Aug 20 2018, 2:50 AM
sdepiets edited the summary of this revision. (Show Details)
sdepiets added reviewers: Localization, aacid, ltoscano.
sdepiets added a project: Localization.

I'm a bit lost, can you explain what's the problem with a bit more verbosity?

sdepiets edited the summary of this revision. (Show Details)Aug 23 2018, 1:24 AM
sdepiets edited the test plan for this revision. (Show Details)

I'm a bit lost, can you explain what's the problem with a bit more verbosity?

I have updated the description with the bug report descriptions.
Each tab has its own KActionCollection, so the shortcut dialog only maps the shortcuts to these KAction instances.

aacid added a subscriber: dfaure.Aug 23 2018, 9:39 PM

The thing is that to me it doesn't feel like guiClient()->reloadXML(); manually, i would expect KXmlGui & friends just to handle this properly.

I'm going to add @dfaure that knows a lot about xmlgui and may be able to give a hint if we're solving this the right way or not.

dfaure added a comment.Sep 5 2018, 8:15 AM

So each tab has its own KActionCollection, but with the same action names as the other tabs?

In that case, having a single KActionCollection (and dispatching in the slots) might be closer to what KXMLGUI was designed for.

So if we don't go for that redesign, we do need a way to update the shortcuts in all actioncollections indeed. Reloading the XML file is one way. Another way would be to implement propagation of shortcuts from one actioncollection to the others after the dialog changed shortcuts in the current collection.

So each tab has its own KActionCollection, but with the same action names as the other tabs?

Yes

In that case, having a single KActionCollection (and dispatching in the slots) might be closer to what KXMLGUI was designed for.

That was my understanding as well, I can probably do that once I have a better understanding of the app.

Another way would be to implement propagation of shortcuts from one actioncollection to the others after the dialog changed shortcuts in the current collection.

I tried that first and failed to do it, it doesn't look easier to implement than redoing a unique kactioncollection

This revision was not accepted when it landed; it landed in state Needs Review.Sep 10 2018, 10:11 AM
This revision was automatically updated to reflect the committed changes.