-rw-r--r-- | kaddressbook/kabcore.cpp | 9 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 32 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.h | 20 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kcmkabconfig.cpp | 16 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kcmkabconfig.h | 2 |
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 @@ -1284,15 +1284,10 @@ QString KABCore::getNameByPhone( const QString &phone ) 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() ), this, SLOT( configurationChanged() ) ); 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 @@ -86,6 +86,6 @@ 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 ) { QVBoxLayout *topLayout = new QVBoxLayout( this, 0, @@ -174,8 +174,7 @@ 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(); bool blocked = signalsBlocked(); @@ -194,9 +193,10 @@ void KABConfigWidget::restoreSettings(KABPrefs* prefs) blockSignals( blocked ); - emit changed( false ); } -void KABConfigWidget::saveSettings(KABPrefs* prefs) +void KABConfigWidget::usrWriteConfig() { + KABPrefs* prefs = KABPrefs::instance(); + prefs->mAutomaticNameParsing = mNameParsing->isChecked(); prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); @@ -208,23 +208,5 @@ 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 @@ -25,5 +25,5 @@ #define KABCONFIGWIDGET_H -#include <qwidget.h> +#include <kprefswidget.h> class QCheckBox; @@ -37,20 +37,16 @@ class KABPrefs; class AddresseeWidget; -class KABConfigWidget : public QWidget +class KABConfigWidget : public KPrefsWidget { Q_OBJECT 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 @@ -40,15 +40,15 @@ 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" ); } } -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 ) { //abort(); QVBoxLayout *layout = new QVBoxLayout( this ); - mConfigWidget = new KABConfigWidget( this, "mConfigWidget" ); + mConfigWidget = new KABConfigWidget( (KABPrefs*)getPreferences(), this, "KABConfigWidget" ); layout->addWidget( mConfigWidget ); layout->setSpacing( 0 ); @@ -60,15 +60,15 @@ KCMKabConfig::KCMKabConfig( KABPrefs* prefs, QWidget *parent, const char *name ) void KCMKabConfig::load() { - mConfigWidget->restoreSettings((KABPrefs*)getPreferences()); + mConfigWidget->readConfig(); } void KCMKabConfig::save() { - mConfigWidget->saveSettings((KABPrefs*)getPreferences()); + mConfigWidget->writeConfig(); } 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 @@ -35,5 +35,5 @@ class KCMKabConfig : public KCModule public: - KCMKabConfig( KABPrefs* prefs, QWidget *parent = 0, const char *name = 0 ); + KCMKabConfig( QWidget *parent = 0, const char *name = 0 ); virtual void load(); |