summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-26 11:32:45 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-26 11:32:45 (GMT)
commit2f2ff89f2d3058c0f50225ef27b611cc5ea94315 (patch)
tree6de44de9bbc27cd59e6bd60278e0cdacf5c22ad1
parent9597ca21eb5f32d7fbac2c80efae1f2a3b381d36 (diff)
Add warning widget about submitted form
-rw-r--r--messageviewer/src/CMakeLists.txt1
-rw-r--r--messageviewer/src/viewer/viewer_p.cpp9
-rw-r--r--messageviewer/src/viewer/viewer_p.h2
-rw-r--r--messageviewer/src/widgets/submittedformwarningwidget.cpp46
-rw-r--r--messageviewer/src/widgets/submittedformwarningwidget.h43
5 files changed, 99 insertions, 2 deletions
diff --git a/messageviewer/src/CMakeLists.txt b/messageviewer/src/CMakeLists.txt
index 0971875..2ea1567 100644
--- a/messageviewer/src/CMakeLists.txt
+++ b/messageviewer/src/CMakeLists.txt
@@ -80,6 +80,7 @@ set(libmessageviewer_widgets_SRCS
widgets/invitationsettings.cpp
widgets/openattachmentfolderwidget.cpp
widgets/mailsourceviewtextbrowserwidget.cpp
+ widgets/submittedformwarningwidget.cpp
)
set(libmessageviewer_widgets_webengine_SRCS
diff --git a/messageviewer/src/viewer/viewer_p.cpp b/messageviewer/src/viewer/viewer_p.cpp
index 4a6fe1f..e87a9da 100644
--- a/messageviewer/src/viewer/viewer_p.cpp
+++ b/messageviewer/src/viewer/viewer_p.cpp
@@ -120,11 +120,11 @@
#include <WebEngineViewer/FindBarWebEngineView>
#include "viewer/webengine/mailwebengineview.h"
-#include <QWebEngineSettings>
#include "htmlwriter/webengineparthtmlwriter.h"
#include <widgets/mailsourcewebengineviewer.h>
#include <WebEngineViewer/WebHitTestResult>
#include "header/headerstylemenumanager.h"
+#include "widgets/submittedformwarningwidget.h"
#include <MimeTreeParser/BodyPart>
#include <MimeTreeParser/HtmlWriter>
@@ -142,6 +142,7 @@
#include <KJobWidgets/KJobWidgets>
#include <QApplication>
#include <QStandardPaths>
+#include <QWebEngineSettings>
#include <header/headerstyleplugin.h>
#include <viewerplugins/viewerplugininterface.h>
#include <WebEngineViewer/ZoomActionMenu>
@@ -1487,6 +1488,10 @@ void ViewerPrivate::createWidgets()
mColorBar->setObjectName(QStringLiteral("mColorBar"));
mColorBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
+ mSubmittedFormWarning = new SubmittedFormWarningWidget(readerBox);
+ mSubmittedFormWarning->setObjectName(QStringLiteral("submittedformwarning"));
+ readerBoxVBoxLayout->addWidget(mSubmittedFormWarning);
+
mScamDetectionWarning = new ScamDetectionWarningWidget(readerBox);
mScamDetectionWarning->setObjectName(QStringLiteral("scandetectionwarning"));
readerBoxVBoxLayout->addWidget(mScamDetectionWarning);
@@ -3010,7 +3015,7 @@ void ViewerPrivate::slotAddToWhiteList()
void ViewerPrivate::slotFormSubmittedForbidden()
{
- //TODO
+ mSubmittedFormWarning->slotShowWarning();
}
void ViewerPrivate::addHelpTextAction(QAction *act, const QString &text)
diff --git a/messageviewer/src/viewer/viewer_p.h b/messageviewer/src/viewer/viewer_p.h
index bc9c277..452edd7 100644
--- a/messageviewer/src/viewer/viewer_p.h
+++ b/messageviewer/src/viewer/viewer_p.h
@@ -91,6 +91,7 @@ class OpenAttachmentFolderWidget;
class HeaderStyleMenuManager;
class ViewerPluginToolManager;
class ViewerPluginInterface;
+class SubmittedFormWarningWidget;
/**
\brief Private class for the Viewer, the main widget in the messageviewer library.
@@ -670,6 +671,7 @@ public:
MessageViewer::ScamDetectionWarningWidget *mScamDetectionWarning;
MessageViewer::OpenAttachmentFolderWidget *mOpenAttachmentFolderWidget;
+ MessageViewer::SubmittedFormWarningWidget *mSubmittedFormWarning;
KPIMTextEdit::TextToSpeechWidget *mTextToSpeechWidget;
Viewer::DisplayFormatMessage mDisplayFormatMessageOverwrite;
KPIMTextEdit::SlideContainer *mSliderContainer;
diff --git a/messageviewer/src/widgets/submittedformwarningwidget.cpp b/messageviewer/src/widgets/submittedformwarningwidget.cpp
new file mode 100644
index 0000000..e223cb3
--- /dev/null
+++ b/messageviewer/src/widgets/submittedformwarningwidget.cpp
@@ -0,0 +1,46 @@
+/*
+ Copyright (c) 2016 Montel Laurent <montel@kde.org>
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ This library is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+ License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+*/
+
+#include "submittedformwarningwidget.h"
+
+#include <KLocalizedString>
+#include <QAction>
+
+using namespace MessageViewer;
+
+
+SubmittedFormWarningWidget::SubmittedFormWarningWidget(QWidget *parent)
+ : KMessageWidget(parent)
+{
+ setVisible(false);
+ setCloseButtonVisible(true);
+ setMessageType(Warning);
+ setWordWrap(true);
+ setText(i18n("Submit form is not allowed in mailer. Please open url in a browser."));
+}
+
+SubmittedFormWarningWidget::~SubmittedFormWarningWidget()
+{
+}
+
+void SubmittedFormWarningWidget::slotShowWarning()
+{
+ animatedShow();
+}
diff --git a/messageviewer/src/widgets/submittedformwarningwidget.h b/messageviewer/src/widgets/submittedformwarningwidget.h
new file mode 100644
index 0000000..39d3e19
--- /dev/null
+++ b/messageviewer/src/widgets/submittedformwarningwidget.h
@@ -0,0 +1,43 @@
+/*
+ Copyright (c) 2016 Montel Laurent <montel@kde.org>
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ This library is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+ License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+*/
+
+#ifndef SUBMITTEDFORMWARNINGWIDGET_H
+#define SUBMITTEDFORMWARNINGWIDGET_H
+
+#include "messageviewer_export.h"
+
+#include <KMessageWidget>
+
+namespace MessageViewer
+{
+class SubmittedFormWarningWidgetPrivate;
+class MESSAGEVIEWER_EXPORT SubmittedFormWarningWidget : public KMessageWidget
+{
+ Q_OBJECT
+public:
+ explicit SubmittedFormWarningWidget(QWidget *parent = Q_NULLPTR);
+ ~SubmittedFormWarningWidget();
+
+public Q_SLOTS:
+ void slotShowWarning();
+};
+}
+
+#endif // SUBMITTEDFORMWARNINGWIDGET_H