summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-26 11:20:24 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-26 11:20:24 (GMT)
commit660f74b66051bbe1c540d39155a7e7e1ae638053 (patch)
tree5d3c4b5bb0b1f6dcafcae9d370b4129a42c8a1f6
parent550ef410cd9f1f53b6367e31d78b371b13bc116b (diff)
Forbidd to submit form
-rw-r--r--messageviewer/src/viewer/viewer_p.cpp6
-rw-r--r--messageviewer/src/viewer/viewer_p.h1
-rw-r--r--messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp3
-rw-r--r--messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.h2
-rw-r--r--messageviewer/src/viewer/webengine/mailwebengineview.cpp5
-rw-r--r--messageviewer/src/viewer/webengine/mailwebengineview.h1
6 files changed, 16 insertions, 2 deletions
diff --git a/messageviewer/src/viewer/viewer_p.cpp b/messageviewer/src/viewer/viewer_p.cpp
index 4213a75..4a6fe1f 100644
--- a/messageviewer/src/viewer/viewer_p.cpp
+++ b/messageviewer/src/viewer/viewer_p.cpp
@@ -1076,6 +1076,7 @@ void ViewerPrivate::initHtmlWidget()
connect(mViewer, &MailWebEngineView::wheelZoomChanged,
this, &ViewerPrivate::slotWheelZoomChanged);
connect(mViewer, &MailWebEngineView::messageMayBeAScam, this, &ViewerPrivate::slotMessageMayBeAScam);
+ connect(mViewer, &MailWebEngineView::formSubmittedForbidden, this, &ViewerPrivate::slotFormSubmittedForbidden);
connect(mScamDetectionWarning, &ScamDetectionWarningWidget::showDetails, mViewer, &MailWebEngineView::slotShowDetails);
connect(mScamDetectionWarning, &ScamDetectionWarningWidget::moveMessageToTrash, this, &ViewerPrivate::moveMessageToTrash);
connect(mScamDetectionWarning, &ScamDetectionWarningWidget::messageIsNotAScam, this, &ViewerPrivate::slotMessageIsNotAScam);
@@ -3007,6 +3008,11 @@ void ViewerPrivate::slotAddToWhiteList()
}
}
+void ViewerPrivate::slotFormSubmittedForbidden()
+{
+ //TODO
+}
+
void ViewerPrivate::addHelpTextAction(QAction *act, const QString &text)
{
act->setStatusTip(text);
diff --git a/messageviewer/src/viewer/viewer_p.h b/messageviewer/src/viewer/viewer_p.h
index 29b3eb2..bc9c277 100644
--- a/messageviewer/src/viewer/viewer_p.h
+++ b/messageviewer/src/viewer/viewer_p.h
@@ -431,6 +431,7 @@ private Q_SLOTS:
void slotMessageMayBeAScam();
void slotMessageIsNotAScam();
void slotAddToWhiteList();
+ void slotFormSubmittedForbidden();
/** Show hide all fields specified inside this function */
void toggleFullAddressList();
diff --git a/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp b/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp
index 08c0387..f94617a 100644
--- a/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp
+++ b/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp
@@ -51,7 +51,8 @@ bool BlockExternalResourcesUrlInterceptor::interceptRequest(QWebEngineUrlRequest
) {
return true;
} else if (info.navigationType() == QWebEngineUrlRequestInfo::NavigationTypeFormSubmitted) {
-
+ Q_EMIT formSubmittedForbidden();
+ return true;
}
return false;
}
diff --git a/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.h b/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.h
index f8e7ef5..c33217c 100644
--- a/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.h
+++ b/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.h
@@ -33,6 +33,8 @@ public:
bool interceptRequest(QWebEngineUrlRequestInfo &info) Q_DECL_OVERRIDE;
void setAllowExternalContent(bool b);
bool allowExternalContent() const;
+Q_SIGNALS:
+ void formSubmittedForbidden();
};
}
#endif // BLOCKEXTERNALRESOURCESURLINTERCEPTOR_H
diff --git a/messageviewer/src/viewer/webengine/mailwebengineview.cpp b/messageviewer/src/viewer/webengine/mailwebengineview.cpp
index 7673e84..a9054c1 100644
--- a/messageviewer/src/viewer/webengine/mailwebengineview.cpp
+++ b/messageviewer/src/viewer/webengine/mailwebengineview.cpp
@@ -96,7 +96,10 @@ MailWebEngineView::MailWebEngineView(KActionCollection *ac, QWidget *parent)
d->mNetworkAccessManager->addInterceptor(d->mExternalReference);
MessageViewer::CidReferencesUrlInterceptor *cidReference = new MessageViewer::CidReferencesUrlInterceptor(this);
d->mNetworkAccessManager->addInterceptor(cidReference);
- d->mNetworkAccessManager->addInterceptor(new MessageViewer::BlockExternalResourcesUrlInterceptor(this));
+ MessageViewer::BlockExternalResourcesUrlInterceptor *blockExternalUrl = new MessageViewer::BlockExternalResourcesUrlInterceptor(this);
+ connect(blockExternalUrl, &BlockExternalResourcesUrlInterceptor::formSubmittedForbidden, this, &MailWebEngineView::formSubmittedForbidden);
+
+ d->mNetworkAccessManager->addInterceptor(blockExternalUrl);
setFocusPolicy(Qt::WheelFocus);
connect(d->mPageEngine, &MailWebEnginePage::urlClicked, this, &MailWebEngineView::openUrl);
#if QT_VERSION >= 0x050700
diff --git a/messageviewer/src/viewer/webengine/mailwebengineview.h b/messageviewer/src/viewer/webengine/mailwebengineview.h
index 790f707..07f5cdc 100644
--- a/messageviewer/src/viewer/webengine/mailwebengineview.h
+++ b/messageviewer/src/viewer/webengine/mailwebengineview.h
@@ -93,6 +93,7 @@ Q_SIGNALS:
void wheelZoomChanged(int numSteps);
void openUrl(const QUrl &url);
void messageMayBeAScam();
+ void formSubmittedForbidden();
/// Emitted when the user right-clicks somewhere
/// @param url if an URL was under the cursor, this parameter contains it. Otherwise empty
/// @param point position where the click happened, in local coordinates