File indexing completed on 2024-05-12 03:46:59
0001 /* 0002 SPDX-License-Identifier: GPL-2.0-or-later 0003 0004 SPDX-FileCopyrightText: 2010 Alexander Rieder <alexanderrieder@gmail.com> 0005 */ 0006 0007 #ifndef _PANEL_PLUGIN_H 0008 #define _PANEL_PLUGIN_H 0009 0010 #include <KXMLGUIClient> 0011 #include <QObject> 0012 #include <KService/KPluginInfo> 0013 0014 #include <cantor/backend.h> 0015 0016 #include <cantor/cantor_export.h> 0017 0018 namespace Cantor 0019 { 0020 class Session; 0021 class PanelPluginPrivate; 0022 0023 /** 0024 * A plugin provides some additional features for the worksheet 0025 */ 0026 class CANTOR_EXPORT PanelPlugin : public QObject /*, public KXMLGUIClient*/ 0027 { 0028 Q_OBJECT 0029 public: 0030 /** 0031 * Create a new PanelPlugin 0032 * @param parent the parent Object @see QObject 0033 **/ 0034 explicit PanelPlugin( QObject* parent ); 0035 /** 0036 * Destructor 0037 */ 0038 ~PanelPlugin() override; 0039 0040 /** 0041 * Sets the properties of this PanelPlugin 0042 * according to KPluginInfo 0043 * @param info KPluginInfo 0044 */ 0045 void setPluginInfo(KPluginInfo info); 0046 0047 /** 0048 * Returns a list of all extensions, the current backend 0049 * must provide to make this PanelPlugin work. If it doesn't 0050 * this PanelPlugin won't be enabled 0051 * @return list of required extensions 0052 */ 0053 QStringList requiredExtensions(); 0054 0055 0056 /** 0057 * Returns the capabilities, the current backend 0058 * must provide to make this PanelPlugin work. If it doesn't 0059 * this PanelPlugin won't be enabled 0060 * @return the required capabilities 0061 */ 0062 virtual Backend::Capabilities requiredCapabilities(); 0063 0064 0065 /** 0066 * Returns the name of the plugin 0067 * @return name of the plugin 0068 */ 0069 QString name(); 0070 0071 /** 0072 * returns the widget, provided by this plugin 0073 * @return the widget, provided by this plugin 0074 **/ 0075 virtual QWidget* widget() = 0; 0076 0077 void setParentWidget(QWidget* widget); 0078 QWidget* parentWidget(); 0079 0080 /** 0081 * sets the session this plugin operates on 0082 **/ 0083 void setSession(Session* session); 0084 0085 /** 0086 * returns the session 0087 */ 0088 Session* session(); 0089 0090 Q_SIGNALS: 0091 void requestRunCommand(const QString& cmd); 0092 void visibilityRequested(); 0093 0094 protected: 0095 virtual void onSessionChanged(); 0096 0097 private: 0098 PanelPluginPrivate* d; 0099 }; 0100 0101 } 0102 0103 #endif /* _PANEL_PLUGIN_H */