Bug 178425 - wrong initial sorting order in file open dialog
Summary: wrong initial sorting order in file open dialog
Status: RESOLVED FIXED
Alias: None
Product: kfile
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
: 171158 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-12-22 04:20 UTC by Marc Schiffbauer
Modified: 2009-05-21 12:25 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Corrects the relationship between sort arrow and loading sort order from saved options. (3.50 KB, patch)
2008-12-23 02:10 UTC, Michael Pyne
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Schiffbauer 2008-12-22 04:20:39 UTC
Version:           4.1.85 (using Devel)
OS:                Linux
Installed from:    Compiled sources

Hi, 

The file open dialog has a bug in the sorting of elements: 

When opened the column header of the filename column indicates ascending sorting of entries -> OK. But the files are sorted descending actually (Wrong!). 
Changing the sort-order two times "fixes" this. 

To reproduce: 
For example in konqueror: File -> Open file 
(Dialog Config: Detailed View, Sort by Name) 
Take a closer look at the sorting order: It shows that it has sorted ascending (a->z) but the files are sorted descending (z->a), clicking on the name column header changes the display to correct order (descending), then when switching back to ascending the files will correctly be sorted. 

See this screenshot which shows the wrong initial display 
http://linuxcc.de/kde-bugs/file-open.png
Comment 1 FiNeX 2008-12-22 11:07:11 UTC
It seems inverted, instead it should behave like dolphin (imho)
Comment 2 Marc Schiffbauer 2008-12-22 14:54:35 UTC
Yes inverted, and wrong because not like the columns heading tells you until you click the column heading: one time will just "fix" the columns heading, sorting order stays descending (z->a), and clicking again changes back the columns heading to its original state *and* changes the ordering of the files like it sould be.
Comment 3 Michael Pyne 2008-12-23 02:10:20 UTC
Created attachment 29566 [details]
Corrects the relationship between sort arrow and loading sort order from saved options.

This touches some KDirOperator code so I would like some code review before I commit, but basically this simplifies the code that handles the sorting option code in the hopes of getting it right. i.e. instead of noting that the sort option is changed and manually flipping the bit we just set it based on whether the appropriate action is checked or not.

In addition a "triggered" signal is changed to "toggled" that way even programmatic changes to the "Reversed" action update the UI.  This could probably be done in many other places where triggered is used but I haven't looked.

Last step was to move the setSorting() call on initial widget creation until after all options are read so that the initial UI is correct.

By the way I'm back from patrol, hi all.
Comment 4 Rafael Fernández López 2008-12-23 03:15:00 UTC
I think the patch looks fine. Wouldn't be, however, the next part of the patch enough to fix the problem ?

@@ -2090,7 +2096,6 @@
     }
 
     d->sorting = sorting;
-    setSorting(d->sorting);
 
     if (configGroup.readEntry(QLatin1String("Show hidden files"),
                               DefaultShowHidden)) {
@@ -2104,6 +2109,7 @@
         d->sorting = d->sorting | QDir::Reversed;
     }
 
+    setSorting(d->sorting);
     if (d->inlinePreviewState == Private::NotForced) {
         d->showPreviews = configGroup.readEntry(QLatin1String("Previews"), false);
     }

But in any case, I like the other changes... I have no comments on this. Peter, do you ? (since AFAIR you wrote this part when porting KDirOperator)
Comment 5 Michael Pyne 2008-12-23 04:01:40 UTC
> I think the patch looks fine. Wouldn't be, however, the next part of the patch
> enough to fix the problem ?

I thought I had already tried just moving the setSorting() call but I had manually called the "synchronize UI with sort status" function instead (unsuccessfully).  Your suggestion should probably work but I don't feel like recompiling kfile right now, Peter probably knows better than I anyways.
Comment 6 Peter Penz 2008-12-23 08:10:43 UTC
> But in any case, I like the other changes... I have no comments on
> this. Peter, do you ? (since AFAIR you wrote this part when
> porting KDirOperator) 

Yes, I did the initial porting but have to admit that I'm not really an expert for kdiroperator... However I think the patch looks fine!
Comment 7 Rafael Fernández López 2008-12-23 11:00:26 UTC
Please Michael, commit :)
Comment 8 Michael Pyne 2008-12-23 16:02:10 UTC
SVN commit 900764 by mpyne:

Fix bug 178425 (wrong initial sorting order in File Open dialog).

BUG:178425


 M  +15 -14    kdiroperator.cpp  
 M  +1 -1      kdiroperator.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=900764
Comment 9 Michael Pyne 2008-12-31 06:17:16 UTC
*** Bug 171158 has been marked as a duplicate of this bug. ***
Comment 10 Tomas Åkesson 2009-05-21 12:25:52 UTC
Using Kubuntu 9.04, KDE 4.4.2. Still some problem with initial sort order:

When opening a file dialog in detailed view, or if I select "detailed view" after having "short view" selected, the files are sorted wrong (z-a). The setting in the sort-menu is initially set to "descending"; i.e. it's consistent, but initial sorting is wrong, so the bug seems to have been partially fixed(?).

My ~/.kde/share/config/kdeglobals says:
[KFileDialog Settings]
Sort reversed=false

But I also tried on a fresh account.