khexedit2 shows up everywhere

Friedrich W. H. Kossebau Friedrich.W.H at
Sun Mar 6 21:53:46 GMT 2005

Am Sonntag, 6. März 2005 15:59, schrieb Friedrich W. H. Kossebau:
> Am Montag, 28. Februar 2005 01:17, schrieb David Faure:
> > On Sunday 27 February 2005 23:53, Friedrich W. H. Kossebau wrote:
> > > Perhaps by adding the option of an explicit flag when asking for a
> > > mimetype handler? Explicit as in "Give me only parts who explicitly say
> > > to handle the given mimetype; suppress those who handle only mimetypes
> > > which are in an IS-ALSO relation to the given one". In the same way one
> > > usually would not like to get the text part as fallback if there was no
> > > HTML part. Would this work for all other part query usages, too?
> > >
> > > Implementation left to those who know about the part query system.
> >
> > AllowDefault=false sounds simpler to me, if that works.
> > That means to let khexedit appear in the "Open With" and "Preview In"
> > submenus but to not use it by default when left-clicking or embedding the
> > preferred part.
> This does work for Konqueror but not KHTML for me. KHTML seems to ignore
> the AllowDefault flag.
> And this might have been simpler but is only a dirty workaround for the
> general problem. KHexEdit2 part may be the first to trigger this
> prominently but the same happens for e.g. embedded SVG objects: Without an
> installed SVG-part KHTML jumps in because:
> * image/svg+xml tells to be X-KDE-IsAlso=text/xml
> * KHTML claims to also deal text/xml
> KHTML seems to fail usually on this and only shows an empty space (which is
> of course not that distracting as viewing hex codes ;) So your user will
> never be told to install a SVG plugin :(
> Test-Environment:
> 1. Change khexedit2part.desktop:
> Revert
> MimeType=application/octet-stream
> to
> MimeType=all/allfiles
> and add
> AllowDefault=false
> 2. Disable your SVG-Part (mv ksvgplugin.desktop ksvgplugin.desktop.hide).
> 3. Create test-files:
> a) sometext.txt~ a backup file from some text file
> b) lion.svg from kdegraphics/ksvg/tests
> c) embeddedtest.html
> <html>
> <head></head>
> <body>
> some text
> <object width="200" height="200"><embed src="sometext.txt~"></object>
> some text
> <object width="200" height="200"><embed src="lion.svg"></object>
> some text
> </body>
> </html>
> 4. View in Konqueror. Hex codes for backup file, empty space for svg file.
> So I still think an explicit flag would be the needed solution here. How
> could this be done? Add an built-in flag for KTrader?

Seems I have to do it myself ;)

In kdelibs/khtml/khtml_part.cpp:
KParts::ReadOnlyPart *KHTMLPart::createPart(...) {
  if ( !serviceName.isEmpty() )
    constr.append( QString::fromLatin1( "Name == '%1'" ).arg( serviceName ) );
// add begin
    constr.append( QString::fromLatin1( 
                   "'%1' in ServiceTypes" ).arg( mimetype ) );
// add end

This constraint restricts to those services that tell explicitly to handle the 
mimetype in question. 

The only problem: If KHTML does not find a proper part it searches for other 
solutions. Here: fires up another konqueror window with a HTML part for the 
svg file and asks for an application for the trash file. I do not know if 
this is a suited reaction :( 

So please, could any KHTML developer jump in? I would like to have this fixed 
for 3.4.1 so the KHexEdit2 part can be enabled again.

BTW: How feels responsible for the KTrader system? The official docs are out 
of date (property "MimeType" is now integrated in "ServiceTypes")! Shall I 
fix this?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <>

More information about the kde-core-devel mailing list