Messagelib

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

KDE's Doxygen guidelines are available online.