File indexing completed on 2025-01-26 04:57:25

0001 /*
0002    SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "webengineviewer_export.h"
0010 #include <QWebEngineView>
0011 #include <WebEngineViewer/BlockTrackingUrlInterceptor>
0012 namespace WebEngineViewer
0013 {
0014 class WebEngineViewPrivate;
0015 class LocalDataBaseManager;
0016 
0017 /**
0018  * @brief The WebEngineView class
0019  * @author Laurent Montel <montel@kde.org>
0020  */
0021 class WEBENGINEVIEWER_EXPORT WebEngineView : public QWebEngineView
0022 {
0023     Q_OBJECT
0024 public:
0025     explicit WebEngineView(QWidget *parent = nullptr);
0026     ~WebEngineView() override;
0027 
0028     void clearRelativePosition();
0029     void saveRelativePosition();
0030     [[nodiscard]] qreal relativePosition() const;
0031 
0032     [[nodiscard]] WebEngineViewer::LocalDataBaseManager *phishingDatabase() const;
0033 
0034 Q_SIGNALS:
0035     void mailTrackingFound(const WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList &);
0036 
0037 protected:
0038     bool eventFilter(QObject *obj, QEvent *event) override;
0039     QWebEngineView *createWindow(QWebEnginePage::WebWindowType type) override;
0040 
0041     virtual void forwardWheelEvent(QWheelEvent *event);
0042     virtual void forwardKeyPressEvent(QKeyEvent *event);
0043     virtual void forwardKeyReleaseEvent(QKeyEvent *event);
0044     virtual void forwardMousePressEvent(QMouseEvent *event);
0045     virtual void forwardMouseMoveEvent(QMouseEvent *event);
0046     virtual void forwardMouseReleaseEvent(QMouseEvent *event);
0047 
0048 private:
0049     std::unique_ptr<WebEngineViewPrivate> const d;
0050 };
0051 }