When no label is displayed, there's no point in creating a KFilePlacesModel.
Also, only emit a change for displayLabel when it actually changed.
Moreover, listen to changes in the KFilePlacesModel and update the label if needed.
Also, make the KFilePlacesModel static and shared between all Folder View instances.
Details
Details
- Reviewers
hein - Group Reviewers
Plasma - Commits
- R119:dff9d7fe09f2: [Folder View] Create KFilePlacesModel only when needed and listen for changes
- My test partition still has its proper "Device" name (devices are populated deferred, so if we didn't listen for changes, creating a model and asking for closestItem right away would return Root (/media/foo is closed to /)
- Reduces the number of displayLabelChanged emissions to half on startup
- Added a Pictures folder view, renamed my Pictures place in Dolphin, label updated immediately
- Verified in GammaRay there's no KFilePlacesModel instance in plasmashell unless having a Folder View widget on desktop or panel (but not in the default containment case)
Diff Detail
Diff Detail
- Repository
- R119 Plasma Desktop
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Comment Actions
Can we make the KFilePlaces model static on top of this? It could be shared by all FVs that need it. Look at how tasksmodel.cpp keeps a refcount of when ActivityInfo is in use and deletes it when it drops to 0 for example ...
Comment Actions
- Make KFilePlacesModel static and ref-counted
For simplicify the ref count is increased/decreased in the constructor and not depending on whether the model is actually used, e.g. when user changes setting from default display label to something else. This would make the patch super complicated otherwise. The model is then only not loaded again on next startup.