diff --git a/src/libtomahawk/AtticaManager.cpp b/src/libtomahawk/AtticaManager.cpp index 2ecbc6fe3..7d87459e2 100644 --- a/src/libtomahawk/AtticaManager.cpp +++ b/src/libtomahawk/AtticaManager.cpp @@ -456,7 +456,7 @@ AtticaManager::payloadFetched() if ( reply->property( "createAccount" ).toBool() ) { // Do the install / add to tomahawk - Tomahawk::Accounts::Account* resolver = Tomahawk::Accounts::ResolverAccountFactory::createFromPath( resolverPath, true ); + Tomahawk::Accounts::Account* resolver = Tomahawk::Accounts::ResolverAccountFactory::createFromPath( resolverPath, "resolveraccount", true ); Tomahawk::Accounts::AccountManager::instance()->addAccount( resolver ); TomahawkSettings::instance()->addAccount( resolver->accountId() ); } diff --git a/src/libtomahawk/accounts/Account.h b/src/libtomahawk/accounts/Account.h index 93fcda654..f2e297241 100644 --- a/src/libtomahawk/accounts/Account.h +++ b/src/libtomahawk/accounts/Account.h @@ -182,8 +182,8 @@ public: virtual Account* createAccount( const QString& accountId = QString() ) = 0; /// If this resolver type accepts this path on disk (For general and special resolver accounts) - virtual bool acceptsPath( const QString& path ) const { return false; } - virtual Account* createFromPath( const QString& path ) { return 0; } + virtual bool acceptsPath( const QString& ) const { return false; } + virtual Account* createFromPath( const QString& ) { return 0; } }; }; diff --git a/src/libtomahawk/accounts/AccountModel.cpp b/src/libtomahawk/accounts/AccountModel.cpp index 9c8b78f80..6a7b43b0c 100644 --- a/src/libtomahawk/accounts/AccountModel.cpp +++ b/src/libtomahawk/accounts/AccountModel.cpp @@ -597,7 +597,6 @@ void AccountModel::accountStateChanged( Account* account , Account::ConnectionState ) { // Find the factory this belongs up, and update - AccountFactory* factory = AccountManager::instance()->factoryForAccount( account ); for ( int i = 0; i < m_accounts.size(); i++ ) { AccountModelNode* n = m_accounts.at( i ); diff --git a/src/libtomahawk/accounts/AccountModelNode.h b/src/libtomahawk/accounts/AccountModelNode.h index fd6d2c933..28a3a5625 100644 --- a/src/libtomahawk/accounts/AccountModelNode.h +++ b/src/libtomahawk/accounts/AccountModelNode.h @@ -118,6 +118,7 @@ struct AccountModelNode { { init(); resolverAccount = ra; + factory = AccountManager::instance()->factoryForAccount( ra ); } explicit AccountModelNode( Account* account ) : type( CustomAccountType ) diff --git a/src/libtomahawk/accounts/ResolverAccount.cpp b/src/libtomahawk/accounts/ResolverAccount.cpp index 76efe47fd..801477fd2 100644 --- a/src/libtomahawk/accounts/ResolverAccount.cpp +++ b/src/libtomahawk/accounts/ResolverAccount.cpp @@ -48,21 +48,21 @@ ResolverAccountFactory::createAccount( const QString& accountId ) Account* ResolverAccountFactory::createFromPath( const QString& path ) { - return createFromPath( path, false ); + return createFromPath( path, factoryId(), false ); } Account* -ResolverAccountFactory::createFromPath( const QString& path, bool isAttica ) +ResolverAccountFactory::createFromPath( const QString& path, const QString& factory, bool isAttica ) { qDebug() << "Creating ResolverAccount from path:" << path << "is attica" << isAttica; if ( isAttica ) { QFileInfo info( path ); - return new AtticaResolverAccount( generateId( "resolveraccount" ), path, info.baseName() ); + return new AtticaResolverAccount( generateId( factory ), path, info.baseName() ); } else - return new ResolverAccount( generateId( "resolveraccount" ), path ); + return new ResolverAccount( generateId( factory ), path ); } diff --git a/src/libtomahawk/accounts/ResolverAccount.h b/src/libtomahawk/accounts/ResolverAccount.h index db33f157d..59b8ef162 100644 --- a/src/libtomahawk/accounts/ResolverAccount.h +++ b/src/libtomahawk/accounts/ResolverAccount.h @@ -48,7 +48,7 @@ public: virtual Account* createFromPath( const QString& path ); // Internal use - static Account* createFromPath( const QString& path, bool isAttica ); + static Account* createFromPath( const QString& path, const QString& factoryId, bool isAttica ); }; /** diff --git a/src/libtomahawk/accounts/SpotifyAccount.cpp b/src/libtomahawk/accounts/SpotifyAccount.cpp index 24a52c081..b0567019e 100644 --- a/src/libtomahawk/accounts/SpotifyAccount.cpp +++ b/src/libtomahawk/accounts/SpotifyAccount.cpp @@ -47,7 +47,7 @@ SpotifyAccountFactory::acceptsPath( const QString& path ) const Account* SpotifyAccountFactory::createFromPath( const QString& path ) { - return new SpotifyAccount( generateId( "spotifyaccount" ), path ); + return new SpotifyAccount( generateId( factoryId() ), path ); }