summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-17 12:26:08 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-17 12:26:08 (GMT)
commit00c89a0e3d961dcf3c4e9040bf0a6a35746cfc7a (patch)
tree523e19c39bbb8cd5fa7c4e371069303d345ce2fc
parenta11336eaf194485c33813082043edf6a13137ca6 (diff)
improve local database
-rw-r--r--webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.cpp4
-rw-r--r--webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.h2
-rw-r--r--webengineviewer/src/checkphishingurl/localdatabasemanager.cpp4
-rw-r--r--webengineviewer/src/checkphishingurl/localdatabasemanager.h3
-rw-r--r--webengineviewer/src/checkphishingurl/tests/CMakeLists.txt11
5 files changed, 19 insertions, 5 deletions
diff --git a/webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.cpp b/webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.cpp
index 7532ccd..d7e7433 100644
--- a/webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.cpp
+++ b/webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.cpp
@@ -27,7 +27,7 @@ CheckPhishingUrlFromLocalDataBaseJob::CheckPhishingUrlFromLocalDataBaseJob(QObje
}
-WebEngineViewer::CheckPhishingUrlFromLocalDataBaseJob::~CheckPhishingUrlFromLocalDataBaseJob()
+CheckPhishingUrlFromLocalDataBaseJob::~CheckPhishingUrlFromLocalDataBaseJob()
{
}
@@ -40,7 +40,7 @@ void CheckPhishingUrlFromLocalDataBaseJob::setCheckPhisingUrl(const QUrl &url)
void CheckPhishingUrlFromLocalDataBaseJob::start()
{
if (mUrl.isValid()) {
- Q_EMIT finished(InvalidUrl);
+ Q_EMIT finished(mUrl, InvalidUrl);
deleteLater();
} else {
//TODO check in local database
diff --git a/webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.h b/webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.h
index 4a3f631..c3f9f89 100644
--- a/webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.h
+++ b/webengineviewer/src/checkphishingurl/checkphishingurlfromlocaldatabasejob.h
@@ -48,7 +48,7 @@ public:
QByteArray createHash();
Q_SIGNALS:
- void finished(WebEngineViewer::CheckPhishingUrlFromLocalDataBaseJob::UrlStatus status);
+ void finished(const QUrl &url, WebEngineViewer::CheckPhishingUrlFromLocalDataBaseJob::UrlStatus status);
private:
QUrl mUrl;
diff --git a/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp b/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
index 58570ae..430b6f5 100644
--- a/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
+++ b/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
@@ -18,6 +18,7 @@
*/
#include "localdatabasemanager.h"
#include "webengineviewer_debug.h"
+#include "checkphishingurlfromlocaldatabasejob.h"
#include <QStandardPaths>
#include <QSqlDatabase>
@@ -42,8 +43,7 @@ LocalDataBaseManager::~LocalDataBaseManager()
QString LocalDataBaseManager::localDataBasePath() const
{
- //TODO
- return {};
+ return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/phishingurl/");
}
LocalDataBaseManager *LocalDataBaseManager::self()
diff --git a/webengineviewer/src/checkphishingurl/localdatabasemanager.h b/webengineviewer/src/checkphishingurl/localdatabasemanager.h
index 36fedaa..0e71331 100644
--- a/webengineviewer/src/checkphishingurl/localdatabasemanager.h
+++ b/webengineviewer/src/checkphishingurl/localdatabasemanager.h
@@ -36,6 +36,9 @@ public:
static LocalDataBaseManager *self();
void checkUrl(const QUrl &url);
+
+Q_SIGNALS:
+ void checkUrlFinished(const QUrl &url);
private:
QSqlError initDb();
bool initializeDataBase();
diff --git a/webengineviewer/src/checkphishingurl/tests/CMakeLists.txt b/webengineviewer/src/checkphishingurl/tests/CMakeLists.txt
index 7183cdd..8c2d68f 100644
--- a/webengineviewer/src/checkphishingurl/tests/CMakeLists.txt
+++ b/webengineviewer/src/checkphishingurl/tests/CMakeLists.txt
@@ -22,3 +22,14 @@ target_link_libraries(createphishingurldatabasegui
Qt5::WebEngineWidgets
KF5::I18n
)
+
+set(managelocaldatabasegui_SRCS managelocaldatabasegui.cpp)
+add_executable(managelocaldatabasegui ${managelocaldatabasegui_SRCS})
+target_link_libraries(managelocaldatabasegui
+ KF5::KIOCore
+ KF5::WebEngineViewer
+ Qt5::WebEngine
+ Qt5::WebEngineWidgets
+ KF5::I18n
+ Qt5::Sql
+ )