summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-20 13:14:46 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-20 13:14:46 (GMT)
commit0a2601b993e9f97912815e1aa43b199a4cb3b3f1 (patch)
tree819b3124f210575ffdb912f0a701f8ae516f82e0
parent650ddbe06f8c3a9e88a26d01cc03461e3123e948 (diff)
Improve test apps
-rw-r--r--webengineviewer/src/checkphishingurl/tests/searchfullhashgui.cpp48
-rw-r--r--webengineviewer/src/checkphishingurl/tests/searchfullhashgui.h3
2 files changed, 33 insertions, 18 deletions
diff --git a/webengineviewer/src/checkphishingurl/tests/searchfullhashgui.cpp b/webengineviewer/src/checkphishingurl/tests/searchfullhashgui.cpp
index 1821805..fe34de8 100644
--- a/webengineviewer/src/checkphishingurl/tests/searchfullhashgui.cpp
+++ b/webengineviewer/src/checkphishingurl/tests/searchfullhashgui.cpp
@@ -32,16 +32,26 @@ SearchFullHashGui::SearchFullHashGui(QWidget *parent)
{
QVBoxLayout *layout = new QVBoxLayout(this);
- QHBoxLayout *checkUrlLayout = new QHBoxLayout;
- layout->addLayout(checkUrlLayout);
- QLabel *lab = new QLabel(QStringLiteral("Url to Check:"), this);
- checkUrlLayout->addWidget(lab);
- mCheckUrlLineEdit = new QLineEdit(this);
- checkUrlLayout->addWidget(mCheckUrlLineEdit);
+ QHBoxLayout *checkHashLayout = new QHBoxLayout;
+ layout->addLayout(checkHashLayout);
+ QLabel *lab = new QLabel(QStringLiteral("Hash from Url to Check:"), this);
+ checkHashLayout->addWidget(lab);
+ mCheckHashLineEdit = new QLineEdit(this);
+ checkHashLayout->addWidget(mCheckHashLineEdit);
+
+
+ QHBoxLayout *databaseHashLayout = new QHBoxLayout;
+ layout->addLayout(databaseHashLayout);
+ lab = new QLabel(QStringLiteral("Database hash:"), this);
+ checkHashLayout->addWidget(lab);
+ mDataBaseHashLineEdit = new QLineEdit(this);
+ checkHashLayout->addWidget(mDataBaseHashLineEdit);
+
+
QPushButton *button = new QPushButton(QStringLiteral("Check"), this);
- checkUrlLayout->addWidget(button);
+ checkHashLayout->addWidget(button);
connect(button, &QPushButton::clicked, this, &SearchFullHashGui::slotCheckUrl);
- connect(mCheckUrlLineEdit, &QLineEdit::returnPressed, this, &SearchFullHashGui::slotCheckUrl);
+ connect(mCheckHashLineEdit, &QLineEdit::returnPressed, this, &SearchFullHashGui::slotCheckUrl);
mResult = new QTextEdit(this);
mResult->setReadOnly(true);
@@ -52,7 +62,6 @@ SearchFullHashGui::SearchFullHashGui(QWidget *parent)
mJson->setReadOnly(true);
mJson->setAcceptRichText(false);
layout->addWidget(mJson);
-
}
SearchFullHashGui::~SearchFullHashGui()
@@ -62,19 +71,24 @@ SearchFullHashGui::~SearchFullHashGui()
void SearchFullHashGui::slotCheckUrl()
{
- const QString urlStr = mCheckUrlLineEdit->text().trimmed();
- if (urlStr.isEmpty()) {
+ const QString hashStr = mCheckHashLineEdit->text().trimmed();
+ if (hashStr.isEmpty()) {
return;
}
+ const QString databaseHashStr = mDataBaseHashLineEdit->text().trimmed();
+ if (databaseHashStr.isEmpty()) {
+ return;
+ }
+
mResult->clear();
-/*
- WebEngineViewer::CheckPhishingUrlJob *job = new WebEngineViewer::CheckPhishingUrlJob(this);
+ WebEngineViewer::SearchFullHashJob *job = new WebEngineViewer::SearchFullHashJob(this);
job->setUseCompactJson(false);
- connect(job, &WebEngineViewer::CheckPhishingUrlJob::result, this, &SearchFullHashGui::slotGetResult);
- connect(job, &WebEngineViewer::CheckPhishingUrlJob::debugJson, this, &SearchFullHashGui::slotJSonDebug);
- job->setUrl(QUrl::fromUserInput(urlStr));
+ connect(job, &WebEngineViewer::SearchFullHashJob::result, this, &SearchFullHashGui::slotGetResult);
+ connect(job, &WebEngineViewer::SearchFullHashJob::debugJson, this, &SearchFullHashGui::slotJSonDebug);
+ job->setDatabaseState(databaseHashStr);
+ job->setSearchHash(hashStr.toLatin1());
+
job->start();
- */
}
void SearchFullHashGui::slotJSonDebug(const QByteArray &debug)
diff --git a/webengineviewer/src/checkphishingurl/tests/searchfullhashgui.h b/webengineviewer/src/checkphishingurl/tests/searchfullhashgui.h
index 45d420e..ae3278a 100644
--- a/webengineviewer/src/checkphishingurl/tests/searchfullhashgui.h
+++ b/webengineviewer/src/checkphishingurl/tests/searchfullhashgui.h
@@ -35,7 +35,8 @@ private Q_SLOTS:
void slotGetResult(WebEngineViewer::SearchFullHashJob::UrlStatus result);
void slotJSonDebug(const QByteArray &debug);
private:
- QLineEdit *mCheckUrlLineEdit;
+ QLineEdit *mCheckHashLineEdit;
+ QLineEdit *mDataBaseHashLineEdit;
QTextEdit *mJson;
QTextEdit *mResult;
};