[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Global shortcuts are saved with their text-name and not their
From: Christian Esken <esken () kde ! org>
Date: 2007-12-30 19:02:50
Message-ID: 200712302002.50733.esken () kde ! org
[Download RAW message or body]
Am Sonntag, 30. Dezember 2007 schrieb Andreas Pakulat:
> On 30.12.07 15:29:23, Andreas Hartmetz wrote:
> > 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@soundcardID"):
> > >
> > > QString increaseVolumeString = QString("Increase volume %1").arg(
> > > actionSuffix ); // e.g. actionSuffic == "PCM:0@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@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
>
> There's objectName() and KActionCollection sets that property when an
> action is added, see KActionCollection::addAction(const QString&,
OK, I am using another call, namely addAction(const QString&, const QObject *, const \
char *). Looking at the kactioncollection.cpp this looks fine. I checked it and the \
objectName() is set correctly, e.g. to "Increase volume \
Headphone:0@ALSA::HDA_NVidia:1".
> QAction*). There's 1 way though to have no object name (or rather an
> empty one), which is not setting an object name when creating the action
> and calling addAction with an empty string (see the same function). That
> one can be changed however as there's always a generated name inside the
> collection.
>
> > 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.
>
> An action automatically changes its name when its inserted into a second
> collection with a different name.
This sounds good.
But how can we progress from here? As it is now, the shortcuts break when changing to \
another language. Is it still possible to change it for KDE4, or is it too dangerous?
If it is not possible, I could use a human readable form for my action names \
prefixes, like "PCM HDA_NVidia 1" instead of a cryptic "PCM:0@ALSA::HDA_NVidia:1".
> And in the case of 2 collections getting the same action without a name
> they both create the same internal name.
>
> Andreas
Christian
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic