D19887: KFileItem: call stat() on demand, add SkipMimeTypeDetermination option

Robert Hoffmann noreply at phabricator.kde.org
Fri Mar 29 14:33:58 GMT 2019


hoffmannrobert marked 4 inline comments as done.
hoffmannrobert added inline comments.

INLINE COMMENTS

> dfaure wrote in kfileitem.cpp:362
> There is one thing I've been wondering back and forth about: the alternative way of doing this, which is to call init() unconditionally and testing the bool first thing in there.
> The benefit is that it would reduce the code size overall, and greatly simplify the top of this method (two calls to init, done).
> The downside is that for the reader, a call to init() might in fact do nothing (and it reads like it's doing something, until going there to check). So it's maybeInit(), urgh.
> 
> Ah, in another code base (QMimeType) I wrote ensureLoaded(). This could be ensureInitialized() ?
> 
> Sorry for not suggesting this earlier. Do you agree that it would make the code better?

Yes, I agree, but here you still need the two ifs, and the init() still is needed because of refresh().

> dfaure wrote in kfileitem.cpp:609
> No no, this won't work. entry() returns a copy, not a reference.

Ah, sorry, yes.

> dfaure wrote in kfileitem.cpp:663
> here entry() would work, no?

No, it's KFileItemPrivate.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D19887

To: hoffmannrobert, dfaure, #frameworks, #dolphin
Cc: kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190329/7b7188e4/attachment.html>


More information about the Kde-frameworks-devel mailing list