summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorulf69 <ulf69>2004-08-10 01:34:22 (UTC)
committer ulf69 <ulf69>2004-08-10 01:34:22 (UTC)
commitc9d570427f3d5bead7bee1301514a2d4b82836ea (patch) (side-by-side diff)
tree8d25f388217c591b7dac1db6c26d0777e6459352 /libkdepim
parent4f05a9fcbb9e54184aef93883886aaf865104463 (diff)
downloadkdepimpi-c9d570427f3d5bead7bee1301514a2d4b82836ea.zip
kdepimpi-c9d570427f3d5bead7bee1301514a2d4b82836ea.tar.gz
kdepimpi-c9d570427f3d5bead7bee1301514a2d4b82836ea.tar.bz2
enhancements to configure external apps like email and phones through a
generalized interface
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/addresseeview.cpp31
-rw-r--r--libkdepim/kcmconfigs/kcmkdepimconfig.cpp24
-rw-r--r--libkdepim/kcmconfigs/kcmkdepimconfig.h10
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp534
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.h68
-rw-r--r--libkdepim/kpimprefs.cpp11
-rw-r--r--libkdepim/kpimprefs.h19
-rw-r--r--libkdepim/libkdepim.pro4
-rw-r--r--libkdepim/libkdepimE.pro4
9 files changed, 527 insertions, 178 deletions
diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp
index 547441c..83aba48 100644
--- a/libkdepim/addresseeview.cpp
+++ b/libkdepim/addresseeview.cpp
@@ -39,4 +39,4 @@
#ifndef DESKTOP_VERSION
-#include <qtopia/qcopenvelope_qws.h>
-#include <qpe/qpeapplication.h>
+#include <qtopia/qcopenvelope_qws.h>
+#include <qpe/qpeapplication.h>
#endif
@@ -61,3 +61,3 @@ AddresseeView::AddresseeView( QWidget *parent, const char *name )
//US link->setColor( KGlobalSettings::linkColor() );
-
+
}
@@ -90,3 +90,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr )
if ( kphoneInstalled > 0 )
- kphoneAvail = true;
+ kphoneAvail = true;
#if 0
@@ -97,3 +97,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr )
#endif
-
+
#endif
@@ -146,3 +146,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr )
-
+
for ( ; emailIt != emails.end(); ++emailIt ) {
@@ -183,3 +183,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr )
} else {
-
+
dynamicPart += QString(
@@ -190,3 +190,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr )
.arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ );
-
+
}
@@ -210,5 +210,5 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr )
aRole = "<tr>"
- "<td align=\"left\">" + mAddressee.role() + "</td>"
+ "<td align=\"left\">" + mAddressee.role() + "</td>"
"</tr>";
- }
+ }
if ( true /*!mAddressee.organization().isEmpty()*/ ) {
@@ -270,3 +270,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr )
mText = "<table width=\"100%\">\n";
- //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
+ //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
#ifdef DESKTOP_VERSION
@@ -276,3 +276,3 @@ mText = "<table width=\"100%\">\n";
#endif
-
+
#ifdef DESKTOP_VERSION
@@ -289,3 +289,3 @@ mText = "<table width=\"100%\">\n";
.arg( i18n(" ") )
- .arg( name );
+ .arg( name );
*/
@@ -304,3 +304,3 @@ mText = "<table width=\"100%\">\n";
mText += "</table>";
-
+
}
@@ -309,2 +309,3 @@ mText = "<table width=\"100%\">\n";
setText( mText );
+
}
@@ -323,3 +324,3 @@ void AddresseeView::addTag(const QString & tag,const QString & text)
QString tmpStr=str;
- if(number !=-1)
+ if(number !=-1)
{
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
index 830d5d2..f26efe0 100644
--- a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
+++ b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
@@ -41,3 +41,4 @@ $Id$
#include "kprefs.h"
-#include "kpimprefs.h"
+#include "kpimglobalprefs.h"
+
#ifndef _WIN32_
@@ -45,4 +46,4 @@ extern "C"
{
- KCModule *create_kabconfig( QWidget *parent, const char * ) {
- return new KCMKdePimConfig( parent, "kcmkdepimconfig" );
+ KCModule *create_kabconfig( KPimGlobalPrefs* prefs, QWidget *parent, const char * ) {
+ return new KCMKdePimConfig( prefs, parent, "kcmkdepimconfig" );
}
@@ -50,4 +51,5 @@ extern "C"
#endif
-KCMKdePimConfig::KCMKdePimConfig( QWidget *parent, const char *name )
- : KCModule( parent, name )
+
+KCMKdePimConfig::KCMKdePimConfig( KPimGlobalPrefs* prefs, QWidget *parent, const char *name )
+ : KCModule( prefs, parent, name )
{
@@ -63,15 +65,15 @@ KCMKdePimConfig::KCMKdePimConfig( QWidget *parent, const char *name )
-void KCMKdePimConfig::load(KPrefs* prefs)
+void KCMKdePimConfig::load()
{
- mConfigWidget->restoreSettings((KPimPrefs*)prefs);
+ mConfigWidget->restoreSettings((KPimGlobalPrefs*)getPreferences());
}
-void KCMKdePimConfig::save(KPrefs* prefs)
+void KCMKdePimConfig::save()
{
- mConfigWidget->saveSettings((KPimPrefs*)prefs);
+ mConfigWidget->saveSettings((KPimGlobalPrefs*)getPreferences());
}
-void KCMKdePimConfig::defaults(KPrefs* prefs)
+void KCMKdePimConfig::defaults()
{
- mConfigWidget->defaults((KPimPrefs*)prefs);
+ mConfigWidget->defaults((KPimGlobalPrefs*)getPreferences());
}
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.h b/libkdepim/kcmconfigs/kcmkdepimconfig.h
index 8cb74f4..fa96eda 100644
--- a/libkdepim/kcmconfigs/kcmkdepimconfig.h
+++ b/libkdepim/kcmconfigs/kcmkdepimconfig.h
@@ -36,3 +36,3 @@ $Id$
class KDEPIMConfigWidget;
-class KPrefs;
+class KPimGlobalPrefs;
@@ -43,7 +43,7 @@ class KCMKdePimConfig : public KCModule
public:
- KCMKdePimConfig( QWidget *parent = 0, const char *name = 0 );
+ KCMKdePimConfig( KPimGlobalPrefs* prefs, QWidget *parent = 0, const char *name = 0 );
- virtual void load(KPrefs* prefs);
- virtual void save(KPrefs* prefs);
- virtual void defaults(KPrefs* prefs);
+ virtual void load();
+ virtual void save();
+ virtual void defaults();
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index 477267c..9964eeb 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -73,3 +73,3 @@ $Id$
-#include "kpimprefs.h"
+#include "kpimglobalprefs.h"
@@ -81,2 +81,9 @@ KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name )
{
+ mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
+ mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
+ mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
+ mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
+ mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
+
+
QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
@@ -86,97 +93,78 @@ KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name )
topLayout->addWidget( tabWidget );
-/*US
- // 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() );
- groupBox->layout()->setMargin(KDialog::marginHintSmall()) ;
- groupBox->layout()->setSpacing(KDialog::spacingHintSmall());
- boxLayout->setSpacing( KDialog::spacingHintSmall() );
- mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), groupBox, "msingle" );
- boxLayout->addWidget( mViewsSingleClickBox );
-
- mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), groupBox, "mparse" );
- boxLayout->addWidget( mNameParsing );
-
- layout->addWidget( groupBox );
-
-
- //extensions groupbox
-
- QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage );
- QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() );
- boxLayout->setAlignment( Qt::AlignTop );
- boxLayout->setMargin(KDialog::marginHintSmall());
- boxLayout->setSpacing(KDialog::spacingHintSmall());
- groupBox->layout()->setMargin(1) ;
- groupBox->layout()->setSpacing(0);
- mExtensionView = new KListView( groupBox );
- mExtensionView->setAllColumnsShowFocus( true );
- mExtensionView->addColumn( i18n( "Name" ) );
- mExtensionView->addColumn( i18n( "Description" ) );
- mExtensionView->setMaximumHeight(80);
-
- boxLayout->addWidget( mExtensionView );
-
- mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
- mConfigureButton->setEnabled( false );
- boxLayout->addWidget( mConfigureButton );
-
- layout->addWidget( groupBox );
-
- connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
- connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
- connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
- SLOT( selectionChanged( QListViewItem* ) ) );
- connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
- SLOT( itemClicked( QListViewItem* ) ) );
- connect( mConfigureButton, SIGNAL( clicked() ),
- SLOT( configureExtension() ) );
-
- tabWidget->addTab( generalPage, i18n( "General" ) );
-
- // Addressee page
- mAddresseeWidget = new AddresseeWidget( this );
- tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
- connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
-*/
+
+
// mailclient page
- QWidget *mailclientPage = new QWidget( this );
- QVBoxLayout* layout = new QVBoxLayout( mailclientPage, KDialog::marginHintSmall(),
+ QWidget *externalAppsPage = new QWidget( this );
+ QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
KDialog::spacingHintSmall() );
- QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), mailclientPage );
- QVBoxLayout* 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() );
+ mExternalApps = new QComboBox( externalAppsPage );
+
+ QMap<ExternalAppHandler::Types, QString>::Iterator it;
+ for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it )
+ mExternalApps->insertItem( it.data(), it.key() );
+
+ layout->addWidget( mExternalApps );
+
+ connect( mExternalApps, SIGNAL( activated( int ) ),
+ this, SLOT (externalapp_changed( int ) ) );
+
+
+
+
+ mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
+ QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" );
+
+
+ mClient = new QComboBox( mExternalAppGroupBox );
+ boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 );
+
+ connect( mClient, SIGNAL( activated( int ) ),
+ this, SLOT (client_changed( int ) ) );
+
+ QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox);
+ boxLayout->addWidget( lab, 1, 0 );
+ mChannel = new QLineEdit(mExternalAppGroupBox);
+ mChannel->setReadOnly(true);
+ boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 );
+
+ lab = new QLabel( i18n("Message:"), mExternalAppGroupBox);
+ boxLayout->addWidget( lab, 3, 0 );
+ mMessage = new QLineEdit(mExternalAppGroupBox);
+ mMessage->setReadOnly(true);
+ boxLayout->addWidget( mMessage , 4, 0);
+
+ lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox);
+ boxLayout->addWidget( lab, 3, 1 );
+ mParameters = new QLineEdit(mExternalAppGroupBox);
+ mParameters->setReadOnly(true);
+ boxLayout->addWidget( mParameters, 4, 1 );
+
+ lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox);
+ boxLayout->addWidget( lab, 5, 0 );
+ mMessage2 = new QLineEdit(mExternalAppGroupBox);
+ mMessage2->setReadOnly(true);
+ boxLayout->addWidget( mMessage2 , 6, 0);
+
+ lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox);
+ boxLayout->addWidget( lab, 5, 1 );
+ mParameters2 = new QLineEdit(mExternalAppGroupBox);
+ mParameters2->setReadOnly(true);
+ boxLayout->addWidget( mParameters2, 6, 1 );
- mEmailClient = new QComboBox( groupBox );
- mEmailClient->insertItem( i18n("OM/Pi"), KPimPrefs::OMPI );
- mEmailClient->insertItem( i18n("Qtopia mail"), KPimPrefs::QTOPIA );
- mEmailClient->insertItem( i18n("Opie mail"), KPimPrefs::OPIE );
- mEmailClient->insertItem( i18n("Other"), KPimPrefs::OTHER );
- boxLayout->addWidget( mEmailClient );
+ lab = new QLabel( i18n("HINT: Delimiter=; Data=%1 "), mExternalAppGroupBox);
+ boxLayout->addMultiCellWidget( lab, 7, 7, 0, 1 );
- 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 );
+ connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
+ connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
+ connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
+ connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
+ connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
- layout->addWidget( groupBox );
- tabWidget->addTab( mailclientPage, i18n( "Mail" ) );
+ layout->addWidget( mExternalAppGroupBox );
+ tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) );
@@ -184,43 +172,234 @@ KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name )
+void KDEPIMConfigWidget::externalapp_changed( int newApp )
+{
+ // first store the current data
+ saveEditFieldSettings();
+
+ // set mCurrentApp
+ mCurrentApp = (ExternalAppHandler::Types)newApp;
+
+ // set mCurrentClient
+ switch(mCurrentApp)
+ {
+ case(ExternalAppHandler::EMAIL):
+ mCurrentClient = mEmailClient;
+ break;
+ case(ExternalAppHandler::PHONE):
+ mCurrentClient = mPhoneClient;
+ break;
+ case(ExternalAppHandler::SMS):
+ mCurrentClient = mSMSClient;
+ break;
+ case(ExternalAppHandler::FAX):
+ mCurrentClient = mFaxClient;
+ break;
+ case(ExternalAppHandler::PAGER):
+ mCurrentClient = mPagerClient;
+ break;
+ default:
+ return;
+ }
+ // and at last update the widgets
+ updateClientWidgets();
+}
-void KDEPIMConfigWidget::emailclient_changed( int newClient )
+
+
+void KDEPIMConfigWidget::client_changed( int newClient )
{
- if (newClient == KPimPrefs::OTHER)
- mEmailChannel->setReadOnly(false);
- else
- mEmailChannel->setReadOnly(true);
+ if (newClient == mCurrentClient)
+ return;
- QString opiepath = QString::fromLatin1( getenv("OPIEDIR") );
- QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") );
+ // first store the current data
+ saveEditFieldSettings();
- if (opiepath.isEmpty())
- opiepath = qtopiapath;
- QString text = mEmailChannel->text();
+ //then reset the clientvariable
+ mCurrentClient = newClient;
- if (newClient == KPimPrefs::OPIE)
+ // and at last update the widgets
+ updateClientWidgets();
+
+ modified();
+}
+
+void KDEPIMConfigWidget::saveEditFieldSettings()
+{
+
+ switch(mCurrentApp)
{
- if ( QFile::exists( opiepath + "/bin/opiemail" ))
- text = "QPE/Application/opiemail";
- else
- text = "FILENOTFOUND: " + opiepath + "/bin/opiemail";
+ case(ExternalAppHandler::EMAIL):
+ mEmailClient = mClient->currentItem();
+ break;
+ case(ExternalAppHandler::PHONE):
+ mPhoneClient= mClient->currentItem();
+ break;
+ case(ExternalAppHandler::SMS):
+ mSMSClient = mClient->currentItem();
+ break;
+ case(ExternalAppHandler::FAX):
+ mFaxClient = mClient->currentItem();
+ break;
+ case(ExternalAppHandler::PAGER):
+ mPagerClient = mClient->currentItem();
+ break;
+ default:
+ return;
}
- else if (newClient == KPimPrefs::QTOPIA)
- {
- if ( QFile::exists( qtopiapath + "/bin/qtmail" ))
- text = "QPE/Application/qtmail";
- else
- text = "FILENOTFOUND: " + qtopiapath + "/bin/qtmail";
+ //store the current data back to the apropriate membervariables if we had set it to "other"
+ if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
+ {
+ mEmailOtherChannel = mChannel->text();
+ mEmailOtherMessage = mMessage->text();
+ mEmailOtherMessageParameters = mParameters->text();
+ mEmailOtherMessage2 = mMessage2->text();
+ mEmailOtherMessageParameters2 = mParameters2->text();
+ }
+ else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
+ {
+ mPhoneOtherChannel = mChannel->text();
+ mPhoneOtherMessage = mMessage->text();
+ mPhoneOtherMessageParameters = mParameters->text();
+ }
+ else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
+ {
+ mSMSOtherChannel = mChannel->text();
+ mSMSOtherMessage = mMessage->text();
+ mSMSOtherMessageParameters = mParameters->text();
+ }
+ else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
+ {
+ mFaxOtherChannel = mChannel->text();
+ mFaxOtherMessage = mMessage->text();
+ mFaxOtherMessageParameters = mParameters->text();
+ }
+ else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
+ {
+ mPagerOtherChannel = mChannel->text();
+ mPagerOtherMessage = mMessage->text();
+ mPagerOtherMessageParameters = mParameters->text();
}
- else if (newClient == KPimPrefs::OMPI)
+
+}
+
+void KDEPIMConfigWidget::updateClientWidgets()
+{
+ bool blocked = signalsBlocked();
+ blockSignals( true );
+
+ // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display
+ QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp );
+ if (it == mExternalAppsMap.end())
+ return;
+
+ // update group box
+ mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data()));
+
+ //update the entries in the client combobox
+ mClient->clear();
+
+ QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp);
+ DefaultAppItem* dai;
+ for ( dai=items.first(); dai != 0; dai=items.next() )
{
- 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";
+ mClient->insertItem( i18n(dai->_label), dai->_id );
+
+ if (dai->_id == mCurrentClient)
+ {
+ //restore the edit fields with the data of the local membervariables if we had set it to "other".
+ //Otherwise take the default data from externalapphandler.
+ mChannel->setText(dai->_channel);
+ mMessage->setText(dai->_message);
+ mParameters->setText(dai->_parameters);
+ mMessage2->setText(dai->_message2);
+ mParameters2->setText(dai->_parameters2);
+
+
+ if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
+ {
+ mChannel->setText(mEmailOtherChannel);
+ mMessage->setText(mEmailOtherMessage);
+ mParameters->setText(mEmailOtherMessageParameters);
+ mMessage2->setText(mEmailOtherMessage2);
+ mParameters2->setText(mEmailOtherMessageParameters2);
+ }
+ else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
+ {
+ mChannel->setText(mPhoneOtherChannel);
+ mMessage->setText(mPhoneOtherMessage);
+ mParameters->setText(mPhoneOtherMessageParameters);
+ }
+ else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
+ {
+ mChannel->setText(mSMSOtherChannel);
+ mMessage->setText(mSMSOtherMessage);
+ mParameters->setText(mSMSOtherMessageParameters);
+ }
+ else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
+ {
+ mChannel->setText(mFaxOtherChannel);
+ mMessage->setText(mFaxOtherMessage);
+ mParameters->setText(mFaxOtherMessageParameters);
+ }
+ else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
+ {
+ mChannel->setText(mPagerOtherChannel);
+ mMessage->setText(mPagerOtherMessage);
+ mParameters->setText(mPagerOtherMessageParameters);
+ }
+ }
+
+ }
+ bool readonly;
+ bool enabled;
+ if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
+ ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
+ ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
+ ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
+ ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)))
+ {
+ readonly = false;
+ }
+ else
+ {
+ readonly = true;
+ }
+
+ if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC))
+ ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC))
+ ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC))
+ ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC))
+ ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)))
+ {
+ enabled = false;
+ }
+ else
+ {
+ enabled = true;
+ }
+
+
+ mChannel->setReadOnly(readonly);
+ mMessage->setReadOnly(readonly);
+ mParameters->setReadOnly(readonly);
+ mMessage2->setReadOnly(readonly);
+ mParameters2->setReadOnly(readonly);
+
+ mChannel->setEnabled(enabled);
+ mMessage->setEnabled(enabled);
+ mParameters->setEnabled(enabled);
+ mMessage2->setEnabled(enabled);
+ mParameters2->setEnabled(enabled);
+
+
+
+ mClient->setCurrentItem(mCurrentClient);
+
+
+ // enable/disable the extra message/parameter field
+ if (mCurrentApp == ExternalAppHandler::EMAIL)
+ {
}
@@ -228,8 +407,14 @@ void KDEPIMConfigWidget::emailclient_changed( int newClient )
{
- //do nothing if we choosed other
+ mMessage2->setText( "" );
+ mParameters2->setText( "" );
}
- mEmailChannel->setText( text );
+ if (enabled == true) {
+ mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
+ mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
+ }
+ blockSignals( blocked );
+
}
@@ -237,3 +422,5 @@ void KDEPIMConfigWidget::emailclient_changed( int newClient )
-void KDEPIMConfigWidget::restoreSettings(KPimPrefs* prefs)
+
+
+void KDEPIMConfigWidget::restoreSettings(KPimGlobalPrefs* prefs)
{
@@ -242,4 +429,33 @@ void KDEPIMConfigWidget::restoreSettings(KPimPrefs* prefs)
- mEmailChannel->setText( prefs->mEmailChannel );
- mEmailClient->setCurrentItem(prefs->mEmailClient);
+ mEmailClient = prefs->mEmailClient;
+ mEmailOtherChannel = prefs->mEmailOtherChannel;
+ mEmailOtherMessage = prefs->mEmailOtherMessage;
+ mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters;
+ mEmailOtherMessage2 = prefs->mEmailOtherMessage2;
+ mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2;
+
+ mPhoneClient = prefs->mPhoneClient;
+ mPhoneOtherChannel = prefs->mPhoneOtherChannel;
+ mPhoneOtherMessage = prefs->mPhoneOtherMessage;
+ mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters;
+
+ mFaxClient = prefs->mFaxClient;
+ mFaxOtherChannel = prefs->mFaxOtherChannel;
+ mFaxOtherMessage = prefs->mFaxOtherMessage;
+ mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters;
+
+ mSMSClient = prefs->mSMSClient;
+ mSMSOtherChannel = prefs->mSMSOtherChannel;
+ mSMSOtherMessage = prefs->mSMSOtherMessage;
+ mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters;
+
+ mPagerClient = prefs->mPagerClient;
+ mPagerOtherChannel = prefs->mPagerOtherChannel;
+ mPagerOtherMessage = prefs->mPagerOtherMessage;
+ mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters;
+
+ mCurrentApp = ExternalAppHandler::EMAIL;
+ mCurrentClient = mEmailClient;
+
+ updateClientWidgets();
@@ -248,8 +464,35 @@ void KDEPIMConfigWidget::restoreSettings(KPimPrefs* prefs)
emit changed( false );
+
}
-void KDEPIMConfigWidget::saveSettings(KPimPrefs* prefs)
+void KDEPIMConfigWidget::saveSettings(KPimGlobalPrefs* prefs)
{
- prefs->mEmailClient = mEmailClient->currentItem();
- prefs->mEmailChannel = mEmailChannel->text();
+ saveEditFieldSettings();
+
+ prefs->mEmailClient = mEmailClient;
+ prefs->mEmailOtherChannel = mEmailOtherChannel;
+ prefs->mEmailOtherMessage = mEmailOtherMessage;
+ prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters;
+ prefs->mEmailOtherMessage2 = mEmailOtherMessage2;
+ prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2;
+
+ prefs->mPhoneClient = mPhoneClient;
+ prefs->mPhoneOtherChannel = mPhoneOtherChannel;
+ prefs->mPhoneOtherMessage = mPhoneOtherMessage;
+ prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters;
+
+ prefs->mFaxClient = mFaxClient;
+ prefs->mFaxOtherChannel = mFaxOtherChannel;
+ prefs->mFaxOtherMessage = mFaxOtherMessage;
+ prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters;
+
+ prefs->mSMSClient = mSMSClient;
+ prefs->mSMSOtherChannel = mSMSOtherChannel;
+ prefs->mSMSOtherMessage = mSMSOtherMessage;
+ prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters;
+
+ prefs->mPagerClient = mPagerClient;
+ prefs->mPagerOtherChannel = mPagerOtherChannel;
+ prefs->mPagerOtherMessage = mPagerOtherMessage;
+ prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters;
@@ -260,6 +503,42 @@ void KDEPIMConfigWidget::saveSettings(KPimPrefs* prefs)
-void KDEPIMConfigWidget::defaults(KPimPrefs* prefs)
+void KDEPIMConfigWidget::defaults(KPimGlobalPrefs* prefs)
{
- mEmailClient->setCurrentItem(KPimPrefs::OMPI);
- emailclient_changed( KPimPrefs::OMPI );
+
+ DefaultAppItem* dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC);
+
+ mEmailClient = dai->_id;
+ mEmailOtherChannel = dai->_channel;
+ mEmailOtherMessage = dai->_message;
+ mEmailOtherMessageParameters = dai->_parameters;
+ mEmailOtherMessage2 = dai->_message2;
+ mEmailOtherMessageParameters2 = dai->_parameters2;
+
+
+ dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC);
+
+ mPhoneClient = dai->_id;
+ mPhoneOtherChannel = dai->_channel;
+ mPhoneOtherMessage = dai->_message;
+ mPhoneOtherMessageParameters = dai->_parameters;
+
+ dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC);
+
+ mFaxClient = dai->_id;
+ mFaxOtherChannel = dai->_channel;
+ mFaxOtherMessage = dai->_message;
+ mFaxOtherMessageParameters = dai->_parameters;
+
+ dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC);
+
+ mSMSClient = dai->_id;
+ mSMSOtherChannel = dai->_channel;
+ mSMSOtherMessage = dai->_message;
+ mSMSOtherMessageParameters = dai->_parameters;
+
+ dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC);
+
+ mPagerClient = dai->_id;
+ mPagerOtherChannel = dai->_channel;
+ mPagerOtherMessage = dai->_message;
+ mPagerOtherMessageParameters = dai->_parameters;
@@ -273 +552,6 @@ void KDEPIMConfigWidget::modified()
}
+
+void KDEPIMConfigWidget::textChanged( const QString& text )
+{
+ emit changed( true );
+}
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.h b/libkdepim/kcmconfigs/kdepimconfigwidget.h
index 109a847..6e02544 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.h
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.h
@@ -34,2 +34,6 @@ $Id$
#include <qwidget.h>
+#include <qmap.h>
+
+#include "externalapphandler.h"
+
@@ -43,3 +47,4 @@ class QComboBox;
class QLineEdit;
-class KPimPrefs;
+class KPimGlobalPrefs;
+class QGroupBox;
@@ -52,5 +57,5 @@ class KDEPIMConfigWidget : public QWidget
- void restoreSettings(KPimPrefs* prefs);
- void saveSettings(KPimPrefs* prefs);
- void defaults(KPimPrefs* prefs);
+ void restoreSettings(KPimGlobalPrefs* prefs);
+ void saveSettings(KPimGlobalPrefs* prefs);
+ void defaults(KPimGlobalPrefs* prefs);
@@ -59,4 +64,6 @@ class KDEPIMConfigWidget : public QWidget
+
public slots:
void modified();
+ void textChanged( const QString& text );
@@ -68,5 +75,9 @@ class KDEPIMConfigWidget : public QWidget
// void itemClicked( QListViewItem* );
- void emailclient_changed( int newClient );
+ void client_changed( int newClient );
+ void externalapp_changed( int newApp );
private:
+ void saveEditFieldSettings();
+ void updateClientWidgets();
+
// void restoreExtensionSettings();
@@ -79,4 +90,47 @@ class KDEPIMConfigWidget : public QWidget
// QPushButton *mConfigureButton;
- QComboBox* mEmailClient;
- QLineEdit* mEmailChannel;
+ QComboBox* mExternalApps;
+ QGroupBox* mExternalAppGroupBox;
+
+
+ QComboBox* mClient;
+ QLineEdit* mChannel;
+ QLineEdit* mMessage;
+ QLineEdit* mParameters;
+ QLineEdit* mMessage2;
+ QLineEdit* mParameters2;
+
+ ExternalAppHandler::Types mCurrentApp;
+ int mCurrentClient;
+
+
+ int mEmailClient;
+ QString mEmailOtherChannel;
+ QString mEmailOtherMessage;
+ QString mEmailOtherMessageParameters;
+ QString mEmailOtherMessage2;
+ QString mEmailOtherMessageParameters2;
+
+ int mPhoneClient;
+ QString mPhoneOtherChannel;
+ QString mPhoneOtherMessage;
+ QString mPhoneOtherMessageParameters;
+
+ int mFaxClient;
+ QString mFaxOtherChannel;
+ QString mFaxOtherMessage;
+ QString mFaxOtherMessageParameters;
+
+ int mSMSClient;
+ QString mSMSOtherChannel;
+ QString mSMSOtherMessage;
+ QString mSMSOtherMessageParameters;
+
+ int mPagerClient;
+ QString mPagerOtherChannel;
+ QString mPagerOtherMessage;
+ QString mPagerOtherMessageParameters;
+
+
+
+ QMap<ExternalAppHandler::Types, QString> mExternalAppsMap;
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp
index 15531c7..140a286 100644
--- a/libkdepim/kpimprefs.cpp
+++ b/libkdepim/kpimprefs.cpp
@@ -23,2 +23,9 @@
+/*
+Enhanced Version of the file for platform independent KDE tools.
+Copyright (c) 2004 Ulf Schenk
+
+$Id$
+*/
+
#include <kglobal.h>
@@ -33,6 +40,2 @@ KPimPrefs::KPimPrefs( const QString &name ) :
{
- KPrefs::setCurrentGroup( "ExternalApplications" );
- addItemInt( "EmailChannelType", &mEmailClient, OMPI );
- addItemString( "EmailChannelOther", &mEmailChannel, "" );
-
}
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h
index 5186315..9bd9466 100644
--- a/libkdepim/kpimprefs.h
+++ b/libkdepim/kpimprefs.h
@@ -22,2 +22,10 @@
*/
+
+/*
+Enhanced Version of the file for platform independent KDE tools.
+Copyright (c) 2004 Ulf Schenk
+
+$Id$
+*/
+
#ifndef KPIMPREFS_H
@@ -46,9 +54,2 @@ class KPimPrefs : public KPrefs
- enum EMailClients {
- OMPI = 0,
- QTOPIA = 1,
- OPIE = 2,
- OTHER = 3
- };
-
@@ -57,6 +58,2 @@ class KPimPrefs : public KPrefs
- int mEmailClient;
- QString mEmailChannel;
-
-
diff --git a/libkdepim/libkdepim.pro b/libkdepim/libkdepim.pro
index 902f049..e05e681 100644
--- a/libkdepim/libkdepim.pro
+++ b/libkdepim/libkdepim.pro
@@ -25,2 +25,3 @@ HEADERS = \
categoryselectdialog_base.h \
+ externalapphandler.h \
kdateedit.h \
@@ -30,2 +31,3 @@ HEADERS = \
kpimprefs.h \
+ kpimglobalprefs.h \
kprefsdialog.h \
@@ -42,2 +44,3 @@ SOURCES = \
categoryselectdialog_base.cpp \
+ externalapphandler.cpp \
kdateedit.cpp \
@@ -47,2 +50,3 @@ SOURCES = \
kpimprefs.cpp \
+ kpimglobalprefs.cpp \
kprefsdialog.cpp \
diff --git a/libkdepim/libkdepimE.pro b/libkdepim/libkdepimE.pro
index fc8abe1..b322bce 100644
--- a/libkdepim/libkdepimE.pro
+++ b/libkdepim/libkdepimE.pro
@@ -19,2 +19,3 @@ HEADERS = \
categoryselectdialog_base.h \
+ externalapphandler.h \
kdateedit.h \
@@ -24,2 +25,3 @@ HEADERS = \
kpimprefs.h \
+ kpimglobalprefs.h \
kprefsdialog.h \
@@ -38,2 +40,3 @@ SOURCES = \
categoryselectdialog_base.cpp \
+ externalapphandler.cpp \
kdateedit.cpp \
@@ -43,2 +46,3 @@ SOURCES = \
kpimprefs.cpp \
+ kpimglobalprefs.cpp \
kprefsdialog.cpp \