File indexing completed on 2024-04-21 04:58:11
0001 /* 0002 SPDX-FileCopyrightText: 2001 Joseph Wenninger <jowenn@kde.org> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef KONQSIDEBARPART_H 0007 #define KONQSIDEBARPART_H 0008 0009 #include <kparts_version.h> 0010 #include <kparts/part.h> 0011 #include "kf5compat.h" //For NavigationExtension 0012 #include <QPointer> 0013 #include "sidebar_widget.h" 0014 0015 class KonqSidebarPart; 0016 0017 class KonqSidebarNavigationExtension : public KParts::NavigationExtension 0018 { 0019 Q_OBJECT 0020 public: 0021 KonqSidebarNavigationExtension(KonqSidebarPart *part, Sidebar_Widget *widget); 0022 ~KonqSidebarNavigationExtension() override {} 0023 0024 protected: 0025 QPointer<Sidebar_Widget> widget; 0026 0027 // The following slots are needed for konqueror's standard actions 0028 // They are called from the RMB popup menu 0029 protected Q_SLOTS: 0030 void copy() 0031 { 0032 if (widget) { 0033 widget->stdAction("copy"); 0034 } 0035 } 0036 void cut() 0037 { 0038 if (widget) { 0039 widget->stdAction("cut"); 0040 } 0041 } 0042 void paste() 0043 { 0044 if (widget) { 0045 widget->stdAction("paste"); 0046 } 0047 } 0048 void pasteTo(const QUrl &) 0049 { 0050 if (widget) { 0051 widget->stdAction("pasteToSelection"); 0052 } 0053 } 0054 }; 0055 0056 /** 0057 * This is a "Part". It that does all the real work in a KPart 0058 * application. 0059 * 0060 * @short Main Part 0061 * @author Joseph WENNINGER <jowenn@kde.org> 0062 * @version 0.1 0063 */ 0064 class KonqSidebarPart : public KParts::ReadOnlyPart 0065 { 0066 Q_OBJECT 0067 public: 0068 /** 0069 * Default constructor 0070 */ 0071 KonqSidebarPart(QWidget *parentWidget, QObject *parent, const KPluginMetaData& metaData, const QVariantList &); 0072 0073 /** 0074 * Destructor 0075 */ 0076 ~KonqSidebarPart() override; 0077 0078 bool openUrl(const QUrl &url) override; 0079 0080 protected: 0081 /** 0082 * This must be implemented by each part 0083 */ 0084 KonqSidebarNavigationExtension *m_extension; 0085 bool openFile() override; 0086 0087 void customEvent(QEvent *ev) override; 0088 0089 private: 0090 Sidebar_Widget *m_widget; 0091 }; 0092 0093 #endif // KONQSIDEBARPART_H