[PATCH] KWallet and lastfm usage bug

View: New views
1 Messages — Rating Filter:   Alert me  

[PATCH] KWallet and lastfm usage bug

by Ignacio Serantes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi!

I send you a patch to solves the problem with KWallet if you don't want to use it to store passwords and prefer the old plain text storage.

The problem is that "ignoreWallet" configuration property is ignored with the current logic so, I do some changes to LastFmServiceConfig::LastFmServiceConfig() to avoid the anoing KWallet dialog anytime Amarok is launched.

The changes are:

KConfigGroup config = KGlobal::config()->group( configSectionName() );

is now the first line of the method and

if( KWallet::Wallet::isEnabled() )

was changed for

if( ( config.readEntry( "ignoreWallet", QString() ) == "no" ) && KWallet::Wallet::isEnabled() )

So now kwallet is created only if "ignoreWallet" equals "no".

--

Un saúdo

Ignacio Serantes (kde@...)

Urb. Mesón da Auga - Oleiros - A Coruña

España


[fix_kwallet_lastfm_bug.patch]

diff --git a/src/services/lastfm/LastFmServiceConfig.cpp b/src/services/lastfm/LastFmServiceConfig.cpp
index d4b708d..e867726 100644
--- a/src/services/lastfm/LastFmServiceConfig.cpp
+++ b/src/services/lastfm/LastFmServiceConfig.cpp
@@ -31,14 +31,14 @@ LastFmServiceConfig::LastFmServiceConfig()
     : m_askDiag( 0 )
     , m_wallet( 0 )
 {
-    if( KWallet::Wallet::isEnabled() )
+    KConfigGroup config = KGlobal::config()->group( configSectionName() );
+
+    if( ( config.readEntry( "ignoreWallet", QString() ) == "no" ) && 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();
@@ -89,20 +89,20 @@ LastFmServiceConfig::load()
             m_wallet->writeEntry( "lastfm_username", config.readEntry( "username" ).toUtf8() );
             config.deleteEntry( "username" );
         }
-        
+
         if( m_wallet->readPassword( "lastfm_password", m_password ) > 0 )
             debug() << "Failed to read lastfm password from kwallet!";
         QByteArray rawUsername;
         if( m_wallet->readEntry( "lastfm_username", rawUsername ) > 0 )
             debug() << "failed to read last.fm username from kwallet.. :(";
         else
-            m_username = QString::fromUtf8( rawUsername );  
+            m_username = QString::fromUtf8( rawUsername );
     } else if( config.readEntry( "ignoreWallet", QString() ) == "yes" )
     {
         m_username = config.readEntry( "username", QString() );
         m_password = config.readEntry( "password", QString() );
     }
-    
+
     m_sessionKey = config.readEntry( "sessionKey", QString() );
     m_scrobble = config.readEntry( "scrobble", true );
     m_fetchSimilar = config.readEntry( "fetchSimilar", true );
@@ -117,7 +117,7 @@ void LastFmServiceConfig::save()
     config.writeEntry( "sessionKey", m_sessionKey );
     config.writeEntry( "scrobble", m_scrobble );
     config.writeEntry( "fetchSimilar", m_fetchSimilar );
-        
+
     if( m_wallet )
     {
         m_wallet->setFolder( "Amarok" );


_______________________________________________
Amarok mailing list
Amarok@...
https://mail.kde.org/mailman/listinfo/amarok