[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:       Andreas Pakulat <apaku () gmx ! de>
Date:       2007-12-30 17:09:17
Message-ID: 20071230170917.GA25657 () morpheus ! apaku ! dnsalias ! org
[Download RAW message or body]

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&,
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.

And in the case of 2 collections getting the same action without a name
they both create the same internal name.

Andreas

-- 
Do what comes naturally.  Seethe and fume and throw a tantrum.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic