LastFmServiceConfig::LastFmServiceConfig() : m_askDiag( 0 ) , m_wallet( 0 ) { KConfigGroup config = KGlobal::config()->group( configSectionName() ); // we only want to load the wallet if the user has enabled features that require a user/pass bool scrobble = config.readEntry( "scrobble", false ); bool fetch_sim = config.readEntry( "fetchSimilar", false ); if( scrobble || fetch_sim ) // if either of these are true we need the wallet. { // open wallet unless explicitly told not to tryToOpenWallet(); } load(); }
LastFmServiceConfig::LastFmServiceConfig() : m_askDiag( 0 ) , m_wallet( 0 ) { DEBUG_BLOCK KConfigGroup config = KGlobal::config()->group( configSectionName() ); m_sessionKey = config.readEntry( "sessionKey", QString() ); m_scrobble = config.readEntry( "scrobble", defaultScrobble() ); m_fetchSimilar = config.readEntry( "fetchSimilar", defaultFetchSimilar() ); m_scrobbleComposer = config.readEntry( "scrobbleComposer", defaultScrobbleComposer() ); m_useFancyRatingTags = config.readEntry( "useFancyRatingTags", defaultUseFancyRatingTags() ); m_announceCorrections = config.readEntry( "announceCorrections", defaultAnnounceCorrections() ); m_filterByLabel = config.readEntry( "filterByLabel", defaultFilterByLabel() ); m_filteredLabel = config.readEntry( "filteredLabel", defaultFilteredLabel() ); if( config.hasKey( "kWalletUsage" ) ) m_kWalletUsage = KWalletUsage( config.readEntry( "kWalletUsage", int( NoPasswordEnteredYet ) ) ); else { // migrate from the old config that used "ignoreWallet" key set to yes/no if( config.readEntry( "ignoreWallet", "" ) == "yes" ) m_kWalletUsage = PasswordInAscii; else if( config.hasKey( "scrobble" ) ) // assume password was saved in KWallet if the config was once written m_kWalletUsage = PasswodInKWallet; else m_kWalletUsage = NoPasswordEnteredYet; // config not yet saved, assume unused } switch( m_kWalletUsage ) { case NoPasswordEnteredYet: break; case PasswodInKWallet: openWalletToRead(); break; case PasswordInAscii: m_username = config.readEntry( "username", QString() ); m_password = config.readEntry( "password", QString() ); break; } }