[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [amarok/spotify] src/core-impl/collections/spotifycollection: Fix resolver path error
From:       Edward Hades <edward.hades () gmail ! com>
Date:       2012-10-28 11:20:00
Message-ID: 20121028112000.084F6A6111 () git ! kde ! org
[Download RAW message or body]

Git commit e53eac0797cd8b90431109f5a921a3846f4269e3 by Edward Hades, on behalf of \
Ryan Feng. Committed on 24/08/2012 at 12:20.
Pushed by hades into branch 'spotify'.

Fix resolver path error

Always use KStandardDirs('data'..) to get the resolver's path, the
resolver should be downloaded in $KDEHOME/share/apps/

M  +3    -13   src/core-impl/collections/spotifycollection/SpotifyConfig.cpp
M  +5    -1    src/core-impl/collections/spotifycollection/SpotifySettings.cpp

http://commits.kde.org/amarok/e53eac0797cd8b90431109f5a921a3846f4269e3

diff --git a/src/core-impl/collections/spotifycollection/SpotifyConfig.cpp \
b/src/core-impl/collections/spotifycollection/SpotifyConfig.cpp index \
                92c35b4..ee7dbad 100644
--- a/src/core-impl/collections/spotifycollection/SpotifyConfig.cpp
+++ b/src/core-impl/collections/spotifycollection/SpotifyConfig.cpp
@@ -52,7 +52,7 @@ SpotifyConfig::load()
 {
     DEBUG_BLOCK
     debug() << "Loading Spotify config...";
-
+    reset();
     KConfigGroup config = KGlobal::config()->group( configSectionName() );
 
     if( m_wallet )
@@ -68,16 +68,6 @@ SpotifyConfig::load()
             warning() << "Cannot get Spotify password from KWallet!";
         }
 
-        QByteArray resolverPath;
-        if( m_wallet->readEntry( "spotify_resolver", resolverPath ) > 0 )
-        {
-            warning() << "Cannot get Spotify resolver path from KWallet!";
-        }
-        else
-        {
-            m_resolverPath = resolverPath;
-        }
-
         QByteArray rawUsername;
         if( m_wallet->readEntry( "spotify_username", rawUsername ) > 0 )
         {
@@ -132,7 +122,7 @@ SpotifyConfig::save()
 
         // Set default resolver path
         if( m_resolverPath.isEmpty() )
-            m_resolverPath = KStandardDirs::locateLocal( "exe", \
defaultResolverName() ); +            m_resolverPath = KStandardDirs::locateLocal( \
"data", defaultResolverName() );  
         config.writeEntry( "resolver", m_resolverPath );
 
@@ -164,7 +154,7 @@ SpotifyConfig::reset()
     m_username = "";
     m_password = "";
     // Use the the API key embedded in Spotify resolver
-    m_resolverPath = KStandardDirs::locateLocal( "exe", defaultResolverName() );
+    m_resolverPath = KStandardDirs::locateLocal( "data", defaultResolverName() );
     debug() << "Resolver path: " << m_resolverPath;
 }
 
diff --git a/src/core-impl/collections/spotifycollection/SpotifySettings.cpp \
b/src/core-impl/collections/spotifycollection/SpotifySettings.cpp index \
                3afeb25..a671751 100644
--- a/src/core-impl/collections/spotifycollection/SpotifySettings.cpp
+++ b/src/core-impl/collections/spotifycollection/SpotifySettings.cpp
@@ -152,6 +152,9 @@ SpotifySettings::tryDownloadResolver()
 {
     DEBUG_BLOCK
 
+    if( m_config.resolverPath().isEmpty() )
+        m_config.reset();
+
     debug() << "Trying to download: " << m_config.resolverDownloadUrl();
 
     NetworkAccessManagerProxy* manager = The::networkAccessManager();
@@ -212,7 +215,7 @@ SpotifySettings::slotDownloadFinished()
                       "please check your internet connection and try again later." ) \
);  
         // Don't show the settings dialog
-        deleteLater();
+        slotCancel();
         return;
     }
 
@@ -224,6 +227,7 @@ SpotifySettings::slotDownloadFinished()
     if( !file.open( QIODevice::WriteOnly ) )
     {
         KMessageBox::error( this, i18n( "Failed to open file '%1' to write." ).arg( \
m_config.resolverPath() ) ); +        slotCancel();
     }
     else
     {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic