summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-10 20:27:30 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-10 20:27:30 (GMT)
commitd832310a02b9263b216c45275f185984880348c5 (patch)
tree5ca7742f42699c3bab0ff1be1fc21b961db088c7
parenta20268fb6f40580d59ad367175f7548e4d4a9002 (diff)
USe cache
-rw-r--r--CMakeLists.txt2
-rw-r--r--messageviewer/src/viewer/viewer_p.cpp18
2 files changed, 14 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7c75a66..60a2d70 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,7 +21,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
-set(PIM_VERSION "5.3.81")
+set(PIM_VERSION "5.3.82")
set(MESSAGELIB_LIB_VERSION ${PIM_VERSION})
set(AKONADIMIME_LIB_VERSION "5.3.80")
diff --git a/messageviewer/src/viewer/viewer_p.cpp b/messageviewer/src/viewer/viewer_p.cpp
index 8c7f87a..e30ae0c 100644
--- a/messageviewer/src/viewer/viewer_p.cpp
+++ b/messageviewer/src/viewer/viewer_p.cpp
@@ -126,6 +126,7 @@
#include <WebEngineViewer/WebHitTestResult>
#include "header/headerstylemenumanager.h"
#include "widgets/submittedformwarningwidget.h"
+#include <WebEngineViewer/CheckPhishingUrlCache>
#include <MimeTreeParser/BodyPart>
#include <MimeTreeParser/HtmlWriter>
@@ -1973,11 +1974,16 @@ void ViewerPrivate::slotUrlOpen(const QUrl &url)
void ViewerPrivate::checkPhishingUrl()
{
if (MessageViewer::MessageViewerSettings::self()->checkPhishingUrl() && (mClickedUrl.scheme() != QLatin1String("mailto"))) {
- MessageViewer::MailCheckPhishingUrlJob *job = new MessageViewer::MailCheckPhishingUrlJob(this);
- connect(job, &MessageViewer::MailCheckPhishingUrlJob::result, this, &ViewerPrivate::slotCheckUrl);
- job->setUrl(mClickedUrl);
- job->setItem(mMessageItem);
- job->start();
+ WebEngineViewer::CheckPhishingUrlCache::UrlStatus status = WebEngineViewer::CheckPhishingUrlCache::self()->urlStatus(mClickedUrl);
+ if (status == WebEngineViewer::CheckPhishingUrlCache::UrlOk) {
+ executeRunner(mClickedUrl);
+ } else {
+ MessageViewer::MailCheckPhishingUrlJob *job = new MessageViewer::MailCheckPhishingUrlJob(this);
+ connect(job, &MessageViewer::MailCheckPhishingUrlJob::result, this, &ViewerPrivate::slotCheckUrl);
+ job->setUrl(mClickedUrl);
+ job->setItem(mMessageItem);
+ job->start();
+ }
} else {
executeRunner(mClickedUrl);
}
@@ -2002,8 +2008,10 @@ void ViewerPrivate::slotCheckUrl(WebEngineViewer::CheckPhishingUrlJob::UrlStatus
KMessageBox::error(mMainWindow, i18n("The url %1 is not valid.", url.toString()), i18n("Check Phishing Url"));
break;
case WebEngineViewer::CheckPhishingUrlJob::Ok:
+ WebEngineViewer::CheckPhishingUrlCache::self()->setCheckingUrlResult(url, WebEngineViewer::CheckPhishingUrlCache::UrlOk);
break;
case WebEngineViewer::CheckPhishingUrlJob::MalWare:
+ WebEngineViewer::CheckPhishingUrlCache::self()->setCheckingUrlResult(url, WebEngineViewer::CheckPhishingUrlCache::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;
}