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.cpp109
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.h8
2 files changed, 115 insertions, 2 deletions
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 38c7946..1bac26f 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -26,8 +26,12 @@
#include <qgroupbox.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qtabwidget.h>
+#include <qcombobox.h>
+#include <qlineedit.h>
+#include <qlabel.h>
+#include <qfile.h>
#include <kconfig.h>
#include <kdebug.h>
#include <kdialog.h>
@@ -92,9 +96,9 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
// General page
QWidget *generalPage = new QWidget( this );
QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(),
KDialog::spacingHintSmall() );
-
+ //general groupbox
QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage );
QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() );
boxLayout->setAlignment( Qt::AlignTop );
boxLayout->setMargin(KDialog::marginHintSmall() );
@@ -108,8 +112,11 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
boxLayout->addWidget( mNameParsing );
layout->addWidget( groupBox );
+
+ //extensions groupbox
+
groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage );
boxLayout = new QVBoxLayout( groupBox->layout() );
boxLayout->setAlignment( Qt::AlignTop );
boxLayout->setMargin(KDialog::marginHintSmall());
@@ -144,17 +151,109 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
// Addressee page
mAddresseeWidget = new AddresseeWidget( this );
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 )
+{
+ 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";
+
+ }
+ 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);
+
mAddresseeWidget->restoreSettings();
restoreExtensionSettings();
@@ -166,8 +265,12 @@ void KABConfigWidget::restoreSettings()
void KABConfigWidget::saveSettings()
{
KABPrefs::instance()->mAutomaticNameParsing = mNameParsing->isChecked();
KABPrefs::instance()->mHonorSingleClick = mViewsSingleClickBox->isChecked();
+
+ KABPrefs::instance()->mEmailClient = mEmailClient->currentItem();
+ KABPrefs::instance()->mEmailChannel = mEmailChannel->text();
+
mAddresseeWidget->saveSettings();
saveExtensionSettings();
KABPrefs::instance()->writeConfig();
@@ -179,8 +282,12 @@ void KABConfigWidget::defaults()
{
mNameParsing->setChecked( true );
mViewsSingleClickBox->setChecked( false );
+ mEmailClient->setCurrentItem(KABPrefs::OMPI);
+ emailclient_changed( KABPrefs::OMPI );
+
+
emit changed( true );
}
void KABConfigWidget::modified()
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h
index 0f36d9e..9d1363b 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.h
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.h
@@ -28,9 +28,10 @@
class QCheckBox;
class QListViewItem;
class QPushButton;
-
+class QComboBox;
+class QLineEdit;
class KListView;
class AddresseeWidget;
@@ -50,12 +51,15 @@ class KABConfigWidget : public QWidget
public slots:
void modified();
+
+
private slots:
void configureExtension();
void selectionChanged( QListViewItem* );
void itemClicked( QListViewItem* );
+ void emailclient_changed( int newClient );
private:
void restoreExtensionSettings();
void saveExtensionSettings();
@@ -64,8 +68,10 @@ class KABConfigWidget : public QWidget
QCheckBox *mNameParsing;
QCheckBox *mViewsSingleClickBox;
QPushButton *mConfigureButton;
+ QComboBox* mEmailClient;
+ QLineEdit* mEmailChannel;
AddresseeWidget *mAddresseeWidget;
};