Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 24 lines (19 sloc) 0.714 kB
353fe86 @halogenandtoast Handle unsupported content types gracefully
halogenandtoast authored
1 #include "UnsupportedContentHandler.h"
2 #include "WebPage.h"
3 #include <QNetworkReply>
4
5 UnsupportedContentHandler::UnsupportedContentHandler(WebPage *page, QNetworkReply *reply, QObject *parent) : QObject(parent) {
6 m_page = page;
7 m_reply = reply;
8 }
9
cae5119 @jferris Fix issues with Qt 4.8
jferris authored
10 void UnsupportedContentHandler::renderNonHtmlContent() {
11 QByteArray text = m_reply->readAll();
12 m_page->mainFrame()->setContent(text, QString("text/plain"), m_reply->url());
5bef336 @mhoran Don't wait for finished replies
mhoran authored
13 m_page->unsupportedContentFinishedReply(m_reply);
9257fe3 @halogenandtoast Cleanup
halogenandtoast authored
14 this->deleteLater();
15 }
16
cae5119 @jferris Fix issues with Qt 4.8
jferris authored
17 void UnsupportedContentHandler::waitForReplyToFinish() {
18 connect(m_reply, SIGNAL(finished()), this, SLOT(replyFinished()));
9257fe3 @halogenandtoast Cleanup
halogenandtoast authored
19 }
20
cae5119 @jferris Fix issues with Qt 4.8
jferris authored
21 void UnsupportedContentHandler::replyFinished() {
ecfa783 @mhoran Render non-HTML content when reply emits finished
mhoran authored
22 renderNonHtmlContent();
353fe86 @halogenandtoast Handle unsupported content types gracefully
halogenandtoast authored
23 }
Something went wrong with that request. Please try again.