Popup menu MIME types

Jonathan Marten jjm at keelhaul.demon.co.uk
Fri Jan 28 07:20:27 GMT 2005


Hello all,

This is my attempt at fixing a problem that has annoyed me for some time - the 
lists of applications and previewers shown in the popup menu over a link are 
always those applicable to HTML, not the actual MIME type of the target.  
It's not a problem for most web browsing, but it helps in the case where the 
user wants to open a link in other than the default viewer for that type.  At 
the moment there is no way to do that other than selecting the required 
application in "Other".

Bug 93607 and duplicates refers.  Maksim Orlovich suggested there that I copy 
this list with the details, so here it is...

The problem of course is that the MIME type of the link target is not 
available (for HTTP and similar protocols) without actually downloading it.  
But it should be possible to at least make a guess, based on the file 
extension, when the popup menu is shown.  This guess could possibly be wrong, 
but it's not a disaster - the correct MIME type is always used if the link is 
clicked.

The change is unfortunately spread over two files, because the "Open" menu is 
built in one but "Preview" in another.  When building the "Open" list in 
konq_popupmenu.cc, if the URL is suitable its "extension" is used to look up 
the MIME type and that is used to select appropriate applications.  There is 
a list of untrustable MIME types that are more likely to be a webserver 
script than a file to be opened - at the moment this is hardcoded, but there 
may be a better way.  That MIME type is also saved for later use by 
"Preview".

The patch to konq_mainwindow.cc looks extensive, but it is mostly just moving 
code around.  Building the "Preview" menu is delayed until the popup menu has 
been built, so that the same MIME type can be used to select appropriate 
previewers.

I don't know whether this fix would be acceptable in the 3.4 timescale, but 
hopefully it or something similar could be implemented in a suitable KDE 
release.  As far as I can tell the change is not BIC.

Any comments or suggestions are invited...

Regards
  Jonathan

-- 
Jonathan Marten                           work:  currently looking
http://www.keelhaul.demon.co.uk/          play:  jjm at keelhaul.demon.co.uk




More information about the kfm-devel mailing list