D24773: kio_trash: Add size, modification, access and create date for trash:/

David Faure noreply at phabricator.kde.org
Mon Apr 13 14:41:25 BST 2020


dfaure requested changes to this revision.
dfaure added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> trashsizecache.cpp:131
> +    qint64 max_mtime = 0;
> +    const auto checMaxTime = [max_mtime] (const qint64 lastModTime) -> qint64 {
> +        return lastModTime > max_mtime ? lastModTime : max_mtime;

Typo: checkMaxTime with a 'k'?

> trashsizecache.cpp:131
> +    qint64 max_mtime = 0;
> +    const auto checMaxTime = [max_mtime] (const qint64 lastModTime) -> qint64 {
> +        return lastModTime > max_mtime ? lastModTime : max_mtime;

Interesting. One benefit of lambdas is that they can work on local variable; I would have captured max_mtime by reference and modified it inside the lambda.
Written this way (which I guess more "pure functional programming" because no side effects), it could be a static helper function ;)

Wait, this doesn't work, does it? It makes a copy of mtime right now, while it's still 0.

I'm pretty sure you want to capture by [&] instead
(and then, unless you insist on pure functions, I'd suggest just modifying it here, and returning void). It removes the "max_mtime = " duplication ;)

REPOSITORY
  R241 KIO

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

To: meven, #frameworks, ngraham, elvisangelaccio, dfaure
Cc: kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200413/315154f3/attachment.html>


More information about the Kde-frameworks-devel mailing list