You know that side bar in Dolphin and the file open/save dialogue boxes? The one that lists things like “Home” “Root” “Volume (vfat)” “Remote” etc? Yes, that one.
There’s now a data engine for it. You can fire up plasmaengineexplorer and check it out, if you like. You know, if you’re particularly bored.
The implementation uses KFilePlacesModel. And KFreeDiskSpace from KIO. Because logically related things are never put together in APIs😛.
One of the interesting things about KFilePlacesModel is what does and doesn’t propagate between programs.
For example, if you change the name of “Home” to “Home Directory” in Dolphin, the KFilePlacesModel will notice and tell the Places engine that the old data is invalid. And the engine will duly send the updated information to whoever asked for it.
However, if you mount (“set up” in Solid terminology) a removable device in Dolphin (by clicking on it), the KFilePlacesModel in the Places data engine won’t notice. So Places will still claim that the device needs setting up and has no URL (mount point), and will not tell you about free disk space. How rude. In fact, the same goes for hiding/unhiding places.
Unfortunately, Solid doesn’t provide this kind of notification, either (should it?). And it wouldn’t fix the hiding problem even if it did (although that’s not so important). So the only solution I can see is to periodically refresh the data.
Well, the real solution would be to make KFilePlacesModel pick up on these things. But that’s more work than I’m willing to do right now, with kdeprint to look at as well.