1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-28 11:42:42 +01:00

Fix on/off == enabled/disabled semantics.

This commit is contained in:
Teo Mrnjavac 2012-08-14 21:46:52 +02:00
parent ef5efacade
commit fbee760723
2 changed files with 10 additions and 8 deletions

View File

@ -39,15 +39,16 @@ AccountModelFactoryProxy::filterAcceptsRow( int sourceRow, const QModelIndex& so
return true;
const QModelIndex idx = sourceModel()->index( sourceRow, 0, sourceParent );
const Qt::CheckState checkState = static_cast< Qt::CheckState >( idx.data( Qt::CheckStateRole ).value< int >() );
qDebug() << "FILTERING";
qDebug() << "checkState is " << checkState;
if( checkState == Qt::Unchecked ) //if the service is not even enabled
return false;
const AccountModel::RowType rowType = static_cast< AccountModel::RowType >( idx.data( AccountModel::RowTypeRole ).value< int >() );
if( rowType == Tomahawk::Accounts::AccountModel::TopLevelFactory )
{
if ( idx.data( Tomahawk::Accounts::AccountModel::ChildrenOfFactoryRole )
.value< QList< Tomahawk::Accounts::Account* > >().isEmpty() )
return false;
}
return rowType == m_filterRowType;
}

View File

@ -22,6 +22,7 @@
#include "SlideSwitchButton.h"
#include "accounts/Account.h"
#include "accounts/AccountModel.h"
#include "accounts/AccountManager.h"
#include "sip/SipPlugin.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/AnimatedSpinner.h"
@ -206,11 +207,11 @@ AccountWidget::changeAccountConnectionState( bool connected )
{
if ( connected )
{
account->authenticate();
Tomahawk::Accounts::AccountManager::instance()->enableAccount( account );
}
else
{
account->deauthenticate();
Tomahawk::Accounts::AccountManager::instance()->disableAccount( account );
}
}
}