RFC: [KFilePlacesView] Use asynchronous KIO::FileSystemFreeSpaceJob
ClosedPublic

Authored by broulik on Oct 19 2018, 10:54 AM.

Details

Summary

This ensure hovering a broken mount will not freeze the UI.
I already optimized it in D11088 to avoid doing blocking calls for when the bar isn't shown but this patch makes it fully async now.
Moreover, refresh only every 60 seconds (it's what Dolphin as well as Plasma's free space warning do), currently it would refresh every frame

Test Plan

Capacity bar shows up for a mounted drive and updates after a while when you hover it again.
It doesn't update "live" but it never did that, only happened to because it was querying free space like a mad man.

In theory this would also enable free space bars for network shares but CapacityBarRecommendedRole is only for mounted local storage sans CD rom.

Diff Detail

Repository
R241 KIO
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Oct 19 2018, 10:54 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptOct 19 2018, 10:54 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
broulik requested review of this revision.Oct 19 2018, 10:54 AM
broulik retitled this revision from [KFilePlacesView] Use asynchronous KIO::FileSystemFreeSpaceJob to RFC: [KFilePlacesView] Use asynchronous KIO::FileSystemFreeSpaceJob.

+1, but I'd like to hear people more experienced than me.

anthonyfieroni added inline comments.
src/filewidgets/kfileplacesview.cpp
258

You will get the job as lambda parameter.

259

You can make lambda mutable in there you can modify m_freeSpaceInfo without declare it mutable

anthonyfieroni added inline comments.Oct 24 2018, 8:11 AM
src/filewidgets/kfileplacesview.cpp
259

No ignore it, it does not work.

dfaure requested changes to this revision.Nov 4 2018, 10:14 AM

This map will keep growing and growing...

This revision now requires changes to proceed.Nov 4 2018, 10:14 AM

This map will keep growing and growing...

Are you sure? It didn't grow during my testing, even after moving places around and adding and removing items. It could always identify the same QPersistentModelIndex

davidedmundson added inline comments.
src/filewidgets/kfileplacesview.cpp
1111

I think David F means you should connect here and expunge dead entries.

dfaure accepted this revision.Aug 24 2019, 10:39 AM

Hmm I see this is only about the (few) entries in the Places view, not about general navigation into subsubdirs. So my initial comment was a bit nonsense.

src/filewidgets/kfileplacesview.cpp
258

Yes but he needs it for !info.job 3 lines above, to avoid starting multiple jobs for the same thing at the same time.

265

Usually written as

if (job->error())
1111

and clear the map in this method.

But I see that calling setModel twice isn't really supported properly anyway (no disconnects).

This revision is now accepted and ready to land.Aug 24 2019, 10:39 AM
This revision was automatically updated to reflect the committed changes.