Global shortcuts are saved with their text-name and not their action-name - Bug?
esken at kde.org
Sat Jan 5 11:43:37 GMT 2008
Am Freitag, 4. Januar 2008 schrieb Andreas Hartmetz:
> Am Donnerstag 03 Januar 2008 21:34:07 schrieb Christian Esken:
> > Am Mittwoch, 2. Januar 2008 schrieb Christian Esken:
> > > But there is still an issue: The global shortcuts are *not* recognized
> > > after restarting KMix.
> > >
> > > Also the shortcut dialog shows no shortcuts. When trying to reasign the
> > > same Shortcut to exactly the *same* action, I get a message:
> > >
> > > The 'Shift+O' key combination has already been allocated to the global
> > > action "Increase Volume - PCM, Sound Fusion CS46xx" in kmix. Do you want
> > > to reassign it from that action to the current one?
> > >
> > > ?!?
> > >
> > > So the shortcuts are known, but not assigned to the actions. Why? What
> > > can I do here? I have already played around a lot, like also adding the
> > > actions to the global actionCollection(), but that didn't help either.
> > I found it. Everything works now. :-)
> What was the error? Did some peculiarity of the API involved make it
> especially easy to make that error? If you make an error using something it's
> not necessarily only your fault...
I just needed to add "action->setGlobalShortcutAllowed(true);". But I found it very strange because:
Indepenendent on whether you call setGlobalShortcutAllowed(true) or not, ...
1) Global shortcuts show up for EVERY action in the KShortcutsDialog.
2) Global shortcuts actually work when you assign them.
3) Global shortcuts are saved.
The only thing that didn't work was restoring.
About 1) As far as I see this is a contradiction to the apidocs of KAction::setGlobalShortcutAllowed():
"Indicate whether the programmer and/or user may define a global shortcut for this action. Defaults to false."
Also I propose the following addition in the APIDOCS of KAction::setGlobalShortcutAllowed(bool,GlobalShortcutLoading):
"The global shortcut will be restored by this call, unless you set loading to NoAutoloading."
More information about the kde-core-devel