Bug 164185 - Undo "cut" operation will gray out icons of previously cutted files.
Summary: Undo "cut" operation will gray out icons of previously cutted files.
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 16.12.2
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Peter Penz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-15 22:07 UTC by FiNeX
Modified: 2009-01-08 21:52 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
un-cutted files (18.35 KB, image/jpeg)
2008-06-15 22:08 UTC, FiNeX
Details
Correct (?) result (40.88 KB, image/png)
2009-01-05 11:37 UTC, Peter Penz
Details
bug still there (86.90 KB, image/jpeg)
2009-01-08 17:33 UTC, David Faure
Details

Note You need to log in before you can comment on or make changes to this bug.
Description FiNeX 2008-06-15 22:07:56 UTC
Version:            (using Devel)
Installed from:    Compiled sources

Steps to reproduce:
1) cut some files
2) paste them on another directory
3) go back to the original directory
4) undo the operation with CTRL+Z or by the edit->undo menu action
the un-cutted files will have a different icon.

On the next screenshot you can see the file "test1", "test2" and "test3" which has been cutted and bring back with undo. Before cutting icons was equal to "test4" and "test5".
Comment 1 FiNeX 2008-06-15 22:08:29 UTC
Created attachment 25367 [details]
un-cutted files
Comment 2 Peter Penz 2008-06-18 21:45:17 UTC
Very interesting issue :-) Can you tell me which MIME-type your files test1, test2, ... have? I assume when pressing "reload" the icons will be fixed. Is this correct?
Comment 3 FiNeX 2008-06-18 22:19:46 UTC
yes, after reloading all is ok.
I've reproduced even creating some empty files.
Comment 4 Dario Andres 2008-12-19 21:14:32 UTC
Here using:

Qt: 4.4.3                                              
KDE: 4.1.85 (KDE 4.1.85 (KDE 4.2 Beta2))               
kdelibs svn rev. 899058 / kdebase svn rev. 899058      
on ArchLinux x86_64 - Kernel 2.6.27.8

I've created some empty files (with ".txt" extension) using "touch".
This files have an "text" icon
After cutting and undoing the cut operation, 
The cutted files have the same "text" icon (they aren't "empty")
Comment 5 David Faure 2008-12-24 14:55:16 UTC
.txt makes the mimetype determination say "those are text files". Better not use extensions, to reproduce the original report.
I can reproduce it indeed (using  "for i in test{1,2,3,4,5}; do echo foo > $i ; done").
Strange that "undo" generates the bug, but not moving back the file by hand.

The code that generates the "cut" icon is the problem, but where is that code? Peter? I thought there was some DolphinIconManager or something? Can't find it.
Comment 6 Peter Penz 2008-12-24 16:06:42 UTC
(i'm only online per iphone -> short reply) the code for cut items is in kfilepreviewgenerator in kdelibs. i've svn access again on the 1st of january and will take care for this :-)
Comment 7 Peter Penz 2009-01-04 21:12:25 UTC
Hm, I've problems to reproduce the issue... I did the following:

1. Open Dolphin in ~
2. Create text files like in comment #5 by
for i in test{1,2,3,4,5}; do echo foo > $i ; done
3. Cut items test4 and test5
4. Go into directory ~/Temp
5. Press paste
6. Go into directory ~
7. Select "Undo Move"

However the icons are not "empty", but indicate a text (see attachment). Has something changed in the meantime or do I something wrong?

Comment 8 FiNeX 2009-01-05 00:18:19 UTC
I can still reproduce it (r905373)... but wait... are you using previews enabled? I'm not using previews.
Comment 9 Peter Penz 2009-01-05 11:37:11 UTC
Created attachment 29925 [details]
Correct (?) result
Comment 10 Peter Penz 2009-01-05 11:39:18 UTC
Update: I just added the attachment I mentioned in comment #7 (I accidently added it to a wrong bug report).

@FiNeX:
> I can still reproduce it (r905373)... but wait... are
> you using previews enabled? I'm not using previews.

I did not use previews, very strange... I'll try it again today, maybe it is a timing problem.
Comment 11 David Faure 2009-01-08 17:33:41 UTC
Created attachment 30032 [details]
bug still there

I tried the exact steps from Peter in comment 7, and the bug happened again.
SVN trunk r907015.
Comment 12 David Faure 2009-01-08 18:14:34 UTC
The bug seems to be in kfileitem, it finds the mimetype application/octet-stream for these files (which makes sense as a first guess from the extension, but not as final mimetype)... I guess what's missing is the delayed mimetype determination for those new files.
Comment 13 David Faure 2009-01-08 20:46:14 UTC
Ah. Found it. Mimetype is determined, but cached icon isn't cleared out.
Another way to see this bug: cut one file, then rename it with another (known) extension -> the icon won't change, but it does normally (when the icon is not cut).

KDirModel bug, on my way to fixing it.
Comment 14 David Faure 2009-01-08 21:10:48 UTC
SVN commit 907835 by dfaure:

Clear the cached icon (preview or "cut icon") when the mimetype changes (due to delayed mimetype determination
or due to renaming the file).
BUG: 164185


 M  +13 -0     kdirmodel.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=907835
Comment 15 David Faure 2009-01-08 21:11:46 UTC
SVN commit 907837 by dfaure:

Clear the cached icon (preview or "cut icon") when the mimetype changes (due to delayed mimetype determination
or due to renaming the file). The fix will be in 4.2.
CCBUG: 164185


 M  +13 -0     kdirmodel.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=907837
Comment 16 Peter Penz 2009-01-08 21:13:07 UTC
Thanks David!!
Comment 17 FiNeX 2009-01-08 21:52:13 UTC
Good, the patch works fine :)