Add places:/ KIO slave
Changes PlannedPublic

Authored by broulik on Mar 8 2017, 1:30 PM.

Details

Reviewers
hein
dfaure
Group Reviewers
Plasma
Summary

This will expose KFilePlacesModel as KIO slave.
With it you can place e.g. a places FolderView in your panel for quick access to your stuff.

BUG: 377375

Test Plan

Lists my places, navigating into both local and remove locations works fine. Place icons are taken into account and hidden places are added as hidden files.

It doesn't signal updates when places are added/removed from/to the model as I didn't find signals to notify changes when I had a quick glance at KIO stuff.

Also, a FolderView pointing at places:/ will show the generic folder icon as well as "places:/" title (for the latter this is expected as it uses QUrl fileName, maybe needs to also use the root item's display text somehow) but the icon should be correct at least). Adding places:/ as a places in Dolphin actually uses the correct icon.

It was a first attempt to gather feedback. Additional features it could provide is removing places (on the other hand it might introduce ambiguity if deleting stuff in places:/ just removes the link from places whereas in ~ it will be destructive) and adding them (if you drag a folder into it e.g.)

Diff Detail

Repository
R120 Plasma Workspace
Lint
Lint Skipped
Unit
Unit Tests Skipped
broulik created this revision.Mar 8 2017, 1:30 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMar 8 2017, 1:30 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik edited the test plan for this revision. (Show Details)Mar 8 2017, 1:34 PM

Nice!
But I don't see anything plasma-specific in this slave. It would be better to put it in kio or kio-extras, imho.

It would be better to put it in kio or kio-extras, imho.

Fine with me. I just used the kios in plasma-workspace as a base, so I put them here to have something to work with first :)

dfaure edited edge metadata.Mar 8 2017, 8:59 PM

"I didn't find signals to notify changes" --> you mean how to tell apps that something changed in a given protocol? That's what KDirNotify is for, but you can't do the monitoring from a short-lived slave, you need something that stays alive for the whole session, and that's what a kded module can be used for.

IMHO this is for plasma or kio-extras, not kio, at least as long as it's not required by anything in kio itself.

hein edited edge metadata.Mar 8 2017, 9:07 PM

See DesktopNotifier in the desktop:/ slave codebase for an example of a kded module for this purpose.

I worked on that stuff (the internal dbus stuff) once to make desktop:/ in KDirModel not remove+insert but just dataChange when a file is renamed, so FV wouldn't lose the icon position :)

Another question I had was how could I add a new place when I drag a folder in it? I tried implementing copy() and symlink() but that is only called when stuff happens within my protocol and for mkdir() I only know what folder to create not why it will be created.

I managed to implement renaming and removing of places but you could have two places with the same text but having to files with the same name probably isn't a good idea and the potentially ambiguous URLs are all I get in rename().

Of course we could also just have places:/ read-only and call it a day.

hein added a comment.Mar 9 2017, 8:01 PM

Hmm it would be really nice if we could get the title to read "Places" somehow, yeah.

What's the status of this patch? Are changes required to proceed?

broulik planned changes to this revision.Apr 24 2018, 2:54 PM

Will revisit shortly (famous last words)