summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-08 06:32:29 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-08 06:32:29 (GMT)
commit5fb54f0da8ef1bbe2210b59a61b203a098e06191 (patch)
tree6ceb782215535583a288ef4f73130dafa8d90725
parente8742e84b855eee90a0126eaa786dd3990d8f5bd (diff)
Start to parse answer
-rw-r--r--webengineviewer/src/checkphishingurl/checkphishingurljob.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/webengineviewer/src/checkphishingurl/checkphishingurljob.cpp b/webengineviewer/src/checkphishingurl/checkphishingurljob.cpp
index 38c211f..1394965 100644
--- a/webengineviewer/src/checkphishingurl/checkphishingurljob.cpp
+++ b/webengineviewer/src/checkphishingurl/checkphishingurljob.cpp
@@ -51,7 +51,19 @@ QString CheckPhishingUrlJob::secretKey() const
void CheckPhishingUrlJob::parse(const QByteArray &replyStr)
{
QJsonDocument document = QJsonDocument::fromJson(replyStr);
- qCDebug(WEBENGINEVIEWER_LOG) << " info : " << document.toJson();
+ qDebug() << " info : " << document.toJson();
+ if (document.isNull()) {
+ Q_EMIT result(WebEngineViewer::CheckPhishingUrlJob::Unknown, mUrl);
+ } else {
+ const QVariantMap answer = document.toVariant().toMap();
+ if (answer.isEmpty()) {
+ Q_EMIT result(WebEngineViewer::CheckPhishingUrlJob::Ok, mUrl);
+ } else {
+ const QVariantMap info = answer.value(QStringLiteral("matches")).toMap();
+ qDebug() << " INFO "<<info;
+ }
+ qDebug() << " answer" <<answer;
+ }
}
void CheckPhishingUrlJob::slotCheckUrlFinished(QNetworkReply *reply)