1
0
Fork 0
mirror of https://github.com/thoughtbot/capybara-webkit synced 2023-03-27 23:22:28 -04:00
capybara-webkit/src/UnsupportedContentHandler.cpp
Matthew Horan 2eb38b3c02 Don't disconnect loadFinished in UnsupportedContentHandler
WebPage::setContent will cause the loadFinished signal to fire, so
there's no need to call loadFinished if the signal is connected.
2012-12-05 21:05:36 -05:00

23 lines
714 B
C++

#include "UnsupportedContentHandler.h"
#include "WebPage.h"
#include <QNetworkReply>
UnsupportedContentHandler::UnsupportedContentHandler(WebPage *page, QNetworkReply *reply, QObject *parent) : QObject(parent) {
m_page = page;
m_reply = reply;
}
void UnsupportedContentHandler::renderNonHtmlContent() {
QByteArray text = m_reply->readAll();
m_page->mainFrame()->setContent(text, QString("text/plain"), m_reply->url());
m_page->unsupportedContentFinishedReply(m_reply);
this->deleteLater();
}
void UnsupportedContentHandler::waitForReplyToFinish() {
connect(m_reply, SIGNAL(finished()), this, SLOT(replyFinished()));
}
void UnsupportedContentHandler::replyFinished() {
renderNonHtmlContent();
}