summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/opluginconfig.h36
-rw-r--r--libopie2/opieui/opluginconfigwidget.cpp136
2 files changed, 167 insertions, 5 deletions
diff --git a/libopie2/opieui/opluginconfig.h b/libopie2/opieui/opluginconfig.h
index bfee5bf..0db1fcb 100644
--- a/libopie2/opieui/opluginconfig.h
+++ b/libopie2/opieui/opluginconfig.h
@@ -23,3 +23,4 @@ namespace Ui {
23 * 23 *
24 * Internally we operate on Opie::Core::OPluginManager. 24 * Internally we operate on Opie::Core::OPluginManager. You can insert any numbers of loaders
25 * or pluginmanagers. But you need to call load() after you've inserted new items.
25 * 26 *
@@ -42,5 +43,5 @@ public:
42 43
43 ~OPluginConfig(); 44 virtual ~OPluginConfig();
44 45
45 void setChangeMode( enum Mode ); 46 void setChangeMode( enum ChangeMode );
46 ChangeMode mode()const; 47 ChangeMode mode()const;
@@ -48,3 +49,3 @@ public:
48 void insert( const QString&, const Opie::Core::OPluginManager* ); 49 void insert( const QString&, const Opie::Core::OPluginManager* );
49 void insert( const QString&, const Opie::Core::OPluginLoader* ); 50 void insert( const QString&, const Opie::Core::OGenericPluginLoader* );
50 51
@@ -52,7 +53,30 @@ signals:
52 /** 53 /**
53 * @param item The new OPluginItem 54 * A PluginItem was changed. This signal is only emitted if you're
55 * in the immediate ChangeMode.
56 * This is emitted on any change ( disable,enable,pos)
57 *
58 * @param item The OPluginItem that was changed. This is how it looks now
59 * @param old_state If it was enabled before
54 */ 60 */
55 void pluginChanged ( const Opie::Core::OPluginItem& item, bool old_state); 61 void pluginChanged ( const Opie::Core::OPluginItem& item, bool old_state);
62
63 /**
64 * emitted only if you're in Immediate when an Item was enabled
65 *
66 * @param item The Item that was enabled
67 */
56 void pluginEnabled ( const Opie::Core::OPluginItem& item); 68 void pluginEnabled ( const Opie::Core::OPluginItem& item);
69
70 /**
71 * emitted only if you're in Immediate when an Item was enabled
72 *
73 * @param item The Item was disabled
74 */
57 void pluginDisabled( const Opie::Core::OPluginItem& item); 75 void pluginDisabled( const Opie::Core::OPluginItem& item);
76
77 /**
78 * Data was saved(). Normally this is emitted when save() is called
79 * @see changed
80 */
81 void changed();
58public: 82public:
@@ -62,2 +86,4 @@ public:
62private: 86private:
87 ChangeMode m_mode;
88 QMap<Opie::Core::OPluginManager*, bool> m_items;
63 89
diff --git a/libopie2/opieui/opluginconfigwidget.cpp b/libopie2/opieui/opluginconfigwidget.cpp
new file mode 100644
index 0000000..359e7a1
--- a/dev/null
+++ b/libopie2/opieui/opluginconfigwidget.cpp
@@ -0,0 +1,136 @@
1/*
2 * LGPLv2 2004 zecke@handhelds.org
3 */
4
5
6#include "opluginconfig.h"
7
8#include <opie/opluginloader.h>
9
10using Opie::Core::OPluginManager;
11using Opie::Core::OGenericPluginLoader;
12
13namespace Opie {
14namespace Ui {
15
16}
17}
18
19/**
20 * C'tor compatible with all Qt Widgets in its arguments.
21 * After constructing you need to insert and call load()
22 *
23 * The default mode is Queued
24 *
25 * @param wid the Widget
26 * @param name The name of the widget
27 * @param fl The widget flags you may want to set
28 *
29 * @see QWidget::QWidget
30 */
31OPluginConfigWidget::OPluginConfigWidget( QWidget* wid, const char *name, WFlags fl )
32 : QWidget( wid, name, fl ), m_mode( Queued )
33{
34}
35
36/**
37 * C'tor where you can give a Opie::Core::OPluginManager and additional optional
38 * parameters.
39 *
40 * This call insert for the OPluginManager you pass to this method. You'll still
41 * need to call load after constructing this widget.
42 *
43 * Ownership will not be transfered
44 *
45 * The default mode is Queued
46 *
47 * @param manager The OPluginManager you pass
48 * @param wid The QWidget parent
49 * @param name the Name of the widget
50 * @param fl Possible Flags
51 *
52 */
53OPluginConfigWidget::OPluginConfigWidget( Opie::Core::OPluginManager* manager,
54 QWidget* wid, const char* name, WFlags fl )
55 : QWidget( wid, name, fl ), m_mode( Queued )
56{
57 insert( QString::null, manager );
58}
59
60
61/**
62 * C'tor where you can give a Opie::Core::OGenericPluginLoader and additional optional
63 * parameters. Internally we use a Opie::Core::OPluginManager on top of the loader.
64 *
65 * This call insert for the Opie::Core::OGenericPluginLoader you pass to this method.
66 * You'll still need to call load() after constructing this widget.
67 *
68 * It is still your OGenericPluginLoader and ownership is not transfered.
69 *
70 * The default mode is Queued
71 *
72 * @param manager The OGenericPluginLoader you pass
73 * @param wid The QWidget parent
74 * @param name the Name of the widget
75 * @param fl Possible Flags
76 *
77 */
78OPluginConfigWidget::OPluginConfigWidget( Opie::Core::OGenericPluginLoader* load,
79 QWidget* wid, const char* name, WFlags fl )
80 : QWidget( wid, name, fl ), m_mode( Queued )
81{
82 insert( QString::null, load );
83}
84
85/**
86 * d'tor. This does not save the changes if your in Queued mode
87 * make sure to call save() before destructing this widget.
88 */
89OPluginConfigWidget::~OPluginConfigWidget() {
90//
91}
92
93/**
94 * Set the ChangeMode of this widget. Currently there are two possible values.
95 * Immediate - all changes by the user are immediately applied and signals are emitted
96 * the signals emitted are plugin* and also changed() due calling save internally
97 * Queued - changes need to be saved manually. save() emits changed()
98 *
99 * @param mode the ChangeMode to use. Either use Immediate or Queued
100 */
101void OPluginConfigWidget::setChangeMode( enum OPluginConfigWidget::ChangeMode mode ) {
102 m_mode = mode;
103}
104
105/**
106 * Return the Mode
107 *
108 * @return Returns the change mode this widget is in.
109 * @see OPluginConfigWidget::ChangeMode
110 * @see OPluginConfigWidget::setChangeMode
111 */
112OPluginConfigWidget::ChangeMode OPluginConfigWidget::mode()const{
113 return m_mode;
114}
115
116/**
117 * Insert a PluginManager directly. Ownership is not transfered.
118 *
119 * @param name The name represented to the user
120 * @param mana The manager which should be inserted
121 */
122void OPluginConfigWidget::insert( const QString& name, const Opie::Core::OPluginManager* mana) {
123
124}
125
126/**
127 *
128 * @param name The name
129 *
130 */
131void OPluginConfigWidget::insert( const QString& name, const Opie::Core::OGenericPluginLoader* load) {
132
133}
134
135}
136}