[Digikam-devel] [Bug 156186] Sorting of albums other than alphabetically

Chris Green chris at isbd.co.uk
Thu Jul 10 21:34:15 BST 2008


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=156186         




------- Additional Comments From chris isbd co uk  2008-07-10 22:34 -------
As requested my patch to do this is as follows:-

In albumfolderview.cpp, method AlbumFolderViewItem::compare(QListViewItem *i, int col, bool ascending):-

Lines 215-218 were:-

    if (!m_groupItem || m_year == 0 || m_month == 0)
    {
        return QListViewItem::compare(i, col, ascending);
    }

Change them to:-

    if (!m_groupItem || m_year == 0 || m_month == 0)
    {
        PAlbum * myalbum = album();

        if (!myalbum)
            return 0;

        QDate myDate = myalbum->date();

        AlbumFolderViewItem* thatItem = dynamic_cast<AlbumFolderViewItem*>(i);
        if (!thatItem)
            return 0;
        PAlbum * thatAlbum = thatItem->album();
        if (!thatAlbum)
            return 0;
        QDate thatDate = thatAlbum->date();

        if (myDate == thatDate)
            return 0;
        else if (myDate > thatDate)
            return 1;
        else
            return -1;
    }

Obviously to make this switchable from original (alphabetical) sort to my new chrinological sort it needs a menu option and an if/else block to choose the new or old code.



More information about the Digikam-devel mailing list