Kubuntu 12.04 Firefox and Rekong don't know how to open downloaded files
I just installed Kubuntu 12.04 beta 1.
Both Rekong and Firefox don't know how to "Open Containing Folder" for downloaded items. They also don't know how open the item itself. (I'll give the specific error below.)
Furthermore, if I manually tell Firefox (in the dialog) to remember the file associations, that creates a new problem. Every file opens in Dolphin first, then Dolphin opens the correct application. (It could almost be a feature instead of a bug, but it gets annoying at times.)
My installation is missing the file /usr/share/applications/mimeinfo.cache. I'm also missing /usr/share/applications/defaults.list and ~/.local/share/applications/mimeapps.list. If anyone has default copies of those files for this build, I would appreciate copies. I think they may help me resolve this. (Anyone else see those files missing?)
Details:
Rekong is installed by default and the problem is present in a standard configuration.
To reproduce, download a file with Rekong. Then go to Downloads > Open directory (of the downloaded file). The result is:
Error: rekonq does not know how to handle this protocol:
The same situation exists in Firefox. I used the included Kubuntu menu item to install Firefox. No problems with the installation, everything standard.
But when I download an item (e.g., a JPG image) with Firefox and then choose to either open it or open the containing folder, I get a dialog titled "launch application" and I have to "choose an application". Once I choose an application, telling Firefox to remember it leads to the problem above: Every file opens in Dolphin.
It seems that Firefox doesn't know the mime types. However, Dolphin does know the mime types.
More info:
In Firefox preferences > Applications, the only content types shown are irc, ircs, mailto, podcast, tar file, webca and webfeed. Normally, there would be many more.
I tried deleting mimeTypes.rdf (as mentioned in a Mozilla Knowledge Base article) in my Firefox profile and it did not resolve the issue.
I also tried copying a known good complete Firefox profile from my other computer (Linux Mint 12). Once I began using that profile, it also had the problem under Kubuntu 12.04.
Here's some more info:
$ cat ~/.local/share/applications/mimeapps.list
cat: /home/user/.local/share/applications/mimeapps.list: No such file or directory
$ cat /usr/share/applications/defaults.list
cat: /usr/share/applications/defaults.list: No such file or directory
Unfortunately, copying those files from a working Ubuntu installation did not resolve the issue. It had seemingly no impact.
The default applications for handling files in Dolphin works correctly.
I have been continuing to research this. I was reading this knowledge base article: http://kb.mozillazine.org/File_types_and_download_actions#Resetting_download_actions
It says, "All versions of Firefox and SeaMonkey will use an installed and enabled plugin to open a downloaded file by default, based on its MIME type."
I checked and the only plugin installed in Firefox is Skype Buttons for Kopete. Nothing else. On my Linux Mint install, there are a number of plugins, including Gnome Shell Integration. Could missing plugins be the issue?
There's a similar question here with no solution.
Here's a question where the problem sounds almost identical, but the solution is unrelated. I'm working with a new, fresh installation of Kubuntu and I don't have any other DE installed.
Here is a workaround for the Firefox problem from Canonical support:
1) stop firefox
2) rm ~/.mozilla/firefox//mimeTypes.rdf
3) start firefox
4) download a file
5) open it from the downloads menu and choose the application. Browse to /usr/bin /xdg-open. then check to remember your choice
Now both open and open containing folder should work. You can then change the preferred programs through kde's file associations settings.
NOTE: I have confirmed that this solution works. It's a workaround, but in some ways it is an improvement over the original Firefox approach (for KDE users).
Regarding Rekonq, I was in the kubuntu-devel IRC channel recently speaking to a developer. He said he was putting through a fix for the Rekonq issue. I believe it is in place now. I'm told that that after 'apt-get upgrade rekonq' has been run on Kubuntu 12.04 beta1 that this Rekonq bug is gone. EDIT: yes, I have confirmed this fix too.
I may have found a solution by shadowsnipes. It is a bit old, but based on what I've seen the last couple days, it appears relevant and up to date. (The same files are still used.) I can't test it tonight, but I will test it tomorrow. In the mean time, in case anyone is interested, here is what I found:
Originally Posted by drauk
Hey i was trying to do this too. After read the posts and check in "about:config", i copy /etc/mailcap from other distro and if work now i have a list of programs to open with (i tried mime.types before mailcap and didn't work to me).
Ahh, thanks for the tip. I think I have found one solution for getting this all to work in Firefox in Slackware. You can copy /etc/mailcap from a distro that has this working, yes, but you can also just write the entries you need.
Instead of modifying my /etc/mailcap I chose to modify ~/.mailcap. The default path for mailcap is (as found under the man page)
Code:
$HOME/.mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap
Here is an example of some lines you can add for getting files to associate with ark.
Code:
application/x-tar;ark %s
application/x-tgz;ark %s
application/x-bzip2;ark %s
Now start up firefox and try opening a tar, tar.gz, or bz2 file. It doesn't work ...yet.
You have to modify mimeTypes.rdf under your firefox profile first. I found the easiest way to do this is to use the MIME Edit firefox extension. Simply add one entry for each corresponding entry of interest in the mailcap (you don't have to do them all).
Now once this is done you should see the default option (ark in this case) come up whenever you try to download or open one of these three archive file types. In addition, if you use the MIME edit extension to specify an alternate program to use for these files, it will now be included as an option. Be sure to check the 'always ask what to do' unless you want the files to be handled automatically. The option selected by default will be the last one selected under the MIME edit extension.
Once you are all setup with this you can simply copy the mimeTypes.rdf file to another profile if you desire.
BTW, an earlier post by unSpawn in the same thread is really helpful in terms of background:
About MIME types and .desktop files
For any entity your browser can not render internally it will look for an accompanying MIME type. FF recognises MIME types searching through two databases" (type "about:config" and search for "mime"). Customised handling can then be configured in ~/.mozilla/firefox/$PROFILENAME/mimeTypes.rdf. Recognising applications linked to MIME types is done by your Desktop Environment which should honour the Desktop Entry Specification. It dictates each shared MIME type (also see: XDG) is mapped to a .desktop file in the mimeinfo.cache (and defaults.list) and each relevant application has a .desktop file with a "MimeType" entry in it. So if for instance you're looking for "tar" ("application/x-tar") you could check if 'grep -i 'tar=' mimeinfo.cache' and 'grep -i 'tar=' defaults.list' both point to the same .desktop file and if that file exists if it emits the right MIME types 'grep -i mime'.
Somebody else may know of a more "correct", easier or even GUI way for handling this kind of thing.