File ksuseinstall.diff of Package amarok

diff -urB amarok-2.4.90/src/CMakeLists.txt new/src/CMakeLists.txt
--- amarok-2.4.90/src/CMakeLists.txt	2011-11-14 12:26:13.000000000 +0100
+++ new/src/CMakeLists.txt	2011-11-16 00:30:36.752709749 +0100
@@ -934,6 +934,7 @@
     amarokcore
     amarokocsclient
     amarok-transcoding
+    ksuseinstall
 )
 
 if( TAGLIB_FOUND )
Only in new/src: CMakeLists.txt.orig
diff -urB amarok-2.4.90/src/EngineController.cpp new/src/EngineController.cpp
--- amarok-2.4.90/src/EngineController.cpp	2011-11-14 12:26:13.000000000 +0100
+++ new/src/EngineController.cpp	2011-11-16 00:30:36.753709749 +0100
@@ -54,6 +54,8 @@
 #include <QTextDocument>
 #include <QtCore/qmath.h>
 
+#include <ksuseinstall.h>
+
 namespace The {
     EngineController* engineController() { return EngineController::instance(); }
 }
@@ -300,6 +302,7 @@
 bool
 EngineController::installDistroCodec()
 {
+#if 0
     KService::List services = KServiceTypeTrader::self()->query( "Amarok/CodecInstall"
         , QString( "[X-KDE-Amarok-codec] == 'mp3' and [X-KDE-Amarok-engine] == 'phonon-%1'").arg( "xine" ) );
     //todo - figure out how to query Phonon for the current backend loaded
@@ -309,6 +312,12 @@
         QString installScript = service->exec();
         if( !installScript.isNull() ) //just a sanity check
         {
+#else
+    // amarok restart may be required, do not complain repeatedly in such case
+    static bool alreadyDone = false;
+    if( alreadyDone )
+        return true;
+#endif
             KGuiItem installButton( i18n( "Install MP3 Support" ) );
             if(KMessageBox::questionYesNo( The::mainWindow()
             , i18n("Amarok currently cannot play MP3 files. Do you want to install support for MP3?")
@@ -317,11 +326,29 @@
             , KStandardGuiItem::no()
             , "codecInstallWarning" ) == KMessageBox::Yes )
             {
+#if 0
                     KRun::runCommand(installScript, 0);
                     return true;
+#else
+                    if( KSUSEInstall::installCapabilities( QStringList() << "gstreamer-0_10-fluendo-mp3",
+                        KSUSEInstall::FullInstallRequired, The::mainWindow()))
+                    { // TODO use the items
+                        KGuiItem restartNowGuiItem( KStandardGuiItem::yes());
+                        restartNowGuiItem.setText( i18nc( "@action:button", "Restart Now" ));
+                        KGuiItem restartLaterGuiItem( KStandardGuiItem::no());
+                        restartLaterGuiItem.setText( i18nc( "@action:button", "Restart Later" ));
+                        KMessageBox::information( The::mainWindow(),
+                            i18n( "The necessary support has been successfully installed."
+                                " It may be necessary to restart the application for the support to be activated." ));
+                        alreadyDone = true;
+                        return true;
+                    }
+#endif
             }
+#if 0
         }
     }
+#endif
 
     return false;
 }
Only in new/src: EngineController.cpp.orig