summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-18 06:23:24 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-18 06:23:24 (GMT)
commit9919a40f3217f42f9155231d9c21a30e6ca083fd (patch)
tree96bff35e8ce7f9560ae068d17f41f2675218d808
parent6a813662fd111a9aa5b3f054ed4c53172dbd4e17 (diff)
Don't call two fullUpdate if we still are in progress
-rw-r--r--webengineviewer/src/checkphishingurl/localdatabasemanager.cpp10
-rw-r--r--webengineviewer/src/checkphishingurl/localdatabasemanager.h1
2 files changed, 10 insertions, 1 deletions
diff --git a/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp b/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
index 754a977..2adb91b 100644
--- a/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
+++ b/webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
@@ -49,7 +49,8 @@ inline QString sqlFileName() {
LocalDataBaseManager::LocalDataBaseManager(QObject *parent)
: QObject(parent),
- mDataBaseOk(false)
+ mDataBaseOk(false),
+ mDownloadProgress(false)
{
}
@@ -83,6 +84,7 @@ void LocalDataBaseManager::saveConfig()
void LocalDataBaseManager::downloadPartialDataBase()
{
+ mDownloadProgress = true;
WebEngineViewer::CreatePhishingUrlDataBaseJob *job = new WebEngineViewer::CreatePhishingUrlDataBaseJob(this);
job->setDataBaseDownloadNeeded(WebEngineViewer::CreatePhishingUrlDataBaseJob::UpdateDataBase);
job->setDataBaseState(QString()); //TODO
@@ -92,6 +94,7 @@ void LocalDataBaseManager::downloadPartialDataBase()
void LocalDataBaseManager::downloadFullDataBase()
{
+ mDownloadProgress = true;
WebEngineViewer::CreatePhishingUrlDataBaseJob *job = new WebEngineViewer::CreatePhishingUrlDataBaseJob(this);
job->setDataBaseDownloadNeeded(WebEngineViewer::CreatePhishingUrlDataBaseJob::FullDataBase);
connect(job, &CreatePhishingUrlDataBaseJob::finished, this, &LocalDataBaseManager::slotDownloadDataBaseFinished);
@@ -100,6 +103,9 @@ void LocalDataBaseManager::downloadFullDataBase()
void LocalDataBaseManager::initialize()
{
+ if (mDownloadProgress) {
+ return;
+ }
if (!mDataBaseOk) {
bool initDatabaseSuccess = initializeDataBase();
if (initDatabaseSuccess) {
@@ -121,6 +127,7 @@ void LocalDataBaseManager::initialize()
void LocalDataBaseManager::slotDownloadDataBaseFinished(const WebEngineViewer::UpdateDataBaseInfo &infoDataBase,
WebEngineViewer::CreatePhishingUrlDataBaseJob::DataBaseDownloadResult status)
{
+
qDebug() << "LocalDataBaseManager::slotDownloadFullDataBaseFinished "<<status;
switch(status) {
case CreatePhishingUrlDataBaseJob::InvalidData:
@@ -153,6 +160,7 @@ void LocalDataBaseManager::slotDownloadDataBaseFinished(const WebEngineViewer::U
}
}
}
+ mDownloadProgress = false;
}
LocalDataBaseManager *LocalDataBaseManager::self()
diff --git a/webengineviewer/src/checkphishingurl/localdatabasemanager.h b/webengineviewer/src/checkphishingurl/localdatabasemanager.h
index c17d79e..b8b3abc 100644
--- a/webengineviewer/src/checkphishingurl/localdatabasemanager.h
+++ b/webengineviewer/src/checkphishingurl/localdatabasemanager.h
@@ -64,6 +64,7 @@ private:
bool createTable();
QSqlDatabase mDataBase;
bool mDataBaseOk;
+ bool mDownloadProgress;
};
}