From 5641f2a07ca7f3b4e964f26a31654013eb26f86a Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Thu, 8 Mar 2012 12:32:53 -0500 Subject: [PATCH] fix migrating when there is already a last.fm account, and hide debug --- src/libtomahawk/accounts/AccountModel.cpp | 10 +++++++--- src/libtomahawk/tomahawksettings.cpp | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/libtomahawk/accounts/AccountModel.cpp b/src/libtomahawk/accounts/AccountModel.cpp index 1233c7117..146aef080 100644 --- a/src/libtomahawk/accounts/AccountModel.cpp +++ b/src/libtomahawk/accounts/AccountModel.cpp @@ -29,6 +29,7 @@ using namespace Tomahawk; using namespace Accounts; +#define ACCOUNTMODEL_DEBUG 0 AccountModel::AccountModel( QObject* parent ) : QAbstractListModel( parent ) { @@ -52,10 +53,11 @@ AccountModel::loadData() // Add all factories QList< AccountFactory* > factories = AccountManager::instance()->factories(); QList< Account* > allAccounts = AccountManager::instance()->accounts(); +#if ACCOUNTMODEL_DEBUG qDebug() << "All accounts:"; foreach ( Account* acct, allAccounts ) qDebug() << acct->accountFriendlyName() << "\t" << acct->accountId(); - +#endif foreach ( AccountFactory* fac, factories ) { if ( !fac->allowUserCreation() ) @@ -86,11 +88,12 @@ AccountModel::loadData() { m_accounts << new AccountModelNode( acct ); const int removed = allAccounts.removeAll( acct ); - +#if ACCOUNTMODEL_DEBUG qDebug() << "Removed custom account from misc accounts list, found:" << removed; qDebug() << "All accounts after remove:"; foreach ( Account* acct, allAccounts ) qDebug() << acct->accountFriendlyName() << "\t" << acct->accountId(); // All other accounts we haven't dealt with yet +#endif } } else { @@ -112,10 +115,11 @@ AccountModel::loadData() } } - +#if ACCOUNTMODEL_DEBUG qDebug() << "All accounts left:"; foreach ( Account* acct, allAccounts ) qDebug() << acct->accountFriendlyName() << "\t" << acct->accountId(); // All other accounts we haven't dealt with yet +#endif foreach ( Account* acct, allAccounts ) { qDebug() << "Resolver is left over:" << acct->accountFriendlyName(); diff --git a/src/libtomahawk/tomahawksettings.cpp b/src/libtomahawk/tomahawksettings.cpp index aaf1ae8d8..403cba64d 100644 --- a/src/libtomahawk/tomahawksettings.cpp +++ b/src/libtomahawk/tomahawksettings.cpp @@ -288,6 +288,10 @@ TomahawkSettings::doUpgrade( int oldVersion, int newVersion ) foreach ( const QString& resolver, allResolvers ) { + // We handle last.fm resolvers differently. + if ( resolver.contains( "lastfm" ) ) + continue; + const QString accountKey = QString( "resolveraccount_%1" ).arg( QUuid::createUuid().toString().mid( 1, 8 ) ); accounts << accountKey;