summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-18 14:09:18 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-18 14:09:18 (GMT)
commit05dfc61523176fb124e9912d6f28d30f67852fcd (patch)
tree248827458d8d41c7e1d74bf50e26f45e73355a08
parent2a5a261a77c95ed0a97e6fa1e316016545d26672 (diff)
Forward signal
-rw-r--r--webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt2
-rw-r--r--webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.cpp25
-rw-r--r--webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.h3
3 files changed, 26 insertions, 4 deletions
diff --git a/webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt b/webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt
index 20b41a0..b815118 100644
--- a/webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt
+++ b/webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt
@@ -11,7 +11,7 @@ ecm_add_test(checkphishingurljobtest.cpp ../checkphishingurljob.cpp ../checkphi
ecm_add_test(checkphishingurlfromlocaldatabasejobtest.cpp ../checkphishingurlutil.cpp ../checkphishingurlfromlocaldatabasejob.cpp ${testwebengineviewer_webengine_common_SRCS}
TEST_NAME checkphishingurlfromlocaldatabasetest
NAME_PREFIX "webengineview-checkphishingurl-"
- LINK_LIBRARIES Qt5::Test Qt5::WebKitWidgets KF5::WebEngineViewer
+ LINK_LIBRARIES Qt5::Test Qt5::WebKitWidgets KF5::WebEngineViewer Qt5::Sql
)
diff --git a/webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.cpp b/webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.cpp
index 45a5e39..09c1628 100644
--- a/webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.cpp
+++ b/webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.cpp
@@ -19,6 +19,8 @@
#include "checkphishingurlfromlocaldatabasejob.h"
#include <qcryptographichash.h>
+#include "localdatabasemanager.h"
+
using namespace WebEngineViewer;
CheckPhishingUrlFromLocalDataBaseJob::CheckPhishingUrlFromLocalDataBaseJob(QObject *parent)
@@ -44,11 +46,30 @@ void CheckPhishingUrlFromLocalDataBaseJob::start()
deleteLater();
} else {
QByteArray hash = createHash();
- //TODO
- //TODO check in local database
+ connect(LocalDataBaseManager::self(), &LocalDataBaseManager::checkUrlFinished, this, &CheckPhishingUrlFromLocalDataBaseJob::slotCheckUrlFinished);
+ //LocalDataBaseManager::self()->checkUrl(/*TODO*/);
}
}
+void CheckPhishingUrlFromLocalDataBaseJob::slotCheckUrlFinished(const QUrl &url, WebEngineViewer::LocalDataBaseManager::UrlStatus status)
+{
+ CheckPhishingUrlFromLocalDataBaseJob::UrlStatus currentStatus(CheckPhishingUrlFromLocalDataBaseJob::Unknown);
+ switch(status) {
+ case WebEngineViewer::LocalDataBaseManager::Unknown:
+ break;
+ case WebEngineViewer::LocalDataBaseManager::UrlOk:
+ currentStatus = CheckPhishingUrlFromLocalDataBaseJob::Ok;
+ break;
+ case WebEngineViewer::LocalDataBaseManager::Malware:
+ currentStatus = CheckPhishingUrlFromLocalDataBaseJob::MalWare;
+ break;
+ }
+
+ Q_EMIT finished(url, currentStatus);
+ deleteLater();
+}
+
+
bool CheckPhishingUrlFromLocalDataBaseJob::canStart() const
{
return mUrl.isValid();
diff --git a/webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.h b/webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.h
index c3f9f89..54f0aa0 100644
--- a/webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.h
+++ b/webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.h
@@ -22,8 +22,8 @@
#include <QObject>
#include "webengineviewer_export.h"
+#include <WebEngineViewer/LocalDataBaseManager>
#include <QUrl>
-
namespace WebEngineViewer
{
class WEBENGINEVIEWER_EXPORT CheckPhishingUrlFromLocalDataBaseJob : public QObject
@@ -51,6 +51,7 @@ Q_SIGNALS:
void finished(const QUrl &url, WebEngineViewer::CheckPhishingUrlFromLocalDataBaseJob::UrlStatus status);
private:
+ void slotCheckUrlFinished(const QUrl &url, WebEngineViewer::LocalDataBaseManager::UrlStatus status);
QUrl mUrl;
};
}