This forum has been archived. All content is frozen. Please use KDE Discuss instead.

amarok 2 tool-/settingsbutton click

Tags: None
(comma "," separated)
kk7
Registered Member
Posts
6
Karma
0

amarok 2 tool-/settingsbutton click

Sat Oct 04, 2008 2:21 pm
its very easy to add a button to the tools or settings menu:
Code: Select all
Amarok.Window.addSettingsMenu( 42, "MyButton" );


...but how is it possible to react during a 'click'-event? or is this not yet implemented?
thomas.dub
Registered Member
Posts
14
Karma
0
Hello,

I had the same problem on my script.

I've seen some scripts who uses this syntax :
Code: Select all
Amarok.Window.addToolsMenu("id_action","Name","icon");
Amarok.Window.ToolsMenu.id_action.triggered.connect(my_function);


But it doesn't work for me.

After a long search, I've found a solution who works, but I'm not shure that it's work for a long time...
Code: Select all
Amarok.Window.addToolsMenu("id_action","Name","icon");
Amarok.Window.ToolsMenu.id_action.triggered.connect(Amarok.Window.ToolsMenu.id_action,my_function);


For help : id_action is a Qstring who must be unique from all actions performed in Amarok.
"icon" has default Amarok icon if this parameter is not set.

I hope my script will be finished in some days :)

P.S: I'm french and I'm not sure that all I've writen is good...


[edit] In another computer, maybe with a more recent version of some packages, this method doesn't work... I dont understant... :(

Last edited by thomas.dub on Tue Feb 24, 2009 6:56 pm, edited 1 time in total.


Excuse my english.. please ;)
"Before, I had a life, now, I have a PC."
thomas.dub
Registered Member
Posts
14
Karma
0
Yeah, I've found another solution, regarding the debug output, and it's works for me ! for the moment...

That's my code :
Code: Select all
function SyncAmarokCallback() { ... }
if ( Amarok.Window.addToolsMenu("script_sync_amarok", "SyncAmaroK") )
{
    var sync_button = Amarok.Window.ToolsMenu.script_sync_amarok;
    sync_button['triggered()'].connect(syncAmarokCallback);
}
else
    Amarok.debug( "SyncAmarok menu already exists!" );



I don't understant this syntax, but it works for me, so...

Good luck to you :)


Excuse my english.. please ;)
"Before, I had a life, now, I have a PC."


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], daret, Evergrowing, Google [Bot], lockheed, sandyvee, Sogou [Bot]