Bug 307691

Summary: Image Viewer does not open image from local directory (using DirModel)
Product: [Unmaintained] Active Reporter: Ruediger Gad <r.c.g>
Component: GeneralAssignee: active
Status: RESOLVED FIXED    
Severity: normal CC: thomas.pfeiffer
Priority: NOR    
Version: unspecified   
Target Milestone: unscheduled   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Ruediger Gad 2012-10-01 22:18:07 UTC
On PlasmaActive (image: basyskom-plasma-active-archos-gen9-omapfb-tablet-mer-testing-120921-1829.tar.bz)
it is not possible to open images from a local directory (e.g. mounted sd-card) via the built-in image viewer.

Icons for the images are displayed. However, clicking on an image yields in a black screen that shows "loading...".
The "image bar" at the bottom works.

When running the image viewer from the command line the error is as follows:
file:///usr/share/kde4/apps/plasma/packages/org.kde.active.imageviewerpart/contents/ui/ViewerPage.qml:218: TypeError: Result of expression 'fileBrowserRoot.model.get' [undefined] is not a function.

I assume the reason is that when navigating a local filesystem a DirModel (more precisely KDirModel wrapped via DirModel in plasma-mobile) is used for fileBrowserRoot.model.
However, there is no "get" method that can be invoked via QML.
Hence, the above error is occurs.

Reproducible: Always

Steps to Reproduce:
1. Open image viewer
2. Try to open an image from a local file and not the gallery.
Actual Results:  
Black screen showing "loading..." is displayed.

Expected Results:  
The selected image should be displayed.
Comment 1 Ruediger Gad 2012-10-01 23:50:30 UTC
I uploaded a fixed version to
https://build.pub.meego.com/package/show?package=plasma-mobile&project=home%3Awonko%3Abranches%3AProject%3AKDE%3ATrunk%3ATesting
See
add-path-for-index-method.patch
fix-ViewerPage-DirModel-handling.patch
Comment 2 Thomas Pfeiffer 2012-10-05 14:50:50 UTC
In the current Testing image, I can load images on a USB stick without a problem. Does this mean the patch has already been applied or is the bug just not reproduceable?
Comment 3 Marco Martin 2012-10-05 21:31:26 UTC
Git commit c6eea8c7a8b7230b3e9afe048a3fd5fa65671e1f by Marco Martin.
Committed on 05/10/2012 at 23:30.
Pushed by mart into branch 'master'.

integrate Ruediger Gad patch

patch still needs to be changed

M  +8    -1    applications/filebrowser/imageviewerpart/contents/ui/ViewerPage.qml
M  +9    -0    components/dirmodel/dirmodel.cpp
M  +2    -0    components/dirmodel/dirmodel.h

http://commits.kde.org/plasma-mobile/c6eea8c7a8b7230b3e9afe048a3fd5fa65671e1f
Comment 4 Ruediger Gad 2012-10-15 21:23:55 UTC
Git commit 47a6624960f38d49fd98949f9d0647ed9ee61044 by Ruediger Gad.
Committed on 15/10/2012 at 23:11.
Pushed by ruedigergad into branch 'master'.

Add via QML callable get method to DirModel.

The get method returns a QVariantMap.
Currently this maps contains the keys "url" and "mimeType", but it can
be easily extended.
This obsoletes the previous hack.

M  +1    -8    applications/filebrowser/imageviewerpart/contents/ui/ViewerPage.qml
M  +11   -5    components/dirmodel/dirmodel.cpp
M  +2    -1    components/dirmodel/dirmodel.h

http://commits.kde.org/plasma-mobile/47a6624960f38d49fd98949f9d0647ed9ee61044