author | ulf69 <ulf69> | 2004-08-06 20:29:00 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-06 20:29:00 (UTC) |
commit | 38d84409bcca83516eb816461c8b79b4cf6cbf57 (patch) (unidiff) | |
tree | f7cc928c007ed6f4bca43d7474343d78bd0f4eab /microkde | |
parent | 40ac88770c32ae78e194096e758ef3818d2fb434 (diff) | |
download | kdepimpi-38d84409bcca83516eb816461c8b79b4cf6cbf57.zip kdepimpi-38d84409bcca83516eb816461c8b79b4cf6cbf57.tar.gz kdepimpi-38d84409bcca83516eb816461c8b79b4cf6cbf57.tar.bz2 |
expanded functionality of kcmultidialog to support other applications
-rw-r--r-- | microkde/kdeui/kcmodule.h | 9 | ||||
-rw-r--r-- | microkde/kutils/kcmultidialog.cpp | 13 | ||||
-rw-r--r-- | microkde/kutils/kcmultidialog.h | 20 | ||||
-rw-r--r-- | microkde/microkdeE.pro | 2 |
4 files changed, 26 insertions, 18 deletions
diff --git a/microkde/kdeui/kcmodule.h b/microkde/kdeui/kcmodule.h index 90a87c9..bc020bc 100644 --- a/microkde/kdeui/kcmodule.h +++ b/microkde/kdeui/kcmodule.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | //USclass KAboutData; | 27 | //USclass KAboutData; |
28 | class KCModulePrivate; | 28 | class KCModulePrivate; |
29 | class KPrefs; | ||
29 | //US class KInstance; | 30 | //US class KInstance; |
30 | 31 | ||
31 | /** | 32 | /** |
@@ -105,7 +106,7 @@ public: | |||
105 | * 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, |
106 | * so you probably want to call this method in the constructor. | 107 | * so you probably want to call this method in the constructor. |
107 | */ | 108 | */ |
108 | virtual void load() {}; | 109 | virtual void load(KPrefs* prefs) {}; |
109 | 110 | ||
110 | /** | 111 | /** |
111 | * Save the configuration data. | 112 | * Save the configuration data. |
@@ -118,7 +119,7 @@ public: | |||
118 | * | 119 | * |
119 | * save is called when the user clicks "Apply" or "Ok". | 120 | * save is called when the user clicks "Apply" or "Ok". |
120 | */ | 121 | */ |
121 | virtual void save() {}; | 122 | virtual void save(KPrefs* prefs) {}; |
122 | 123 | ||
123 | /** | 124 | /** |
124 | * Sets the configuration to sensible default values. | 125 | * Sets the configuration to sensible default values. |
@@ -126,7 +127,7 @@ public: | |||
126 | * This method is called when the user clicks the "Default" | 127 | * This method is called when the user clicks the "Default" |
127 | * button. It should set the display to useful values. | 128 | * button. It should set the display to useful values. |
128 | */ | 129 | */ |
129 | virtual void defaults() {}; | 130 | virtual void defaults(KPrefs* prefs) {}; |
130 | 131 | ||
131 | /** | 132 | /** |
132 | * Set the configuration to system default values. | 133 | * Set the configuration to system default values. |
@@ -136,7 +137,7 @@ public: | |||
136 | * | 137 | * |
137 | * NOTE: The default behaviour is to call defaults(). | 138 | * NOTE: The default behaviour is to call defaults(). |
138 | */ | 139 | */ |
139 | virtual void sysdefaults() { defaults(); }; | 140 | virtual void sysdefaults(KPrefs* prefs) { defaults(prefs); }; |
140 | 141 | ||
141 | /** | 142 | /** |
142 | * Return a quick-help text. | 143 | * Return a quick-help text. |
diff --git a/microkde/kutils/kcmultidialog.cpp b/microkde/kutils/kcmultidialog.cpp index 13be2ce..c2378fb 100644 --- a/microkde/kutils/kcmultidialog.cpp +++ b/microkde/kutils/kcmultidialog.cpp | |||
@@ -34,12 +34,13 @@ | |||
34 | #include <kprocess.h> | 34 | #include <kprocess.h> |
35 | 35 | ||
36 | #include "kcmultidialog.h" | 36 | #include "kcmultidialog.h" |
37 | #include "kprefs.h" | ||
37 | //US #include "kcmultidialog.moc" | 38 | //US #include "kcmultidialog.moc" |
38 | //US #include "kcmoduleloader.h" | 39 | //US #include "kcmoduleloader.h" |
39 | 40 | ||
40 | KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal) | 41 | KCMultiDialog::KCMultiDialog(KPrefs* prefs, const QString& baseGroup, QWidget *parent, const char *name, bool modal) |
41 | : KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok, | 42 | : KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok, |
42 | parent, name, modal, true), d(0L) | 43 | parent, name, modal, true), mPrefs(prefs), d(0L) |
43 | { | 44 | { |
44 | enableButton(Apply, false); | 45 | enableButton(Apply, false); |
45 | //connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *))); | 46 | //connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *))); |
@@ -74,7 +75,7 @@ void KCMultiDialog::slotDefault() | |||
74 | { | 75 | { |
75 | if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex) | 76 | if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex) |
76 | { | 77 | { |
77 | (*it)->defaults(); | 78 | (*it)->defaults(mPrefs); |
78 | clientChanged(true); | 79 | clientChanged(true); |
79 | return; | 80 | return; |
80 | } | 81 | } |
@@ -88,7 +89,7 @@ qDebug("KCMultiDialog::slotApply clicked"); | |||
88 | 89 | ||
89 | QPtrListIterator<KCModule> it(modules); | 90 | QPtrListIterator<KCModule> it(modules); |
90 | for (; it.current(); ++it) | 91 | for (; it.current(); ++it) |
91 | (*it)->save(); | 92 | (*it)->save(mPrefs); |
92 | clientChanged(false); | 93 | clientChanged(false); |
93 | 94 | ||
94 | emit applyClicked(); | 95 | emit applyClicked(); |
@@ -102,7 +103,7 @@ qDebug("KCMultiDialog::slotOk clicked"); | |||
102 | 103 | ||
103 | QPtrListIterator<KCModule> it(modules); | 104 | QPtrListIterator<KCModule> it(modules); |
104 | for (; it.current(); ++it) | 105 | for (; it.current(); ++it) |
105 | (*it)->save(); | 106 | (*it)->save(mPrefs); |
106 | accept(); | 107 | accept(); |
107 | 108 | ||
108 | emit okClicked(); | 109 | emit okClicked(); |
@@ -160,6 +161,8 @@ void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, | |||
160 | 161 | ||
161 | modules.append(module); | 162 | modules.append(module); |
162 | connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); | 163 | connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); |
164 | //US | ||
165 | module->load(mPrefs); | ||
163 | 166 | ||
164 | 167 | ||
165 | } | 168 | } |
diff --git a/microkde/kutils/kcmultidialog.h b/microkde/kutils/kcmultidialog.h index 63d5d42..a42555f 100644 --- a/microkde/kutils/kcmultidialog.h +++ b/microkde/kutils/kcmultidialog.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <kjanuswidget.h> | 29 | #include <kjanuswidget.h> |
30 | #include <kcmodule.h> | 30 | #include <kcmodule.h> |
31 | 31 | ||
32 | class KPrefs; | ||
32 | 33 | ||
33 | /** | 34 | /** |
34 | * A class that offers a @ref KDialogBase containing arbitrary KControl Modules | 35 | * A class that offers a @ref KDialogBase containing arbitrary KControl Modules |
@@ -53,7 +54,7 @@ public: | |||
53 | * kcontrol, just keep "settings" | 54 | * kcontrol, just keep "settings" |
54 | * @param modal If you pass true here, the dialog will be modal | 55 | * @param modal If you pass true here, the dialog will be modal |
55 | **/ | 56 | **/ |
56 | KCMultiDialog(const QString& baseGroup = QString::fromLatin1("settings"), | 57 | KCMultiDialog(KPrefs* prefs, const QString& baseGroup = QString::fromLatin1("settings"), |
57 | QWidget *parent=0, const char *name=0, | 58 | QWidget *parent=0, const char *name=0, |
58 | bool modal=false); | 59 | bool modal=false); |
59 | 60 | ||
@@ -77,9 +78,9 @@ public: | |||
77 | //US special method for microkde. We dop noty want to load everything dynamically. | 78 | //US special method for microkde. We dop noty want to load everything dynamically. |
78 | void addModule(KCModule* module );//, const QString& modulename, const QString& iconname); | 79 | void addModule(KCModule* module );//, const QString& modulename, const QString& iconname); |
79 | QVBox* getNewVBoxPage(const QString & modulename) ; | 80 | QVBox* getNewVBoxPage(const QString & modulename) ; |
80 | 81 | ||
81 | 82 | ||
82 | 83 | ||
83 | protected slots: | 84 | protected slots: |
84 | /** | 85 | /** |
85 | * This slot is called when the user presses the "Default" Button | 86 | * This slot is called when the user presses the "Default" Button |
@@ -128,17 +129,18 @@ private: | |||
128 | QString path; | 129 | QString path; |
129 | bool withfallback; | 130 | bool withfallback; |
130 | }; | 131 | }; |
131 | */ | 132 | */ |
132 | QPtrList<KCModule> modules; | 133 | QPtrList<KCModule> modules; |
133 | /* | 134 | /* |
134 | QPtrDict<LoadInfo> moduleDict; | 135 | QPtrDict<LoadInfo> moduleDict; |
135 | QString _docPath; | 136 | QString _docPath; |
136 | */ | 137 | */ |
137 | QString _baseGroup; | 138 | QString _baseGroup; |
138 | 139 | ||
139 | //US | 140 | //US |
140 | KJanusWidget* mMainWidget; | 141 | KJanusWidget* mMainWidget; |
141 | 142 | KPrefs* mPrefs; | |
143 | |||
142 | // For future use | 144 | // For future use |
143 | class KCMultiDialogPrivate; | 145 | class KCMultiDialogPrivate; |
144 | KCMultiDialogPrivate *d; | 146 | KCMultiDialogPrivate *d; |
diff --git a/microkde/microkdeE.pro b/microkde/microkdeE.pro index b664c9a..06b288b 100644 --- a/microkde/microkdeE.pro +++ b/microkde/microkdeE.pro | |||
@@ -95,6 +95,7 @@ osmartpointer.h \ | |||
95 | kdecore/klocale.h \ | 95 | kdecore/klocale.h \ |
96 | kdecore/klibloader.h \ | 96 | kdecore/klibloader.h \ |
97 | kdecore/kcatalogue.h \ | 97 | kdecore/kcatalogue.h \ |
98 | kdecore/kprefs.h \ | ||
98 | kdecore/ksharedptr.h \ | 99 | kdecore/ksharedptr.h \ |
99 | kdecore/kshell.h \ | 100 | kdecore/kshell.h \ |
100 | kdecore/kstandarddirs.h \ | 101 | kdecore/kstandarddirs.h \ |
@@ -138,6 +139,7 @@ oprocess.cpp \ | |||
138 | kdecore/klibloader.cpp \ | 139 | kdecore/klibloader.cpp \ |
139 | kdecore/klocale.cpp \ | 140 | kdecore/klocale.cpp \ |
140 | kdecore/kmdcodec.cpp \ | 141 | kdecore/kmdcodec.cpp \ |
142 | kdecore/kprefs.cpp \ | ||
141 | kdecore/kshell.cpp \ | 143 | kdecore/kshell.cpp \ |
142 | kdecore/kstandarddirs.cpp \ | 144 | kdecore/kstandarddirs.cpp \ |
143 | kdecore/kstringhandler.cpp \ | 145 | kdecore/kstringhandler.cpp \ |