http status code in khtml

David Faure faure at kde.org
Tue Jan 31 13:16:42 GMT 2006


On Friday 27 January 2006 16:04, Miroslav Suchý wrote:
> David Faure wrote:
> > On Tuesday 24 January 2006 19:40, Miroslav Suchý wrote:
> >>So I change and specify my question:
> >>I have class derived from KHTMLPart and I need access to HTTP headers of
> >>opened page. Can somebody point me where I can find it?
> >>
>  > job->addMetaData("PropagateHttpHeader","true") should give you the
> HTTP headers
> > at the end of the job. When using KHTMLPart, you can connect to started(KIO::Job*) in order
> > to get the job instance being used to download the stuff.
> Why I do not get job instance?

Because my advice was crap, actually. Look at khtml_part.cpp, it says emit started(0).
This is because we don't want the progress info to depend on this job only, so it passes 0.

I think you need to modify KHTMLPart to add a job() method, implemented as:
KIO::Job* KHTMLPart::job() { 
    return d->m_job; 
} 

Right now the job is completely internal to KHTMLPart, I see no way of accessing it
from the outside.

Or (binary incompatible, so for kde4), we could add a virtual void startingJob( KIO::Job * ) { }
so that derived classes can do something with that job before it gets started.
Connecting signals to it would have the undefined-order-of-slots problem though,
so we should probably also make slotFinished() virtual in kde4.

-- 
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 kfm-devel mailing list