summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/kcmodule.h9
-rw-r--r--microkde/kutils/kcmultidialog.cpp13
-rw-r--r--microkde/kutils/kcmultidialog.h20
-rw-r--r--microkde/microkdeE.pro2
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
@@ -21,16 +21,17 @@
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;
28class KCModulePrivate; 28class KCModulePrivate;
29class 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 *
@@ -100,48 +101,48 @@ public:
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 *
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
@@ -29,22 +29,23 @@
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
40KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal) 41KCMultiDialog::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 );
@@ -69,45 +70,45 @@ void KCMultiDialog::slotDefault()
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
85void KCMultiDialog::slotApply() 86void KCMultiDialog::slotApply()
86{ 87{
87qDebug("KCMultiDialog::slotApply clicked"); 88qDebug("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
99void KCMultiDialog::slotOk() 100void KCMultiDialog::slotOk()
100{ 101{
101qDebug("KCMultiDialog::slotOk clicked"); 102qDebug("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
111void KCMultiDialog::slotHelp() 112void KCMultiDialog::slotHelp()
112{ 113{
113/*US 114/*US
@@ -155,16 +156,18 @@ QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename )
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.
158void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname) 159void 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
167void KCMultiDialog::slotAboutToShow(QWidget *page) 170void KCMultiDialog::slotAboutToShow(QWidget *page)
168{ 171{
169/*US 172/*US
170 LoadInfo *loadInfo = moduleDict[page]; 173 LoadInfo *loadInfo = moduleDict[page];
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
@@ -24,16 +24,17 @@
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
32class 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>
@@ -48,17 +49,17 @@ public:
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
@@ -72,19 +73,19 @@ public:
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
83protected slots: 84protected 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();
@@ -123,25 +124,26 @@ 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
@@ -90,16 +90,17 @@ osmartpointer.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
@@ -133,16 +134,17 @@ KDGanttMinimizeSplitter.cpp \
133 ofileselector_p.cpp \ 134 ofileselector_p.cpp \
134 ofontselector.cpp \ 135 ofontselector.cpp \
135oprocctrl.cpp \ 136oprocctrl.cpp \
136oprocess.cpp \ 137oprocess.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 \