summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-20 16:33:45 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-20 16:33:45 (GMT)
commitc9d5c0a1637074d58a46807ee414c87d023d3d57 (patch)
treea9f900cd61b5e167e9fc5c910a6153ee94f91b41
parentc97f4b28277468b8d8748b41240fc4b8644f074e (diff)
Improve localdatabasefile
-rw-r--r--webengineviewer/src/checkphishingurl/localdatabasefile.cpp9
-rw-r--r--webengineviewer/src/checkphishingurl/localdatabasefile.h11
-rw-r--r--webengineviewer/src/checkphishingurl/searchfullhashjob.cpp7
3 files changed, 19 insertions, 8 deletions
diff --git a/webengineviewer/src/checkphishingurl/localdatabasefile.cpp b/webengineviewer/src/checkphishingurl/localdatabasefile.cpp
index b4a2e83..3d5a9aa 100644
--- a/webengineviewer/src/checkphishingurl/localdatabasefile.cpp
+++ b/webengineviewer/src/checkphishingurl/localdatabasefile.cpp
@@ -21,8 +21,8 @@
using namespace WebEngineViewer;
-LocalDataBaseFile::LocalDataBaseFile(QObject *parent)
- : QObject(parent)
+LocalDataBaseFile::LocalDataBaseFile(const QString &filename)
+ : mFileName(filename)
{
}
@@ -31,3 +31,8 @@ LocalDataBaseFile::~LocalDataBaseFile()
{
}
+
+void LocalDataBaseFile::initialize()
+{
+ //TODO
+}
diff --git a/webengineviewer/src/checkphishingurl/localdatabasefile.h b/webengineviewer/src/checkphishingurl/localdatabasefile.h
index 1479b45..e4c0614 100644
--- a/webengineviewer/src/checkphishingurl/localdatabasefile.h
+++ b/webengineviewer/src/checkphishingurl/localdatabasefile.h
@@ -19,16 +19,19 @@
#ifndef LOCALDATABASEFILE_H
#define LOCALDATABASEFILE_H
-#include <QObject>
+
+#include <QString>
namespace WebEngineViewer
{
-class LocalDataBaseFile : public QObject
+class LocalDataBaseFile
{
- Q_OBJECT
public:
- explicit LocalDataBaseFile(QObject *parent = Q_NULLPTR);
+ LocalDataBaseFile(const QString &filename);
~LocalDataBaseFile();
+private:
+ void initialize();
+ QString mFileName;
};
}
diff --git a/webengineviewer/src/checkphishingurl/searchfullhashjob.cpp b/webengineviewer/src/checkphishingurl/searchfullhashjob.cpp
index b03849d..68d9d31 100644
--- a/webengineviewer/src/checkphishingurl/searchfullhashjob.cpp
+++ b/webengineviewer/src/checkphishingurl/searchfullhashjob.cpp
@@ -97,14 +97,17 @@ void SearchFullHashJob::parse(const QByteArray &replyStr)
return;
} else {
const QVariantList info = answer.value(QStringLiteral("matches")).toList();
+ //Implement multi match ?
if (info.count() == 1) {
const QVariantMap map = info.at(0).toMap();
const QString threatTypeStr = map[QStringLiteral("threatType")].toString();
if (threatTypeStr == QStringLiteral("MALWARE")) {
const QVariantMap urlMap = map[QStringLiteral("threat")].toMap();
if (urlMap.count() == 1) {
+ const QString hashStr = urlMap[QStringLiteral("hash")].toString();
+ //TODO
/*
- if (urlMap[QStringLiteral("url")].toString() == mHash.toString()) {
+ if (urlMap[QStringLiteral("hash")].toString() == mHash.toString()) {
Q_EMIT result(WebEngineViewer::SearchFullHashJob::MalWare, mHash);
return;
}
@@ -162,7 +165,7 @@ QByteArray SearchFullHashJob::jsonRequest() const
clientMap.insert(QStringLiteral("clientVersion"), QStringLiteral("5.4.0")); //FIXME
map.insert(QStringLiteral("client"), clientMap);
- //clientStates
+ //clientStates We can support multi database.
const QVariantList clientStatesList = { mDatabaseHash };
map.insert(QStringLiteral("clientStates"), clientStatesList);