Registered Member
|
I have been unable to figure out how to allow my Amarok2 script to perform clean-up actions when either the script is disabled or Amarok2 exits. Basically, when the script is about to be terminated, I would like to have a function get called.
It seems that in the 1.x series, Amarok would terminate scripts by sending their process a SIGTERM, and they could handle it by registering a signal handler. From what I can tell, Amarok2 behaves the same way. However, I am unsure of how to register a signal handler through JavaScript. Furthermore, it seems like there should be a better means of handling the application exit through the Qt libraries (via QtScript). If anyone could provide some ideas or insight on how to solve this problem, they would be appreciated.
Last edited by Jahava on Mon Feb 23, 2009 6:22 pm, edited 1 time in total.
|
KDE Developer
|
Interesting question. Perhaps this here could be of use to you:
http://doc.trolltech.com/4.4/qcoreappli ... boutToQuit
--
Mark Kretschmann - Amarok Developer |
Registered Member
|
Hey! Thanks for the direction - very much appreciated. I implemented your recommendation by registering a signal handler for QCoreApplication.instance().aboutToQuit. From what I can tell, the handler gets called when Amarok is quit via the Amarok>Quit menu. The other case that I'd like to address is when the script itself is disabled via the Script Manager. In this case, (near as I can tell) the handler that I registered (and that worked with Amarok>Quit) is never called. However, the process in which my script is running is definitely terminated when that box is unchecked. Any thoughts on how to handle this? |
Registered users: bancha, Bing [Bot], daret, Evergrowing, Google [Bot], lockheed, sandyvee, Sogou [Bot]