https://bugs.kde.org/show_bug.cgi?id=403250

--- Comment #4 from equ...@gmail.com ---
(In reply to Fabian Vogt from comment #3)
> Which URL do you end up with if you click on one of the devices?
> 
> I don't see a way how the drives can end up with a non-file:// url but still
> work fine.

Selecting file from drive returns correct URL.

When KFilePlacesModel populates itself, it checks scheme against an URL from
KBookmark
(https://github.com/KDE/kio/blob/master/src/filewidgets/kfileplacesmodel.cpp#L680)
and creates KFilePlacesItem from a bookmark if scheme is supported. Solid
devices' URLs are empty
(https://github.com/KDE/kio/blob/master/src/filewidgets/kfileplacesitem.cpp#L328,
they have only UDI and isSystemItem items) so they are included in the list
only if scheme is empty too.

When user clicks on an item in a sidebar, an URL for that item is taken from
KFilePlacesItem::data(UrlRole)
(https://github.com/KDE/kio/blob/master/src/filewidgets/kfileplacesitem.cpp#L135).
For devices it returns URL from Solid, not from internal KBookmark object,
that's why an URL for files from devices are correct.

I think that storage devices should be included in KFilePlacesModel if scheme
is "file". I managed to do this by storing Solid::Device objects instead of
their UDI's in KFilePlacesModel::Private::availableDevices and then check for
device type when populating list, like this:
https://gist.github.com/equeim/769c3747ac34b3baaeae596a6a366a8f

But I have no experience with Solid and don't know if this is a correct
solution.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to