[Amarok] 3b825af Add mockup method for "Script Stalled" dialog.

Mark Kretschmann kretschmann at kde.org
Sun Feb 7 10:48:20 CET 2010


commit 3b825af4a09341a86257a51ab8415f1018d32faa
Author: Mark Kretschmann <kretschmann at kde.org>
Date:   Sun Feb 7 10:44:43 2010 +0100

    Add mockup method for "Script Stalled" dialog.
    
    The purpose of this is to get around string freeze issues, in case
    we want to implement this system later.
    
    CCMAIL: amarok-devel at kde.org

diff --git a/src/dialogs/ScriptManager.cpp b/src/dialogs/ScriptManager.cpp
index a4b5756..cba8268 100644
--- a/src/dialogs/ScriptManager.cpp
+++ b/src/dialogs/ScriptManager.cpp
@@ -1,5 +1,5 @@
 /****************************************************************************************
- * Copyright (c) 2004-2007 Mark Kretschmann <kretschmann at kde.org>                       *
+ * Copyright (c) 2004-2010 Mark Kretschmann <kretschmann at kde.org>                       *
  * Copyright (c) 2005-2007 Seb Ruiz <ruiz at kde.org>                                      *
  * Copyright (c) 2006 Alexandre Pereira de Oliveira <aleprj at gmail.com>                  *
  * Copyright (c) 2006 Martin Ellis <martin.ellis at kdemail.net>                           *
@@ -141,6 +141,9 @@ ScriptManager::ScriptManager( QWidget* parent )
     // Delay this call via eventloop, because it's a bit slow and would block
     QTimer::singleShot( 0, this, SLOT( updateAllScripts() ) );
 
+
+    //FIXME This is only here for testing purposes. Remove later.
+    //QTimer::singleShot( 0, this, SLOT( showScriptStalledDialog() ) );
 }
 
 ScriptManager::~ScriptManager()
@@ -580,6 +583,23 @@ ScriptManager::scriptFinished( QString name ) //SLOT
     delete m_scripts[name].engine;
 }
 
+
+//MOCKUP method, see API docs
+void
+ScriptManager::showScriptStalledDialog()  // SLOT
+{
+    const QString script = "FIXME";
+
+    const int reply = KMessageBox::questionYesNo( 0, i18n( "The script '%1' appears to have stalled.\n\n"
+                                                           "Would you like to stop it?", script ),
+                                                           i18n( "Script Manager - Amarok" ),
+                                                           KStandardGuiItem::yes(),
+                                                           KStandardGuiItem::no(),
+                                                           QString(),
+                                                           KMessageBox::Dangerous );
+}
+
+
 ////////////////////////////////////////////////////////////////////////////////
 // private
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/src/dialogs/ScriptManager.h b/src/dialogs/ScriptManager.h
index 3245796..0bb0aa5 100644
--- a/src/dialogs/ScriptManager.h
+++ b/src/dialogs/ScriptManager.h
@@ -1,5 +1,5 @@
 /****************************************************************************************
- * Copyright (c) 2004-2007 Mark Kretschmann <kretschmann at kde.org>                       *
+ * Copyright (c) 2004-2010 Mark Kretschmann <kretschmann at kde.org>                       *
  * Copyright (c) 2005 Seb Ruiz <ruiz at kde.org>                                           *
  * Copyright (c) 2008 Peter ZHOU <peterzhoulei at gmail.com>                               *
  *                                                                                      *
@@ -122,6 +122,13 @@ class AMAROK_EXPORT ScriptManager : public KDialog, public EngineObserver
         void updaterFinished( QString scriptPath );
         void slotUpdateSettingChanged( bool enabled );
 
+       /**
+        * MOCKUP: This dialog shows a warning, if a script stalls,
+        * and allows the user to terminate this script.
+        * Purpose: Getting around upcoming string freeze, then implementing fully.
+        */
+        void showScriptStalledDialog();
+
     private:
         explicit ScriptManager( QWidget* parent );
         virtual ~ScriptManager();


More information about the Amarok-devel mailing list