-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 | |||
@@ -1,60 +1,61 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the KDE libraries | 2 | This file is part of the KDE libraries |
3 | 3 | ||
4 | Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org> | 4 | Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | */ | 21 | */ |
22 | #ifndef __KCMODULE_H__ | 22 | #ifndef __KCMODULE_H__ |
23 | #define __KCMODULE_H__ | 23 | #define __KCMODULE_H__ |
24 | 24 | ||
25 | #include <qwidget.h> | 25 | #include <qwidget.h> |
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 | /** |
32 | * The base class for control center modules. | 33 | * The base class for control center modules. |
33 | * | 34 | * |
34 | * Starting from KDE 2.0, control center modules are realized as shared | 35 | * Starting from KDE 2.0, control center modules are realized as shared |
35 | * libraries that are loaded into the control center at runtime. | 36 | * libraries that are loaded into the control center at runtime. |
36 | * | 37 | * |
37 | * The module in principle is a simple widget displaying the | 38 | * The module in principle is a simple widget displaying the |
38 | * item to be changed. The module has a very small interface. | 39 | * item to be changed. The module has a very small interface. |
39 | * | 40 | * |
40 | * All the necessary glue logic and the GUI bells and whistles | 41 | * All the necessary glue logic and the GUI bells and whistles |
41 | * are provided by the control center and must not concern | 42 | * are provided by the control center and must not concern |
42 | * the module author. | 43 | * the module author. |
43 | * | 44 | * |
44 | * To write a config module, you have to create a library | 45 | * To write a config module, you have to create a library |
45 | * that contains at one factory function like this: | 46 | * that contains at one factory function like this: |
46 | * | 47 | * |
47 | * <pre> | 48 | * <pre> |
48 | * #include <kgenericfactory.h> | 49 | * #include <kgenericfactory.h> |
49 | * | 50 | * |
50 | * typedef KGenericFactory<YourKCModule, QWidget> YourKCModuleFactory; | 51 | * typedef KGenericFactory<YourKCModule, QWidget> YourKCModuleFactory; |
51 | * K_EXPORT_COMPONENT_FACTORY( yourLibName, YourKCModuleFactory("name_of_the_po_file") ); | 52 | * K_EXPORT_COMPONENT_FACTORY( yourLibName, YourKCModuleFactory("name_of_the_po_file") ); |
52 | * </pre> | 53 | * </pre> |
53 | * | 54 | * |
54 | * The parameter "name_of_the_po_file" has to correspond with the messages target | 55 | * The parameter "name_of_the_po_file" has to correspond with the messages target |
55 | * that you created in your Makefile.am. | 56 | * that you created in your Makefile.am. |
56 | * | 57 | * |
57 | * See kdebase/kcontrol/HOWTO for more detailed documentation. | 58 | * See kdebase/kcontrol/HOWTO for more detailed documentation. |
58 | * | 59 | * |
59 | * @author Matthias Hoelzer-Kluepfel <hoelzer@kde.org> | 60 | * @author Matthias Hoelzer-Kluepfel <hoelzer@kde.org> |
60 | */ | 61 | */ |
@@ -76,96 +77,96 @@ public: | |||
76 | Cancel=8, /* obsolete, do not use! */ | 77 | Cancel=8, /* obsolete, do not use! */ |
77 | Ok=32, /* obsolete, do not use! */ | 78 | Ok=32, /* obsolete, do not use! */ |
78 | SysDefault=64 /* obsolete, do not use! */ }; | 79 | SysDefault=64 /* obsolete, do not use! */ }; |
79 | 80 | ||
80 | /* | 81 | /* |
81 | * Base class for all KControlModules. | 82 | * Base class for all KControlModules. |
82 | * Make sure you have a QStringList argument in your | 83 | * Make sure you have a QStringList argument in your |
83 | * implementation. | 84 | * implementation. |
84 | */ | 85 | */ |
85 | KCModule(QWidget *parent=0, const char *name=0, const QStringList &args=QStringList() ); | 86 | KCModule(QWidget *parent=0, const char *name=0, const QStringList &args=QStringList() ); |
86 | 87 | ||
87 | //US KCModule(KInstance *instance, QWidget *parent=0, const QStringList &args=QStringList() ); | 88 | //US KCModule(KInstance *instance, QWidget *parent=0, const QStringList &args=QStringList() ); |
88 | 89 | ||
89 | /* | 90 | /* |
90 | * Destroys the module. | 91 | * Destroys the module. |
91 | */ | 92 | */ |
92 | ~KCModule(); | 93 | ~KCModule(); |
93 | 94 | ||
94 | /** | 95 | /** |
95 | * Load the configuration data into the module. | 96 | * Load the configuration data into the module. |
96 | * | 97 | * |
97 | * The load method sets the user interface elements of the | 98 | * The load method sets the user interface elements of the |
98 | * module to reflect the current settings stored in the | 99 | * module to reflect the current settings stored in the |
99 | * configuration files. | 100 | * configuration files. |
100 | * | 101 | * |
101 | * This method is invoked whenever the module should read its configuration | 102 | * This method is invoked whenever the module should read its configuration |
102 | * (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. |
103 | * 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 |
104 | * 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 |
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. |
112 | * | 113 | * |
113 | * The save method stores the config information as shown | 114 | * The save method stores the config information as shown |
114 | * in the user interface in the config files. | 115 | * in the user interface in the config files. |
115 | * | 116 | * |
116 | * If necessary, this method also updates the running system, | 117 | * If necessary, this method also updates the running system, |
117 | * e.g. by restarting applications. | 118 | * e.g. by restarting applications. |
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. |
125 | * | 126 | * |
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. |
133 | * | 134 | * |
134 | * This method is called when the user clicks the "System-Default" | 135 | * This method is called when the user clicks the "System-Default" |
135 | * button. It should set the display to the system default values. | 136 | * button. It should set the display to the system default values. |
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. |
143 | * | 144 | * |
144 | * This method is called when the module is docked. | 145 | * This method is called when the module is docked. |
145 | * 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 |
146 | * 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. |
147 | * | 148 | * |
148 | * NOTE: Please make sure the quick help text gets translated (use i18n()). | 149 | * NOTE: Please make sure the quick help text gets translated (use i18n()). |
149 | */ | 150 | */ |
150 | virtual QString quickHelp() const { return QString::null; }; | 151 | virtual QString quickHelp() const { return QString::null; }; |
151 | 152 | ||
152 | /** | 153 | /** |
153 | * Returns a the KAboutData for this module | 154 | * Returns a the KAboutData for this module |
154 | * This is generally only called for the KBugReport. | 155 | * This is generally only called for the KBugReport. |
155 | * Override and have it return a pointer to a constant | 156 | * Override and have it return a pointer to a constant |
156 | */ | 157 | */ |
157 | //US virtual const KAboutData *aboutData() const { return 0; } | 158 | //US virtual const KAboutData *aboutData() const { return 0; } |
158 | 159 | ||
159 | /** | 160 | /** |
160 | * Indicate which buttons will be used. | 161 | * Indicate which buttons will be used. |
161 | * | 162 | * |
162 | * The return value is a value or'ed together from | 163 | * The return value is a value or'ed together from |
163 | * the Button enumeration type. | 164 | * the Button enumeration type. |
164 | * | 165 | * |
165 | * @see KCModule::setButtons | 166 | * @see KCModule::setButtons |
166 | */ | 167 | */ |
167 | int buttons() const { return _btn; }; | 168 | int buttons() const { return _btn; }; |
168 | 169 | ||
169 | /** | 170 | /** |
170 | * Get the RootOnly message for this module. | 171 | * Get the RootOnly message for this module. |
171 | * | 172 | * |
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 | |||
@@ -5,190 +5,193 @@ | |||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <qhbox.h> | 22 | #include <qhbox.h> |
23 | #include <qvbox.h> | 23 | #include <qvbox.h> |
24 | #include <qcursor.h> | 24 | #include <qcursor.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | 26 | ||
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | #include <kglobal.h> | 28 | #include <kglobal.h> |
29 | #include <kdebug.h> | 29 | #include <kdebug.h> |
30 | #include <kiconloader.h> | 30 | #include <kiconloader.h> |
31 | #include <kmessagebox.h> | 31 | #include <kmessagebox.h> |
32 | //US #include <klibloader.h> | 32 | //US #include <klibloader.h> |
33 | #include <krun.h> | 33 | #include <krun.h> |
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 *))); |
46 | 47 | ||
47 | connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) ); | 48 | connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) ); |
48 | 49 | ||
49 | _baseGroup = baseGroup; | 50 | _baseGroup = baseGroup; |
50 | mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed ); | 51 | mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed ); |
51 | setMainWidget(mMainWidget ); | 52 | setMainWidget(mMainWidget ); |
52 | #ifdef DESKTOP_VERSION | 53 | #ifdef DESKTOP_VERSION |
53 | resize(640,480); | 54 | resize(640,480); |
54 | #else | 55 | #else |
55 | resize(640,480); | 56 | resize(640,480); |
56 | setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480)); | 57 | setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480)); |
57 | //showMaximized(); | 58 | //showMaximized(); |
58 | #endif | 59 | #endif |
59 | 60 | ||
60 | } | 61 | } |
61 | 62 | ||
62 | KCMultiDialog::~KCMultiDialog() | 63 | KCMultiDialog::~KCMultiDialog() |
63 | { | 64 | { |
64 | //US moduleDict.setAutoDelete(true); | 65 | //US moduleDict.setAutoDelete(true); |
65 | } | 66 | } |
66 | 67 | ||
67 | void KCMultiDialog::slotDefault() | 68 | void KCMultiDialog::slotDefault() |
68 | { | 69 | { |
69 | 70 | ||
70 | int curPageIndex = mMainWidget->activePageIndex(); | 71 | int curPageIndex = mMainWidget->activePageIndex(); |
71 | 72 | ||
72 | QPtrListIterator<KCModule> it(modules); | 73 | QPtrListIterator<KCModule> it(modules); |
73 | for (; it.current(); ++it) | 74 | for (; it.current(); ++it) |
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 | } |
81 | } | 82 | } |
82 | 83 | ||
83 | } | 84 | } |
84 | 85 | ||
85 | void KCMultiDialog::slotApply() | 86 | void KCMultiDialog::slotApply() |
86 | { | 87 | { |
87 | qDebug("KCMultiDialog::slotApply clicked"); | 88 | 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(); |
95 | 96 | ||
96 | } | 97 | } |
97 | 98 | ||
98 | 99 | ||
99 | void KCMultiDialog::slotOk() | 100 | void KCMultiDialog::slotOk() |
100 | { | 101 | { |
101 | qDebug("KCMultiDialog::slotOk clicked"); | 102 | 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(); |
109 | } | 110 | } |
110 | 111 | ||
111 | void KCMultiDialog::slotHelp() | 112 | void KCMultiDialog::slotHelp() |
112 | { | 113 | { |
113 | /*US | 114 | /*US |
114 | KURL url( KURL("help:/"), _docPath ); | 115 | KURL url( KURL("help:/"), _docPath ); |
115 | 116 | ||
116 | if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") { | 117 | if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") { |
117 | KProcess process; | 118 | KProcess process; |
118 | process << "khelpcenter" | 119 | process << "khelpcenter" |
119 | << url.url(); | 120 | << url.url(); |
120 | process.start(KProcess::DontCare); | 121 | process.start(KProcess::DontCare); |
121 | process.detach(); | 122 | process.detach(); |
122 | } else { | 123 | } else { |
123 | new KRun(url); | 124 | new KRun(url); |
124 | } | 125 | } |
125 | */ | 126 | */ |
126 | } | 127 | } |
127 | 128 | ||
128 | void KCMultiDialog::clientChanged(bool state) | 129 | void KCMultiDialog::clientChanged(bool state) |
129 | { | 130 | { |
130 | enableButton(Apply, state); | 131 | enableButton(Apply, state); |
131 | } | 132 | } |
132 | 133 | ||
133 | /*US | 134 | /*US |
134 | void KCMultiDialog::addModule(const QString& path, bool withfallback) | 135 | void KCMultiDialog::addModule(const QString& path, bool withfallback) |
135 | { | 136 | { |
136 | kdDebug(1208) << "KCMultiDialog::addModule " << path << endl; | 137 | kdDebug(1208) << "KCMultiDialog::addModule " << path << endl; |
137 | 138 | ||
138 | KCModuleInfo info(path, _baseGroup); | 139 | KCModuleInfo info(path, _baseGroup); |
139 | 140 | ||
140 | QHBox* page = addHBoxPage(info.moduleName(), info.comment(), | 141 | QHBox* page = addHBoxPage(info.moduleName(), info.comment(), |
141 | KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium)); | 142 | KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium)); |
142 | if(!page) { | 143 | if(!page) { |
143 | KCModuleLoader::unloadModule(info); | 144 | KCModuleLoader::unloadModule(info); |
144 | return; | 145 | return; |
145 | } | 146 | } |
146 | moduleDict.insert(page, new LoadInfo(path, withfallback)); | 147 | moduleDict.insert(page, new LoadInfo(path, withfallback)); |
147 | if (modules.isEmpty()) | 148 | if (modules.isEmpty()) |
148 | slotAboutToShow(page); | 149 | slotAboutToShow(page); |
149 | } | 150 | } |
150 | */ | 151 | */ |
151 | QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename ) | 152 | QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename ) |
152 | { | 153 | { |
153 | QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() ); | 154 | QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() ); |
154 | return page; | 155 | return page; |
155 | 156 | ||
156 | } | 157 | } |
157 | //US special method for microkde. We dop noty want to load everything dynamically. | 158 | //US special method for microkde. We dop noty want to load everything dynamically. |
158 | void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname) | 159 | void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname) |
159 | { | 160 | { |
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 | } |
166 | 169 | ||
167 | void KCMultiDialog::slotAboutToShow(QWidget *page) | 170 | void KCMultiDialog::slotAboutToShow(QWidget *page) |
168 | { | 171 | { |
169 | /*US | 172 | /*US |
170 | LoadInfo *loadInfo = moduleDict[page]; | 173 | LoadInfo *loadInfo = moduleDict[page]; |
171 | if (!loadInfo) | 174 | if (!loadInfo) |
172 | return; | 175 | return; |
173 | 176 | ||
174 | QApplication::setOverrideCursor(Qt::WaitCursor); | 177 | QApplication::setOverrideCursor(Qt::WaitCursor); |
175 | 178 | ||
176 | moduleDict.remove(page); | 179 | moduleDict.remove(page); |
177 | 180 | ||
178 | KCModuleInfo info(loadInfo->path, _baseGroup); | 181 | KCModuleInfo info(loadInfo->path, _baseGroup); |
179 | 182 | ||
180 | KCModule *module = KCModuleLoader::loadModule(info, loadInfo->withfallback); | 183 | KCModule *module = KCModuleLoader::loadModule(info, loadInfo->withfallback); |
181 | 184 | ||
182 | if (!module) | 185 | if (!module) |
183 | { | 186 | { |
184 | QApplication::restoreOverrideCursor(); | 187 | QApplication::restoreOverrideCursor(); |
185 | KCModuleLoader::showLastLoaderError(this); | 188 | KCModuleLoader::showLastLoaderError(this); |
186 | delete loadInfo; | 189 | delete loadInfo; |
187 | return; | 190 | return; |
188 | } | 191 | } |
189 | 192 | ||
190 | module->reparent(page,0,QPoint(0,0),true); | 193 | module->reparent(page,0,QPoint(0,0),true); |
191 | connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); | 194 | connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); |
192 | //setHelp( docpath, QString::null ); | 195 | //setHelp( docpath, QString::null ); |
193 | _docPath = info.docPath(); | 196 | _docPath = info.docPath(); |
194 | modules.append(module); | 197 | modules.append(module); |
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 | |||
@@ -1,147 +1,149 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (c) 2000 Matthias Elter <elter@kde.org> | 2 | Copyright (c) 2000 Matthias Elter <elter@kde.org> |
3 | Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org> | 3 | Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #ifndef KCMULTIDIALOG_H | 22 | #ifndef KCMULTIDIALOG_H |
23 | #define KCMULTIDIALOG_H | 23 | #define KCMULTIDIALOG_H |
24 | 24 | ||
25 | #include <qptrlist.h> | 25 | #include <qptrlist.h> |
26 | #include <qptrdict.h> | 26 | #include <qptrdict.h> |
27 | 27 | ||
28 | #include <kdialogbase.h> | 28 | #include <kdialogbase.h> |
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 |
35 | * | 36 | * |
36 | * @short A method that offers a @ref KDialogBase containing arbitrary | 37 | * @short A method that offers a @ref KDialogBase containing arbitrary |
37 | * KControl Modules. | 38 | * KControl Modules. |
38 | * | 39 | * |
39 | * @author Matthias Elter <elter@kde.org>, Daniel Molkentin <molkentin@kde.org> | 40 | * @author Matthias Elter <elter@kde.org>, Daniel Molkentin <molkentin@kde.org> |
40 | * @since 3.2 | 41 | * @since 3.2 |
41 | */ | 42 | */ |
42 | class KCMultiDialog : public KDialogBase | 43 | class KCMultiDialog : public KDialogBase |
43 | { | 44 | { |
44 | Q_OBJECT | 45 | Q_OBJECT |
45 | 46 | ||
46 | public: | 47 | public: |
47 | /** | 48 | /** |
48 | * Constructs a new KCMultiDialog | 49 | * Constructs a new KCMultiDialog |
49 | * | 50 | * |
50 | * @param parent The parent Widget | 51 | * @param parent The parent Widget |
51 | * @param name The widget name | 52 | * @param name The widget name |
52 | * @param baseGroup The baseGroup, if you want to call a module out of | 53 | * @param baseGroup The baseGroup, if you want to call a module out of |
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 | ||
60 | /** | 61 | /** |
61 | * Destructor | 62 | * Destructor |
62 | **/ | 63 | **/ |
63 | virtual ~KCMultiDialog(); | 64 | virtual ~KCMultiDialog(); |
64 | 65 | ||
65 | /** | 66 | /** |
66 | * Add a module. | 67 | * Add a module. |
67 | * | 68 | * |
68 | * @param module Specify the name of the module that is to be added | 69 | * @param module Specify the name of the module that is to be added |
69 | * to the list of modules the dialog will show. | 70 | * to the list of modules the dialog will show. |
70 | * | 71 | * |
71 | * @param withfallback Try harder to load the module. Might result | 72 | * @param withfallback Try harder to load the module. Might result |
72 | * in the module appearing outside the dialog. | 73 | * in the module appearing outside the dialog. |
73 | **/ | 74 | **/ |
74 | //US void addModule(const QString& module, bool withfallback=true); | 75 | //US void addModule(const QString& module, bool withfallback=true); |
75 | 76 | ||
76 | 77 | ||
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 |
86 | * You can reimplement it if needed. | 87 | * You can reimplement it if needed. |
87 | * | 88 | * |
88 | * @note Make sure you call the original implementation! | 89 | * @note Make sure you call the original implementation! |
89 | **/ | 90 | **/ |
90 | virtual void slotDefault(); | 91 | virtual void slotDefault(); |
91 | 92 | ||
92 | /** | 93 | /** |
93 | * This slot is called when the user presses the "Apply" Button | 94 | * This slot is called when the user presses the "Apply" Button |
94 | * You can reimplement it if needed | 95 | * You can reimplement it if needed |
95 | * | 96 | * |
96 | * @note Make sure you call the original implementation! | 97 | * @note Make sure you call the original implementation! |
97 | **/ | 98 | **/ |
98 | virtual void slotApply(); | 99 | virtual void slotApply(); |
99 | 100 | ||
100 | /** | 101 | /** |
101 | * This slot is called when the user presses the "OK" Button | 102 | * This slot is called when the user presses the "OK" Button |
102 | * You can reimplement it if needed | 103 | * You can reimplement it if needed |
103 | * | 104 | * |
104 | * @note Make sure you call the original implementation! | 105 | * @note Make sure you call the original implementation! |
105 | **/ | 106 | **/ |
106 | virtual void slotOk(); | 107 | virtual void slotOk(); |
107 | 108 | ||
108 | /** | 109 | /** |
109 | * This slot is called when the user presses the "Help" Button | 110 | * This slot is called when the user presses the "Help" Button |
110 | * You can reimplement it if needed | 111 | * You can reimplement it if needed |
111 | * | 112 | * |
112 | * @note Make sure you call the original implementation! | 113 | * @note Make sure you call the original implementation! |
113 | **/ | 114 | **/ |
114 | virtual void slotHelp(); | 115 | virtual void slotHelp(); |
115 | 116 | ||
116 | private slots: | 117 | private slots: |
117 | 118 | ||
118 | void slotAboutToShow(QWidget *); | 119 | void slotAboutToShow(QWidget *); |
119 | 120 | ||
120 | void clientChanged(bool state); | 121 | void clientChanged(bool state); |
121 | 122 | ||
122 | private: | 123 | private: |
123 | /*US | 124 | /*US |
124 | struct LoadInfo { | 125 | struct LoadInfo { |
125 | LoadInfo(const QString &_path, bool _withfallback) | 126 | LoadInfo(const QString &_path, bool _withfallback) |
126 | : path(_path), withfallback(_withfallback) | 127 | : path(_path), withfallback(_withfallback) |
127 | { } | 128 | { } |
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; |
145 | }; | 147 | }; |
146 | 148 | ||
147 | #endif //KCMULTIDIALOG_H | 149 | #endif //KCMULTIDIALOG_H |
diff --git a/microkde/microkdeE.pro b/microkde/microkdeE.pro index b664c9a..06b288b 100644 --- a/microkde/microkdeE.pro +++ b/microkde/microkdeE.pro | |||
@@ -66,107 +66,109 @@ osmartpointer.h \ | |||
66 | kdeui/kbuttonbox.h \ | 66 | kdeui/kbuttonbox.h \ |
67 | kdeui/klistbox.h \ | 67 | kdeui/klistbox.h \ |
68 | kdeui/klistview.h \ | 68 | kdeui/klistview.h \ |
69 | kdeui/kjanuswidget.h \ | 69 | kdeui/kjanuswidget.h \ |
70 | kdeui/kseparator.h \ | 70 | kdeui/kseparator.h \ |
71 | kdeui/kmainwindow.h \ | 71 | kdeui/kmainwindow.h \ |
72 | kdeui/knuminput.h \ | 72 | kdeui/knuminput.h \ |
73 | kdeui/knumvalidator.h \ | 73 | kdeui/knumvalidator.h \ |
74 | kdeui/ksqueezedtextlabel.h \ | 74 | kdeui/ksqueezedtextlabel.h \ |
75 | kdeui/ktoolbar.h \ | 75 | kdeui/ktoolbar.h \ |
76 | kdeui/ktoolbarbutton.h \ | 76 | kdeui/ktoolbarbutton.h \ |
77 | kdeui/ktoolbarhandler.h \ | 77 | kdeui/ktoolbarhandler.h \ |
78 | kdeui/kxmlguiclient.h \ | 78 | kdeui/kxmlguiclient.h \ |
79 | kio/job.h \ | 79 | kio/job.h \ |
80 | kio/kio/kdirwatch.h \ | 80 | kio/kio/kdirwatch.h \ |
81 | kio/kio/kdirwatch_p.h \ | 81 | kio/kio/kdirwatch_p.h \ |
82 | kio/kfile/kurlrequester.h \ | 82 | kio/kfile/kurlrequester.h \ |
83 | kresources/resource.h \ | 83 | kresources/resource.h \ |
84 | kresources/factory.h \ | 84 | kresources/factory.h \ |
85 | kresources/managerimpl.h \ | 85 | kresources/managerimpl.h \ |
86 | kresources/manager.h \ | 86 | kresources/manager.h \ |
87 | kresources/selectdialog.h \ | 87 | kresources/selectdialog.h \ |
88 | kresources/configpage.h \ | 88 | kresources/configpage.h \ |
89 | kresources/configwidget.h \ | 89 | kresources/configwidget.h \ |
90 | kresources/configdialog.h \ | 90 | kresources/configdialog.h \ |
91 | kresources/kcmkresources.h \ | 91 | kresources/kcmkresources.h \ |
92 | kresources/syncwidget.h \ | 92 | kresources/syncwidget.h \ |
93 | kdecore/kmdcodec.h \ | 93 | kdecore/kmdcodec.h \ |
94 | kdecore/kconfigbase.h \ | 94 | kdecore/kconfigbase.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 \ |
101 | kdecore/kstringhandler.h \ | 102 | kdecore/kstringhandler.h \ |
102 | kdecore/kshortcut.h \ | 103 | kdecore/kshortcut.h \ |
103 | kutils/kcmultidialog.h | 104 | kutils/kcmultidialog.h |
104 | 105 | ||
105 | 106 | ||
106 | 107 | ||
107 | 108 | ||
108 | SOURCES = \ | 109 | SOURCES = \ |
109 | KDGanttMinimizeSplitter.cpp \ | 110 | KDGanttMinimizeSplitter.cpp \ |
110 | kapplication.cpp \ | 111 | kapplication.cpp \ |
111 | kcalendarsystem.cpp \ | 112 | kcalendarsystem.cpp \ |
112 | kcalendarsystemgregorian.cpp \ | 113 | kcalendarsystemgregorian.cpp \ |
113 | kcolorbutton.cpp \ | 114 | kcolorbutton.cpp \ |
114 | kcolordialog.cpp \ | 115 | kcolordialog.cpp \ |
115 | kconfig.cpp \ | 116 | kconfig.cpp \ |
116 | kdatetbl.cpp \ | 117 | kdatetbl.cpp \ |
117 | kdialog.cpp \ | 118 | kdialog.cpp \ |
118 | kdialogbase.cpp \ | 119 | kdialogbase.cpp \ |
119 | keditlistbox.cpp \ | 120 | keditlistbox.cpp \ |
120 | kemailsettings.cpp \ | 121 | kemailsettings.cpp \ |
121 | kfontdialog.cpp \ | 122 | kfontdialog.cpp \ |
122 | kfiledialog.cpp \ | 123 | kfiledialog.cpp \ |
123 | kglobal.cpp \ | 124 | kglobal.cpp \ |
124 | kglobalsettings.cpp \ | 125 | kglobalsettings.cpp \ |
125 | kiconloader.cpp \ | 126 | kiconloader.cpp \ |
126 | kmessagebox.cpp \ | 127 | kmessagebox.cpp \ |
127 | kprocess.cpp \ | 128 | kprocess.cpp \ |
128 | krun.cpp \ | 129 | krun.cpp \ |
129 | ksystemtray.cpp \ | 130 | ksystemtray.cpp \ |
130 | ktempfile.cpp \ | 131 | ktempfile.cpp \ |
131 | kurl.cpp \ | 132 | kurl.cpp \ |
132 | ktextedit.cpp \ | 133 | ktextedit.cpp \ |
133 | ofileselector_p.cpp \ | 134 | ofileselector_p.cpp \ |
134 | ofontselector.cpp \ | 135 | ofontselector.cpp \ |
135 | oprocctrl.cpp \ | 136 | oprocctrl.cpp \ |
136 | oprocess.cpp \ | 137 | oprocess.cpp \ |
137 | kdecore/kcatalogue.cpp \ | 138 | kdecore/kcatalogue.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 \ |
144 | kdeui/kaction.cpp \ | 146 | kdeui/kaction.cpp \ |
145 | kdeui/kactionclasses.cpp \ | 147 | kdeui/kactionclasses.cpp \ |
146 | kdeui/kactioncollection.cpp \ | 148 | kdeui/kactioncollection.cpp \ |
147 | kdeui/kbuttonbox.cpp \ | 149 | kdeui/kbuttonbox.cpp \ |
148 | kdeui/kcmodule.cpp \ | 150 | kdeui/kcmodule.cpp \ |
149 | kdeui/kguiitem.cpp \ | 151 | kdeui/kguiitem.cpp \ |
150 | kdeui/kjanuswidget.cpp \ | 152 | kdeui/kjanuswidget.cpp \ |
151 | kdeui/klistbox.cpp \ | 153 | kdeui/klistbox.cpp \ |
152 | kdeui/klistview.cpp \ | 154 | kdeui/klistview.cpp \ |
153 | kdeui/kmainwindow.cpp \ | 155 | kdeui/kmainwindow.cpp \ |
154 | kdeui/knuminput.cpp \ | 156 | kdeui/knuminput.cpp \ |
155 | kdeui/knumvalidator.cpp \ | 157 | kdeui/knumvalidator.cpp \ |
156 | kdeui/kseparator.cpp \ | 158 | kdeui/kseparator.cpp \ |
157 | kdeui/kstdaction.cpp \ | 159 | kdeui/kstdaction.cpp \ |
158 | kdeui/ksqueezedtextlabel.cpp \ | 160 | kdeui/ksqueezedtextlabel.cpp \ |
159 | kdeui/ktoolbar.cpp \ | 161 | kdeui/ktoolbar.cpp \ |
160 | kdeui/ktoolbarbutton.cpp \ | 162 | kdeui/ktoolbarbutton.cpp \ |
161 | kdeui/ktoolbarhandler.cpp \ | 163 | kdeui/ktoolbarhandler.cpp \ |
162 | kdeui/kxmlguiclient.cpp \ | 164 | kdeui/kxmlguiclient.cpp \ |
163 | kio/kfile/kurlrequester.cpp \ | 165 | kio/kfile/kurlrequester.cpp \ |
164 | kio/kio/kdirwatch.cpp \ | 166 | kio/kio/kdirwatch.cpp \ |
165 | kresources/configpage.cpp \ | 167 | kresources/configpage.cpp \ |
166 | kresources/configdialog.cpp \ | 168 | kresources/configdialog.cpp \ |
167 | kresources/configwidget.cpp \ | 169 | kresources/configwidget.cpp \ |
168 | kresources/factory.cpp \ | 170 | kresources/factory.cpp \ |
169 | kresources/kcmkresources.cpp \ | 171 | kresources/kcmkresources.cpp \ |
170 | kresources/managerimpl.cpp \ | 172 | kresources/managerimpl.cpp \ |
171 | kresources/resource.cpp \ | 173 | kresources/resource.cpp \ |
172 | kresources/selectdialog.cpp \ | 174 | kresources/selectdialog.cpp \ |