Global shortcuts are saved with their text-name and not their action-name - Bug?
Andreas Hartmetz
ahartmetz at gmail.com
Sun Dec 30 14:29:23 GMT 2007
Am Sonntag 30 Dezember 2007 13:45:18 schrieb Christian Esken:
> Hello,
>
> global shortcuts are saved with their text set with action->setText(),
> instead of their action name. This is reflected in
> ~/.kde/share/config/kglobalshortcutsrc [1]. As far as I understand it, this
> as a bug. Am I right here?
>
> This has an impact especially on KMix. For example the "increase
> volume"action can be applied to arbitrary controls (e.g. CD, PCM, Master),
> so the actions need to have distinct names (using a prefix in the style of
> "controlID at soundcardID"):
>
> QString increaseVolumeString = QString("Increase volume %1").arg(
> actionSuffix ); // e.g. actionSuffic == "PCM:0 at ALSA::USB_Audio:1" KAction
> *a = _mdwPopupActions->addAction( increaseVolumeString ); a->setText( i18n(
> "Increase Volume" ) );
>
> I cam across this when trying to understand why setting global shortcuts in
> KMix behaves so strange and unreliable. Obviously I don't want to present
> the user a label like "Increase volume PCM:0 at ALSA::USB_Audio:1". Any ideas
> here?
>
Oh yes, this is a bug. The biggest problem is that the config name changes if
the language is changed which will obviously cause severe breakage.
But there is no way to fix it because actions don't have any name except
theire text(). There simply is no name() property except if the action is
inside an action collection and then the name is a property of the
collection. An action can be inserted into two different collections with two
different names.
I guess we should just make the name a property of the action and disallow
putting an action in more than one collection to prevent ambiguities. That
would implicitly change the API a little bit in a BC way (I hope nobody puts
action into several collections*) and add a name() property to actions.
That doesn't sound very good and better suggestions are welcome.
(*) You never know if there is a valid use case for something apparently
stupid :/
> Christian
>
>
>
> [1] ~/.kde/share/config/kglobalshortcutsrc
>
> Current state (wrong?):
> [KDE Global Shortcuts]
> kmix\x01Increase Volume=Ctrl+Shift+I
>
> It should be instead (e.g.):
> [KDE Global Shortcuts]
> kmix\x01Increase Volume PCM:0 at ALSA::USB_Audio:1=Ctrl+Shift+I
More information about the kde-core-devel
mailing list