-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 @@ -20,87 +20,95 @@ */ #include "kcmodule.h" //US#include <kinstance.h> #include <kglobal.h> #include <klocale.h> #include <kdebug.h> class KCModulePrivate { public: //US KInstance *_instance; QString _rootOnlyMsg; bool _useRootOnlyMsg; bool _hasOwnInstance; + KPrefs* _prefs; }; -KCModule::KCModule(QWidget *parent, const char *name, const QStringList &) +KCModule::KCModule(KPrefs* prefs, QWidget *parent, const char *name, const QStringList &) : QWidget(parent, name), _btn(Help|Default|Apply) { kdDebug() << "KCModule " << name << endl; d = new KCModulePrivate; d->_useRootOnlyMsg = true; -/*US + d->_prefs = prefs; +/*US d->_instance = new KInstance(name); if (name && strlen(name)) { d->_instance = new KInstance(name); KGlobal::locale()->insertCatalogue(name); } else d->_instance = new KInstance("kcmunnamed"); -*/ +*/ d->_hasOwnInstance = true; //US KGlobal::setActiveInstance(this->instance()); } /*US KCModule::KCModule(KInstance *instance, QWidget *parent, const QStringList & ) : QWidget(parent, instance ? instance->instanceName().data() : 0), _btn(Help|Default|Apply) { kdDebug() << "KCModule instance " << (instance ? instance->instanceName().data() : "none") << endl; d = new KCModulePrivate; d->_useRootOnlyMsg = true; d->_instance = instance; KGlobal::locale()->insertCatalogue(instance->instanceName()); d->_hasOwnInstance = false; KGlobal::setActiveInstance(this->instance()); } */ KCModule::~KCModule() { /*US if (d->_hasOwnInstance) delete d->_instance; -*/ +*/ delete d; } void KCModule::setRootOnlyMsg(const QString& msg) { d->_rootOnlyMsg = msg; } QString KCModule::rootOnlyMsg() const { return d->_rootOnlyMsg; } void KCModule::setUseRootOnlyMsg(bool on) { d->_useRootOnlyMsg = on; } bool KCModule::useRootOnlyMsg() const { return d->_useRootOnlyMsg; } + +KPrefs* KCModule::getPreferences() +{ + return d->_prefs; +} + /*US KInstance *KCModule::instance() const { return d->_instance; } */ void KCModule::virtual_hook( int, void* ) { /*BASE::virtual_hook( id, data );*/ } //US #include "kcmodule.moc" 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 @@ -70,87 +70,87 @@ public: * An enumeration type for the buttons used by this module. * You should only use Help, Default and Apply. The rest is obsolete. * * @see KCModule::buttons @see KCModule::setButtons */ enum Button {Help=1, Default=2, Apply=16, Reset=4, /* obsolete, do not use! */ Cancel=8, /* obsolete, do not use! */ Ok=32, /* obsolete, do not use! */ SysDefault=64 /* obsolete, do not use! */ }; /* * Base class for all KControlModules. * Make sure you have a QStringList argument in your * implementation. */ - KCModule(QWidget *parent=0, const char *name=0, const QStringList &args=QStringList() ); + KCModule(KPrefs* prefs, QWidget *parent=0, const char *name=0, const QStringList &args=QStringList() ); //US KCModule(KInstance *instance, QWidget *parent=0, const QStringList &args=QStringList() ); /* * Destroys the module. */ ~KCModule(); /** * Load the configuration data into the module. * * The load method sets the user interface elements of the * module to reflect the current settings stored in the * configuration files. * * This method is invoked whenever the module should read its configuration * (most of the times from a config file) and update the user interface. * This happens when the user clicks the "Reset" button in the control * center, to undo all of his changes and restore the currently valid * settings. NOTE that this is not called after the modules is loaded, * so you probably want to call this method in the constructor. */ - virtual void load(KPrefs* prefs) {}; + virtual void load() {}; /** * Save the configuration data. * * The save method stores the config information as shown * in the user interface in the config files. * * If necessary, this method also updates the running system, * e.g. by restarting applications. * * save is called when the user clicks "Apply" or "Ok". */ - virtual void save(KPrefs* prefs) {}; + virtual void save() {}; /** * Sets the configuration to sensible default values. * * This method is called when the user clicks the "Default" * button. It should set the display to useful values. */ - virtual void defaults(KPrefs* prefs) {}; + virtual void defaults() {}; /** * Set the configuration to system default values. * * This method is called when the user clicks the "System-Default" * button. It should set the display to the system default values. * * NOTE: The default behaviour is to call defaults(). */ - virtual void sysdefaults(KPrefs* prefs) { defaults(prefs); }; + virtual void sysdefaults() { defaults(); }; /** * Return a quick-help text. * * This method is called when the module is docked. * The quick-help text should contain a short description of the module and * links to the module's help files. You can use QML formating tags in the text. * * NOTE: Please make sure the quick help text gets translated (use i18n()). */ virtual QString quickHelp() const { return QString::null; }; /** * Returns a the KAboutData for this module * This is generally only called for the KBugReport. * Override and have it return a pointer to a constant @@ -180,32 +180,33 @@ public: * @see KCModule::setRootOnlyMsg */ QString rootOnlyMsg() const; /** * Tell if KControl should show a RootOnly message when run as * a normal user. * * In some cases, the module don't want a RootOnly message to * appear (for example if it has already one). This function * tells KControl if a RootOnly message should be shown * * @see KCModule::setUseRootOnlyMsg */ bool useRootOnlyMsg() const; + KPrefs* getPreferences(); //US KInstance *instance() const; signals: /** * Indicate that the state of the modules contents has changed. * * This signal is emitted whenever the state of the configuration * shown in the module changes. It allows the control center to * keep track of unsaved changes. * */ void changed(bool state); /** |