Bug 356235 - Dolphin unable to change file associations
Summary: Dolphin unable to change file associations
Status: RESOLVED DUPLICATE of bug 354179
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 15.08.3
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
: 357359 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-12-03 11:01 UTC by Shimi Chen
Modified: 2016-03-07 15:23 UTC (History)
6 users (show)

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


Attachments
All JPGs are forced to open with GIMP (330.86 KB, video/x-matroska)
2016-01-07 22:44 UTC, andydecleyre
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Shimi Chen 2015-12-03 11:01:31 UTC
Whenever trying to change file associations in Dolphin and clicking "Apply", the settings revert to how they were previously.

In Caja the same change works fine.

Reproducible: Always

Steps to Reproduce:
1. Left click on file
2. Properties
3. File Type Options
4. Move an application up
5. Click "Apply"

Actual Results:  
Order of programs is reverted to what is was previously

Expected Results:  
New default choice should be saved. Alternatively, Dolphin should be verbose about why it failed to perform the task.

A demonstration video:
http://tx.technion.ac.il/~shimi/dolphin.ogv
Comment 1 cygn 2015-12-11 15:35:13 UTC
This is due to a confusion where the mimeapps.list is stored. The old deprecated path is  .local/share/applications/mimeapps.list and the correct one is .config/mimeapps.list or .config/kde-mimeapps.list 
kcm/dolphin still write the changes to .local hence they are ignored. My current workaround is to manually copy  .local/share/applications/mimeapps.list to .config/kde-mimeapps.list until someone fixes the paths. 

https://wiki.archlinux.org/index.php/Default_applications
http://standards.freedesktop.org/mime-apps-spec/mime-apps-spec-1.0.html#file
Comment 2 Sudhir Khanger 2016-01-04 16:52:48 UTC
*** Bug 357359 has been marked as a duplicate of this bug. ***
Comment 3 andydecleyre 2016-01-07 22:44:53 UTC
Created attachment 96512 [details]
All JPGs are forced to open with GIMP

I experience this specifically with jpg files, but not others that I've tested (such as gif). Attached is video evidence of the jpg problem.
Comment 4 Daniel 2016-01-18 18:31:06 UTC
In addition to the above mentioned problem with regard paths to mimeapps.list, there appears to be another issue.  I symlinked .local/share/applications/mimeapps.list to .config/mimeapps.list and still had problems with specific filetypes such as PDFs

After a lot of research, I believe I've found the solution.  KDE and most other DEs get information from a package that most distros call 'shared-mime-info'.  This package contains a file called freedesktop.org.xml which in Arch Linux (the distro I use) is stored under /usr/share/mime/packages, but may be stored elsewhere on other distros.

Upon examining this file, I could see that some filetypes have aliases.  For example, for application/pdf it has the aliases application/x-pdf, image/pdf, and application/acrobat.  Whenever I tried to change the default application for PDF to Okular, it would always revert just as is being shown here.  When I checked .config/mimeapps.list, I could see that the entry for application/pdf had been updated to put kde4-okular.desktop first, but the entries for the other aliases had not been.  When I manually added kde4-okular.desktop as the first entry for those aliases, I was able to move Okular the top of the list and it stayed there.

I think the reason this bug is hard to reproduce is that it depends on whether you have entries in your mimeapps.list file for aliases of filetypes you are changing.  For example, I don't have the entry for 'application/acrobat' in my mimeapps.list file even though it is a valid alias.  Perhaps if I had installed an application which creates an entry for that alias in mimeapps.list, it would be in there.  

There is also some further inconsistency because I can see that I have an entry for the one alias for image/jpeg, image/pjpeg, and yet it appears to be ignored and the correct default application from the image/jpeg entry is used.  It seems clear to me that Plasma 5 currently has some issues with the proper handling of MIME aliases, but it seems like an eminently fixable problem.
Comment 5 Shimi Chen 2016-02-23 19:33:07 UTC
Workaround:
rm ~/.config/mimeapps.list
Comment 6 Kien Truong 2016-03-05 15:00:46 UTC
This is already fixed in git by commit

https://quickgit.kde.org/?p=kde-cli-tools.git&a=commit&h=c4ebd9b537d749e5533ecaff5631debab4827760
Comment 7 Rog131 2016-03-05 16:14:07 UTC
Same as  Bug 354179 - File associations cannot be changed if already defined in $XDG_CONFIG_HOME/mimeapps.list  - https://bugs.kde.org/show_bug.cgi?id=354179
Comment 8 Rex Dieter 2016-03-07 15:23:07 UTC

*** This bug has been marked as a duplicate of bug 354179 ***