File amarok-2.2.0-fix-splash-screen-and-lastfm.patch of Package amarok

From 99ebf391215fd19607b8b84afb171fa93dc3fdc4 Mon Sep 17 00:00:00 2001
From: Mark Kretschmann <kretschmann@kde.org>
Date: Sun, 11 Oct 2009 14:17:25 +0200
Subject: [PATCH] Hide the splash screen if Last.fm service opens config dialog (KWallet).

NOTE: This needs to be ported to CredentialStorage too, if we resurrect
that class.

BUG: 210179
---
 src/App.cpp                                 |    3 ---
 src/App.h                                   |   17 +++++++++--------
 src/services/lastfm/LastFmServiceConfig.cpp |   11 +++++++++--
 3 files changed, 18 insertions(+), 13 deletions(-)


Index: src/App.cpp
===================================================================
--- src/App.cpp
+++ src/App.cpp	2009-10-18 16:35:10.000000000 +0200
@@ -58,7 +58,6 @@
 #include <KJobUiDelegate>
 #include <KLocale>
 #include <KShortcutsDialog>              //slotConfigShortcuts()
-#include <KSplashScreen>
 #include <KStandardDirs>
 
 #include <QByteArray>
@@ -121,7 +120,6 @@
 
 App::App()
         : KUniqueApplication()
-        , m_splash( 0 )
 {
     DEBUG_BLOCK
     PERF_LOG( "Begin Application ctor" )
@@ -230,7 +228,6 @@
     DEBUG_BLOCK
 
     delete m_splash;
-    m_splash = 0;
 
     CollectionManager::instance()->stopScan();
 
Index: src/App.h
===================================================================
--- src/App.h
+++ src/App.h	2009-10-18 16:37:51.000000000 +0200
@@ -26,6 +26,7 @@
 #include <KAboutData>
 #include <KUniqueApplication>   //baseclass
 #include <KUrl>
+#include <KSplashScreen>
 
 #include <QHash>
 #include <QPointer>
@@ -41,7 +42,6 @@
 
 class KJob;
 class MediaDeviceManager;
-class KSplashScreen;
 
 class AMAROK_EXPORT App : public KUniqueApplication
 {
@@ -64,10 +64,11 @@
         static int mainThreadId;
 
         virtual int newInstance();
+        void hideSplashScreen() { delete m_splash; }
 
         inline MainWindow *mainWindow() const { return m_mainWindow; }
 
-        // FRIENDS ------
+        // FRIENDS 
         friend class MainWindow; //requires access to applySettings()
 
     signals:
@@ -94,12 +95,12 @@
         void slotTrashResult( KJob *job );
 
     private:
-        // ATTRIBUTES ------
-        bool                 m_isUniqueInstance;
-        QPointer<MainWindow> m_mainWindow;
-        Amarok::TrayIcon     *m_tray;
-        MediaDeviceManager   *m_mediaDeviceManager;
-        KSplashScreen        *m_splash;
+        // ATTRIBUTES
+        bool                    m_isUniqueInstance;
+        QPointer<MainWindow>    m_mainWindow;
+        Amarok::TrayIcon        *m_tray;
+        MediaDeviceManager      *m_mediaDeviceManager;
+        QPointer<KSplashScreen> m_splash;
 };
 
 #define pApp static_cast<App*>(kapp)
Index: src/services/lastfm/LastFmServiceConfig.cpp
===================================================================
--- src/services/lastfm/LastFmServiceConfig.cpp
+++ src/services/lastfm/LastFmServiceConfig.cpp	2009-10-18 16:39:58.000000000 +0200
@@ -18,6 +18,8 @@
 #define DEBUG_PREFIX "lastfm"
 
 #include "LastFmServiceConfig.h"
+
+#include "App.h"
 #include "Debug.h"
 
 #include <KWallet/Wallet>
@@ -29,13 +31,17 @@
     : m_askDiag( 0 )
     , m_wallet( 0 )
 {
-
-    m_wallet = KWallet::Wallet::openWallet( KWallet::Wallet::NetworkWallet(), 0, KWallet::Wallet::Synchronous );
+    if( KWallet::Wallet::isEnabled() )
+    {
+        pApp->hideSplashScreen();
+        m_wallet = KWallet::Wallet::openWallet( KWallet::Wallet::NetworkWallet(), 0, KWallet::Wallet::Synchronous );
+    }
 
     KConfigGroup config = KGlobal::config()->group( configSectionName() );
     
     if( !m_wallet && !config.hasKey( "ignoreWallet" ) )
     {
+        pApp->hideSplashScreen();
         m_askDiag = new KDialog( 0 );
         m_askDiag->setCaption( i18n( "Last.fm credentials" ) );
         m_askDiag->setMainWidget( new QLabel( i18n( "No running KWallet found. Would you like Amarok to save your Last.fm credentials in plaintext?" ), m_askDiag ) );
@@ -46,6 +52,7 @@
         connect( m_askDiag, SIGNAL( cancelClicked() ), this, SLOT( textDialogCancel() ) );
         m_askDiag->exec();
     }
+
     load();
 }
 
openSUSE Build Service is sponsored by