Page is not reloaded in a KHTML part
Tobias Anton
TA at ESC-Electronics.de
Thu Mar 11 09:02:20 GMT 2004
On Mittwoch, 10. März 2004 10:55, Andras Mantia wrote:
> Now why is it called again? Because I have a KHTMLPart::setEncoding() call
> after KHTMLPart::openURL (I forgot to paste this in the origian mail). This
> calls closeURL() and openURL(), but closeURL resets the cache policy and
> openURL will reload from the cache. Now this wouldn't be bad, but in the
> cache there isn't the last version, which was just loaded. So
> part->openURL(url);
> part->setEncoding(someencoding, true);
> part->show();
>
> does not work as expected.
have a look at khtmlpart.cpp:
bool KHTMLPart::setEncoding( const QString &name, bool override )
{
d->m_encoding = name;
d->m_haveEncoding = override;
if( !m_url.isEmpty() ) {
// reload document
closeURL();
KURL url = m_url;
m_url = 0;
d->m_restored = true;
openURL(url);
d->m_restored = false;
}
return true;
}
If you call setEncoding() immediately after openURL(), the page is supposed to
be reloaded, but before the request can actually be issued, it gets aborted
by closeURL(), then the cache policy gets changed and the request is
re-issued with caching turned on.
> What can I do to load an URL and set the
> encoding I want afterwards and avoid the above problem?
I think the flag "d->m_restored" should only be changed if the current page is
already completely loaded. This requires some additional logic in
setEncoding(), however.
--
Tobias Anton
More information about the kfm-devel
mailing list