Bug 138574

Summary: Amarok restarts instead of quitting if Universal Sidebar module is active
Product: [Applications] amarok Reporter: Gunter Ohrner <kdebugs>
Component: generalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.4.4   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Gunter Ohrner 2006-12-09 09:26:39 UTC
Version:           1.4.4 (using KDE KDE 3.5.5)
Installed from:    Debian testing/unstable Packages
OS:                Linux

Hi!

Under the following conditions, Amarok restarts instead of quitting:

a) the Universal Sidebar module must be showing
b) the volume setting must be different from "0"

If these conditions are met, Amarok will restart immediately when being quit (via File menu or systray icon), with the volume set to "0".
Quitting it now (with the volume setting at "0") works. If the volume setting is changed from "0" after the restart, Amarok will just restart again when being asked to quit.

This happens with at least a range of KDE 3.5 releases and Amaroks from the 1.3 and 1.4 series.

Greetings,

  Gunter
Comment 1 Stefan Monov 2006-12-09 11:24:12 UTC
I can confirm in Amarok 1.4.4, KDE 3.5.5, SUSE Linux 10.1, but ONLY if the Amarok tab IS in the universal sidebar.
Comment 2 Mark Kretschmann 2006-12-09 11:42:29 UTC
Yeah but, guys, how sick is that? How could an application restart itself?
Comment 3 Alexandre Oliveira 2006-12-19 04:05:51 UTC
SVN commit 614830 by aoliveira:

Universal Sidebar wouldn't let you quit amarok (it would always restart it).
Now, it will only run amarok by explicit user request.
BUG: 138574


 M  +39 -2     universalamarok.cpp  
 M  +4 -2      universalamarok.h  


--- trunk/extragear/multimedia/amarok/src/konquisidebar/universalamarok.cpp #614829:614830
@@ -212,6 +212,7 @@
  */
 void UniversalAmarok::updateStatus()
 {
+    checkForAmarok();
     vol_slider->setValue( playerStub->getVolume() );
     fileInfo->refresh();
     if( fileInfo->lastModified() != fileDT )
@@ -236,7 +237,11 @@
  */
 void UniversalAmarok::openURLRequest( const KURL &url )
 {
-    if( ! url.isValid() ) return;
+   if( ! url.isValid() ) return;
+   if (url.url() == "run:amarok") {
+        runAmarok();
+        return;
+   }
    checkForAmarok();
    playlistStub->playMedia(url);
 }
@@ -247,10 +252,42 @@
  */
 void UniversalAmarok::checkForAmarok()
 {
-    if(amarokDCOP->isApplicationRegistered("amarok")) return;
+    if(!amarokDCOP->isApplicationRegistered("amarok"))
+        noAmarokRunning();
+}
+
+
+void UniversalAmarok::noAmarokRunning() {
+    QString  m_HTMLSource="";
+    m_HTMLSource.append(
+            "<html>"
+            "<div id='introduction_box' class='box'>"
+                "<div id='introduction_box-header' class='box-header'>"
+                    "<span id='introduction_box-header-title' class='box-header-title'>"
+                    + i18n( "Amarok is not running!" ) +
+                    "</span>"
+                "</div>"
+                "<div id='introduction_box-body' class='box-body'>"
+                    "<p>" +
+                    i18n( "To run Amarok, just click on the link below: "
+                        ) +
+                    "</p>"
+                    "<a href='run:amarok' class='button'>" + i18n( "Run Amarok..." ) + "</a>"
+                "</div>"
+            "</div>"
+            "</html>"
+                       );
+    browser->begin();
+    browser->write( m_HTMLSource );
+    browser->end();
+}
+
+void UniversalAmarok::runAmarok() {
     KApplication::kdeinitExecWait("amarok");
 }
 
+
+
 void UniversalAmarok::volChanged(int vol)
 {
     checkForAmarok();
--- trunk/extragear/multimedia/amarok/src/konquisidebar/universalamarok.h #614829:614830
@@ -22,7 +22,7 @@
 
 #include <khtml_part.h>
 #include <konqsidebarplugin.h>
-#include <dcopclient.h> 
+#include <dcopclient.h>
 #include <qslider.h>
 #include <qvbox.h>
 #include <khtmlview.h>
@@ -79,7 +79,7 @@
    AmarokPlayerInterface_stub *playerStub;
    AmarokPlaylistInterface_stub *playlistStub;
    AmarokContextBrowserInterface_stub *contextStub;
-   
+
 public slots:
     void updateBrowser(const QString&);
     void updateStatus();
@@ -92,6 +92,8 @@
     void volChanged(int vol);
     void openURLRequest( const KURL & );
     void checkForAmarok();
+    void noAmarokRunning();
+    void runAmarok();
     void lyrics() { contextStub->showLyrics(); }
     void currentTrack() { contextStub->showCurrentTrack(); }
     void wiki() { contextStub->showWiki(); }