mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 21:57:41 +02:00
Fix on/off == enabled/disabled semantics.
This commit is contained in:
@@ -39,15 +39,16 @@ AccountModelFactoryProxy::filterAcceptsRow( int sourceRow, const QModelIndex& so
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
const QModelIndex idx = sourceModel()->index( sourceRow, 0, sourceParent );
|
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 >() );
|
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;
|
return rowType == m_filterRowType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
#include "SlideSwitchButton.h"
|
#include "SlideSwitchButton.h"
|
||||||
#include "accounts/Account.h"
|
#include "accounts/Account.h"
|
||||||
#include "accounts/AccountModel.h"
|
#include "accounts/AccountModel.h"
|
||||||
|
#include "accounts/AccountManager.h"
|
||||||
#include "sip/SipPlugin.h"
|
#include "sip/SipPlugin.h"
|
||||||
#include "utils/TomahawkUtilsGui.h"
|
#include "utils/TomahawkUtilsGui.h"
|
||||||
#include "utils/AnimatedSpinner.h"
|
#include "utils/AnimatedSpinner.h"
|
||||||
@@ -206,11 +207,11 @@ AccountWidget::changeAccountConnectionState( bool connected )
|
|||||||
{
|
{
|
||||||
if ( connected )
|
if ( connected )
|
||||||
{
|
{
|
||||||
account->authenticate();
|
Tomahawk::Accounts::AccountManager::instance()->enableAccount( account );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
account->deauthenticate();
|
Tomahawk::Accounts::AccountManager::instance()->disableAccount( account );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user