Bug 156186

Summary: Sorting of albums other than alphabetically
Product: digikam Reporter: Chris Green <chris>
Component: Albums-SortAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: caulier.gilles, EMuede, krienke, languitar
Priority: NOR Flags: languitar: Junior_Jobs+
Version: 0.9.2   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 4.3.0
Attachments: patch as in #c2

Description Chris Green 2008-01-19 18:40:39 UTC
Version:           0.9.2 (using KDE 3.5.8)
Installed from:    Fedora RPMs
OS:                Linux

It would be good to be able to specify different sort orders for albums/sub-directories so that, for example, they could be sorted by date rather than alphabetically.

It would also be good to be able to specify album/sub-folder order 'by hand' as it were.  For example if I have an album called 1960 which has sub-directories "Spring - Barnet", "Easter - Cottage", "Summer - Cottage", "Autumn" I'd like to be able to list them in the following order in the 1960 album:-

    Easter - Cottage
    Spring - Barnet
    Summer - Cottage
    Autumn

I.e. I'd like to be able to drag and drop the sub-directories to my choice of place in the album regardless of their actual creation date or alphabetical order (like you sort bookmarks in Firefox for example).
Comment 1 Chris Green 2008-07-04 23:27:28 UTC
My ideal would be to sort albums by the album properties date in the folder view of albums.  This would allow albums given month names (for example) to be shown in chronological order rather than alphabetical order as at present.
Comment 2 Chris Green 2008-07-10 22:34:14 UTC
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.
Comment 3 Arnd Baecker 2008-07-11 09:53:57 UTC
Created attachment 26034 [details]
patch as in #c2

The patch works fine for me (and: I really like that behaviour!!).

There is one additional thing: if the dates are equal, I would propose
to use the usual alphabetical sorting.
(The dates can be excatly equal, when one uses the GUI...)
Comment 4 Chris Green 2008-07-11 12:30:38 UTC
Yes, that's a good point, and it would be very easy to do it.
Comment 5 Johannes Wienke 2009-10-22 01:23:31 UTC
Looks like this would also be solved with porting to Qt4 model concept, or am I wrong?
Comment 6 Marcel Wiesweg 2009-10-22 17:55:01 UTC
You are quite right. You have seen the ImageSortSettings class, same can be done for albums. With model/view, everything is nicely separated and can be more clearly implemented and shared.
Comment 7 Andi Clemens 2010-12-04 12:21:55 UTC
Sorting albums seems to be gone from the menu... have we removed this feature on purpose?
Comment 8 caulier.gilles 2011-12-23 10:27:26 UTC
Johannes, Marcel,

What's new about album sorting and qt4 model/view ?

Gilles Caulier
Comment 9 caulier.gilles 2011-12-23 11:13:11 UTC
*** Bug 189555 has been marked as a duplicate of this bug. ***
Comment 10 Ewald Müller 2012-12-17 23:59:13 UTC
I would like to have a different sort-order based upon the album-properties. Reason: I've many films digitized from 'analog' sources (dias, film-rolls), where i ordered an extra cd when the film was developed. Since i used a nikon (analog) the pictures (with exactly the same timestamp) are always numbered descending (imm_036 ... imm_001): so that import should be shown in descending order.

Now there are many albums in the collection taken from digital sources with EXIF-data, which should be sorted ascending (by exif-time-field).

Is it posibble to implement a default order (ascending) for each new created album while the existing albums remain -as they were- descending ?

This property could be shown as a small icon in the folder-view

Thanks for your time

Ewald
Comment 11 caulier.gilles 2014-08-23 21:50:17 UTC
"View/Sort Albums/By Folder | By Categories | By Date" options have been re-implemented with 4.x series

Gilles Caulier