Bug 346002

Summary: [Regression] Kickoff is not mounting removable devices and shows "Invalid URL" error
Product: [Plasma] plasmashell Reporter: Konrad Materka <materka>
Component: Application Launcher (Kickoff) widgetAssignee: David Edmundson <kde>
Status: RESOLVED FIXED    
Severity: normal CC: materka, notmart, plasma-bugs
Priority: NOR    
Version: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: use openItem instead of openUrl

Description Konrad Materka 2015-04-08 22:18:36 UTC
It was working in KDE 4. If pendrive is not mounted it cannot be accessed using System tab in Kickoff. It only shows error (url is empty).

Reproducible: Always

Steps to Reproduce:
1. Insert pendrive
2. Do not mount it
3. Try to access it using System tab in Kickoff

Actual Results:  
Error, something like "Invalid url", I can't remember.

Expected Results:  
Mount removable device and open it.

It uses openUrl but should openItem. I have a patch :)
Comment 1 Konrad Materka 2015-04-08 22:20:52 UTC
Created attachment 91958 [details]
use openItem instead of openUrl

need to be applied in plasma-desktop/applets/kickoff
Comment 2 David Edmundson 2015-04-08 22:27:51 UTC
FYI, we tend to use http://git.reviewboard.kde.org for patches.

I can take this from here if you like, but it's useful to know for future code contributions.
Comment 3 David Edmundson 2015-04-08 22:46:55 UTC
Why the change to set a VisualDelegateModel?

it can't be in order to use the modelIndex method as the existing code used that already
Comment 4 Konrad Materka 2015-04-09 07:23:02 UTC
I don't have account on Review Board, please move it from here. In meantime I need to find a way how to get LDAP account ;)
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. I don't know if it has side effects, think about this as a proof of concept.
Of course I could change openItem and pass url and udi instead of QModelIndex but this doesn't look right - openItem method should get only... item (or item's model) and get required data internally.

PS. I'm from Java world, I have little experience with Qt (3/4) and never used Qt Quick and QML.
Comment 5 Marco Martin 2015-04-13 11:57:14 UTC
I uploaded the patch here:
https://git.reviewboard.kde.org/r/123350/

btw, if you plan of submitting other patches, you would be very welcome!
Comment 6 Marco Martin 2015-04-14 07:33:01 UTC
btw locally here can't reproduce, removable drives gets mounted fine
Comment 7 Konrad Materka 2015-04-15 07:36:32 UTC
Patch makes more harm than good... I'll retest latest GIT code today and check if it is working - maybe it was fixed in meantime. If not I'll prepare test case with some log etc.
Comment 8 Konrad Materka 2015-04-18 08:55:53 UTC
Marco, I was able to reproduce using latest GIT code.
Screenshots, first shows not mounted removable device, second is error message (in Polish):
https://www.dropbox.com/s/8vcokx17kmn3onw/zrzut%20ekranu1.png?dl=0&s=sl
https://www.dropbox.com/s/sqkci1z1fhb3h3p/zrzut%20ekranu2.png?dl=0&s=sl

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

I looks that KFilePlacesModel->url(index) returns empty string for not mounted devices. I have 5.9.0 version of libkf5kiocore5 installed.
Comment 9 Konrad Materka 2015-04-19 09:53:42 UTC
New, fixed patch:
https://git.reviewboard.kde.org/r/123426/
Last one broke Favourites View.
Comment 10 Marco Martin 2015-05-12 09:32:15 UTC
Git commit 49a1a2827639b3099a2f16fc3c8eef6130e4d95d by Marco Martin.
Committed on 12/05/2015 at 09:26.
Pushed by mart into branch 'master'.

Fix removable devices mounting in Kickoff

use openItem instead of openUrl
patch by Konrad Materka

REVIEW:123426

M  +10   -0    applets/kickoff/core/systemmodel.cpp
M  +7    -3    applets/kickoff/package/contents/ui/BaseView.qml
M  +9    -4    applets/kickoff/package/contents/ui/KickoffItem.qml

http://commits.kde.org/plasma-desktop/49a1a2827639b3099a2f16fc3c8eef6130e4d95d