[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Querying the capabilities of KHTML
From:       Kevin Krammer <kevin.krammer () gmx ! at>
Date:       2004-03-31 12:34:54
Message-ID: 200403311434.58793.kevin.krammer () gmx ! at
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Wednesday 31 March 2004 13:57, Jeroen Wijnhout wrote:
> On Wednesday 31 March 2004 13:50, Kevin Krammer wrote:
> > > Is there another way to test for the capabilities of KHTML?
> >
> > KHTML defines it is of ServiceType KPart/ReadOnlyPart and Browser/View.
> >
> > Perhaps you should just use the MIME type and KPart/ReadOnlyPart of you
> > are looking for a viewer for the MIME type.
> >
> > If you need KHTML for special reasons, like casting to its interface, you
> > could direclty instantiate it instead of loading it.
>
> Well, actually I want to test if KHTML supports (i.e. is capable of
> viewing) a file with specified mimetype. If I test for KPart/ReadOnlyPart
> and Browser/View, it is not guaranteed that KHTML is the only service (for
> example, KGhostView would also satisfy the query). This is precisely what I
> want to circumvent. Pressing on a link to a PS file in a KHTML part causes
> the file to be loaded in KHTML, as plain text! So I want to test if KHTML
> is capable of viewing, for example, a PS file. If it can't do that, I use
> KTrader to find an application to view this file.

I see.

Try this
KService::Ptr service = KService::serviceByDesktopName("khtml");
if (service->hasServiceType("text/html"))
// can do it
else
// can't do it

Cheers,
Kevin

-- 
Kevin Krammer <kevin.krammer@gmx.at>
Qt/KDE Developer, Debian User
www.mrunix.de - Unix/Linux programming forum
www.qtforum.org - Qt programming forum

[Attachment #5 (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic