Commit c4348722 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add more informations

parent 706d5920
......@@ -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")
......
......@@ -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.
......
......@@ -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();
}
......
......@@ -38,6 +38,8 @@ public:
enum UrlStatus {
Ok = 0,
MalWare,
BrokenNetwork,
InvalidUrl,
Unknown
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment