diff --git a/src/widgets/AccountModelFactoryProxy.cpp b/src/widgets/AccountModelFactoryProxy.cpp index bdce4d67c..67a014a7d 100644 --- a/src/widgets/AccountModelFactoryProxy.cpp +++ b/src/widgets/AccountModelFactoryProxy.cpp @@ -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; } diff --git a/src/widgets/AccountWidget.cpp b/src/widgets/AccountWidget.cpp index 69a19673b..9dc50c7bc 100644 --- a/src/widgets/AccountWidget.cpp +++ b/src/widgets/AccountWidget.cpp @@ -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 ); } } }