summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-17 21:52:59 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-17 21:52:59 (GMT)
commit84bca161c3cafc26a962c61b0f954ab0816d62d9 (patch)
tree738675d0a60bcc5f10c69daf34d5d3ac389c12db
parent3afd8dfafb9fc09fa52bc7a16fb2369ef36a7620 (diff)
Allow to test load partial download
-rw-r--r--webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.cpp27
-rw-r--r--webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.h1
2 files changed, 27 insertions, 1 deletions
diff --git a/webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.cpp b/webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.cpp
index 409aff5..ded39b2 100644
--- a/webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.cpp
+++ b/webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.cpp
@@ -27,6 +27,7 @@
#include <QTextEdit>
#include <QLabel>
#include <QVBoxLayout>
+#include <QInputDialog>
CreatePhisingUrlDataBaseGui::CreatePhisingUrlDataBaseGui(QWidget *parent)
: QWidget(parent)
@@ -43,9 +44,15 @@ CreatePhisingUrlDataBaseGui::CreatePhisingUrlDataBaseGui(QWidget *parent)
mJson->setAcceptRichText(false);
layout->addWidget(mJson);
+ QHBoxLayout *buttonLayout = new QHBoxLayout;
+ layout->addLayout(buttonLayout);
QPushButton *button = new QPushButton(QStringLiteral("DownLoad full database"), this);
connect(button, &QPushButton::clicked, this, &CreatePhisingUrlDataBaseGui::slotDownloadFullDatabase);
- layout->addWidget(button);
+ buttonLayout->addWidget(button);
+
+ QPushButton *button2 = new QPushButton(QStringLiteral("DownLoad partial database"), this);
+ connect(button2, &QPushButton::clicked, this, &CreatePhisingUrlDataBaseGui::slotDownloadPartialDatabase);
+ buttonLayout->addWidget(button2);
}
CreatePhisingUrlDataBaseGui::~CreatePhisingUrlDataBaseGui()
@@ -53,8 +60,26 @@ CreatePhisingUrlDataBaseGui::~CreatePhisingUrlDataBaseGui()
}
+void CreatePhisingUrlDataBaseGui::slotDownloadPartialDatabase()
+{
+ const QString newValue = QInputDialog::getText(this, QStringLiteral("Define database newClientState"), QStringLiteral("newClientState:"));
+ if (!newValue.isEmpty()) {
+ mJson->clear();
+ mResult->clear();
+ WebEngineViewer::CreatePhishingUrlDataBaseJob *job = new WebEngineViewer::CreatePhishingUrlDataBaseJob(this);
+ job->setUseCompactJson(false);
+ job->setDataBaseDownloadNeeded(WebEngineViewer::CreatePhishingUrlDataBaseJob::UpdateDataBase);
+ job->setDataBaseState(newValue);
+ connect(job, &WebEngineViewer::CreatePhishingUrlDataBaseJob::debugJsonResult, this, &CreatePhisingUrlDataBaseGui::slotResult);
+ connect(job, &WebEngineViewer::CreatePhishingUrlDataBaseJob::debugJson, this, &CreatePhisingUrlDataBaseGui::slotDebugJSon);
+ job->start();
+ }
+}
+
void CreatePhisingUrlDataBaseGui::slotDownloadFullDatabase()
{
+ mJson->clear();
+ mResult->clear();
WebEngineViewer::CreatePhishingUrlDataBaseJob *job = new WebEngineViewer::CreatePhishingUrlDataBaseJob(this);
job->setUseCompactJson(false);
connect(job, &WebEngineViewer::CreatePhishingUrlDataBaseJob::debugJsonResult, this, &CreatePhisingUrlDataBaseGui::slotResult);
diff --git a/webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.h b/webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.h
index b767fbc..3d3d7f0 100644
--- a/webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.h
+++ b/webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.h
@@ -32,6 +32,7 @@ private Q_SLOTS:
void slotResult(const QByteArray &data);
void slotDownloadFullDatabase();
void slotDebugJSon(const QByteArray &data);
+ void slotDownloadPartialDatabase();
private:
QTextEdit *mResult;
QTextEdit *mJson;