Bug 456107 - Show ... toolbar actions loose all their shortcuts when okularpart configuration is modified.
Summary: Show ... toolbar actions loose all their shortcuts when okularpart configurat...
Status: CONFIRMED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 22.04.2
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-29 03:23 UTC by hugh
Modified: 2022-06-29 18:47 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hugh 2022-06-29 03:23:46 UTC
SUMMARY

Setup keyboard shortcuts for visibility of okular sidebar and the okular main toolbar within the okular settings.  Both are unique and don't clash with any other keyboard shortcuts.

Don't show sidebar and main toolbar on application startup.

Show main toolbar using shortcut, which works fine, until the sidebar shortcut is used.

Now the main toolbar keyboard shortcut stops working.  The following error is shown each time it is pressed:

kf.xmlgui: Shortcut for action  "mainToolBar" "Show Toolbar" set with QAction::setShortcut()! Use KActionCollection::setDefaultShortcut(s) instead

As soon as the side bar shortcut key is hit the main toolbar shortcut key stops working.

Only fix is an application restart.

STEPS TO REPRODUCE

1. Set main toolbar keyboard shortcut to "t".
2. Set sidebar keyboard shortcut to "s".
3. Hide both on application start.
4. Open a document in okular, I'm using a pdf.
5. Hit "t" to show the main toolbar.
6. Hit "s" to show the sidebar.
7. Hit "t" to hide the main toolbar.

OBSERVED RESULT

Main toolbar keyboard shortcuts stops working.

The following error message is output:

kf.xmlgui: Shortcut for action  "mainToolBar" "Show Toolbar" set with QAction::setShortcut()! Use KActionCollection::setDefaultShortcut(s) instead

Open Okular keyboard shortcut settings and the main toolbar shortcut is not set.

Add it back, use sidebar shortcut, and it is missing again.

Restarting the application and it is back, until sidebar shortcut is used, the gone again.

Strange.

EXPECTED RESULT

The main toolbar keyboard shortcut continue to work after the sidebar keyboard shortcuts has been used.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Arch Linux
(available in About System)
KDE Plasma Version: 5.25.2
KDE Frameworks Version: 5.95
Qt Version: 5.15.5

ADDITIONAL INFORMATION

Okular package version: 22.04.2-3
Comment 1 Laura David Hurka 2022-06-29 18:47:36 UTC
Reminds me of Bug 384700.

There a shortcut was reset when the configuration of okularpart was modified, which happens in response to certain actions.
In particular, “Toggle change colors” changed the configuration, which in turn caused the shortcut of “Toggle change colors” to be reset.

That bug could have been worked around by avoiding action stuff in response to configuration changes, in particular by avoiding calls to refreshActionProperties().
In the end, the bug has been fixed in KXmlGui, and Okular still calls refreshActionProperties() in response to any configuration changes.

In this case, the shortcut for “Main Toolbar” gets lost when the configuration of okularpart is modified, too.
You describe the bug for “Show sidebar”, but other actions, which write to the configuration, like “Change colors” trigger the bug as well.

But this case is also different.
It says “Shortcut for action set with QAction::setShortcut()!”, which was not the case in Bug 384700.
Also, it deletes any shortcut even if it was already saved to disk.

I think the cause for this bug is refreshActionProperties(), again, and the fact that “Main Toolbar” is somehow special.
You can notice that you can set a shortcut for this action, but you can not add it to any toolbar.
The other show ... toolbar actions have the same behavior.

So I think the bug is in KXmlGui, because it handles these show ... toolbars in some special way.