File indexing completed on 2025-01-26 04:47:11

0001 /*
0002    SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "akregator_export.h"
0010 #include <QList>
0011 #include <QObject>
0012 
0013 namespace Akregator
0014 {
0015 class URLHandlerWebEngine;
0016 class ArticleViewerWebEngine;
0017 class AKREGATOR_EXPORT URLHandlerWebEngineManager : public QObject
0018 {
0019     Q_OBJECT
0020 public:
0021     ~URLHandlerWebEngineManager() override;
0022 
0023     static URLHandlerWebEngineManager *instance();
0024     void registerHandler(const URLHandlerWebEngine *handler);
0025     void unregisterHandler(const URLHandlerWebEngine *handler);
0026 
0027     [[nodiscard]] bool handleClick(const QUrl &url, ArticleViewerWebEngine *w = nullptr) const;
0028     [[nodiscard]] bool handleContextMenuRequest(const QUrl &url, const QPoint &p, ArticleViewerWebEngine *w = nullptr) const;
0029     [[nodiscard]] QString statusBarMessage(const QUrl &url, ArticleViewerWebEngine *w = nullptr) const;
0030 
0031 private:
0032     explicit URLHandlerWebEngineManager(QObject *parent = nullptr);
0033     static URLHandlerWebEngineManager *self;
0034     using HandlerList = QList<const URLHandlerWebEngine *>;
0035     HandlerList mHandlers;
0036 };
0037 }