File indexing completed on 2024-05-05 15:58:11

0001 /*
0002     This program is free software; you can redistribute it and/or
0003     modify it under the terms of the GNU General Public License
0004     as published by the Free Software Foundation; either version 2
0005     of the License, or (at your option) any later version.
0006 
0007     This program is distributed in the hope that it will be useful,
0008     but WITHOUT ANY WARRANTY; without even the implied warranty of
0009     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0010     GNU General Public License for more details.
0011 
0012     You should have received a copy of the GNU General Public License
0013     along with this program; if not, write to the Free Software
0014     Foundation, Inc., 51 Franklin Street, Fifth Floor,
0015     Boston, MA  02110-1301, USA.
0016 
0017     ---
0018     Copyright (C) 2010 Alexander Rieder <alexanderrieder@gmail.com>
0019  */
0020 
0021 #ifndef _PANEL_PLUGIN_H
0022 #define _PANEL_PLUGIN_H
0023 
0024 #include <KXMLGUIClient>
0025 #include <QObject>
0026 #include <KService/KPluginInfo>
0027 
0028 #include <cantor/backend.h>
0029 
0030 #include <cantor/cantor_export.h>
0031 
0032 namespace Cantor
0033 {
0034 class Session;
0035 class PanelPluginPrivate;
0036 
0037 /**
0038  * A plugin provides some additional features for the worksheet
0039  */
0040 class CANTOR_EXPORT PanelPlugin : public QObject /*, public KXMLGUIClient*/
0041 {
0042   Q_OBJECT
0043   public:
0044     /**
0045      * Create a new PanelPlugin
0046      * @param parent the parent Object @see QObject
0047      **/
0048     explicit PanelPlugin( QObject* parent );
0049     /**
0050      * Destructor
0051      */
0052     ~PanelPlugin() override;
0053 
0054     /**
0055      * Sets the properties of this PanelPlugin
0056      * according to KPluginInfo
0057      * @param info KPluginInfo
0058      */
0059     void setPluginInfo(KPluginInfo info);
0060 
0061     /**
0062      * Returns a list of all extensions, the current backend
0063      * must provide to make this PanelPlugin work. If it doesn't
0064      * this PanelPlugin won't be enabled
0065      * @return list of required extensions
0066     */
0067     QStringList requiredExtensions();
0068 
0069 
0070     /**
0071      * Returns the capabilities, the current backend
0072      * must provide to make this PanelPlugin work. If it doesn't
0073      * this PanelPlugin won't be enabled
0074      * @return the required capabilities
0075     */
0076     virtual Backend::Capabilities requiredCapabilities();
0077 
0078 
0079     /**
0080      * Returns the name of the plugin
0081      * @return name of the plugin
0082      */
0083     QString name();
0084 
0085     /**
0086      * returns the widget, provided by this plugin
0087      * @return the widget, provided by this plugin
0088      **/
0089     virtual QWidget* widget() = 0;
0090 
0091     void setParentWidget(QWidget* widget);
0092     QWidget* parentWidget();
0093 
0094     /**
0095      * sets the session this plugin operates on
0096      **/
0097     void setSession(Session* session);
0098 
0099     /**
0100      * returns the session
0101      */
0102     Session* session();
0103 
0104   Q_SIGNALS:
0105     void requestRunCommand(const QString& cmd);
0106     void visibilityRequested();
0107 
0108   protected:
0109     virtual void onSessionChanged();
0110 
0111   private:
0112     PanelPluginPrivate* d;
0113 };
0114 
0115 }
0116 
0117 #endif /* _PANEL_PLUGIN_H */