summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-18 06:12:05 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-18 06:12:05 (GMT)
commit6a813662fd111a9aa5b3f054ed4c53172dbd4e17 (patch)
tree9f948dcdcaa40614215dbe11441ebd15c59588c8
parent03c7cefcaa4104d5d5fc30b5d78e0d0838852ca5 (diff)
Rename methods
-rw-r--r--webengineviewer/src/checkphishingurl/localdatabasemanager.cpp27
-rw-r--r--webengineviewer/src/checkphishingurl/localdatabasemanager.h8
-rw-r--r--webengineviewer/src/checkphishingurl/tests/managelocaldatabasegui.cpp2
3 files changed, 13 insertions, 24 deletions
diff --git a/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp b/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
index a10cd95..754a977 100644
--- a/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
+++ b/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
@@ -86,7 +86,7 @@ void LocalDataBaseManager::downloadPartialDataBase()
WebEngineViewer::CreatePhishingUrlDataBaseJob *job = new WebEngineViewer::CreatePhishingUrlDataBaseJob(this);
job->setDataBaseDownloadNeeded(WebEngineViewer::CreatePhishingUrlDataBaseJob::UpdateDataBase);
job->setDataBaseState(QString()); //TODO
- connect(job, &CreatePhishingUrlDataBaseJob::finished, this, &LocalDataBaseManager::slotDownloadFullDataBaseFinished);
+ connect(job, &CreatePhishingUrlDataBaseJob::finished, this, &LocalDataBaseManager::slotDownloadDataBaseFinished);
job->start();
}
@@ -94,11 +94,11 @@ void LocalDataBaseManager::downloadFullDataBase()
{
WebEngineViewer::CreatePhishingUrlDataBaseJob *job = new WebEngineViewer::CreatePhishingUrlDataBaseJob(this);
job->setDataBaseDownloadNeeded(WebEngineViewer::CreatePhishingUrlDataBaseJob::FullDataBase);
- connect(job, &CreatePhishingUrlDataBaseJob::finished, this, &LocalDataBaseManager::slotDownloadFullDataBaseFinished);
+ connect(job, &CreatePhishingUrlDataBaseJob::finished, this, &LocalDataBaseManager::slotDownloadDataBaseFinished);
job->start();
}
-void LocalDataBaseManager::start()
+void LocalDataBaseManager::initialize()
{
if (!mDataBaseOk) {
bool initDatabaseSuccess = initializeDataBase();
@@ -118,7 +118,7 @@ void LocalDataBaseManager::start()
}
}
-void LocalDataBaseManager::slotDownloadFullDataBaseFinished(const WebEngineViewer::UpdateDataBaseInfo &infoDataBase,
+void LocalDataBaseManager::slotDownloadDataBaseFinished(const WebEngineViewer::UpdateDataBaseInfo &infoDataBase,
WebEngineViewer::CreatePhishingUrlDataBaseJob::DataBaseDownloadResult status)
{
qDebug() << "LocalDataBaseManager::slotDownloadFullDataBaseFinished "<<status;
@@ -162,9 +162,11 @@ LocalDataBaseManager *LocalDataBaseManager::self()
bool LocalDataBaseManager::initializeDataBase()
{
- const QSqlError err = initDb();
- if (err.type() != QSqlError::NoError) {
- qCWarning(WEBENGINEVIEWER_LOG) << "Impossible to open DataBase: " << err.text();
+ mDataBase = QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"));
+ QDir().mkpath(localDataBasePath());
+ mDataBase.setDatabaseName(localDataBasePath() + sqlFileName());
+ if (!mDataBase.open()) {
+ qCWarning(WEBENGINEVIEWER_LOG) << "Impossible to open DataBase: " << mDataBase.lastError().text();
return false;
}
return true;
@@ -177,17 +179,6 @@ bool LocalDataBaseManager::createTable()
"hash varchar(32))").arg(tableName()));
}
-QSqlError LocalDataBaseManager::initDb()
-{
- mDataBase = QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"));
- QDir().mkpath(localDataBasePath());
- mDataBase.setDatabaseName(localDataBasePath() + sqlFileName());
- if (!mDataBase.open()) {
- return mDataBase.lastError();
- }
- return QSqlError();
-}
-
void LocalDataBaseManager::checkUrl(const QUrl &url)
{
if (mDataBaseOk) {
diff --git a/webengineviewer/src/checkphishingurl/localdatabasemanager.h b/webengineviewer/src/checkphishingurl/localdatabasemanager.h
index 154a24b..c17d79e 100644
--- a/webengineviewer/src/checkphishingurl/localdatabasemanager.h
+++ b/webengineviewer/src/checkphishingurl/localdatabasemanager.h
@@ -25,7 +25,6 @@
#include <QSqlDatabase>
#include <QUrl>
#include "createphishingurldatabasejob.h"
-class QSqlError;
namespace WebEngineViewer
{
class WEBENGINEVIEWER_EXPORT LocalDataBaseManager : public QObject
@@ -45,7 +44,7 @@ public:
void checkUrl(const QUrl &url);
- void start();
+ void initialize();
void closeDataBaseAndDeleteIt();
@@ -54,14 +53,13 @@ Q_SIGNALS:
protected:
virtual void downloadFullDataBase();
-
virtual void downloadPartialDataBase();
+
private:
void readConfig();
void saveConfig();
- void slotDownloadFullDataBaseFinished(const WebEngineViewer::UpdateDataBaseInfo &infoDataBase, WebEngineViewer::CreatePhishingUrlDataBaseJob::DataBaseDownloadResult status);
- QSqlError initDb();
+ void slotDownloadDataBaseFinished(const WebEngineViewer::UpdateDataBaseInfo &infoDataBase, WebEngineViewer::CreatePhishingUrlDataBaseJob::DataBaseDownloadResult status);
bool initializeDataBase();
bool createTable();
QSqlDatabase mDataBase;
diff --git a/webengineviewer/src/checkphishingurl/tests/managelocaldatabasegui.cpp b/webengineviewer/src/checkphishingurl/tests/managelocaldatabasegui.cpp
index fadd5d9..a9a094d 100644
--- a/webengineviewer/src/checkphishingurl/tests/managelocaldatabasegui.cpp
+++ b/webengineviewer/src/checkphishingurl/tests/managelocaldatabasegui.cpp
@@ -51,7 +51,7 @@ ManageLocalDataBaseGui::~ManageLocalDataBaseGui()
void ManageLocalDataBaseGui::slotDownloadFullDatabase()
{
- WebEngineViewer::LocalDataBaseManager::self()->start();
+ WebEngineViewer::LocalDataBaseManager::self()->initialize();
}