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

List:       kde-devel
Subject:    Re: Accessing Http-Headers through a Konqueror Plugin
From:       David Faure <faure () kde ! org>
Date:       2006-06-01 7:40:18
Message-ID: 200606010940.18632.faure () kde ! org
[Download RAW message or body]

On Wednesday 31 May 2006 23:55, Mirko Stocker wrote:
> Hi!
> 
> I want to write a plugin for Konqueror which does something if the current 
> page could not be loaded (status 404). 
> But how can I get this information? I thought I could use the job from the 
> signal KParts::ReadOnlyPart::started(KIO::Job*), but it's always null, so 
> that does not work, although I don't know why...
The job that is optionally passed to started() is only for progress info, and in KHTML
the progress info is more complicated to just one job (there could be N jobs due to
images and frames, plus the rendering), so it's indeed always 0.

Try connecting to the canceled(const QString&) signal? Won't be easy to know exactly
which error happened though, since that message is translated. Also this is only for the
case where KHTML itself gets a 404; not for error pages provided by the server
(TransferJob::isErrorPage, but there is no access to the job from outside khtml).
In a custom application you could reimplement showError, but not in a plugin of course.

HTTP Headers are part of the metadata for the job; you just need a signal that tells you
about the job being used for the download of the main page. Since you're not the first
one who seems to need this, feel free to make a KHTMLPart patch and send it here...

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

 
>> 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