Patch: Amarok's global shortcut handling

Seb Ruiz ruiz at kde.org
Wed Oct 1 13:20:35 CEST 2008


2008/9/28 Michael Jansen <kde at michael-jansen.biz>:
>
>
> Hi
>
> I noticed that amarok has a problem with the way it creates global shortcuts.
> In general it's never a good idea to change the object name of a action. The
> identifier is used to save/restore local and global shortcuts.
>
> The problematic code looked like that:
>
>    KAction *action = new KAction(  ... );
>    action->setObjectName("playlist-add")
>    action->setGlobalShortcut( ... );
>    connect( ... );
>    ac->addAction( "playlist_add", action );
>
> The action get's a different objectName when added to the collection with
> addAction. That bring two problems.
>
> 1. Global Shortcuts only work as long as you do not try to change them. In
> that exact moment they stop to work.
> 2. "kcmshell4 keys" shows some shortcuts from amarok twice.
>
> The patch not only corrects the code regarding global shortcuts registration.
> It cleans up the global shortcuts registration too.
>
> Mike

I've started having some problems with kded4 crashing after applying
this patch. I'm using kdelibs 4.1 from ubuntu reps.

Console output:
ASSERT: "d->keyToAction.value(key) == ad" in file
/build/buildd/kde4libs-4.1.1+really4.1.1/kdeui/shortcuts/kdedglobalaccel.cpp,
line 412
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = kded4 path = <unknown> pid = 13189
sock_file=/home/seb/.kde4/socket-hammerhead/kdeinit4__0
kded(13188): Communication problem with  "kded" , it probably crashed.
Error message was:  "org.freedesktop.DBus.Error.NoReply" : " "Message
did not receive a reply (timeout by message bus)" "

Crash occurs in
QList<int> KdedGlobalAccel::setShortcut(const QStringList &actionId,
const QList<int> &keys, uint flags)

http://websvn.kde.org/branches/KDE/4.1/kdelibs/kdeui/shortcuts/kdedglobalaccel.cpp?annotate=829867

Reverting your patch doesn't fix the problem however.

-- 
Seb Ruiz

http://www.sebruiz.net/
http://amarok.kde.org/


More information about the Amarok-devel mailing list