Messagelib

mailwebengineview.h
1 /*
2  SPDX-FileCopyrightText: 2016-2021 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 #include "messageviewer_export.h"
9 #include <WebEngineViewer/BlockTrackingUrlInterceptor>
10 #include <WebEngineViewer/WebEngineView>
11 #include <boost/function.hpp>
12 class QPrinter;
13 class KActionCollection;
14 namespace WebEngineViewer
15 {
16 class WebHitTestResult;
17 }
18 namespace MessageViewer
19 {
20 class ViewerPrivate;
21 class MailWebEngineViewPrivate;
22 /**
23  * @brief The MailWebEngineView class
24  * @author Laurent Montel <[email protected]>
25  */
26 class MESSAGEVIEWER_EXPORT MailWebEngineView : public WebEngineViewer::WebEngineView
27 {
28  Q_OBJECT
29 public:
30  explicit MailWebEngineView(KActionCollection *ac, QWidget *parent = nullptr);
31  ~MailWebEngineView() override;
32 
33  void scrollUp(int pixels);
34  void scrollDown(int pixels);
35 
36  void selectAll();
37  void scamCheck();
38 
39  void saveMainFrameScreenshotInFile(const QString &filename);
40  void showAccessKeys();
41  void hideAccessKeys();
42  void isScrolledToBottom();
43 
44  void setElementByIdVisible(const QString &id, bool visible);
45  void removeAttachmentMarking(const QString &id);
46  void markAttachment(const QString &id, const QString &style);
47  void scrollToAnchor(const QString &anchor);
48  void scrollPageDown(int percent);
49  void scrollPageUp(int percent);
50 
51  void scrollToRelativePosition(qreal pos);
52 
53  void setAllowExternalContent(bool b);
54 
55  Q_REQUIRED_RESULT QList<QAction *> interceptorUrlActions(const WebEngineViewer::WebHitTestResult &result) const;
56 
57  void setPrintElementBackground(bool printElementBackground);
58 
59  void setLinkHovered(const QUrl &url);
60  void setViewer(MessageViewer::ViewerPrivate *viewer);
61  Q_REQUIRED_RESULT bool execPrintPreviewPage(QPrinter *printer, int timeout);
62  void readConfig();
63 
64  static void initializeCustomScheme();
65 public Q_SLOTS:
66  void slotZoomChanged(qreal zoom);
67  void slotShowDetails();
68 
69 protected:
70  void forwardWheelEvent(QWheelEvent *event) override;
71  void forwardKeyPressEvent(QKeyEvent *event) override;
72  void forwardKeyReleaseEvent(QKeyEvent *event) override;
73  void forwardMousePressEvent(QMouseEvent *event) override;
74  void forwardMouseMoveEvent(QMouseEvent *event) override;
75  void forwardMouseReleaseEvent(QMouseEvent *event) override;
76 
77  void resizeEvent(QResizeEvent *e) override;
78 
79  void contextMenuEvent(QContextMenuEvent *e) override;
80 Q_SIGNALS:
81  void wheelZoomChanged(int numSteps);
82  void openUrl(const QUrl &url);
83  void urlBlocked(const QUrl &url);
84  void messageMayBeAScam();
85  void formSubmittedForbidden();
86  /// Emitted when the user right-clicks somewhere
87  void popupMenu(const WebEngineViewer::WebHitTestResult &result);
88  void pageIsScrolledToBottom(bool);
89 
90 private Q_SLOTS:
91  void handleScrollToAnchor(const QVariant &result);
92  void handleIsScrolledToBottom(const QVariant &result);
93 
94  void slotWebHitFinished(const WebEngineViewer::WebHitTestResult &result);
95  void slotLoadFinished();
96 
97 private:
98  void runJavaScriptInWordId(const QString &script);
99  std::unique_ptr<MailWebEngineViewPrivate> const d;
100 };
101 }
102 
The WebHitTestResult class.
The MailWebEngineView class.
The WebEngineView class.
Definition: webengineview.h:23
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Dec 5 2021 23:04:54 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.