Kickoff is not mounting removable devices and shows "Invalid URL"

Review Request #123426 - Created April 19, 2015 and submitted

Konrad Materka

Fixed version of /r/123350/

Why VisualDelegateModel? It may be workaround/hack/you name it but it was the only way I found acceptable. You need to pass QModelIndex to openItem and I don't know how to get it using plain ListView and SystemModel. VisualDelegateModel has a convenience method modelIndex which is already used in KickoffItem.qml (but only if ApplicationsView tab is active). I changed BaseView to use VisualDelegateModel to have modelIndex method and to be more consistent with ApplicaitonView.

"this change seems uneeded; we're using modelIndex fine in the old code, see line 40 in KickoffItem.qml in the old code.
(unless maybe that didn't work ?)
My understanding is setting the model to a QAIM, internally just creates a VDM anyway."

It didn't work. modelIndex is used only if flag hasModelChildren is set to true. That can happen only for ApplicationView, as only there children exist. Also ApplicationView uses VisualDataModel explicitly, so method modelIndex is available.
In SystemView model is set directly, VisualDataModel is not created implicitly (or even if it is it is not accessible). In other words listItem.ListView.view.model returns SystemModel object which is QAbstractProxyModel/QAbstractItemModel implementation. SystemModel does not have any slot that would be usefull in this case.
Passing "model" variable is not an option. It would be a good idea as it contains all data related to current item but this is internal QML/Qt Quick class.

In KDE 4 it was not a problem as it was easy to get QModelIndex from event (lines 860 - 878):

I was able to reproduce bug using latest GIT code.
Screenshots, first shows not mounted removable device, second is error message (in Polish):

In console I can find this message:
Opening item with URL ""

It looks that KFilePlacesModel->url(index) returns empty string for not mounted devices. I have 5.9.0 version of libkf5kiocore5 installed.

Patch fixed mounting. I also tested all tabs, all items works as expected.


Konrad Materka
David Edmundson
Konrad Materka
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted with commit 49a1a2827639b3099a2f16fc3c8eef6130e4d95d by Marco Martin to branch master.