Bug 353475 - Okular opens .png, .jpg, .tiff, and other image formats despite changing the file associations in systemsettings5
Summary: Okular opens .png, .jpg, .tiff, and other image formats despite changing the ...
Status: RESOLVED WORKSFORME
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_filetypes (show other bugs)
Version: 5.4.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2015-10-02 22:29 UTC by johnsc301
Modified: 2018-10-27 03:33 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Contains mimeapps.list and screenshots of my settings (339.54 KB, application/x-zip-compressed)
2015-10-03 19:51 UTC, johnsc301
Details

Note You need to log in before you can comment on or make changes to this bug.
Description johnsc301 2015-10-02 22:29:00 UTC
Plasma 5
Plasma-desktop 5.4.1-2
Arch Linux
Okular 0.23.1

If I right-click on a picture and change the file association to Gwenview, Okular still opens the images.
If I check the associations, they were reset.

Even if I go to systemsettings5, they don't hold my settings for Gwenview, Okular, and images.

Reproducible: Always

Steps to Reproduce:
1. Change file type association for .png for example to open with Gwenview
2. Open image
3. Okular still opens up the image

Actual Results:  
The file type associations for images (and only for images from what I've noticed) reset to open with Okular

Expected Results:  
My settings should not reset

n/a
Comment 1 David Edmundson 2015-10-03 16:29:14 UTC
can you attach your 

.local/share/applications/mimeapps.list

and a screenshot of the systemsettings page where you saved it

what does "xdg-open /path/to/some.png" open with?

finally can you see if running:
update-desktop-database .local/share/applications 

changes anything
Comment 2 David Faure 2015-10-03 17:30:05 UTC
update-desktop-database is a wrong hint, we don't use that in KDE.

Better test kde-open than xdg-open (which might end up calling kde-open or something else depending on the type of session etc.).

But yes the main thing is, did mimeapps.list get updated correctly.

And then, does running `kbuildsycoca5` help? (although systemsettings is supposed to do that already anyway)
Comment 3 johnsc301 2015-10-03 19:51:26 UTC
Created attachment 94832 [details]
Contains mimeapps.list and screenshots of my settings
Comment 4 johnsc301 2015-10-03 19:52:49 UTC
Here are the commands I used, and what happened after denoted by `#->`

...
[john@john-archlinux ~]$ xdg-open /$HOME/Downloads/1.png
#-> Opened with Okular

[john@john-archlinux ~]$ update-desktop-database .local/share/applications 
[john@john-archlinux ~]$ xdg-open /$HOME/Downloads/1.png
#-> Opened with Okular

[john@john-archlinux ~]$ kbuildsycoca5
Could not find drkonqi at /usr/lib/drkonqi
kbuildsycoca5 running...
Reusing existing ksycoca
Recreating ksycoca file ("/home/john/.cache/ksycoca5", version 303)
Still in the time dict (i.e. deleted files) ("apps")
Parse error in  "/home/john/.config/menus/applications-merged/xdg-desktop-menu-dummy.menu" , line  1 , col  1 :  "unexpected end of file"
Menu "applications-kmenuedit.menu" not found.
Saving
Emitting notifyDatabaseChanged ("apps")
[john@john-archlinux ~]$ xdg-open /$HOME/Downloads/1.png
#-> Opened with Okular
...

In mimeapps.list, I noticed these lines:
image/png=org.kde.gwenview.desktop;kde4-kolourpaint.desktop;shotwell-viewer.desktop;gimp.desktop;
#
image/png=org.kde.gwenview.desktop;
#
image/png=kde4-okularApplication_kimgio.desktop;kde4-okularApplication_kimgio.desktop;
Comment 5 David Faure 2015-10-03 20:35:46 UTC
Comment on attachment 94832 [details]
Contains mimeapps.list and screenshots of my settings

Please try kde-open5 rather than xdg-open.

Where is org.kde.gwenview.desktop installed?
Does this command find it?
  `qtpaths --locate-file GenericDataLocation applications/org.kde.gwenview.desktop`

What does this show?
  `ktraderclient5 --mimetype image/png | grep DesktopEntryPath`
Comment 6 johnsc301 2015-10-03 21:37:45 UTC
Here is my output:

[john@john-archlinux ~]$ kde-open5 /$HOME/Downloads/1.png
#-> opens with Okular
[john@john-archlinux ~]$ qtpaths --locate-file GenericDataLocation applications/org.kde.gwenview.desktop  
/usr/share/applications/org.kde.gwenview.desktop
[john@john-archlinux ~]$ ktraderclient5 --mimetype image/png | grep DesktopEntryPath
Request for unknown property "UntranslatedGenericName"
Request for unknown property "UntranslatedGenericName"
Request for unknown property "UntranslatedGenericName"
Request for unknown property "UntranslatedGenericName"
Request for unknown property "X-GIO-NoFuse"
Request for unknown property "X-GNOME-FullName"
Request for unknown property "X-GNOME-Gettext-Domain"
DesktopEntryPath : '/usr/share/applications/kde4/okularApplication_kimgio.desktop'
DesktopEntryPath : '/usr/share/applications/org.kde.gwenview.desktop'
DesktopEntryPath : '/usr/share/applications/kde4/kolourpaint.desktop'
Request for unknown property "UntranslatedGenericName"
Request for unknown property "X-GNOME-Bugzilla-Bugzilla"
Request for unknown property "X-GNOME-Bugzilla-Component"
Request for unknown property "X-GNOME-Bugzilla-OtherBinaries"
Request for unknown property "X-GNOME-Bugzilla-Product"
Request for unknown property "X-GNOME-Bugzilla-Version"
DesktopEntryPath : '/usr/share/applications/shotwell-viewer.desktop'
DesktopEntryPath : '/usr/share/applications/gimp.desktop'
Comment 7 David Faure 2015-10-04 22:33:24 UTC
So mimeapps.list looks good, but the trader query returns okular on top.

I tried to reproduce this here but it all works here.

There must be something else we're missing.

Do you set $XDG_DATA_HOME?
Does `qtpaths --locate-files GenericDataLocation applications/mimeapps.list` return other mimeapps.list files?
Same with applications/kde-mimeapps.list, just in case (I expect "no such file or directory").
An even safer way to find out which files are being used is
`strace -e open kbuildsycoca5 |& grep mimeapps`

Does the same happen if you temporarily move away mimeapps.list? After all the InitialPreference in org.kde.gwenview.desktop is 8 while the InitialPreference in okularApplication_kimgio.desktop is 1, so it should even work out of the box. But of course I still want to track down the bug, this is just an additional data point.

You still have okularApplication_kimgio.desktop in [Removed Associations], right? In that case it shouldn't even be anywhere in the trader results (and this is the case for me here).

Any chance for recompiling kservice with the two debug statements in KMimeAssociations::parseRemovedAssociations enabled?
Comment 8 johnsc301 2015-10-04 23:04:39 UTC
I don't know what $XDG_DATA_HOME is.

Log:
[john@john-archlinux ~]$ qtpaths --locate-files GenericDataLocation applications/mimeapps.list
/home/john/.local/share/applications/mimeapps.list
[john@john-archlinux ~]$ qtpaths --locate-files GenericDataLocation applications/kde-mimeapps.list

[john@john-archlinux ~]$ strace -e open kbuildsycoca5 |& grep mimeapps

I removed the mimeapps.list and set the default app for .png, Okular still opened.
kularApplication_kimgio.desktop is in [Removed Associations].

"Any chance for recompiling kservice with the two debug statements in KMimeAssociations::parseRemovedAssociations enabled?"
I'll try that later.
Comment 9 johnsc301 2015-10-05 13:14:23 UTC
OK I see KMimeAssociations::parseRemovedAssociations listed here:
http://api.kde.org/frameworks-api/frameworks5-apidocs/kservice/html/kmimeassociations_8cpp_source.html

Are you referring to the if / else statement?
Also, how would I go about this in Arch, or in general?
Comment 10 johnsc301 2015-10-06 19:53:00 UTC
OK I installed kservice with the debug statements uncommented.

In the meantime, I open a .png file with Gwenview in terminal and got this:
"Could not find drkonqi at /usr/lib/drkonqi
KSambaShare: Could not find smb.conf!"

Next, I decided to use the "Open with:" dialog and "remember" the application association.
Here is a screenshot:
https://i.imgur.com/9RizzHL.png

The filetype associations are now respected, but only if I set them using the Open With dialog.
Comment 11 johnsc301 2015-10-06 19:57:57 UTC
I noticed that after registering these file associations using this workaround, there are now two entries for Gwenview:
gwenview and Gwenview

Screenshots:
https://i.imgur.com/8L6gHdE.png
https://i.imgur.com/MMXJ9sn.png
Comment 12 johnsc301 2015-10-06 20:02:50 UTC
After using the workaround in Comment 10, I get errors when trying to open images, with Gwenview.

Screenshot:
https://i.imgur.com/mBMRRrk.png

The system looks confused listing because it is listing gwenview and Gwenview.
After remembering Gwenview to open a filetype through the Open With menu, two gwenview entries are shown, and now Gwenview is unable to open anything.
Comment 13 Andrew Crouthamel 2018-09-25 21:57:22 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days, the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please set the bug status as REPORTED so that the KDE team knows that the bug is ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 14 Andrew Crouthamel 2018-10-27 03:33:19 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!