Messagelib

mailwebengineview.h
1/*
2 SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
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
13namespace WebEngineViewer
14{
15class WebHitTestResult;
16}
17namespace MessageViewer
18{
19class ViewerPrivate;
20class MailWebEngineViewPrivate;
21/**
22 * @brief The MailWebEngineView class
23 * @author Laurent Montel <montel@kde.org>
24 */
25class MESSAGEVIEWER_EXPORT MailWebEngineView : public WebEngineViewer::WebEngineView
26{
27 Q_OBJECT
28public:
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 [[nodiscard]] 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 void readConfig();
61
62 static void initializeCustomScheme();
63
64public Q_SLOTS:
65 void slotZoomChanged(qreal zoom);
66 void slotShowDetails();
67
68protected:
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;
79Q_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
87 void pageIsScrolledToBottom(bool);
88
89private Q_SLOTS:
90 MESSAGEVIEWER_NO_EXPORT void handleScrollToAnchor(const QVariant &result);
91 MESSAGEVIEWER_NO_EXPORT void handleIsScrolledToBottom(const QVariant &result);
92
93 MESSAGEVIEWER_NO_EXPORT void slotWebHitFinished(const WebEngineViewer::WebHitTestResult &result);
94 MESSAGEVIEWER_NO_EXPORT void slotLoadFinished();
95
96private:
97 MESSAGEVIEWER_NO_EXPORT void runJavaScriptInWordId(const QString &script);
98 std::unique_ptr<MailWebEngineViewPrivate> const d;
99};
100}
The MailWebEngineView class.
void popupMenu(const WebEngineViewer::WebHitTestResult &result)
Emitted when the user right-clicks somewhere.
The WebEngineView class.
The WebHitTestResult class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 4 2024 11:53:55 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.