Review Request 111830: Make determining the mime type faster for directories
Frank Reininghaus
frank78ac at googlemail.com
Thu Aug 8 22:33:12 BST 2013
> On Aug. 7, 2013, 8:40 p.m., Emmanuel Pescosta wrote:
> > dolphin/src/kitemviews/kfileitemmodel.cpp, line 1371
> > <http://git.reviewboard.kde.org/r/111830/diff/1/?file=175708#file175708line1371>
> >
> > Is this "if" really neccessary?
> > Because local static variables are created and initialized the first time they are used, as far as I know.
> >
> > So "static QString folderMimeType = item.mimeComment()" should also work here or could item.mimeComment() be empty when it is called the first time?
> >
You are right, it seems that my approach is more complicated than it needs to be. Thanks for pointing that out - I'll change it.
- Frank
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/111830/#review37309
-----------------------------------------------------------
On Aug. 1, 2013, 6:44 a.m., Frank Reininghaus wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/111830/
> -----------------------------------------------------------
>
> (Updated Aug. 1, 2013, 6:44 a.m.)
>
>
> Review request for Dolphin and Christoph Feck.
>
>
> Description
> -------
>
> Christoph noted in https://bugs.kde.org/show_bug.cgi?id=321710#c2 that "Sort by Type" sometimes does not work perfectly even in directories with a rather small number of sub-directories inside. I think that this is because we always call KFileItem::determineMimeType() before getting the type, which also tries to load the .directory files inside the directories to load the icon.
>
> We could improve this by not calling KFileItem::determineMimeType() for directories, but assign the type based on what KFileItem::isDir() returns.
>
> The "folder" mime type could be cached in a static QString, such that we only have to do the expensive things once for directories before the sorting can begin.
>
> Christoph, it would be nice if you could test it!
>
>
> Diffs
> -----
>
> dolphin/src/kitemviews/kfileitemmodel.cpp 1b4911d
>
> Diff: http://git.reviewboard.kde.org/r/111830/diff/
>
>
> Testing
> -------
>
> Seems to work nicely for me.
>
>
> Thanks,
>
> Frank Reininghaus
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20130808/07543c4e/attachment.htm>
More information about the kfm-devel
mailing list