summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-17 07:19:33 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-17 07:19:33 (GMT)
commitc09a8f0929eef87299374f691db6b3bed1148f7c (patch)
tree9a5f9cc50337c4672547b8a4cfd1c193661812cc
parentb34448bfbca4ccf5c41184c7cdb194c912c8308e (diff)
Look at to define sqlite database for phishing url database
-rw-r--r--CMakeLists.txt2
-rw-r--r--webengineviewer/src/CMakeLists.txt1
-rw-r--r--webengineviewer/src/checkphishingurl/localdatabasemanager.cpp19
-rw-r--r--webengineviewer/src/checkphishingurl/localdatabasemanager.h3
4 files changed, 24 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 60a2d70..411d0b6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,7 +53,7 @@ find_package(KF5Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED)
if (NOT ${MIMETREEPARSER_ONLY_BUILD})
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Network PrintSupport WebEngine WebEngineWidgets WebKitWidgets)
-
+ find_package(Qt5Sql ${QT_REQUIRED_VERSION} REQUIRED COMPONENTS Private)
find_package(KF5Archive ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5Completion ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5Config ${KF5_VERSION} CONFIG REQUIRED)
diff --git a/webengineviewer/src/CMakeLists.txt b/webengineviewer/src/CMakeLists.txt
index c635ce1..c1a4329 100644
--- a/webengineviewer/src/CMakeLists.txt
+++ b/webengineviewer/src/CMakeLists.txt
@@ -96,6 +96,7 @@ target_link_libraries(KF5WebEngineViewer
KF5::I18n
KF5::WidgetsAddons
KF5::ConfigCore
+ Qt5::Sql
)
set_target_properties(KF5WebEngineViewer PROPERTIES
diff --git a/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp b/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
index 37f013f..38fed95 100644
--- a/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
+++ b/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
@@ -18,6 +18,9 @@
*/
#include "localdatabasemanager.h"
+#include <QSqlDatabase>
+#include <QSqlError>
+
using namespace WebEngineViewer;
Q_GLOBAL_STATIC(LocalDataBaseManager, s_localDataBaseManager)
@@ -33,6 +36,12 @@ LocalDataBaseManager::~LocalDataBaseManager()
}
+QString LocalDataBaseManager::localDataBasePath() const
+{
+ //TODO
+ return {};
+}
+
LocalDataBaseManager *LocalDataBaseManager::self()
{
return s_localDataBaseManager;
@@ -40,7 +49,17 @@ LocalDataBaseManager *LocalDataBaseManager::self()
void LocalDataBaseManager::initializeDataBase()
{
+}
+
+QSqlError LocalDataBaseManager::initDb()
+{
+ QSqlDatabase db = QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"));
+ db.setDatabaseName(QStringLiteral(":phishingurl:"));
+
+ if (!db.open())
+ return db.lastError();
//TODO
+ return QSqlError();
}
void LocalDataBaseManager::checkUrl(const QUrl &url)
diff --git a/webengineviewer/src/checkphishingurl/localdatabasemanager.h b/webengineviewer/src/checkphishingurl/localdatabasemanager.h
index a35ea64..626757e 100644
--- a/webengineviewer/src/checkphishingurl/localdatabasemanager.h
+++ b/webengineviewer/src/checkphishingurl/localdatabasemanager.h
@@ -22,6 +22,7 @@
#include <QObject>
#include <QUrl>
+class QSqlError;
namespace WebEngineViewer
{
class LocalDataBaseManager : public QObject
@@ -35,7 +36,9 @@ public:
void checkUrl(const QUrl &url);
private:
+ QSqlError initDb();
void initializeDataBase();
+ QString localDataBasePath() const;
};
}