summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-04 07:55:36 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-04 07:55:36 (GMT)
commitc4348722ce821da1fae53cf7397439f380194126 (patch)
treeda589a75f84157d3aa142a2fb7dde64680c2eeea
parent706d59208f68bf3656398f8838ae63270e81faaa (diff)
Add more informations
-rw-r--r--CMakeLists.txt2
-rw-r--r--messageviewer/src/viewer/viewer_p.cpp7
-rw-r--r--webengineviewer/src/checkphishingurl/checkphishingurljob.cpp12
-rw-r--r--webengineviewer/src/checkphishingurl/checkphishingurljob.h2
4 files changed, 15 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e3485b..0137c82 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
-set(PIM_VERSION "5.3.79")
+set(PIM_VERSION "5.3.80")
set(MESSAGELIB_LIB_VERSION ${PIM_VERSION})
set(AKONADIMIME_LIB_VERSION "5.3.40")
diff --git a/messageviewer/src/viewer/viewer_p.cpp b/messageviewer/src/viewer/viewer_p.cpp
index 5fcd3d7..3d9c67c 100644
--- a/messageviewer/src/viewer/viewer_p.cpp
+++ b/messageviewer/src/viewer/viewer_p.cpp
@@ -2010,6 +2010,12 @@ void ViewerPrivate::slotUrlOpen(const QUrl &url)
void ViewerPrivate::slotCheckUrl(WebEngineViewer::CheckPhishingUrlJob::UrlStatus status, const QUrl &url)
{
switch (status) {
+ case WebEngineViewer::CheckPhishingUrlJob::BrokenNetwork:
+ KMessageBox::error(mMainWindow, i18n("The network is broken."), i18n("Check Phishing Url"));
+ break;
+ case WebEngineViewer::CheckPhishingUrlJob::InvalidUrl:
+ KMessageBox::error(mMainWindow, i18n("The url %1 is not valid.", url.toString()), i18n("Check Phishing Url"));
+ break;
case WebEngineViewer::CheckPhishingUrlJob::Ok:
break;
case WebEngineViewer::CheckPhishingUrlJob::MalWare:
@@ -2018,6 +2024,7 @@ void ViewerPrivate::slotCheckUrl(WebEngineViewer::CheckPhishingUrlJob::UrlStatus
}
break;
case WebEngineViewer::CheckPhishingUrlJob::Unknown:
+ qCWarning(MESSAGEVIEWER_LOG) << "WebEngineViewer::CheckPhishingUrlJob unknown error ";
break;
}
//TODO fix me.
diff --git a/webengineviewer/src/checkphishingurl/checkphishingurljob.cpp b/webengineviewer/src/checkphishingurl/checkphishingurljob.cpp
index 826c509..3b3d2d1 100644
--- a/webengineviewer/src/checkphishingurl/checkphishingurljob.cpp
+++ b/webengineviewer/src/checkphishingurl/checkphishingurljob.cpp
@@ -50,7 +50,10 @@ void CheckPhishingUrlJob::setUrl(const QUrl &url)
void CheckPhishingUrlJob::start()
{
- if (canStart()) {
+ if (!PimCommon::NetworkManager::self()->networkConfigureManager()->isOnline()) {
+ Q_EMIT result(WebEngineViewer::CheckPhishingUrlJob::BrokenNetwork, mUrl);
+ deleteLater();
+ } else if (canStart()) {
const QString postRequest = createPostRequest();
if (postRequest.isEmpty()) {
Q_EMIT result(WebEngineViewer::CheckPhishingUrlJob::Unknown, mUrl);
@@ -67,7 +70,7 @@ void CheckPhishingUrlJob::start()
connect(reply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), this, &CheckPhishingUrlJob::slotError);
}
} else {
- Q_EMIT result(WebEngineViewer::CheckPhishingUrlJob::Unknown, mUrl);
+ Q_EMIT result(WebEngineViewer::CheckPhishingUrlJob::InvalidUrl, mUrl);
deleteLater();
}
}
@@ -82,11 +85,6 @@ void CheckPhishingUrlJob::slotError(QNetworkReply::NetworkError error)
bool CheckPhishingUrlJob::canStart() const
{
- if (!PimCommon::NetworkManager::self()->networkConfigureManager()->isOnline()) {
- //TODO it's not online !
- return false;
- }
-
return mUrl.isValid();
}
diff --git a/webengineviewer/src/checkphishingurl/checkphishingurljob.h b/webengineviewer/src/checkphishingurl/checkphishingurljob.h
index 3c830a1..c7bc649 100644
--- a/webengineviewer/src/checkphishingurl/checkphishingurljob.h
+++ b/webengineviewer/src/checkphishingurl/checkphishingurljob.h
@@ -38,6 +38,8 @@ public:
enum UrlStatus {
Ok = 0,
MalWare,
+ BrokenNetwork,
+ InvalidUrl,
Unknown
};