summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp9
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp32
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.h20
-rw-r--r--kaddressbook/kcmconfigs/kcmkabconfig.cpp16
-rw-r--r--kaddressbook/kcmconfigs/kcmkabconfig.h2
5 files changed, 26 insertions, 53 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 4ebd6a8..1b40d71 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1285,13 +1285,8 @@ void KABCore::openConfigDialog()
{
- KABPrefs* kab_prefs = KABPrefs::instance();
- KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance();
-
KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
- KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
+ KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
ConfigureDialog->addModule(kabcfg );
- KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
+ KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
ConfigureDialog->addModule(kdelibcfg );
-
-
connect( ConfigureDialog, SIGNAL( applyClicked() ),
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 0c3a199..e970c3d 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -87,4 +87,4 @@ class ExtensionItem : public QCheckListItem
-KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
- : QWidget( parent, name )
+KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name )
+ : KPrefsWidget( prefs, parent, name )
{
@@ -175,6 +175,5 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
-
-void KABConfigWidget::restoreSettings(KABPrefs* prefs)
+void KABConfigWidget::usrReadConfig()
{
-//US prefs was KABPrefs::instance() before
+ KABPrefs* prefs = KABPrefs::instance();
@@ -195,7 +194,8 @@ void KABConfigWidget::restoreSettings(KABPrefs* prefs)
- emit changed( false );
}
-void KABConfigWidget::saveSettings(KABPrefs* prefs)
+void KABConfigWidget::usrWriteConfig()
{
+ KABPrefs* prefs = KABPrefs::instance();
+
prefs->mAutomaticNameParsing = mNameParsing->isChecked();
@@ -209,21 +209,3 @@ void KABConfigWidget::saveSettings(KABPrefs* prefs)
saveExtensionSettings();
- KABPrefs::instance()->writeConfig();
- emit changed( false );
-}
-
-void KABConfigWidget::defaults(KABPrefs* prefs)
-{
- mNameParsing->setChecked( true );
- mViewsSingleClickBox->setChecked( false );
- mMultipleViewsAtOnce->setChecked( true );
- mSearchReturnBox->setChecked( true );
- mAskForQuit->setChecked (true);
-
- emit changed( true );
-}
-
-void KABConfigWidget::modified()
-{
- emit changed( true );
}
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h
index 6cd4223..1e71fd1 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.h
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.h
@@ -26,3 +26,3 @@
-#include <qwidget.h>
+#include <kprefswidget.h>
@@ -38,3 +38,3 @@ class AddresseeWidget;
-class KABConfigWidget : public QWidget
+class KABConfigWidget : public KPrefsWidget
{
@@ -43,13 +43,9 @@ class KABConfigWidget : public QWidget
public:
- KABConfigWidget( QWidget *parent, const char *name = 0 );
+ KABConfigWidget(KABPrefs *prefs, QWidget *parent, const char *name = 0 );
- void restoreSettings(KABPrefs* prefs);
- void saveSettings(KABPrefs* prefs);
- void defaults(KABPrefs* prefs);
-
- signals:
- void changed( bool );
-
- public slots:
- void modified();
+ protected:
+ /** Implement this to read custom configuration widgets. */
+ virtual void usrReadConfig();
+ /** Implement this to write custom configuration widgets. */
+ virtual void usrWriteConfig();
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.cpp b/kaddressbook/kcmconfigs/kcmkabconfig.cpp
index b460a81..cbfedbd 100644
--- a/kaddressbook/kcmconfigs/kcmkabconfig.cpp
+++ b/kaddressbook/kcmconfigs/kcmkabconfig.cpp
@@ -41,4 +41,4 @@ extern "C"
{
- KCModule *create_kabconfig( KABPrefs* prefs, QWidget *parent, const char * ) {
- return new KCMKabConfig( prefs, parent, "kcmkabconfig" );
+ KCModule *create_kabconfig( QWidget *parent, const char * ) {
+ return new KCMKabConfig( parent, "kcmkabconfig" );
}
@@ -46,4 +46,4 @@ extern "C"
-KCMKabConfig::KCMKabConfig( KABPrefs* prefs, QWidget *parent, const char *name )
- : KCModule( prefs, parent, name )
+KCMKabConfig::KCMKabConfig( QWidget *parent, const char *name )
+ : KCModule( KABPrefs::instance(), parent, name )
{
@@ -51,3 +51,3 @@ KCMKabConfig::KCMKabConfig( KABPrefs* prefs, QWidget *parent, const char *name )
QVBoxLayout *layout = new QVBoxLayout( this );
- mConfigWidget = new KABConfigWidget( this, "mConfigWidget" );
+ mConfigWidget = new KABConfigWidget( (KABPrefs*)getPreferences(), this, "KABConfigWidget" );
layout->addWidget( mConfigWidget );
@@ -61,3 +61,3 @@ void KCMKabConfig::load()
{
- mConfigWidget->restoreSettings((KABPrefs*)getPreferences());
+ mConfigWidget->readConfig();
}
@@ -66,3 +66,3 @@ void KCMKabConfig::save()
{
- mConfigWidget->saveSettings((KABPrefs*)getPreferences());
+ mConfigWidget->writeConfig();
}
@@ -71,3 +71,3 @@ void KCMKabConfig::defaults()
{
- mConfigWidget->defaults((KABPrefs*)getPreferences());
+ mConfigWidget->setDefaults();
}
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.h b/kaddressbook/kcmconfigs/kcmkabconfig.h
index 1cb6ad3..2ecbfef 100644
--- a/kaddressbook/kcmconfigs/kcmkabconfig.h
+++ b/kaddressbook/kcmconfigs/kcmkabconfig.h
@@ -36,3 +36,3 @@ class KCMKabConfig : public KCModule
public:
- KCMKabConfig( KABPrefs* prefs, QWidget *parent = 0, const char *name = 0 );
+ KCMKabConfig( QWidget *parent = 0, const char *name = 0 );