mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-16 19:14:06 +02:00
Store the enabled state of external accounts
This commit is contained in:
@@ -211,18 +211,12 @@ Tomahawk::Accounts::TelepathyConfigStorage::priority() const
|
|||||||
void
|
void
|
||||||
Tomahawk::Accounts::TelepathyConfigStorage::save( const QString& accountId, const Account::Configuration& cfg )
|
Tomahawk::Accounts::TelepathyConfigStorage::save( const QString& accountId, const Account::Configuration& cfg )
|
||||||
{
|
{
|
||||||
// TomahawkSettings* s = TomahawkSettings::instance();
|
TomahawkSettings* s = TomahawkSettings::instance();
|
||||||
// s->beginGroup( "accounts/" + accountId );
|
s->beginGroup( "externalaccounts/" + accountId );
|
||||||
// s->setValue( "accountfriendlyname", cfg.accountFriendlyName );
|
s->setValue( "enabled", cfg.enabled );
|
||||||
// s->setValue( "enabled", cfg.enabled );
|
s->setValue( "acl", cfg.acl );
|
||||||
// s->setValue( "configuration", cfg.configuration );
|
s->endGroup();
|
||||||
// s->setValue( "acl", cfg.acl );
|
s->sync();
|
||||||
// s->setValue( "types", cfg.types );
|
|
||||||
// s->endGroup();
|
|
||||||
// s->sync();
|
|
||||||
|
|
||||||
//CredentialsManager* c = AccountManager::instance()->credentialsManager();
|
|
||||||
//c->setCredentials( m_credentialsServiceName, accountId, cfg.credentials );
|
|
||||||
|
|
||||||
if ( !m_accountIds.contains( accountId ) )
|
if ( !m_accountIds.contains( accountId ) )
|
||||||
m_accountIds.append( accountId );
|
m_accountIds.append( accountId );
|
||||||
@@ -232,6 +226,13 @@ Tomahawk::Accounts::TelepathyConfigStorage::save( const QString& accountId, cons
|
|||||||
void
|
void
|
||||||
Tomahawk::Accounts::TelepathyConfigStorage::load( const QString& accountId, Account::Configuration& cfg )
|
Tomahawk::Accounts::TelepathyConfigStorage::load( const QString& accountId, Account::Configuration& cfg )
|
||||||
{
|
{
|
||||||
|
TomahawkSettings* s = TomahawkSettings::instance();
|
||||||
|
s->beginGroup( "externalaccounts/" + accountId );
|
||||||
|
cfg.enabled = s->value( "enabled", true ).toBool();
|
||||||
|
cfg.acl = s->value( "acl", QVariantMap() ).toMap();
|
||||||
|
s->endGroup();
|
||||||
|
|
||||||
|
|
||||||
Tp::AccountPtr account = m_tpam->accountForObjectPath( accountIdToTelepathyPath( accountId ) );
|
Tp::AccountPtr account = m_tpam->accountForObjectPath( accountIdToTelepathyPath( accountId ) );
|
||||||
|
|
||||||
if ( !account->normalizedName().isEmpty() )
|
if ( !account->normalizedName().isEmpty() )
|
||||||
@@ -242,9 +243,6 @@ Tomahawk::Accounts::TelepathyConfigStorage::load( const QString& accountId, Acco
|
|||||||
if ( cfg.accountFriendlyName.isEmpty() ) //this should never happen
|
if ( cfg.accountFriendlyName.isEmpty() ) //this should never happen
|
||||||
cfg.accountFriendlyName = accountId;
|
cfg.accountFriendlyName = accountId;
|
||||||
|
|
||||||
cfg.enabled = true;
|
|
||||||
cfg.acl = QVariantMap();
|
|
||||||
|
|
||||||
QStringList types;
|
QStringList types;
|
||||||
types << "SipType";
|
types << "SipType";
|
||||||
cfg.types = types;
|
cfg.types = types;
|
||||||
@@ -282,18 +280,12 @@ Tomahawk::Accounts::TelepathyConfigStorage::load( const QString& accountId, Acco
|
|||||||
void
|
void
|
||||||
Tomahawk::Accounts::TelepathyConfigStorage::remove( const QString& accountId )
|
Tomahawk::Accounts::TelepathyConfigStorage::remove( const QString& accountId )
|
||||||
{
|
{
|
||||||
// TomahawkSettings* s = TomahawkSettings::instance();
|
TomahawkSettings* s = TomahawkSettings::instance();
|
||||||
// s->beginGroup( "accounts/" + accountId );
|
s->beginGroup( "externalaccounts/" + accountId );
|
||||||
// s->remove( "accountfriendlyname" );
|
s->remove( "enabled" );
|
||||||
// s->remove( "enabled" );
|
s->remove( "acl" );
|
||||||
// s->remove( "configuration" );
|
s->endGroup();
|
||||||
// s->remove( "acl" );
|
s->remove( "externalaccounts/" + accountId );
|
||||||
// s->remove( "types" );
|
|
||||||
// s->endGroup();
|
|
||||||
// s->remove( "accounts/" + accountId );
|
|
||||||
|
|
||||||
// Tomahawk::Accounts::CredentialsManager* c = Tomahawk::Accounts::AccountManager::instance()->credentialsManager();
|
|
||||||
// c->setCredentials( m_credentialsServiceName, account->uniqueIdentifier(), QVariantHash() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN2( Tomahawk::Accounts::ConfigStorage, Tomahawk::Accounts::TelepathyConfigStorage )
|
Q_EXPORT_PLUGIN2( Tomahawk::Accounts::ConfigStorage, Tomahawk::Accounts::TelepathyConfigStorage )
|
||||||
|
Reference in New Issue
Block a user