mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-22 21:54:00 +02:00
Fix atticaid sync issue that would lose value
This commit is contained in:
@@ -30,6 +30,7 @@ using namespace Tomahawk;
|
||||
using namespace Accounts;
|
||||
|
||||
#define ACCOUNTMODEL_DEBUG 0
|
||||
|
||||
AccountModel::AccountModel( QObject* parent )
|
||||
: QAbstractListModel( parent )
|
||||
{
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user