[Task Manager] Add "Places" for entries belonging to a file manager

Authored by broulik on Dec 26 2016, 8:36 PM.



Since we cannot have dynamic jump list actions but this is an often requested feature and common among other desktop environments, at least add the "Places" to entries belonging to a file manager.

To avoid the menu becoming too long, the number of places shown is limited to 5* when the application is running and the menu would also have window controls. For when it's a launcher, all places are shown as there the menu is less likely to become massive.

This is added to services that contain the "FileManager" category, such as Dolphin.

*) It actually truncates it to 5 entries only if there's more than 7 places. There's nothing more frustrating than having a "reveal more" button that ends up adding just one or two items once clicked.

Test Plan

Those are the "Places" found in Dolphin's sidebar or Open/Save dialogs.

This does not include the Search for / Recently saved entries and nor does it include removable hard drives, it's only the static places the user can have in here.

Only seen Dolphin having this category. Verified that the places are opened with the respective application - for testing I added the flag to Gwenview and had Gwenview open e.g. the Pictures folder.

(colapsed view - as you can tell, the "Downloads" place in the upper screenshot is not in the collapsed view as I clicked the Projects entry more often)

Diff Detail

R119 Plasma Desktop
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
broulik updated this revision to Diff 9370.Dec 26 2016, 8:36 PM
broulik retitled this revision from to [Task Manager] Add "Places" for entries belonging to a file manager.
broulik updated this object.
broulik edited the test plan for this revision. (Show Details)
broulik added reviewers: Plasma, hein, Plasma: Design.
broulik set the repository for this revision to R119 Plasma Desktop.
Restricted Application added a project: Plasma. · View Herald TranscriptDec 26 2016, 8:36 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik added inline comments.Dec 26 2016, 8:46 PM

I just spotted this memory leak in backend, jumpListActions and recentDocumentActions both take a "parent" argument which is never used. I'll make a follow-up patch to change new QAction(this) to new QAction(menu) and I verified that this causes the QActions to be disposed of once the menu closes

To solve the problem of the context menu getting very long: How about putting the places in a submenu?

mart added a subscriber: mart.Dec 27 2016, 10:41 AM

+1 from me
but i feel that moving it to a submenu kinda misses the point to make the places immediately accessible

Yes, that is certainly a downside. One idea could be to move it into a submenu if there are more than X entries (though I'm not sure yet which number to choose). The downside of that would be that people who often add and remove places might get confused by the context menus jumping between submenu and no submenu

We could show up to 5 entries and then a "xx more Places" sub menu or an entry that expands to reveal the rest. However, this would massively complex things, as we then would need to track which items the user uses frequently and give priority to them, otherwise this quick access feature would be pointless.

broulik updated this revision to Diff 9422.Dec 28 2016, 4:01 PM
broulik updated this object.
broulik edited the test plan for this revision. (Show Details)
  • Limit number of places shown
hein requested changes to this revision.Jan 2 2017, 11:49 AM
hein edited edge metadata.
hein added inline comments.
78 ↗(On Diff #9422)

We have KActivitiesStats to track access frequency of locations, doing this in the TM applet is wrong. I propose you add KActivitieStats support to the places model and add a sort mode using it.

This revision now requires changes to proceed.Jan 2 2017, 11:49 AM
broulik added inline comments.Jan 2 2017, 2:21 PM
78 ↗(On Diff #9422)

I don't want to change the sorting, though, but I'll have a look

hein added inline comments.Jan 2 2017, 2:49 PM
78 ↗(On Diff #9422)

The sort mode would be optional. Could also be a new model column to set as sort colimn :)

broulik updated this revision to Diff 11026.Feb 7 2017, 8:20 PM
broulik updated this object.
broulik edited edge metadata.
  • For launchers show all places. There the menu is less likely to become overly large as there's no window controls in this case.

I looked into KActivitiesStats or KFilePlacesModel but I couldn't figure it out.

hein accepted this revision.Feb 14 2017, 2:05 PM
hein edited edge metadata.

Accepted, but please make the minor mods I suggested if you can.


Maybe a dated C++ mindset, but I don't like having no initial value :/


Some comments to explain why 7 here and 5 below might be good.

This revision is now accepted and ready to land.Feb 14 2017, 2:05 PM
This revision was automatically updated to reflect the committed changes.