summaryrefslogtreecommitdiffabout
path: root/microkde
Side-by-side diff
Diffstat (limited to 'microkde') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kdeui/kcmodule.cpp10
-rw-r--r--microkde/kdeui/kcmodule.h11
-rw-r--r--microkde/kutils/kcmultidialog.cpp13
-rw-r--r--microkde/kutils/kcmultidialog.h5
4 files changed, 22 insertions, 17 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
@@ -24,32 +24,34 @@
//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;
+ 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());
}
@@ -85,22 +87,28 @@ 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
@@ -74,79 +74,79 @@ public:
*/
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; };
@@ -184,24 +184,25 @@ public:
/**
* 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.
*
diff --git a/microkde/kutils/kcmultidialog.cpp b/microkde/kutils/kcmultidialog.cpp
index c2378fb..6c82e4f 100644
--- a/microkde/kutils/kcmultidialog.cpp
+++ b/microkde/kutils/kcmultidialog.cpp
@@ -25,31 +25,30 @@
#include <qlayout.h>
#include <klocale.h>
#include <kglobal.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <kmessagebox.h>
//US #include <klibloader.h>
#include <krun.h>
#include <kprocess.h>
#include "kcmultidialog.h"
-#include "kprefs.h"
//US #include "kcmultidialog.moc"
//US #include "kcmoduleloader.h"
-KCMultiDialog::KCMultiDialog(KPrefs* prefs, const QString& baseGroup, QWidget *parent, const char *name, bool modal)
+KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal)
: KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok,
- parent, name, modal, true), mPrefs(prefs), d(0L)
+ parent, name, modal, true), d(0L)
{
enableButton(Apply, false);
//connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *)));
connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) );
_baseGroup = baseGroup;
mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed );
setMainWidget(mMainWidget );
#ifdef DESKTOP_VERSION
resize(640,480);
#else
@@ -66,53 +65,53 @@ KCMultiDialog::~KCMultiDialog()
}
void KCMultiDialog::slotDefault()
{
int curPageIndex = mMainWidget->activePageIndex();
QPtrListIterator<KCModule> it(modules);
for (; it.current(); ++it)
{
if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex)
{
- (*it)->defaults(mPrefs);
+ (*it)->defaults();
clientChanged(true);
return;
}
}
}
void KCMultiDialog::slotApply()
{
qDebug("KCMultiDialog::slotApply clicked");
QPtrListIterator<KCModule> it(modules);
for (; it.current(); ++it)
- (*it)->save(mPrefs);
+ (*it)->save();
clientChanged(false);
emit applyClicked();
}
void KCMultiDialog::slotOk()
{
qDebug("KCMultiDialog::slotOk clicked");
QPtrListIterator<KCModule> it(modules);
for (; it.current(); ++it)
- (*it)->save(mPrefs);
+ (*it)->save();
accept();
emit okClicked();
}
void KCMultiDialog::slotHelp()
{
/*US
KURL url( KURL("help:/"), _docPath );
if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") {
KProcess process;
@@ -153,25 +152,25 @@ QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename )
{
QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() );
return page;
}
//US special method for microkde. We dop noty want to load everything dynamically.
void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname)
{
modules.append(module);
connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool)));
//US
- module->load(mPrefs);
+ module->load();
}
void KCMultiDialog::slotAboutToShow(QWidget *page)
{
/*US
LoadInfo *loadInfo = moduleDict[page];
if (!loadInfo)
return;
QApplication::setOverrideCursor(Qt::WaitCursor);
diff --git a/microkde/kutils/kcmultidialog.h b/microkde/kutils/kcmultidialog.h
index a42555f..1aa66b2 100644
--- a/microkde/kutils/kcmultidialog.h
+++ b/microkde/kutils/kcmultidialog.h
@@ -20,50 +20,48 @@
*/
#ifndef KCMULTIDIALOG_H
#define KCMULTIDIALOG_H
#include <qptrlist.h>
#include <qptrdict.h>
#include <kdialogbase.h>
#include <kjanuswidget.h>
#include <kcmodule.h>
-class KPrefs;
-
/**
* A class that offers a @ref KDialogBase containing arbitrary KControl Modules
*
* @short A method that offers a @ref KDialogBase containing arbitrary
* KControl Modules.
*
* @author Matthias Elter <elter@kde.org>, Daniel Molkentin <molkentin@kde.org>
* @since 3.2
*/
class KCMultiDialog : public KDialogBase
{
Q_OBJECT
public:
/**
* Constructs a new KCMultiDialog
*
* @param parent The parent Widget
* @param name The widget name
* @param baseGroup The baseGroup, if you want to call a module out of
* kcontrol, just keep "settings"
* @param modal If you pass true here, the dialog will be modal
**/
- KCMultiDialog(KPrefs* prefs, const QString& baseGroup = QString::fromLatin1("settings"),
+ KCMultiDialog(const QString& baseGroup = QString::fromLatin1("settings"),
QWidget *parent=0, const char *name=0,
bool modal=false);
/**
* Destructor
**/
virtual ~KCMultiDialog();
/**
* Add a module.
*
* @param module Specify the name of the module that is to be added
@@ -130,20 +128,19 @@ private:
bool withfallback;
};
*/
QPtrList<KCModule> modules;
/*
QPtrDict<LoadInfo> moduleDict;
QString _docPath;
*/
QString _baseGroup;
//US
KJanusWidget* mMainWidget;
- KPrefs* mPrefs;
// For future use
class KCMultiDialogPrivate;
KCMultiDialogPrivate *d;
};
#endif //KCMULTIDIALOG_H