D14426: [Folder View] Create KFilePlacesModel only when needed and listen for changes
This revision was automatically updated to reflect the committed changes. Closed by commit R119:dff9d7fe09f2: [Folder View] Create KFilePlacesModel only when needed and listen for changes (authored by broulik). CHANGED PRIOR TO COMMIT https://phabricator.kde.org/D14426?vs=41331=41485#toc REPOSITORY R119 Plasma Desktop CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D14426?vs=41331=41485 REVISION DETAIL https://phabricator.kde.org/D14426 AFFECTED FILES containments/desktop/plugins/folder/labelgenerator.cpp containments/desktop/plugins/folder/labelgenerator.h To: broulik, #plasma, hein Cc: plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D14426: [Folder View] Create KFilePlacesModel only when needed and listen for changes
broulik updated this revision to Diff 41331. broulik added a comment. Indeed I did :) REPOSITORY R119 Plasma Desktop CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D14426?vs=41318=41331 REVISION DETAIL https://phabricator.kde.org/D14426 AFFECTED FILES containments/desktop/plugins/folder/labelgenerator.cpp To: broulik, #plasma, hein Cc: plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D14426: [Folder View] Create KFilePlacesModel only when needed and listen for changes
hein added a comment. Did you forget to update the diff? REPOSITORY R119 Plasma Desktop REVISION DETAIL https://phabricator.kde.org/D14426 To: broulik, #plasma, hein Cc: plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D14426: [Folder View] Create KFilePlacesModel only when needed and listen for changes
broulik updated this revision to Diff 41318. broulik edited the summary of this revision. broulik added a comment. - 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. REPOSITORY R119 Plasma Desktop CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D14426?vs=38587=41318 REVISION DETAIL https://phabricator.kde.org/D14426 AFFECTED FILES containments/desktop/plugins/folder/labelgenerator.cpp containments/desktop/plugins/folder/labelgenerator.h To: broulik, #plasma, hein Cc: plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D14426: [Folder View] Create KFilePlacesModel only when needed and listen for changes
hein added a comment. Danke :) REPOSITORY R119 Plasma Desktop REVISION DETAIL https://phabricator.kde.org/D14426 To: broulik, #plasma, hein Cc: plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D14426: [Folder View] Create KFilePlacesModel only when needed and listen for changes
broulik planned changes to this revision. broulik added a comment. Good idea, will do REPOSITORY R119 Plasma Desktop REVISION DETAIL https://phabricator.kde.org/D14426 To: broulik, #plasma, hein Cc: plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D14426: [Folder View] Create KFilePlacesModel only when needed and listen for changes
hein added a comment. 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 ... REPOSITORY R119 Plasma Desktop REVISION DETAIL https://phabricator.kde.org/D14426 To: broulik, #plasma, hein Cc: plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D14426: [Folder View] Create KFilePlacesModel only when needed and listen for changes
broulik created this revision. broulik added reviewers: Plasma, hein. Restricted Application added a project: Plasma. Restricted Application added a subscriber: plasma-devel. broulik requested review of this revision. REVISION SUMMARY 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 TEST PLAN - 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) REPOSITORY R119 Plasma Desktop REVISION DETAIL https://phabricator.kde.org/D14426 AFFECTED FILES containments/desktop/plugins/folder/labelgenerator.cpp containments/desktop/plugins/folder/labelgenerator.h To: broulik, #plasma, hein Cc: plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart