File indexing completed on 2024-03-24 05:55:51
0001 /* 0002 SPDX-FileCopyrightText: 2017, 2020 Friedrich W. H. Kossebau <kossebau@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.1-or-later 0005 */ 0006 0007 #ifndef MARKDOWNBROWSEREXTENSION_HPP 0008 #define MARKDOWNBROWSEREXTENSION_HPP 0009 0010 // Qt 0011 #include <QPoint> 0012 0013 // KF 0014 #include <kparts_version.h> 0015 0016 #include <KParts/NavigationExtension> 0017 0018 class MarkdownPart; 0019 class KActionCollection; 0020 0021 0022 class MarkdownBrowserExtension : public KParts::NavigationExtension 0023 { 0024 Q_OBJECT 0025 0026 public: 0027 explicit MarkdownBrowserExtension(MarkdownPart* part); 0028 0029 public: // KParts::BrowserExtension API 0030 int xOffset() override; 0031 int yOffset() override; 0032 0033 public Q_SLOTS: 0034 void copy(); 0035 0036 void updateCopyAction(bool enabled); 0037 void requestOpenUrl(const QUrl& url); 0038 void requestOpenUrlNewWindow(const QUrl& url); 0039 void requestContextMenu(QPoint globalPos, 0040 const QUrl& linkUrl, 0041 bool hasSelection); 0042 0043 private: 0044 MarkdownPart* m_part; 0045 // needed to memory manage the context menu actions 0046 KActionCollection* m_contextMenuActionCollection; 0047 }; 0048 0049 #endif