-rw-r--r-- | microkde/kdeui/kcmodule.cpp | 16 | ||||
-rw-r--r-- | microkde/kdeui/kcmodule.h | 11 |
2 files changed, 18 insertions, 9 deletions
diff --git a/microkde/kdeui/kcmodule.cpp b/microkde/kdeui/kcmodule.cpp index 915cd0f..f646db3 100644 --- a/microkde/kdeui/kcmodule.cpp +++ b/microkde/kdeui/kcmodule.cpp | |||
@@ -28,32 +28,34 @@ | |||
28 | 28 | ||
29 | class KCModulePrivate | 29 | class KCModulePrivate |
30 | { | 30 | { |
31 | public: | 31 | public: |
32 | //US KInstance *_instance; | 32 | //US KInstance *_instance; |
33 | QString _rootOnlyMsg; | 33 | QString _rootOnlyMsg; |
34 | bool _useRootOnlyMsg; | 34 | bool _useRootOnlyMsg; |
35 | bool _hasOwnInstance; | 35 | bool _hasOwnInstance; |
36 | KPrefs* _prefs; | ||
36 | }; | 37 | }; |
37 | 38 | ||
38 | KCModule::KCModule(QWidget *parent, const char *name, const QStringList &) | 39 | KCModule::KCModule(KPrefs* prefs, QWidget *parent, const char *name, const QStringList &) |
39 | : QWidget(parent, name), _btn(Help|Default|Apply) | 40 | : QWidget(parent, name), _btn(Help|Default|Apply) |
40 | { | 41 | { |
41 | kdDebug() << "KCModule " << name << endl; | 42 | kdDebug() << "KCModule " << name << endl; |
42 | d = new KCModulePrivate; | 43 | d = new KCModulePrivate; |
43 | d->_useRootOnlyMsg = true; | 44 | d->_useRootOnlyMsg = true; |
44 | /*US | 45 | d->_prefs = prefs; |
46 | /*US | ||
45 | d->_instance = new KInstance(name); | 47 | d->_instance = new KInstance(name); |
46 | if (name && strlen(name)) { | 48 | if (name && strlen(name)) { |
47 | d->_instance = new KInstance(name); | 49 | d->_instance = new KInstance(name); |
48 | KGlobal::locale()->insertCatalogue(name); | 50 | KGlobal::locale()->insertCatalogue(name); |
49 | } else | 51 | } else |
50 | d->_instance = new KInstance("kcmunnamed"); | 52 | d->_instance = new KInstance("kcmunnamed"); |
51 | */ | 53 | */ |
52 | d->_hasOwnInstance = true; | 54 | d->_hasOwnInstance = true; |
53 | //US KGlobal::setActiveInstance(this->instance()); | 55 | //US KGlobal::setActiveInstance(this->instance()); |
54 | } | 56 | } |
55 | 57 | ||
56 | /*US | 58 | /*US |
57 | KCModule::KCModule(KInstance *instance, QWidget *parent, const QStringList & ) | 59 | KCModule::KCModule(KInstance *instance, QWidget *parent, const QStringList & ) |
58 | : QWidget(parent, instance ? instance->instanceName().data() : 0), _btn(Help|Default|Apply) | 60 | : QWidget(parent, instance ? instance->instanceName().data() : 0), _btn(Help|Default|Apply) |
59 | { | 61 | { |
@@ -66,17 +68,17 @@ KCModule::KCModule(KInstance *instance, QWidget *parent, const QStringList & ) | |||
66 | KGlobal::setActiveInstance(this->instance()); | 68 | KGlobal::setActiveInstance(this->instance()); |
67 | } | 69 | } |
68 | */ | 70 | */ |
69 | KCModule::~KCModule() | 71 | KCModule::~KCModule() |
70 | { | 72 | { |
71 | /*US | 73 | /*US |
72 | if (d->_hasOwnInstance) | 74 | if (d->_hasOwnInstance) |
73 | delete d->_instance; | 75 | delete d->_instance; |
74 | */ | 76 | */ |
75 | delete d; | 77 | delete d; |
76 | } | 78 | } |
77 | 79 | ||
78 | void KCModule::setRootOnlyMsg(const QString& msg) | 80 | void KCModule::setRootOnlyMsg(const QString& msg) |
79 | { | 81 | { |
80 | d->_rootOnlyMsg = msg; | 82 | d->_rootOnlyMsg = msg; |
81 | } | 83 | } |
82 | 84 | ||
@@ -89,16 +91,22 @@ void KCModule::setUseRootOnlyMsg(bool on) | |||
89 | { | 91 | { |
90 | d->_useRootOnlyMsg = on; | 92 | d->_useRootOnlyMsg = on; |
91 | } | 93 | } |
92 | 94 | ||
93 | bool KCModule::useRootOnlyMsg() const | 95 | bool KCModule::useRootOnlyMsg() const |
94 | { | 96 | { |
95 | return d->_useRootOnlyMsg; | 97 | return d->_useRootOnlyMsg; |
96 | } | 98 | } |
99 | |||
100 | KPrefs* KCModule::getPreferences() | ||
101 | { | ||
102 | return d->_prefs; | ||
103 | } | ||
104 | |||
97 | /*US | 105 | /*US |
98 | KInstance *KCModule::instance() const | 106 | KInstance *KCModule::instance() const |
99 | { | 107 | { |
100 | return d->_instance; | 108 | return d->_instance; |
101 | } | 109 | } |
102 | */ | 110 | */ |
103 | void KCModule::virtual_hook( int, void* ) | 111 | void KCModule::virtual_hook( int, void* ) |
104 | { /*BASE::virtual_hook( id, data );*/ } | 112 | { /*BASE::virtual_hook( id, data );*/ } |
diff --git a/microkde/kdeui/kcmodule.h b/microkde/kdeui/kcmodule.h index bc020bc..874958c 100644 --- a/microkde/kdeui/kcmodule.h +++ b/microkde/kdeui/kcmodule.h | |||
@@ -78,17 +78,17 @@ public: | |||
78 | Ok=32, /* obsolete, do not use! */ | 78 | Ok=32, /* obsolete, do not use! */ |
79 | SysDefault=64 /* obsolete, do not use! */ }; | 79 | SysDefault=64 /* obsolete, do not use! */ }; |
80 | 80 | ||
81 | /* | 81 | /* |
82 | * Base class for all KControlModules. | 82 | * Base class for all KControlModules. |
83 | * Make sure you have a QStringList argument in your | 83 | * Make sure you have a QStringList argument in your |
84 | * implementation. | 84 | * implementation. |
85 | */ | 85 | */ |
86 | KCModule(QWidget *parent=0, const char *name=0, const QStringList &args=QStringList() ); | 86 | KCModule(KPrefs* prefs, QWidget *parent=0, const char *name=0, const QStringList &args=QStringList() ); |
87 | 87 | ||
88 | //US KCModule(KInstance *instance, QWidget *parent=0, const QStringList &args=QStringList() ); | 88 | //US KCModule(KInstance *instance, QWidget *parent=0, const QStringList &args=QStringList() ); |
89 | 89 | ||
90 | /* | 90 | /* |
91 | * Destroys the module. | 91 | * Destroys the module. |
92 | */ | 92 | */ |
93 | ~KCModule(); | 93 | ~KCModule(); |
94 | 94 | ||
@@ -101,48 +101,48 @@ public: | |||
101 | * | 101 | * |
102 | * This method is invoked whenever the module should read its configuration | 102 | * This method is invoked whenever the module should read its configuration |
103 | * (most of the times from a config file) and update the user interface. | 103 | * (most of the times from a config file) and update the user interface. |
104 | * This happens when the user clicks the "Reset" button in the control | 104 | * This happens when the user clicks the "Reset" button in the control |
105 | * center, to undo all of his changes and restore the currently valid | 105 | * center, to undo all of his changes and restore the currently valid |
106 | * settings. NOTE that this is not called after the modules is loaded, | 106 | * settings. NOTE that this is not called after the modules is loaded, |
107 | * so you probably want to call this method in the constructor. | 107 | * so you probably want to call this method in the constructor. |
108 | */ | 108 | */ |
109 | virtual void load(KPrefs* prefs) {}; | 109 | virtual void load() {}; |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * Save the configuration data. | 112 | * Save the configuration data. |
113 | * | 113 | * |
114 | * The save method stores the config information as shown | 114 | * The save method stores the config information as shown |
115 | * in the user interface in the config files. | 115 | * in the user interface in the config files. |
116 | * | 116 | * |
117 | * If necessary, this method also updates the running system, | 117 | * If necessary, this method also updates the running system, |
118 | * e.g. by restarting applications. | 118 | * e.g. by restarting applications. |
119 | * | 119 | * |
120 | * save is called when the user clicks "Apply" or "Ok". | 120 | * save is called when the user clicks "Apply" or "Ok". |
121 | */ | 121 | */ |
122 | virtual void save(KPrefs* prefs) {}; | 122 | virtual void save() {}; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * Sets the configuration to sensible default values. | 125 | * Sets the configuration to sensible default values. |
126 | * | 126 | * |
127 | * This method is called when the user clicks the "Default" | 127 | * This method is called when the user clicks the "Default" |
128 | * button. It should set the display to useful values. | 128 | * button. It should set the display to useful values. |
129 | */ | 129 | */ |
130 | virtual void defaults(KPrefs* prefs) {}; | 130 | virtual void defaults() {}; |
131 | 131 | ||
132 | /** | 132 | /** |
133 | * Set the configuration to system default values. | 133 | * Set the configuration to system default values. |
134 | * | 134 | * |
135 | * This method is called when the user clicks the "System-Default" | 135 | * This method is called when the user clicks the "System-Default" |
136 | * button. It should set the display to the system default values. | 136 | * button. It should set the display to the system default values. |
137 | * | 137 | * |
138 | * NOTE: The default behaviour is to call defaults(). | 138 | * NOTE: The default behaviour is to call defaults(). |
139 | */ | 139 | */ |
140 | virtual void sysdefaults(KPrefs* prefs) { defaults(prefs); }; | 140 | virtual void sysdefaults() { defaults(); }; |
141 | 141 | ||
142 | /** | 142 | /** |
143 | * Return a quick-help text. | 143 | * Return a quick-help text. |
144 | * | 144 | * |
145 | * This method is called when the module is docked. | 145 | * This method is called when the module is docked. |
146 | * The quick-help text should contain a short description of the module and | 146 | * The quick-help text should contain a short description of the module and |
147 | * links to the module's help files. You can use QML formating tags in the text. | 147 | * links to the module's help files. You can use QML formating tags in the text. |
148 | * | 148 | * |
@@ -188,16 +188,17 @@ public: | |||
188 | * In some cases, the module don't want a RootOnly message to | 188 | * In some cases, the module don't want a RootOnly message to |
189 | * appear (for example if it has already one). This function | 189 | * appear (for example if it has already one). This function |
190 | * tells KControl if a RootOnly message should be shown | 190 | * tells KControl if a RootOnly message should be shown |
191 | * | 191 | * |
192 | * @see KCModule::setUseRootOnlyMsg | 192 | * @see KCModule::setUseRootOnlyMsg |
193 | */ | 193 | */ |
194 | bool useRootOnlyMsg() const; | 194 | bool useRootOnlyMsg() const; |
195 | 195 | ||
196 | KPrefs* getPreferences(); | ||
196 | 197 | ||
197 | //US KInstance *instance() const; | 198 | //US KInstance *instance() const; |
198 | 199 | ||
199 | signals: | 200 | signals: |
200 | 201 | ||
201 | /** | 202 | /** |
202 | * Indicate that the state of the modules contents has changed. | 203 | * Indicate that the state of the modules contents has changed. |
203 | * | 204 | * |