mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-16 19:14:06 +02:00
* Fix sorting for real.
This commit is contained in:
@@ -146,7 +146,7 @@ CollectionItem::peerSortValue() const
|
|||||||
if( m_source->isLocal() )
|
if( m_source->isLocal() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return m_source->id();
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -91,22 +91,6 @@ SourcesProxyModel::expandRequested( const QModelIndex& idx )
|
|||||||
bool
|
bool
|
||||||
SourcesProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) const
|
SourcesProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) const
|
||||||
{
|
{
|
||||||
CollectionItem* ciL = qobject_cast< CollectionItem* >( m_model->data( left, SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >() );
|
|
||||||
CollectionItem* ciR = qobject_cast< CollectionItem* >( m_model->data( right, SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >() );
|
|
||||||
|
|
||||||
if ( ciL && ciR )
|
|
||||||
{
|
|
||||||
if ( ciL->source().isNull() )
|
|
||||||
return true;
|
|
||||||
if ( ciR->source().isNull() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if ( ciL->source() == SourceList::instance()->getLocal() )
|
|
||||||
return true;
|
|
||||||
if ( ciR->source() == SourceList::instance()->getLocal() )
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_model->data( left, SourcesModel::SortRole ) != m_model->data( right, SourcesModel::SortRole ) )
|
if ( m_model->data( left, SourcesModel::SortRole ) != m_model->data( right, SourcesModel::SortRole ) )
|
||||||
return ( m_model->data( left, SourcesModel::SortRole ).toInt() < m_model->data( right, SourcesModel::SortRole ).toInt() );
|
return ( m_model->data( left, SourcesModel::SortRole ).toInt() < m_model->data( right, SourcesModel::SortRole ).toInt() );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user