summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-08 06:13:34 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-08 06:13:34 (GMT)
commite8742e84b855eee90a0126eaa786dd3990d8f5bd (patch)
tree517e1b2f52d0ab77e46c9fb841c6a830b8790815
parentee5016d76ab4dedcf0e956a2e76e1f34e893964b (diff)
Add parsing
-rw-r--r--webengineviewer/src/checkphishingurl/checkphishingurljob.cpp12
-rw-r--r--webengineviewer/src/checkphishingurl/checkphishingurljob.h1
2 files changed, 9 insertions, 4 deletions
diff --git a/webengineviewer/src/checkphishingurl/checkphishingurljob.cpp b/webengineviewer/src/checkphishingurl/checkphishingurljob.cpp
index 5c80210..38c211f 100644
--- a/webengineviewer/src/checkphishingurl/checkphishingurljob.cpp
+++ b/webengineviewer/src/checkphishingurl/checkphishingurljob.cpp
@@ -48,11 +48,15 @@ QString CheckPhishingUrlJob::secretKey() const
return QStringLiteral("mdT1DjzohxN3npUUzkENT0gO");
}
-void CheckPhishingUrlJob::slotCheckUrlFinished(QNetworkReply *reply)
+void CheckPhishingUrlJob::parse(const QByteArray &replyStr)
{
- QJsonDocument document = QJsonDocument::fromJson(reply->readAll());
-
+ QJsonDocument document = QJsonDocument::fromJson(replyStr);
qCDebug(WEBENGINEVIEWER_LOG) << " info : " << document.toJson();
+}
+
+void CheckPhishingUrlJob::slotCheckUrlFinished(QNetworkReply *reply)
+{
+ parse(reply->readAll());
//TODO extract info from
//TODO Q_EMIT result(MessageViewer::CheckPhishingUrlJob:: ?);
reply->deleteLater();
@@ -140,7 +144,7 @@ void CheckPhishingUrlJob::start()
void CheckPhishingUrlJob::slotError(QNetworkReply::NetworkError error)
{
QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender());
- qCDebug(WEBENGINEVIEWER_LOG)<<" error "<<reply->errorString();
+ qCDebug(WEBENGINEVIEWER_LOG)<<" error "<<error << " error string : "<< reply->errorString();
//mErrorMsg = reply->errorString();
//FIXME
reply->deleteLater();
diff --git a/webengineviewer/src/checkphishingurl/checkphishingurljob.h b/webengineviewer/src/checkphishingurl/checkphishingurljob.h
index 19d06c1..5d965b5 100644
--- a/webengineviewer/src/checkphishingurl/checkphishingurljob.h
+++ b/webengineviewer/src/checkphishingurl/checkphishingurljob.h
@@ -49,6 +49,7 @@ public:
bool canStart() const;
QByteArray jsonRequest() const;
+ void parse(const QByteArray &replyStr);
Q_SIGNALS:
void result(WebEngineViewer::CheckPhishingUrlJob::UrlStatus status, const QUrl &url);
void debugJson(const QByteArray &ba);