Fwd: Patch: Amarok's global shortcut handling

me at sebruiz.net me at sebruiz.net
Sun Sep 28 02:37:44 CEST 2008


Sorry, forgot to CC Mike.

---------- Forwarded message ----------
From: me at sebruiz.net
Date: Sun, 28 Sep 2008 10:32:27 +1000
Subject: Re: Patch: Amarok's global shortcut handling
To: amarok-devel at kde.org

Hey Mike,

Thanks for the patch. Could you please clarify why it's needed to
assign and then forget all the shortcuts? Is this meant as a one off
"cleansing" of KDE4's global shortcut register or does it need to be
called on every application startup?

action.setObjectName("addMedia");
action.setGlobalShortcut(KShortcut());
action.forgetGlobalShortcut();

Cheers
Seb

On 28/09/2008, Michael Jansen <kde at michael-jansen.biz> wrote:
>
>
> 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
>
> --
> Michael Jansen
>
> http://www.michael-jansen.biz
>
>
>


-- 
Seb Ruiz

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



-- 
Seb Ruiz

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


More information about the Amarok-devel mailing list