Global shortcuts are saved with their text-name and not their action-name - Bug?

Andreas Hartmetz ahartmetz at gmail.com
Thu Jan 10 06:13:32 GMT 2008


Am Samstag 05 Januar 2008 12:43:37 schrieb Christian Esken:
> 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.

The default menu stuff provided by kdelibs should get a separate menu item for 
global shortcuts in the near future. The main advantage of that would be that 
only actions with global shortcuts allowed would show up and the menu item 
could be automatically hidden if there are no actions with global shortcuts 
allowed. This was planned but forgotten :/
Does anyone see compatibility problems with that?

> 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."
>
*agree*
The funny semantics of global shortcuts should really have gotten an API that 
doesn't make you think it's as easy as setting a local shortcut. Oh well.

>    Christian






More information about the kde-core-devel mailing list