1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-10-04 17:41:42 +02:00

More work on handling binary resolver install

This commit is contained in:
Leo Franchi
2012-05-16 18:07:56 -04:00
parent d60b8bda3e
commit ff431b1183
9 changed files with 104 additions and 30 deletions

View File

@@ -516,6 +516,35 @@ TomahawkSettings::doUpgrade( int oldVersion, int newVersion )
remove( "playlistupdaters" );
}
else if ( oldVersion == 11 )
{
// If the user doesn't have a spotify account, create one, since now it
// is like the last.fm account and always exists
QStringList allAccounts = value( "accounts/allaccounts" ).toStringList();
bool found = false;
foreach ( const QString& account, allAccounts )
{
if ( account.startsWith( "spotifyaccount_" ) )
{
found = true;
break;
}
}
if ( !found )
{
const QString accountKey = QString( "spotifyaccount_%1" ).arg( QUuid::createUuid().toString().mid( 1, 8 ) );
beginGroup( "accounts/" + accountKey );
setValue( "enabled", false );
setValue( "types", QStringList() << "ResolverType" );
setValue( "credentials", QVariantHash() );
setValue( "configuration", QVariantHash() );
endGroup();
allAccounts << accountKey;
setValue( "accounts/allaccounts", allAccounts );
}
}
}