1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-18 11:51:44 +02:00

Store to LocalConfigStorage as fallback when installing a ResolverAccount.

This commit is contained in:
Teo Mrnjavac
2013-06-29 15:19:02 +02:00
parent af6a90f956
commit 2cd1736203
4 changed files with 17 additions and 1 deletions

View File

@@ -143,7 +143,8 @@ Account::loadFromConfig( const QString& accountId )
{ {
m_accountId = accountId; m_accountId = accountId;
AccountManager::instance()->configStorageForAccount( m_accountId )->load( m_accountId, m_cfg ); if ( AccountManager::instance()->configStorageForAccount( m_accountId ) != 0 ) //could be 0 if we are installing the account right now
AccountManager::instance()->configStorageForAccount( m_accountId )->load( m_accountId, m_cfg );
} }

View File

@@ -424,6 +424,13 @@ AccountManager::configStorageForAccount( const QString& accountId )
} }
ConfigStorage*
AccountManager::localConfigStorage()
{
return m_configStorageById.value( "localconfigstorage" );
}
void void
AccountManager::hookupAccount( Account* account ) const AccountManager::hookupAccount( Account* account ) const
{ {

View File

@@ -96,6 +96,7 @@ public:
CredentialsManager* credentialsManager() const { return m_creds; } CredentialsManager* credentialsManager() const { return m_creds; }
ConfigStorage* configStorageForAccount( const QString& accountId ); ConfigStorage* configStorageForAccount( const QString& accountId );
ConfigStorage* localConfigStorage();
public slots: public slots:
void connectAll(); void connectAll();

View File

@@ -22,6 +22,9 @@
#include "jobview/JobStatusView.h" #include "jobview/JobStatusView.h"
#include "jobview/JobStatusModel.h" #include "jobview/JobStatusModel.h"
#include "jobview/ErrorStatusMessage.h" #include "jobview/ErrorStatusMessage.h"
#include "AccountManager.h"
#include "AtticaManager.h"
#include "ConfigStorage.h"
#include "resolvers/ExternalResolver.h" #include "resolvers/ExternalResolver.h"
#include "resolvers/ExternalResolverGui.h" #include "resolvers/ExternalResolverGui.h"
#include "utils/Logger.h" #include "utils/Logger.h"
@@ -302,6 +305,10 @@ ResolverAccount::ResolverAccount( const QString& accountId, const QString& path,
setConfiguration( configuration ); setConfiguration( configuration );
//just init so this account is tracked by LCS, we'll sync later
if ( !AccountManager::instance()->configStorageForAccount( accountId ) )
AccountManager::instance()->localConfigStorage()->save( accountId, Account::Configuration() );
init( path ); init( path );
sync(); sync();