summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/opluginloader.h
Side-by-side diff
Diffstat (limited to 'libopie2/opiecore/opluginloader.h') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiecore/opluginloader.h59
1 files changed, 42 insertions, 17 deletions
diff --git a/libopie2/opiecore/opluginloader.h b/libopie2/opiecore/opluginloader.h
index 6166b75..2f9ec2a 100644
--- a/libopie2/opiecore/opluginloader.h
+++ b/libopie2/opiecore/opluginloader.h
@@ -34,5 +34,7 @@ public:
OPluginItem();
- OPluginItem( const QString& name, const QString& path, int pos = -1 );
+ OPluginItem( const QString& name, const QString& path, bool enabled = true, int pos = -1 );
~OPluginItem();
+ bool isEmpty()const;
+
bool operator==( const OPluginItem& )const;
@@ -43,2 +45,3 @@ public:
QString path()const;
+ bool isEnabled()const;
int position()const;
@@ -47,2 +50,3 @@ public:
void setPath( const QString& );
+ void setEnabled( bool );
void setPosition( int );
@@ -52,2 +56,3 @@ private:
QString m_path;
+ bool m_enabled : 1;
int m_pos;
@@ -78,3 +83,4 @@ public:
-
+ QString name()const;
+ bool isSorted()const;
bool isInSafeMode()const;
@@ -82,4 +88,4 @@ public:
- List allAvailable(bool sorted = FALSE)const;
- List filtered(bool sorted = FALSE)const;
+ List allAvailable(bool sorted = false )const;
+ List filtered(bool sorted = false )const;
@@ -90,2 +96,3 @@ public:
protected:
+ friend class OPluginManager; // we need the static unlibify
void readConfig();
@@ -94,6 +101,4 @@ protected:
void setPluginDir( const QString& );
- bool isSorted()const;
void setSafeMode(const QString& app = QString::null, bool b = false);
static QString unlibify( const QString& str );
-
private:
@@ -135,3 +140,3 @@ public:
OPluginLoader( const QString& name, bool sorted = false );
- ~OPluginLoader();
+ virtual ~OPluginLoader();
@@ -142,3 +147,3 @@ public:
/**
- * \brief A class to manager order and activation of plugins
+ * \brief A class to manage order and activation of plugins
*
@@ -147,4 +152,5 @@ public:
* on the OPluginLoader you supply.
+ * You must call load() and save after construnction an instance
*
- * @see OPluginConfig
+ * @see Opie::Ui::OPluginConfig
*
@@ -153,9 +159,9 @@ class OPluginManager {
public:
- OPluginManager( OGenericPluginLoader* , const QString& name);
- OPluginManager( OConfig* conf, const QString&,
- const QCString& group, const OPluginItem::List& );
- ~OPluginManager();
+ OPluginManager( OGenericPluginLoader* );
+ OPluginManager( const QString& name, const OPluginItem::List&, bool isSorted = false );
+ virtual ~OPluginManager();
- QString name();
- void setName( const QString& );
+ OPluginItem crashedPlugin()const;
+
+ OPluginItem::List managedPlugins()const;
@@ -166,4 +172,14 @@ public:
- void load();
- void save();
+ virtual void load();
+ virtual void save();
+
+protected:
+ QString configName()const;
+ void replace( const OPluginItem& );
+private:
+ OGenericPluginLoader *m_loader;
+ QString m_cfgName;
+ OPluginItem::List m_plugins;
+ OPluginItem m_crashed;
+ bool m_isSorted : 1;
};
@@ -171,2 +187,11 @@ public:
+/**
+ * This is a template method allowing you to safely cast
+ * your load function
+ *
+ * \code
+ * MyTypePlugin *plug = load->load<MyTypePlugin>( item, IID_MyPlugin );
+ * \endcode
+ *
+ */
template<class IFace>