summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-31 06:48:24 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-31 06:48:24 (GMT)
commitb4f47b8d56348c31f3ddae959e768afbbb9686f0 (patch)
tree0af84f7b6484a390c035c771c666e600b18291f6
parentace882f213f3319fb66891124664741454a4df30 (diff)
Add code to check url
-rw-r--r--messageviewer/src/viewer/viewer_p.cpp22
-rw-r--r--messageviewer/src/viewer/viewer_p.h2
2 files changed, 24 insertions, 0 deletions
diff --git a/messageviewer/src/viewer/viewer_p.cpp b/messageviewer/src/viewer/viewer_p.cpp
index c2ec25a..5031d0d 100644
--- a/messageviewer/src/viewer/viewer_p.cpp
+++ b/messageviewer/src/viewer/viewer_p.cpp
@@ -1988,11 +1988,33 @@ void ViewerPrivate::slotUrlOpen(const QUrl &url)
if (URLHandlerManager::instance()->handleClick(mClickedUrl, this)) {
return;
}
+#if 0
//TODO add check url
+ MessageViewer::CheckPhishingUrlJob *job = new MessageViewer::CheckPhishingUrlJob(this);
+ connect(job, &CheckPhishingUrlJob::result, this, &ViewerPrivate::slotCheckUrl);
+ job->setUrl(mClickedUrl);
+ job->start();
+#endif
Q_EMIT urlClicked(mMessageItem, mClickedUrl);
}
+void ViewerPrivate::slotCheckUrl(MessageViewer::CheckPhishingUrlJob::UrlStatus status)
+{
+ switch(status)
+ {
+ case MessageViewer::CheckPhishingUrlJob::Ok:
+ break;
+ case MessageViewer::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:
+ break;
+ }
+}
+
void ViewerPrivate::slotUrlOn(const QString &link)
{
// The "link" we get here is not URL-encoded, and therefore there is no way QUrl could
diff --git a/messageviewer/src/viewer/viewer_p.h b/messageviewer/src/viewer/viewer_p.h
index 5880f77..f78eb23 100644
--- a/messageviewer/src/viewer/viewer_p.h
+++ b/messageviewer/src/viewer/viewer_p.h
@@ -26,6 +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 <AkonadiCore/item.h>
#include <AkonadiCore/monitor.h>
@@ -473,6 +474,7 @@ private Q_SLOTS:
void slotHandlePagePrinted(bool result);
void slotLoadStarted();
void slotDisableEmoticon();
+ void slotCheckUrl(MessageViewer::CheckPhishingUrlJob::UrlStatus status);
public Q_SLOTS:
/** An URL has been activate with a click. */
void slotUrlOpen(const QUrl &url = QUrl());