Bug 147600

Summary: open folder - files shown in reverse order
Product: [Applications] digikam Reporter: Steve <sodonald22>
Component: Showfoto-DirectoryAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 0.9.4
Sentry Crash Report:
Attachments: Patch to make the sort order configurable
Patch to make the sort order configurable, English improvements
patch?

Description Steve 2007-07-06 10:34:01 UTC
Version:           0.6.0 (using KDE KDE 3.5.7)
Installed from:    SuSE RPMs
OS:                Linux

Not sure if this is a bug or not, but I can't find any way to change this behaviour...

When I open a folder (File > open folder), the thumbnails are shown in descending order (i.e last filename first). This also affects slideshows.

Very annoying if you have a series of images (say of an event) and you want to view them in order from first to last, you must choose the last image and move backwards, which makes it impossible to do a slideshow.
Comment 1 caulier.gilles 2007-07-06 12:50:10 UTC
Steve,

Open Folder sorting file is harcoded in showfoto. Sorting is based on file date (more recent in first).

It's can be trivial to add a new option in settings dialog. 

Beginner developpers, this task is for you (:=)))

The code to patch in showfoto.cpp is in "void ShowFoto::openFolder(const KUrl& url)" where you have these lines :

    // Directory items sorting. Perhaps we need to add any settings in config dialog.
    dir.setFilter ( QDir::Files | QDir::NoSymLinks );
    dir.setSorting ( QDir::Time );

Gilles

Comment 2 Arnd Baecker 2007-07-06 13:02:07 UTC
>     dir.setSorting ( QDir::Time );

Why not just use
      dir.setSorting ( QDir::Time| QDir::Reversed );
?
Making this configurable seems not necessary to me.

Arnd
Comment 3 Steve 2007-07-06 14:22:45 UTC
I agree Arnd, I don't think it really needs to be a settings option.
I'd have a crack at it, but my C skills are only at the very beginning of their developing life... Hope someone out there could have a go at it, otherwise I'll give it a go once I've got a bit more experience under my belt.
Comment 4 caulier.gilles 2007-07-06 14:29:46 UTC
Personnaly, i always use current date order of file loaded in shwofoto. This is why i have implemented like this in source code.

I vote to add a new option in config dialog to load files in Thummbbar using and order based on multiple options as file date, file name, and reverse.

Gilles
Comment 5 Arnd Baecker 2007-07-06 22:24:35 UTC
Created attachment 21079 [details]
Patch to make the sort order configurable

The attached patch implements new configuration options
in showfoto's settings to select between ordering according to 
name/date/size and to reverse the ordering.
The default is to sort by increasing date.
Comment 6 Arnd Baecker 2007-07-24 11:44:13 UTC
Created attachment 21233 [details]
Patch to make the sort order configurable, English improvements

Compared to the previous patch, only the English corrections
by Clytie Siddall (Thanks!) are incorporated.

Further discussion in private mail with Giles (so that it
does not get lost):

Gilles: Currently, the patch fixes Open/Folder feature to order files in
thumbbar. This is not the only one issue : Open/File must be fixed in
this way, because more than one file can be loaded at the same time by
this option...

Arnd: One approach might be to introduce
      in the Routine slotOpenFile() the usage of
	QDir dir(url.path(), patterns),
      where patterns is set to the full names of the file.
      Afterwards, using the routines to sort via QDir's mechanisms
      is possible.

      Does this make sense, and sound like a good solution?

Gilles:
The standard way used is to use the void ShowFoto::applySettings() to
read settings from setup dialog (this method is called when you valid
setup dialog to update editor settings).

Store the setting in a common place to d private class like all others
settings are stored (for ex. d->deleteItem2Trash), and use these settings
where you want (slotOpenFile() or slotOpenFolder()). You can make a
common method to parse folder content accordinly with these settings.
Call this method at the right place...
Comment 7 caulier.gilles 2007-07-24 12:04:28 UTC
Arnd,

So, i can't said more (:=))).

If your future patch respect these rules, well commit it on svn and close this file only when somebody has tested.

Also, prepare your patch to be backported into KDE4 (trunk). The change will be minor normally...

Gilles

Comment 8 Andrzej 2007-10-10 23:49:24 UTC
any chance to have it included in 0.7?
Comment 9 caulier.gilles 2008-03-19 09:20:08 UTC
SVN commit 787439 by cgilles:

digiKam from KDE3 branch: Showfoto: apply patch from Arnd to a added 2 new options to set ordering of images when File/Open Folder action is used.
BUG: 147600



 M  +45 -15    setup/setupeditor.cpp
 M  +28 -3     showfoto.cpp
Comment 10 caulier.gilles 2008-03-19 09:56:19 UTC
SVN commit 787451 by cgilles:

backport commit #787439 from KDE3 branch
CCBUGS: 147600


 M  +36 -0     setup/setupeditor.cpp  
 M  +37 -12    showfoto.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=787451
Comment 11 Andi Clemens 2009-06-26 13:21:45 UTC
Hmm actually this one doesn't seem to be fixed?
When I uncheck "reverse order", images are sorted in a descend way. When I check "reverse", it is correct.

Can anyone confirm? If so, I will re-open the bug.
Comment 12 Andi Clemens 2009-06-26 13:52:14 UTC
Created attachment 34827 [details]
patch?

Shouldn't the if statement be more like this?
Comment 13 caulier.gilles 2009-06-26 13:56:25 UTC
If it work, fine for me...

Gilles
Comment 14 Andi Clemens 2009-06-26 14:31:54 UTC
Ok I'm confused now :-)

What is the correct sorting for Date?
Right now we have:

Name: Z->A (normal), A->Z (reverse).... WRONG!
Size: large->small  (normal,  small->large  (reverse).... WRONG?
Date: old->new (normal), new->old (reverse)... RIGHT!

I guess we want name and size sorting in a different way, right?

Andi
Comment 15 caulier.gilles 2009-07-22 15:19:34 UTC
yes andi, in different way, if possible, but i think it's enough that current implementation must use date to display items in reverse order, not name.

Gilles Caulier