Review Request 125158: add logic to use icons for default xdg user dirs

Harald Sitter sitter at kde.org
Fri Oct 2 12:59:10 UTC 2015



> On Sept. 21, 2015, 7:22 a.m., David Faure wrote:
> > src/core/kfileitem.cpp, line 905
> > <https://git.reviewboard.kde.org/r/125158/diff/2/?file=403005#file403005line905>
> >
> >     This is much better done by a readonly array, in order to take less memory and less CPU time.
> >     
> >         static const struct { QStandardPaths::StandardLocation loc, QString icon } s_icons[] = { { ..., ...} ... };
> >     
> >         static const int s_iconsCount = sizeof s_icons / sizeof *s_icons;
> >     
> >         for (int i = 0 ; i < s_iconsCount; ++i) {
> >          ...
> >         }
> >     
> >     
> >     (you don't even need the O(log n) lookup here, since the only use of the "map" is to iterate over it)

The two-stage lookup is to cache the QStandardPaths::standardLocations() as they do not change 99% of the time, so the roundtrip into QStandardPaths is not necessary.


> On Sept. 21, 2015, 7:22 a.m., David Faure wrote:
> > src/core/kfileitem.cpp, line 976
> > <https://git.reviewboard.kde.org/r/125158/diff/2/?file=403005#file403005line976>
> >
> >     Should be combined with the previous block
> >     
> >         if (isLocalUrl && !delaySlowOperations && isDir()) {
> >             // icons for standards paths
> >         
> >             if (isDirectoryMounted(url)) {
> >                 // iconFromDirectoryFile
> >             }
> >         }

I ordered this the other way around as we want .directory to take preference over the standardpath icon


- Harald


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/125158/#review85710
-----------------------------------------------------------


On Sept. 12, 2015, 1:29 p.m., Harald Sitter wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/125158/
> -----------------------------------------------------------
> 
> (Updated Sept. 12, 2015, 1:29 p.m.)
> 
> 
> Review request for KDE Frameworks.
> 
> 
> Bugs: 352498
>     https://bugs.kde.org/show_bug.cgi?id=352498
> 
> 
> Repository: kio
> 
> 
> Description
> -------
> 
> this acts as an additional fallback to mimetype iconing and .directory
> overrides. xdg user dirs are relocatable and can change depending on user
> locale as well as user configuration and additionally are used in a range
> of different desktop environments making this a very runtime sort of
> decision.
> 
> BUG: 352498
> 
> 
> Diffs
> -----
> 
>   autotests/kfileitemtest.h 615324f2b45fdc90a7841bdd0c8aa7f47cdf57a2 
>   autotests/kfileitemtest.cpp 5f728a411401fe3009924b66970d9ae6f12c60f2 
>   src/core/kfileitem.cpp 966d8626708a8f2672f1777c873f4e27e13023d6 
> 
> Diff: https://git.reviewboard.kde.org/r/125158/diff/
> 
> 
> Testing
> -------
> 
> maked
> autotested
> installed
> dolphin and file open dialogs now show icons
> 
> 
> Thanks,
> 
> Harald Sitter
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20151002/6863b3de/attachment.html>


More information about the Kde-frameworks-devel mailing list