khexedit2 shows up everywhere

David Faure faure at kde.org
Mon Mar 7 17:21:23 GMT 2005


On Sunday 06 March 2005 22:53, Friedrich W. H. Kossebau wrote:
> Seems I have to do it myself ;)
Heh, this isn't church, there's no service on Sundays :-)

> In kdelibs/khtml/khtml_part.cpp:
> KParts::ReadOnlyPart *KHTMLPart::createPart(...) {
>   if ( !serviceName.isEmpty() )
>     constr.append( QString::fromLatin1( "Name == '%1'" ).arg( serviceName ) );
> // add begin
>   else
>     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. 

KTrader::self()->query( mimetype ) is supposed to be exactly equivalent to that.
But you're right, it isn't, since query() looks for handlers for inherited mimetypes
and "%1 in ServiceTypes" is a strict match so it doesn't.

However, do we really want that?
The fact that KHTML is bad at displaying text/xml is a separate fact from the
general idea of mimetype inheritance. For instance, when we say
x-executable-script.desktop:X-KDE-IsAlso=text/plain
this means that we do accept a plain-text viewer for an executable-script,
or C++ source, or a log file, etc.
Or an image/jpeg viewer for an image/pjpeg image. 
Same thing with all aliases of course.

It seems that we have the notion of "acceptable viewers" and "for experts" viewers?
Vieweing the XML code behind text/xhtml or SVG is not what most people want to
do with those files; only the "developers" of those files might want to do that.
In that respect, khexedit is a "for experts only" (for all types of files).

Now, how can we avoid "expert" viewers to come up by default? Well, I thought
AllowDefault solved that. You're saying the same viewer is "ok" for some mimetypes
and "expert" for others? In that case we need a per-mimetype setting for AllowDefault?
Would this help? Not that the .desktop file format makes it really easy to add
per-mimetype AllowDefault... But we might be able to piggyback this on Waldo's
per-mimetype initial preference IIRC.

> 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 :(
I'm not sure I see a problem with that reaction.

> BTW: How feels responsible for the KTrader system? 
That would be me, I guess.

> The official docs are out  of date (property "MimeType" is now integrated in "ServiceTypes")! 
MimeType and ServiceTypes have always been merged conceptually, since a MimeType *is* a ServiceType.
The only reason we keep MimeType is f.d.o compat...

> Shall I fix this?
Sure.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list