summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-02 07:42:34 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-02 07:42:34 (GMT)
commit84625acd5a45fb73c785c1ca9cc564a2616f4e34 (patch)
tree28ac1e6a41eeb78b2a12b72a38b4d6d7c3336e2c
parent260110ecbd92f98a5561ed21f9387cd8621ab24d (diff)
Move in webengineviewer so we can use it in akregator too
-rw-r--r--messageviewer/src/CMakeLists.txt7
-rw-r--r--messageviewer/src/viewer/viewer_p.cpp10
-rw-r--r--messageviewer/src/viewer/viewer_p.h4
-rw-r--r--webengineviewer/src/CMakeLists.txt16
-rw-r--r--webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt (renamed from messageviewer/src/checkphishingurl/autotests/CMakeLists.txt)0
-rw-r--r--webengineviewer/src/checkphishingurl/autotests/checkphishingurljobtest.cpp (renamed from messageviewer/src/checkphishingurl/autotests/checkphishingurljobtest.cpp)2
-rw-r--r--webengineviewer/src/checkphishingurl/autotests/checkphishingurljobtest.h (renamed from messageviewer/src/checkphishingurl/autotests/checkphishingurljobtest.h)0
-rw-r--r--webengineviewer/src/checkphishingurl/checkphishingurljob.cpp (renamed from messageviewer/src/checkphishingurl/checkphishingurljob.cpp)6
-rw-r--r--webengineviewer/src/checkphishingurl/checkphishingurljob.h (renamed from messageviewer/src/checkphishingurl/checkphishingurljob.h)8
-rw-r--r--webengineviewer/src/checkphishingurl/tests/CMakeLists.txt (renamed from messageviewer/src/checkphishingurl/tests/CMakeLists.txt)2
-rw-r--r--webengineviewer/src/checkphishingurl/tests/checkphishingurlgui.cpp (renamed from messageviewer/src/checkphishingurl/tests/checkphishingurlgui.cpp)12
-rw-r--r--webengineviewer/src/checkphishingurl/tests/checkphishingurlgui.h (renamed from messageviewer/src/checkphishingurl/tests/checkphishingurlgui.h)2
12 files changed, 39 insertions, 30 deletions
diff --git a/messageviewer/src/CMakeLists.txt b/messageviewer/src/CMakeLists.txt
index e6d1521..13b5891 100644
--- a/messageviewer/src/CMakeLists.txt
+++ b/messageviewer/src/CMakeLists.txt
@@ -36,8 +36,6 @@ if(BUILD_TESTING)
add_subdirectory(viewer/webengine/tests)
add_subdirectory(messagepartthemes/default/autotests)
add_subdirectory(viewer/webengine/autotests/)
- add_subdirectory(checkphishingurl/autotests/)
- add_subdirectory(checkphishingurl/tests/)
endif()
add_subdirectory(pics)
add_subdirectory(kconf_update)
@@ -119,10 +117,6 @@ set(libmessageviewer_scamdetection_webengine_SRCS
scamdetection/scamdetectionwebengine.cpp
)
-set(libmessageviewer_checkphishingurl_SRCS
- checkphishingurl/checkphishingurljob.cpp
- )
-
set(libmessageviewer_findbar_SRCS
findbar/findbarsourceview.cpp
)
@@ -168,7 +162,6 @@ set(libmessageviewer_messagepartthemes_default_SRCS
)
set(libmessageviewer_SRCS
- ${libmessageviewer_checkphishingurl_SRCS}
${libmessageviewer_messagepartthemes_default_SRCS}
${libmessageviewer_htmlwriter_webengine_SRCS}
${libmessageviewer_messagepartthemes_SRCS}
diff --git a/messageviewer/src/viewer/viewer_p.cpp b/messageviewer/src/viewer/viewer_p.cpp
index e9df1be..5526617 100644
--- a/messageviewer/src/viewer/viewer_p.cpp
+++ b/messageviewer/src/viewer/viewer_p.cpp
@@ -1990,7 +1990,7 @@ void ViewerPrivate::slotUrlOpen(const QUrl &url)
}
#if 0
//TODO add check url
- MessageViewer::CheckPhishingUrlJob *job = new MessageViewer::CheckPhishingUrlJob(this);
+ WebEngineViewer::CheckPhishingUrlJob *job = new WebEngineViewer::CheckPhishingUrlJob(this);
connect(job, &CheckPhishingUrlJob::result, this, &ViewerPrivate::slotCheckUrl);
job->setUrl(mClickedUrl);
job->start();
@@ -1999,17 +1999,17 @@ void ViewerPrivate::slotUrlOpen(const QUrl &url)
Q_EMIT urlClicked(mMessageItem, mClickedUrl);
}
-void ViewerPrivate::slotCheckUrl(MessageViewer::CheckPhishingUrlJob::UrlStatus status)
+void ViewerPrivate::slotCheckUrl(WebEngineViewer::CheckPhishingUrlJob::UrlStatus status)
{
switch (status) {
- case MessageViewer::CheckPhishingUrlJob::Ok:
+ case WebEngineViewer::CheckPhishingUrlJob::Ok:
break;
- case MessageViewer::CheckPhishingUrlJob::MalWare:
+ case WebEngineViewer::CheckPhishingUrlJob::MalWare:
if (KMessageBox::No == KMessageBox::warningYesNo(mMainWindow, i18n("This web site is a malware, do you want to continue to show it?"), i18n("Malware"))) {
return;
}
break;
- case MessageViewer::CheckPhishingUrlJob::Unknown:
+ case WebEngineViewer::CheckPhishingUrlJob::Unknown:
break;
}
}
diff --git a/messageviewer/src/viewer/viewer_p.h b/messageviewer/src/viewer/viewer_p.h
index f78eb23..228645b 100644
--- a/messageviewer/src/viewer/viewer_p.h
+++ b/messageviewer/src/viewer/viewer_p.h
@@ -26,7 +26,7 @@
#include "viewer.h" //not so nice, it is actually for the enums from MailViewer
#include "PimCommon/ShareServiceUrlManager"
#include "messageviewer/viewerplugininterface.h"
-#include "checkphishingurl/checkphishingurljob.h"
+#include <WebEngineViewer/CheckPhishingUrlJob>
#include <AkonadiCore/item.h>
#include <AkonadiCore/monitor.h>
@@ -474,7 +474,7 @@ private Q_SLOTS:
void slotHandlePagePrinted(bool result);
void slotLoadStarted();
void slotDisableEmoticon();
- void slotCheckUrl(MessageViewer::CheckPhishingUrlJob::UrlStatus status);
+ void slotCheckUrl(WebEngineViewer::CheckPhishingUrlJob::UrlStatus status);
public Q_SLOTS:
/** An URL has been activate with a click. */
void slotUrlOpen(const QUrl &url = QUrl());
diff --git a/webengineviewer/src/CMakeLists.txt b/webengineviewer/src/CMakeLists.txt
index deca7d2..663c2af 100644
--- a/webengineviewer/src/CMakeLists.txt
+++ b/webengineviewer/src/CMakeLists.txt
@@ -6,6 +6,8 @@ if(BUILD_TESTING)
add_subdirectory(autotests)
add_subdirectory(webengineaccesskey/autotests)
add_subdirectory(findbar/autotests)
+ add_subdirectory(checkphishingurl/autotests/)
+ add_subdirectory(checkphishingurl/tests/)
endif()
if (Qt5WebEngineWidgets_VERSION VERSION_GREATER "5.7.99")
@@ -28,6 +30,10 @@ set(libwebengineviewer_webengine_SRCS
webenginenavigationrequestinterceptor.cpp
)
+set(libwebengineviewer_checkphishingurl_SRCS
+ checkphishingurl/checkphishingurljob.cpp
+ )
+
set(libwebengineviewer_interceptor_SRCS
urlinterceptor/networkurlinterceptor.cpp
urlinterceptor/networkpluginurlinterceptorinterface.cpp
@@ -53,6 +59,7 @@ set(libwebengineviewer_widgets_SRCS
)
set(libwebengineviewer_SRCS
+ ${libwebengineviewer_checkphishingurl_SRCS}
${libwebengineviewer_interceptor_SRCS}
${libwebengineviewer_webengine_SRCS}
${libwebengineviewer_findbar_SRCS}
@@ -133,6 +140,13 @@ ecm_generate_headers(WebEngineViewer_Camelcasewebengine_manager_HEADERS
PREFIX WebEngineViewer
RELATIVE networkmanager
)
+ecm_generate_headers(WebEngineViewer_Camelcasewebengine_checkurl_HEADERS
+ HEADER_NAMES
+ CheckPhishingUrlJob
+ REQUIRED_HEADERS WebEngineViewer_webengine_checkurl_HEADERS
+ PREFIX WebEngineViewer
+ RELATIVE checkphishingurl
+ )
ecm_generate_headers(WebEngineViewer_Camelcasewebengine_misc_HEADERS
HEADER_NAMES
WebHitTestResult
@@ -165,6 +179,7 @@ ecm_generate_pri_file(BASE_NAME WebEngineViewer
install(FILES
+ ${WebEngineViewer_Camelcasewebengine_checkurl_HEADERS}
${WebEngineViewer_Camelcasewebengine_accesskey_HEADERS}
${WebEngineViewer_Camelcasewebengine_urlinterceptor_HEADERS}
${WebEngineViewer_Camelcasewebengine_manager_HEADERS}
@@ -177,6 +192,7 @@ install(FILES
)
install(FILES
+ ${WebEngineViewer_webengine_checkurl_HEADERS}
${WebEngineViewer_webengine_accesskey_HEADERS}
${WebEngineViewer_findbar_HEADERS}
${WebEngineViewer_webengine_urlinterceptor_HEADERS}
diff --git a/messageviewer/src/checkphishingurl/autotests/CMakeLists.txt b/webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt
index 2f88486..2f88486 100644
--- a/messageviewer/src/checkphishingurl/autotests/CMakeLists.txt
+++ b/webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt
diff --git a/messageviewer/src/checkphishingurl/autotests/checkphishingurljobtest.cpp b/webengineviewer/src/checkphishingurl/autotests/checkphishingurljobtest.cpp
index 432f165..60e3b10 100644
--- a/messageviewer/src/checkphishingurl/autotests/checkphishingurljobtest.cpp
+++ b/webengineviewer/src/checkphishingurl/autotests/checkphishingurljobtest.cpp
@@ -35,7 +35,7 @@ CheckPhishingUrlJobTest::~CheckPhishingUrlJobTest()
void CheckPhishingUrlJobTest::shouldNotBeAbleToStartWithEmptyUrl()
{
- MessageViewer::CheckPhishingUrlJob job;
+ WebEngineViewer::CheckPhishingUrlJob job;
QVERIFY(!job.canStart());
}
diff --git a/messageviewer/src/checkphishingurl/autotests/checkphishingurljobtest.h b/webengineviewer/src/checkphishingurl/autotests/checkphishingurljobtest.h
index 61fd206..61fd206 100644
--- a/messageviewer/src/checkphishingurl/autotests/checkphishingurljobtest.h
+++ b/webengineviewer/src/checkphishingurl/autotests/checkphishingurljobtest.h
diff --git a/messageviewer/src/checkphishingurl/checkphishingurljob.cpp b/webengineviewer/src/checkphishingurl/checkphishingurljob.cpp
index 8dbdf4c..4a9a3ae 100644
--- a/messageviewer/src/checkphishingurl/checkphishingurljob.cpp
+++ b/webengineviewer/src/checkphishingurl/checkphishingurljob.cpp
@@ -22,7 +22,7 @@
#include <QNetworkConfigurationManager>
#include <QNetworkReply>
-using namespace MessageViewer;
+using namespace WebEngineViewer;
CheckPhishingUrlJob::CheckPhishingUrlJob(QObject *parent)
: QObject(parent)
@@ -54,7 +54,7 @@ void CheckPhishingUrlJob::start()
if (canStart()) {
const QString postRequest = createPostRequest();
if (postRequest.isEmpty()) {
- Q_EMIT result(MessageViewer::CheckPhishingUrlJob::Unknown);
+ Q_EMIT result(WebEngineViewer::CheckPhishingUrlJob::Unknown);
deleteLater();
} else {
QNetworkRequest request(QUrl(QStringLiteral("https://safebrowsing.googleapis.com/v4/threatMatches:find")));
@@ -68,7 +68,7 @@ void CheckPhishingUrlJob::start()
connect(reply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), this, &CheckPhishingUrlJob::slotError);
}
} else {
- Q_EMIT result(MessageViewer::CheckPhishingUrlJob::Unknown);
+ Q_EMIT result(WebEngineViewer::CheckPhishingUrlJob::Unknown);
deleteLater();
}
}
diff --git a/messageviewer/src/checkphishingurl/checkphishingurljob.h b/webengineviewer/src/checkphishingurl/checkphishingurljob.h
index 0fbc0cb..14ab273 100644
--- a/messageviewer/src/checkphishingurl/checkphishingurljob.h
+++ b/webengineviewer/src/checkphishingurl/checkphishingurljob.h
@@ -23,13 +23,13 @@
#include <QObject>
#include <QUrl>
#include <QNetworkReply>
-#include "messageviewer_export.h"
+#include "webengineviewer_export.h"
class QNetworkAccessManager;
class QNetworkConfigurationManager;
-namespace MessageViewer
+namespace WebEngineViewer
{
/* https://developers.google.com/safe-browsing/v4/lookup-api */
-class MESSAGEVIEWER_EXPORT CheckPhishingUrlJob : public QObject
+class WEBENGINEVIEWER_EXPORT CheckPhishingUrlJob : public QObject
{
Q_OBJECT
public:
@@ -49,7 +49,7 @@ public:
QString createPostRequest();
Q_SIGNALS:
- void result(MessageViewer::CheckPhishingUrlJob::UrlStatus status);
+ void result(WebEngineViewer::CheckPhishingUrlJob::UrlStatus status);
private:
void slotError(QNetworkReply::NetworkError error);
diff --git a/messageviewer/src/checkphishingurl/tests/CMakeLists.txt b/webengineviewer/src/checkphishingurl/tests/CMakeLists.txt
index abbb4be..65dfc85 100644
--- a/messageviewer/src/checkphishingurl/tests/CMakeLists.txt
+++ b/webengineviewer/src/checkphishingurl/tests/CMakeLists.txt
@@ -8,7 +8,7 @@ set(checkphishingurlgui_SRCS checkphishingurlgui.cpp)
add_executable(checkphishingurlgui ${checkphishingurlgui_SRCS})
target_link_libraries(checkphishingurlgui
KF5::KIOCore
- KF5::MessageViewer
+ KF5::WebEngineViewer
Qt5::WebEngine
Qt5::WebEngineWidgets
KF5::I18n
diff --git a/messageviewer/src/checkphishingurl/tests/checkphishingurlgui.cpp b/webengineviewer/src/checkphishingurl/tests/checkphishingurlgui.cpp
index a093678..46080d6 100644
--- a/messageviewer/src/checkphishingurl/tests/checkphishingurlgui.cpp
+++ b/webengineviewer/src/checkphishingurl/tests/checkphishingurlgui.cpp
@@ -61,23 +61,23 @@ void CheckPhishingUrlGui::slotCheckUrl()
}
mResult->clear();
- MessageViewer::CheckPhishingUrlJob *job = new MessageViewer::CheckPhishingUrlJob(this);
- connect(job, &MessageViewer::CheckPhishingUrlJob::result, this, &CheckPhishingUrlGui::slotGetResult);
+ WebEngineViewer::CheckPhishingUrlJob *job = new WebEngineViewer::CheckPhishingUrlJob(this);
+ connect(job, &WebEngineViewer::CheckPhishingUrlJob::result, this, &CheckPhishingUrlGui::slotGetResult);
job->setUrl(QUrl(urlStr));
job->start();
}
-void CheckPhishingUrlGui::slotGetResult(MessageViewer::CheckPhishingUrlJob::UrlStatus result)
+void CheckPhishingUrlGui::slotGetResult(WebEngineViewer::CheckPhishingUrlJob::UrlStatus result)
{
QString resultStr;
switch(result) {
- case MessageViewer::CheckPhishingUrlJob::Ok:
+ case WebEngineViewer::CheckPhishingUrlJob::Ok:
resultStr = QStringLiteral("Url ok");
break;
- case MessageViewer::CheckPhishingUrlJob::MalWare:
+ case WebEngineViewer::CheckPhishingUrlJob::MalWare:
resultStr = QStringLiteral("Url MalWare");
break;
- case MessageViewer::CheckPhishingUrlJob::Unknown:
+ case WebEngineViewer::CheckPhishingUrlJob::Unknown:
resultStr = QStringLiteral("Url Unknow state");
break;
}
diff --git a/messageviewer/src/checkphishingurl/tests/checkphishingurlgui.h b/webengineviewer/src/checkphishingurl/tests/checkphishingurlgui.h
index f9c3191..936e6d9 100644
--- a/messageviewer/src/checkphishingurl/tests/checkphishingurlgui.h
+++ b/webengineviewer/src/checkphishingurl/tests/checkphishingurlgui.h
@@ -33,7 +33,7 @@ public:
~CheckPhishingUrlGui();
private Q_SLOTS:
void slotCheckUrl();
- void slotGetResult(MessageViewer::CheckPhishingUrlJob::UrlStatus result);
+ void slotGetResult(WebEngineViewer::CheckPhishingUrlJob::UrlStatus result);
private:
QLineEdit *mCheckUrlLineEdit;
QTextEdit *mResult;