Basic openoffice.org control, and listening for new presentation documents, still...
[kworship.git] / kworship / KwPlugin.h
blob4bf595c31d955572a1f75eaf1c03b42bced3f1aa
1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
4 * *
5 * KWorship is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * KWorship is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef _KwPlugin_h_
21 #define _KwPlugin_h_
23 /**
24 * @file KwPlugin.h
25 * @brief An abstract KWorship plugin.
26 * @author James Hogan <james@albanarts.com>
29 #include "KwExport.h"
31 #include <KParts/Plugin>
33 #include <QString>
35 class KwPluginManager;
37 class KConfigDialog;
39 class QDockWidget;
41 /// An abstract KWorship plugin.
42 class KWMAIN_EXPORT KwPlugin : public KParts::Plugin
44 Q_OBJECT
46 public:
49 * Constructors + destructor
52 /** Primary constructor.
53 * @param id Short unique untranslated id.
54 * @param name Translated name of plugin.
55 * @param description Translated description of plugin.
57 KwPlugin(QObject* parent, const QString& id, const QString& name, const QString& description);
59 /// Destructor.
60 virtual ~KwPlugin();
63 * Basic information accessors
66 /// Get the id.
67 const QString& id() const;
69 /// Get the name.
70 const QString& name() const;
72 /// Get the description.
73 const QString& description() const;
75 /// Get whether the plugin is loaded.
76 bool isLoaded() const;
79 * Loading and unloading
82 /** Set the manager.
83 * This should only be called by the manager class itself.
84 * @pre Manager must not have already been set.
85 * @param manager New manager object.
87 void setManager(KwPluginManager* manager);
89 /** Load the plugin.
90 * @pre Manager must have been set.
92 void load();
94 /// Unload the plugin.
95 void unload();
97 /// Setup config dialog to include the plugin.
98 virtual void setupConfigDialog(KConfigDialog* dialog);
100 protected:
103 * Loading and unloading virtual interface
106 /** Load the plugin.
107 * @pre !isLoaded()
109 virtual void _load() = 0;
111 /** Unload the plugin.
112 * @pre isLoaded()
114 virtual void _unload() = 0;
116 private:
119 * Constants
122 /// Short unique untranslated id.
123 QString m_id;
125 /// Translated name.
126 QString m_name;
128 /// Translated description.
129 QString m_description;
132 * Variables
135 /// The current plugin manager.
136 KwPluginManager* m_manager;
138 /// Whether the plugin is loaded.
139 bool m_loaded;
143 #endif // _KwPlugin_h_