summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-20 13:26:22 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-20 13:26:22 (GMT)
commit22771596775663157e0e6e7b42b803365a163bde (patch)
tree05da0a336d60cc8daf4fe59e0708422962172c00
parent0a2601b993e9f97912815e1aa43b199a4cb3b3f1 (diff)
We will use a mmap file
-rw-r--r--CMakeLists.txt1
-rw-r--r--webengineviewer/src/CMakeLists.txt1
-rw-r--r--webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt4
-rw-r--r--webengineviewer/src/checkphishingurl/localdatabasemanager.cpp21
-rw-r--r--webengineviewer/src/checkphishingurl/localdatabasemanager.h2
-rw-r--r--webengineviewer/src/checkphishingurl/tests/CMakeLists.txt1
6 files changed, 11 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 411d0b6..13cc5c5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,7 +53,6 @@ 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 012a5fa..4f7c299 100644
--- a/webengineviewer/src/CMakeLists.txt
+++ b/webengineviewer/src/CMakeLists.txt
@@ -98,7 +98,6 @@ target_link_libraries(KF5WebEngineViewer
KF5::I18n
KF5::WidgetsAddons
KF5::ConfigCore
- Qt5::Sql
)
set_target_properties(KF5WebEngineViewer PROPERTIES
diff --git a/webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt b/webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt
index 10b56c4..6e32538 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-checkphishingurlfromlocaldatabasejob-"
- LINK_LIBRARIES Qt5::Test Qt5::WebKitWidgets KF5::WebEngineViewer Qt5::Sql
+ LINK_LIBRARIES Qt5::Test Qt5::WebKitWidgets KF5::WebEngineViewer
)
@@ -26,7 +26,7 @@ ecm_add_test(createphishingurldatabasejobtest.cpp ../checkphishingurlutil.cpp ..
ecm_add_test(localdatabasemanagertest.cpp ../checkphishingurlutil.cpp ../localdatabasemanager.cpp ${testwebengineviewer_webengine_common_SRCS}
TEST_NAME localdatabasemanagertest
NAME_PREFIX "webengineview-localdatabasemanager-"
- LINK_LIBRARIES Qt5::Test Qt5::WebKitWidgets KF5::WebEngineViewer Qt5::Sql
+ LINK_LIBRARIES Qt5::Test Qt5::WebKitWidgets KF5::WebEngineViewer
)
ecm_add_test(searchfullhashjobtest.cpp ../checkphishingurlutil.cpp ../searchfullhashjob.cpp ${testwebengineviewer_webengine_common_SRCS}
diff --git a/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp b/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
index 8ec17a3..7a67170 100644
--- a/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
+++ b/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
@@ -25,9 +25,6 @@
#include <KSharedConfig>
#include <QStandardPaths>
-#include <QSqlDatabase>
-#include <QSqlError>
-#include <QSqlQuery>
#include <QDebug>
#include <QDir>
#include <QTimer>
@@ -38,15 +35,9 @@ using namespace WebEngineViewer;
Q_GLOBAL_STATIC(LocalDataBaseManager, s_localDataBaseManager)
namespace {
-inline QString tableName() {
- return QStringLiteral("malware");
-}
inline QString localDataBasePath() {
return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/phishingurl/");
}
-inline QString sqlFileName() {
- return QStringLiteral("/malwaredb.sql");
-}
}
LocalDataBaseManager::LocalDataBaseManager(QObject *parent)
@@ -59,13 +50,11 @@ LocalDataBaseManager::LocalDataBaseManager(QObject *parent)
LocalDataBaseManager::~LocalDataBaseManager()
{
- if (mDataBaseOk) {
- mDataBase.close();
- }
}
void LocalDataBaseManager::closeDataBaseAndDeleteIt()
{
+ /*
if (mDataBaseOk) {
mDataBase.close();
QFile f(localDataBasePath() + sqlFileName());
@@ -73,6 +62,7 @@ void LocalDataBaseManager::closeDataBaseAndDeleteIt()
qCWarning(WEBENGINEVIEWER_LOG) << "impossible to remove local database file";
}
}
+ */
}
void LocalDataBaseManager::readConfig()
@@ -114,6 +104,7 @@ void LocalDataBaseManager::initialize()
return;
}
if (!mDataBaseOk) {
+ /*
bool initDatabaseSuccess = initializeDataBase();
if (initDatabaseSuccess) {
if (!mDataBase.tables().contains(tableName())) {
@@ -126,6 +117,7 @@ void LocalDataBaseManager::initialize()
mDataBaseOk = true;
}
}
+ */
} else {
qCWarning(WEBENGINEVIEWER_LOG) << "Database already initialized.";
}
@@ -240,6 +232,7 @@ LocalDataBaseManager *LocalDataBaseManager::self()
bool LocalDataBaseManager::initializeDataBase()
{
+ /*
mDataBase = QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"));
QDir().mkpath(localDataBasePath());
mDataBase.setDatabaseName(localDataBasePath() + sqlFileName());
@@ -247,14 +240,18 @@ bool LocalDataBaseManager::initializeDataBase()
qCWarning(WEBENGINEVIEWER_LOG) << "Impossible to open DataBase: " << mDataBase.lastError().text();
return false;
}
+ */
return true;
}
bool LocalDataBaseManager::createTable()
{
+ return true;
+ /*
QSqlQuery query(mDataBase);
return query.exec(QStringLiteral("create table %1 (id int primary key, "
"hash varchar(32))").arg(tableName()));
+ */
}
void LocalDataBaseManager::setDownloadProgress(bool downloadProgress)
diff --git a/webengineviewer/src/checkphishingurl/localdatabasemanager.h b/webengineviewer/src/checkphishingurl/localdatabasemanager.h
index 56b9943..6628aae 100644
--- a/webengineviewer/src/checkphishingurl/localdatabasemanager.h
+++ b/webengineviewer/src/checkphishingurl/localdatabasemanager.h
@@ -22,7 +22,6 @@
#include <QObject>
#include "webengineviewer_export.h"
-#include <QSqlDatabase>
#include <QUrl>
#include "createphishingurldatabasejob.h"
namespace WebEngineViewer
@@ -74,7 +73,6 @@ private:
bool createTable();
bool malwareFound(const QByteArray &hash);
- QSqlDatabase mDataBase;
QString mNewClientState;
bool mDataBaseOk;
bool mDownloadProgress;
diff --git a/webengineviewer/src/checkphishingurl/tests/CMakeLists.txt b/webengineviewer/src/checkphishingurl/tests/CMakeLists.txt
index c429316..ec94361 100644
--- a/webengineviewer/src/checkphishingurl/tests/CMakeLists.txt
+++ b/webengineviewer/src/checkphishingurl/tests/CMakeLists.txt
@@ -41,5 +41,4 @@ target_link_libraries(managelocaldatabasegui
Qt5::WebEngine
Qt5::WebEngineWidgets
KF5::I18n
- Qt5::Sql
)