Bug 184055 - [PATCH] Custom file list sorting is not honored when opening/creating a new file
Summary: [PATCH] Custom file list sorting is not honored when opening/creating a new file
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: application (show other bugs)
Version: unspecified
Platform: Mandriva RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 176401 185449 196280 198570 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-02-11 22:06 UTC by gambas
Modified: 2010-01-21 00:32 UTC (History)
12 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
On opened its make the call to KateViewDocumentProxyModel::sort() (400 bytes, patch)
2009-12-24 22:13 UTC, Abhishek Patil
Details
sort the content of file list after the file get added to filelist (661 bytes, patch)
2009-12-25 05:31 UTC, Abhishek Patil
Details
sort the content of file list after the file get added to filelist ignore sorting on other filelist event (945 bytes, patch)
2009-12-26 07:58 UTC, Abhishek Patil
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gambas 2009-02-11 22:06:34 UTC
Version:            (using KDE 4.2.0)
OS:                Linux
Installed from:    Mandriva RPMs

I selected "sort files by URL". When I open a new file, it is added at the end of the file list. It will go to its expected sorted place only after opening another new file.
Comment 1 daelstorm 2009-04-08 06:21:50 UTC
This is repeatable with version 3.2.2 (KDE 4.2.2), as well. I believe the bug lies somewhere in part of the code (the iterator?) that checks the number of files added. With this bug, if I open several files, the last one added is not sorted properly, while the all the rest are sorted. 

Manually changing sorting methods to another type, and then back corrects this, but adding yet another file results in that file not being sorted properly, while fixing the next-to-last file.

This bug could be as caused by simply counting from zero, instead of from 1, breaking whatever iterator or code logic checks which files to sort.
Comment 2 Dario Andres 2009-08-17 19:17:38 UTC
*** Bug 185449 has been marked as a duplicate of this bug. ***
Comment 3 Dario Andres 2009-08-17 19:17:48 UTC
*** Bug 198570 has been marked as a duplicate of this bug. ***
Comment 4 Dario Andres 2009-08-17 19:18:51 UTC
*** Bug 196280 has been marked as a duplicate of this bug. ***
Comment 5 Dario Andres 2009-08-17 19:18:54 UTC
*** Bug 176401 has been marked as a duplicate of this bug. ***
Comment 6 Martin Schwinzerl 2009-08-18 08:47:57 UTC
I can confirm this bug with Kate 3.3.0 / KDE 4.3.0 :

0.) Create four text files a.txt, b.txt. c.txt and d.txt and open an empty kate window

1.) Open a.txt
2.) Open c.txt 
3.) Right mouse click in the "documents" side panel -> sort by -> document name
    The displayed list of documents is correct "a.txt", then "c.txt" 

4.) open b.txt -> list of documents is "b.txt", "a.txt", "c.txt" (expected:
    "a.txt", "b.txt", "c.txt" )

5.) open d.txt -> list of documents now shows 
    "d.txt", "a.txt", "b.txt", "c.txt"

Without having the time atm to go through the source code I would speculate that the sorting operation takes place prior to the append operation. 

Regards
Martin
Comment 7 Ralf Jung 2009-11-14 11:17:15 UTC
I do have exactly the same issue with KDE 4.3.2, Kate 3.3.2
Comment 8 David Laban 2009-11-19 17:42:08 UTC
https://bugs.kde.org/show_bug.cgi?id=198570 says how to fix this. Any chance we could get this fixed by kde 4.4, or are you waiting for someone to actually submit a patch?
Comment 9 Abhishek Patil 2009-12-24 22:13:28 UTC
Created attachment 39320 [details]
On opened its make the call to KateViewDocumentProxyModel::sort() 

On KateViewDocumentProxyModel::opened its make the call to KateViewDocumentProxyModel::sort()
Comment 10 Abhishek Patil 2009-12-25 05:31:09 UTC
Created attachment 39323 [details]
sort the content of file list after the file get added to filelist 

Hi,
This version of the patch is more refine which calls the sort function after file gets open as normal behavior of kate add the file in to file list 1st time when we open the file. in this I have removed the unwanted call to sort() from KateViewDocumentProxyModel::slotRowsInserted which is of no use. hope this will solve the BUG :)
Comment 11 Abhishek Patil 2009-12-26 07:58:48 UTC
Created attachment 39346 [details]
sort the content of file list after the file get added to filelist ignore sorting on other filelist event 

More update to same patch but is performance issue solve..
While working on some other but i figured out that 
KateViewDocumentProxyModel::opened getting called on KateFileList clicked event to open and activate doc this will cause in unnecessary calls to Sort()so to protect it if the sender for this slot is KateFileList then ignore this calling sort().. this seems perfect for this..
Comment 12 Dominik Haumann 2009-12-27 20:18:49 UTC
Review request: http://reviewboard.kde.org/r/2447/
Comment 13 Harsh J 2010-01-12 19:24:36 UTC
Fixed in r1070443 by abhishekpatil
WebSVN: http://websvn.kde.org/?view=revision&revision=1070443
Comment 14 Ralf Jung 2010-01-12 19:32:08 UTC
Thanks a lot :)
Any chance of this being back-ported to the 4.4 (and maybe even 4.3?) branch?
Comment 15 Harsh J 2010-01-12 19:44:19 UTC
It already exists in the 4.4 branch (commit was 7 days ago, didn't auto-resolve here for some reason).
Comment 16 Chusslove Illich 2010-01-18 12:40:28 UTC
Indeed, how about also porting the fix to 4.3 branch, given that 4.3.5 will
be released (in two days)?
Comment 17 Chusslove Illich 2010-01-21 00:22:23 UTC
I did actually test the patch in 4.3 branch Kate, and it works as expected.
I'm itching to commit it myself before tomorrow's tagging of 4.3.5. Is there
a reason why I shouldn't?
Comment 18 Milian Wolff 2010-01-21 00:28:35 UTC
Please, go ahead and backport it.
Comment 19 Chusslove Illich 2010-01-21 00:32:24 UTC
SVN commit 1077835 by ilic:

Honor file list sorting when opening/creating new file. (bport: 1070443)
CCBUG: 184055


 M  +7 -3      kateviewdocumentproxymodel.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1077835