Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Cleanup

  • Loading branch information...
commit 9257fe3c93bb1f842246b64de8b0a78efaaa2a41 1 parent 353fe86
@halogenandtoast halogenandtoast authored
View
2  spec/driver_spec.rb
@@ -142,7 +142,7 @@
end
end
- it "should render unsupported content types gracefully" do
+ it "renders unsupported content types gracefully" do
subject.visit("/")
subject.body.should =~ /css/
end
View
18 src/UnsupportedContentHandler.cpp
@@ -12,12 +12,20 @@ UnsupportedContentHandler::UnsupportedContentHandler(WebPage *page, QNetworkRepl
void UnsupportedContentHandler::handleUnsupportedContent() {
QVariant contentMimeType = m_reply->header(QNetworkRequest::ContentTypeHeader);
if(!contentMimeType.isNull()) {
@jferris Owner
jferris added a note

Can you reverse the if clause so that we don't need an "if not then else?"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ this->loadUnsupportedContent();
+ this->finish(true);
+ } else {
+ this->finish(false);
+ }
+ this->deleteLater();
+}
+
+void UnsupportedContentHandler::loadUnsupportedContent() {
QByteArray text = m_reply->readAll();
m_page->mainFrame()->setContent(text, QString("text/plain"), m_reply->url());
+}
+
+void UnsupportedContentHandler::finish(bool success) {
connect(m_page, SIGNAL(loadFinished(bool)), m_page, SLOT(loadFinished(bool)));
- m_page->loadFinished(true);
- } else {
- connect(m_page, SIGNAL(loadFinished(bool)), m_page, SLOT(loadFinished(bool)));
- m_page->loadFinished(false);
- }
+ m_page->loadFinished(success);
}
View
2  src/UnsupportedContentHandler.h
@@ -13,4 +13,6 @@ class UnsupportedContentHandler : public QObject {
private:
WebPage *m_page;
QNetworkReply *m_reply;
+ void loadUnsupportedContent();
+ void finish(bool success);
};
Please sign in to comment.
Something went wrong with that request. Please try again.