Version: (using KDE KDE 3.5.2) Installed from: Compiled From Sources Compiler: gcc (GCC) 3.4.5 (Gentoo 3.4.5-r1, ssp-3.4.5-1.0, pie-8.7.9) OS: Linux In the collection browser, in flat view if you display a column that includes a numerical value (such as Length or Score), and then sort on that column, the table is sorted by the string value instead of by the numerical value (10:30 comes before 5:00). The culprit is the CollectionItem::compare() function. It should be modified to have additional logic similar to PlaylistItem::compare().
Confirming with Amarok 1.4.1 final.
*** Bug 132646 has been marked as a duplicate of this bug. ***
SVN commit 575764 by aumuell: numeric sort for numeric columns in flat collection view BUG: 130667 M +1 -0 ChangeLog M +38 -9 src/collectionbrowser.cpp --- trunk/extragear/multimedia/amarok/ChangeLog #575763:575764 @@ -10,6 +10,7 @@ CHANGES: BUGFIXES: + * Sort numeric columns in flat collection numerically. (BR 130667) VERSION 1.4.2: FEATURES: --- trunk/extragear/multimedia/amarok/src/collectionbrowser.cpp #575763:575764 @@ -3781,9 +3781,9 @@ w += correct; correct = 0; setColumnWidth( c, w ); - if( m_viewMode == modeFlatView ) - m_flatColumnWidths.push_back( w ); } + if( m_viewMode == modeFlatView ) + m_flatColumnWidths.push_back( w ); } } @@ -3806,7 +3806,6 @@ setColumnWidth( 0, width - col1width ); } - // Needed for correct redraw of bubble help triggerUpdate(); } @@ -3911,13 +3910,43 @@ // Sampler is the first one in iPod view CollectionView* view = static_cast<CollectionView*>( listView() ); if( view->viewMode() == CollectionView::modeIpodView ) - { - if ( m_isSampler ) - return -1; - if ( dynamic_cast<CollectionItem*>( i ) && static_cast<CollectionItem*>( i )->m_isSampler ) - return 1; - } + { + if ( m_isSampler ) + return -1; + if ( dynamic_cast<CollectionItem*>( i ) && static_cast<CollectionItem*>( i )->m_isSampler ) + return 1; + } + else if( view->viewMode() == CollectionView::modeFlatView ) + { + ia = ib = 0; + // correctly treat numeric values + switch( col ) + { + case CollectionView::Track: + case CollectionView::DiscNumber: + case CollectionView::Bitrate: + case CollectionView::Score: + case CollectionView::Rating: + case CollectionView::Playcount: + case CollectionView::BPM: + ia = a.toInt(); + ib = b.toInt(); + break; + case CollectionView::Length: + ia = a.section( ':', 0, 0 ).toInt() * 60 + a.section( ':', 1, 1 ).toInt(); + ib = b.section( ':', 0, 0 ).toInt() * 60 + b.section( ':', 1, 1 ).toInt(); + break; + } + if( ia || ib ) + { + if( ia < ib ) + return 1; + if( ia > ib ) + return -1; + return 0; + } + } // Unknown is always the first one unless we're doing iPod view, but if the two items to be compared are Unknown, // then compare the normal way
*** Bug 132948 has been marked as a duplicate of this bug. ***