Bug 155356

Summary: KFileWidget opens wrong file in some cases (reproducible with KWrite)
Product: [Applications] kfile Reporter: Urs Wolfer <uwolfer>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: alan.braslau, amantia, peter.penz19
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Urs Wolfer 2008-01-09 22:16:28 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

In some special cases, KFileWidget returns not the correct selected file. Steps to reproduce this:
* open KWrite
* open the file open dialog
* click the dropdown arrow in the location combobox
* select one item from the dropdown and remember it's name
* click open
* KWrite open instead of this one the atm open file again

2nd way to reproduce:
* do the first 2 steps again
* paste a full file name into the input line. (e.g. a filename from the compiler output...)
* click open
* same happens as above...

After some debugging, I think the problem is in the completion of KFileWidget. The completion object does not emit a "match" signal... This is probably because the completion object has not been requested in the cases above.
Comment 1 Urs Wolfer 2008-01-17 20:01:17 UTC
SVN commit 762724 by uwolfer:

Set the lineedit modified when it has been modified by the user. This way pasted paths/files get opened instead of the last selected in the file view (reproducible in KWrite when already one file has been opened).
BUG: 155356

 M  +2 -0      kfilewidget.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=762724
Comment 2 András Manţia 2008-01-19 19:59:23 UTC
I reopen the bug, as the problem is rather similar in another case: make sure you have files starting with the same latter in the directory (eg. c1.txt, c2.txt, c3.txt). Assume you want to open c3.txt. In the Location box type "c", you will see all the files starting with "c". At the same time in the filelist area the focus will jump to the first file starting with "c", here "c1.txt".
Now select "c3.txt" in the completion box (with the mouse or by going down, but not pressing enter). "c3.txt" is inserted into the location bar (the focus above is still on c1.txt).
Click on Open button, and you will see c1.txt is opened instead of c3.txt. If you press Enter instead of clicking on Open, it works.

I can't say how many times I attached a wrong file to a mail because of this bug...
Comment 3 András Manţia 2008-06-09 15:46:50 UTC
The bug is still present in trunk. The file that is opened is not the one you select (and whose name appears in the location box), but the one that is selected in the file view. Or in other words, if you select a filename from the combobox with the mouse, the selection in the file view  is not updated.
Comment 4 Peter Penz 2008-06-18 21:50:43 UTC
@András: I think this has been fixed by SVN commit 821242 (at least I cannot reproduce this issue anymore). Before I set this issue to resolved and still might miss something, it would be great if you could confirm the fix :-) Thanks!
Comment 5 András Manţia 2008-06-20 08:10:38 UTC
Peter, no it is not fixed yet. The wrong file is selected if you use the mouse 
to select the item from the dropdown combo.
Comment 6 Peter Penz 2008-06-20 08:29:19 UTC
OK, I should have time next week for having a look on this.
Comment 7 Jakub Stachowski 2008-06-21 12:55:17 UTC
*** Bug 163805 has been marked as a duplicate of this bug. ***
Comment 8 Peter Penz 2008-06-26 20:13:00 UTC
SVN commit 824848 by ppenz:

fixed issue that the wrong file has been opened when using the combo box of the location bar

BUG: 155356

 M  +10 -0     kfilewidget.cpp  
 M  +1 -0      kfilewidget.h  


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