summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kcmconfigs
authorulf69 <ulf69>2004-09-21 19:54:39 (UTC)
committer ulf69 <ulf69>2004-09-21 19:54:39 (UTC)
commit618dec7bf4371c2085048cc1f95a93220bc8a233 (patch) (side-by-side diff)
treedf5e3e47a417400fa9f6871912eda6558294d9b4 /kaddressbook/kcmconfigs
parent186ee062d9169860fbab1613ca21b956c69296a6 (diff)
downloadkdepimpi-618dec7bf4371c2085048cc1f95a93220bc8a233.zip
kdepimpi-618dec7bf4371c2085048cc1f95a93220bc8a233.tar.gz
kdepimpi-618dec7bf4371c2085048cc1f95a93220bc8a233.tar.bz2
modified configdialog to work properly with global configwidget from (libkdepim)
Diffstat (limited to 'kaddressbook/kcmconfigs') (more/less context) (ignore whitespace changes)
-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
4 files changed, 24 insertions, 46 deletions
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
@@ -82,14 +82,14 @@ class ExtensionItem : public QCheckListItem
QString mComment;
#endif //KAB_EMBEDDED
};
-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,
KDialog::spacingHint() );
QTabWidget *tabWidget = new QTabWidget( this );
topLayout->addWidget( tabWidget );
@@ -170,16 +170,15 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
mAddresseeWidget = new AddresseeWidget( this );
tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
}
-
-void KABConfigWidget::restoreSettings(KABPrefs* prefs)
+void KABConfigWidget::usrReadConfig()
{
-//US prefs was KABPrefs::instance() before
+ KABPrefs* prefs = KABPrefs::instance();
bool blocked = signalsBlocked();
blockSignals( true );
mNameParsing->setChecked( prefs->mAutomaticNameParsing );
mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick );
@@ -190,45 +189,28 @@ void KABConfigWidget::restoreSettings(KABPrefs* prefs)
mAddresseeWidget->restoreSettings();
restoreExtensionSettings();
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();
prefs->mSearchWithReturn = mSearchReturnBox->isChecked();
prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked();
prefs->mAskForQuit = mAskForQuit->isChecked();
mAddresseeWidget->saveSettings();
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 );
}
void KABConfigWidget::restoreExtensionSettings()
{
QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions;
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
@@ -21,40 +21,36 @@
without including the source code for Qt in the source distribution.
*/
#ifndef KABCONFIGWIDGET_H
#define KABCONFIGWIDGET_H
-#include <qwidget.h>
+#include <kprefswidget.h>
class QCheckBox;
class QListViewItem;
class QPushButton;
class QComboBox;
class QLineEdit;
class KListView;
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();
private slots:
void configureExtension();
void selectionChanged( QListViewItem* );
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
@@ -36,43 +36,43 @@
#include "kabprefs.h"
#include "kprefs.h"
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 );
layout->setMargin( 0 );
connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) );
}
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();
}
#ifndef KAB_EMBEDDED
const KAboutData* KCMKabConfig::aboutData() const
{
KAboutData *about = new KAboutData( I18N_NOOP( "kcmkabconfig" ),
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
@@ -31,13 +31,13 @@ class KABPrefs;
class KCMKabConfig : public KCModule
{
Q_OBJECT
public:
- KCMKabConfig( KABPrefs* prefs, QWidget *parent = 0, const char *name = 0 );
+ KCMKabConfig( QWidget *parent = 0, const char *name = 0 );
virtual void load();
virtual void save();
virtual void defaults();
private: