1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-22 13:43:11 +02:00

Fix atticaid sync issue that would lose value

This commit is contained in:
Leo Franchi
2012-03-18 13:26:33 -04:00
parent 195953f4f8
commit 42b2779240
3 changed files with 21 additions and 4 deletions

View File

@@ -30,6 +30,7 @@ using namespace Tomahawk;
using namespace Accounts;
#define ACCOUNTMODEL_DEBUG 0
AccountModel::AccountModel( QObject* parent )
: QAbstractListModel( parent )
{

View File

@@ -26,6 +26,8 @@
#include <attica/content.h>
#define ACCOUNTMODELNODE_DEBUG 0
namespace Tomahawk {
namespace Accounts {
@@ -87,7 +89,9 @@ struct AccountModelNode {
{
if ( AccountManager::instance()->factoryForAccount( acct ) == fac )
{
// qDebug() << "Found account for factory:" << acct->accountFriendlyName();
#if ACCOUNTMODELNODE_DEBUG
qDebug() << "Found account for factory:" << acct->accountFriendlyName();
#endif
accounts.append( acct );
}
}
@@ -98,15 +102,24 @@ struct AccountModelNode {
init();
atticaContent = cnt;
// qDebug() << "Creating attica model node for resolver:" << cnt.id();
#if ACCOUNTMODELNODE_DEBUG
qDebug() << "Creating attica model node for resolver:" << cnt.id();
#endif
foreach ( Account* acct, AccountManager::instance()->accounts( Accounts::ResolverType ) )
{
#if ACCOUNTMODELNODE_DEBUG
qDebug() << "Checking account:" << acct->accountFriendlyName() << qobject_cast< AtticaResolverAccount* >( acct );
#endif
if ( AtticaResolverAccount* resolver = qobject_cast< AtticaResolverAccount* >( acct ) )
{
#if ACCOUNTMODELNODE_DEBUG
qDebug() << "With attica id:" << resolver->atticaId();
#endif
if ( resolver->atticaId() == atticaContent.id() )
{
// qDebug() << "found atticaaccount :" << resolver->accountFriendlyName();
#if ACCOUNTMODELNODE_DEBUG
qDebug() << "found atticaaccount :" << resolver->accountFriendlyName();
#endif
atticaAccount = resolver;
break;
}

View File

@@ -102,6 +102,8 @@ ResolverAccount::ResolverAccount( const QString& accountId, const QString& path
setAccountFriendlyName( m_resolver.data()->name() );
setTypes( AccountType( ResolverType ) );
sync();
}
@@ -225,6 +227,7 @@ AtticaResolverAccount::AtticaResolverAccount( const QString& accountId, const QS
TomahawkSettings::instance()->setValue( QString( "accounts/%1/atticaresolver" ).arg( accountId ), true );
loadIcon();
sync();
}