summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kcmconfigs
Side-by-side diff
Diffstat (limited to 'kaddressbook/kcmconfigs') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp110
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.h10
-rw-r--r--kaddressbook/kcmconfigs/kcmkabconfig.cpp20
-rw-r--r--kaddressbook/kcmconfigs/kcmkabconfig.h14
4 files changed, 27 insertions, 127 deletions
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 1bac26f..b5309c0 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -153,105 +153,18 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
- // mailclient page
- QWidget *mailclientPage = new QWidget( this );
- layout = new QVBoxLayout( mailclientPage, KDialog::marginHintSmall(),
- KDialog::spacingHintSmall() );
-
- groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), mailclientPage );
- boxLayout = new QVBoxLayout( groupBox->layout() );
- boxLayout->setAlignment( Qt::AlignTop );
-// boxLayout->setMargin(KDialog::marginHintSmall() );
-// groupBox->layout()->setMargin(KDialog::marginHintSmall()) ;
-// groupBox->layout()->setSpacing(KDialog::spacingHintSmall());
-// boxLayout->setSpacing( KDialog::spacingHintSmall() );
-
- mEmailClient = new QComboBox( groupBox );
- mEmailClient->insertItem( i18n("OM/Pi"), KABPrefs::OMPI );
- mEmailClient->insertItem( i18n("Qtopia mail"), KABPrefs::QTOPIA );
- mEmailClient->insertItem( i18n("Opie mail"), KABPrefs::OPIE );
- mEmailClient->insertItem( i18n("Other"), KABPrefs::OTHER );
- boxLayout->addWidget( mEmailClient );
-
- connect( mEmailClient, SIGNAL( activated( int ) ),
- this, SLOT (emailclient_changed( int ) ) );
-
- QLabel* lab = new QLabel( i18n("Channel:"), groupBox);
- boxLayout->addWidget( lab );
- mEmailChannel = new QLineEdit(groupBox);
- mEmailChannel->setReadOnly(true);
- boxLayout->addWidget( mEmailChannel );
-
- layout->addWidget( groupBox );
- tabWidget->addTab( mailclientPage, i18n( "Mail" ) );
-
-
-
}
-
-void KABConfigWidget::emailclient_changed( int newClient )
+void KABConfigWidget::restoreSettings(KABPrefs* prefs)
{
- if (newClient == KABPrefs::OTHER)
- mEmailChannel->setReadOnly(false);
- else
- mEmailChannel->setReadOnly(true);
-
- QString opiepath = QString::fromLatin1( getenv("OPIEDIR") );
- QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") );
-
- if (opiepath.isEmpty())
- opiepath = qtopiapath;
-
- QString text = mEmailChannel->text();
-
- if (newClient == KABPrefs::OPIE)
- {
- if ( QFile::exists( opiepath + "/bin/opiemail" ))
- text = "QPE/Application/opiemail";
- else
- text = "FILENOTFOUND: " + opiepath + "/bin/opiemail";
- }
- else if (newClient == KABPrefs::QTOPIA)
- {
- if ( QFile::exists( qtopiapath + "/bin/qtmail" ))
- text = "QPE/Application/qtmail";
- else
- text = "FILENOTFOUND: " + qtopiapath + "/bin/qtmail";
+//US prefs was KABPrefs::instance() before
- }
- else if (newClient == KABPrefs::OMPI)
- {
- if ( QFile::exists( qtopiapath + "/bin/ompi" ))
- text = "QPE/Application/ompi";
- else if ( QFile::exists( opiepath + "/bin/ompi" ))
- text = "QPE/Application/ompi";
- else
- text = "FILENOTFOUND: " + qtopiapath + "/bin/ompi";
-
- }
- else
- {
- //do nothing if we choosed other
- }
-
- mEmailChannel->setText( text );
-
-
-}
-
-
-void KABConfigWidget::restoreSettings()
-{
bool blocked = signalsBlocked();
blockSignals( true );
- mNameParsing->setChecked( KABPrefs::instance()->mAutomaticNameParsing );
- mViewsSingleClickBox->setChecked( KABPrefs::instance()->mHonorSingleClick );
-
- mEmailChannel->setText( KABPrefs::instance()->mEmailChannel );
- mEmailClient->setCurrentItem(KABPrefs::instance()->mEmailClient);
+ mNameParsing->setChecked( prefs->mAutomaticNameParsing );
+ mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick );
mAddresseeWidget->restoreSettings();
@@ -262,13 +175,10 @@ void KABConfigWidget::restoreSettings()
emit changed( false );
}
-void KABConfigWidget::saveSettings()
+void KABConfigWidget::saveSettings(KABPrefs* prefs)
{
- KABPrefs::instance()->mAutomaticNameParsing = mNameParsing->isChecked();
- KABPrefs::instance()->mHonorSingleClick = mViewsSingleClickBox->isChecked();
-
- KABPrefs::instance()->mEmailClient = mEmailClient->currentItem();
- KABPrefs::instance()->mEmailChannel = mEmailChannel->text();
+ prefs->mAutomaticNameParsing = mNameParsing->isChecked();
+ prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked();
mAddresseeWidget->saveSettings();
@@ -278,15 +188,11 @@ void KABConfigWidget::saveSettings()
emit changed( false );
}
-void KABConfigWidget::defaults()
+void KABConfigWidget::defaults(KABPrefs* prefs)
{
mNameParsing->setChecked( true );
mViewsSingleClickBox->setChecked( false );
- mEmailClient->setCurrentItem(KABPrefs::OMPI);
- emailclient_changed( KABPrefs::OMPI );
-
-
emit changed( true );
}
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h
index 9d1363b..8c0c436 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.h
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.h
@@ -32,6 +32,7 @@ class QPushButton;
class QComboBox;
class QLineEdit;
class KListView;
+class KABPrefs;
class AddresseeWidget;
@@ -42,9 +43,9 @@ class KABConfigWidget : public QWidget
public:
KABConfigWidget( QWidget *parent, const char *name = 0 );
- void restoreSettings();
- void saveSettings();
- void defaults();
+ void restoreSettings(KABPrefs* prefs);
+ void saveSettings(KABPrefs* prefs);
+ void defaults(KABPrefs* prefs);
signals:
void changed( bool );
@@ -58,7 +59,6 @@ class KABConfigWidget : public QWidget
void configureExtension();
void selectionChanged( QListViewItem* );
void itemClicked( QListViewItem* );
- void emailclient_changed( int newClient );
private:
void restoreExtensionSettings();
@@ -69,8 +69,6 @@ class KABConfigWidget : public QWidget
QCheckBox *mNameParsing;
QCheckBox *mViewsSingleClickBox;
QPushButton *mConfigureButton;
- QComboBox* mEmailClient;
- QLineEdit* mEmailChannel;
AddresseeWidget *mAddresseeWidget;
};
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.cpp b/kaddressbook/kcmconfigs/kcmkabconfig.cpp
index a278042..26398f8 100644
--- a/kaddressbook/kcmconfigs/kcmkabconfig.cpp
+++ b/kaddressbook/kcmconfigs/kcmkabconfig.cpp
@@ -27,13 +27,16 @@
#include <kaboutdata.h>
#endif //KAB_EMBEDDED
#include <kdebug.h>
-#include <klocale.h>
-#include <stdlib.h>
+//#include <klocale.h>
+//#include <stdlib.h>
#include "kabconfigwidget.h"
#include "kcmkabconfig.h"
+#include "kabprefs.h"
+#include "kprefs.h"
+
extern "C"
{
KCModule *create_kabconfig( QWidget *parent, const char * ) {
@@ -52,22 +55,21 @@ KCMKabConfig::KCMKabConfig( QWidget *parent, const char *name )
layout->setMargin( 0 );
connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) );
- load();
}
-void KCMKabConfig::load()
+void KCMKabConfig::load(KPrefs* prefs)
{
- mConfigWidget->restoreSettings();
+ mConfigWidget->restoreSettings((KABPrefs*)prefs);
}
-void KCMKabConfig::save()
+void KCMKabConfig::save(KPrefs* prefs)
{
- mConfigWidget->saveSettings();
+ mConfigWidget->saveSettings((KABPrefs*)prefs);
}
-void KCMKabConfig::defaults()
+void KCMKabConfig::defaults(KPrefs* prefs)
{
- mConfigWidget->defaults();
+ mConfigWidget->defaults((KABPrefs*)prefs);
}
#ifndef KAB_EMBEDDED
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.h b/kaddressbook/kcmconfigs/kcmkabconfig.h
index be345b8..b4858c1 100644
--- a/kaddressbook/kcmconfigs/kcmkabconfig.h
+++ b/kaddressbook/kcmconfigs/kcmkabconfig.h
@@ -27,10 +27,7 @@
#include <kcmodule.h>
class KABConfigWidget;
-
-#ifndef KAB_EMBEDDED
-class KAboutData;
-#endif //KAB_EMBEDDED
+class KPrefs;
class KCMKabConfig : public KCModule
{
@@ -39,12 +36,9 @@ class KCMKabConfig : public KCModule
public:
KCMKabConfig( QWidget *parent = 0, const char *name = 0 );
- virtual void load();
- virtual void save();
- virtual void defaults();
-#ifndef KAB_EMBEDDED
- virtual const KAboutData* aboutData() const;
-#endif //KAB_EMBEDDED
+ virtual void load(KPrefs* prefs);
+ virtual void save(KPrefs* prefs);
+ virtual void defaults(KPrefs* prefs);
private:
KABConfigWidget *mConfigWidget;