summaryrefslogtreecommitdiffabout
path: root/libkdepim/kcmconfigs
authorulf69 <ulf69>2004-09-21 19:50:27 (UTC)
committer ulf69 <ulf69>2004-09-21 19:50:27 (UTC)
commit93313aa8d66c01aa0e4562449020af20b5cef0a7 (patch) (side-by-side diff)
tree7bf9930c58b4651a29b5aa4210742340c9439bc8 /libkdepim/kcmconfigs
parentc2cce86fdb2d0b291c3d3bdfa9fac47452153d1a (diff)
downloadkdepimpi-93313aa8d66c01aa0e4562449020af20b5cef0a7.zip
kdepimpi-93313aa8d66c01aa0e4562449020af20b5cef0a7.tar.gz
kdepimpi-93313aa8d66c01aa0e4562449020af20b5cef0a7.tar.bz2
added edit elements for global prefs
Diffstat (limited to 'libkdepim/kcmconfigs') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kcmconfigs/kcmkdepimconfig.cpp17
-rw-r--r--libkdepim/kcmconfigs/kcmkdepimconfig.h2
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp313
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.h45
4 files changed, 277 insertions, 100 deletions
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
index f26efe0..e77c5ab 100644
--- a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
+++ b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
@@ -35,45 +35,46 @@ $Id$
//#include <klocale.h>
//#include <stdlib.h>
#include "kdepimconfigwidget.h"
#include "kcmkdepimconfig.h"
#include "kprefs.h"
#include "kpimglobalprefs.h"
#ifndef _WIN32_
extern "C"
{
- KCModule *create_kabconfig( KPimGlobalPrefs* prefs, QWidget *parent, const char * ) {
- return new KCMKdePimConfig( prefs, parent, "kcmkdepimconfig" );
+ KCModule *create_kabconfig(QWidget *parent, const char * ) {
+ return new KCMKdePimConfig(parent, "kcmkdepimconfig" );
}
}
#endif
-KCMKdePimConfig::KCMKdePimConfig( KPimGlobalPrefs* prefs, QWidget *parent, const char *name )
- : KCModule( prefs, parent, name )
+KCMKdePimConfig::KCMKdePimConfig(QWidget *parent, const char *name )
+ : KCModule( KPimGlobalPrefs::instance(), parent, name )
{
//abort();
QVBoxLayout *layout = new QVBoxLayout( this );
- mConfigWidget = new KDEPIMConfigWidget( this, "mConfigWidget" );
+ mConfigWidget = new KDEPIMConfigWidget( (KPimGlobalPrefs*)getPreferences(), this, "KDEPIMConfigWidget" );
layout->addWidget( mConfigWidget );
layout->setSpacing( 0 );
layout->setMargin( 0 );
connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) );
}
void KCMKdePimConfig::load()
{
- mConfigWidget->restoreSettings((KPimGlobalPrefs*)getPreferences());
+ mConfigWidget->readConfig();
}
void KCMKdePimConfig::save()
{
- mConfigWidget->saveSettings((KPimGlobalPrefs*)getPreferences());
+ mConfigWidget->writeConfig();
}
void KCMKdePimConfig::defaults()
{
- mConfigWidget->defaults((KPimGlobalPrefs*)getPreferences());
+ qDebug("KCMKdePimConfig::defaults()");
+ mConfigWidget->setDefaults();
}
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.h b/libkdepim/kcmconfigs/kcmkdepimconfig.h
index fa96eda..b471e53 100644
--- a/libkdepim/kcmconfigs/kcmkdepimconfig.h
+++ b/libkdepim/kcmconfigs/kcmkdepimconfig.h
@@ -32,23 +32,23 @@ $Id$
#define KCMKDEPIMCONFIG_H
#include <kcmodule.h>
class KDEPIMConfigWidget;
class KPimGlobalPrefs;
class KCMKdePimConfig : public KCModule
{
Q_OBJECT
public:
- KCMKdePimConfig( KPimGlobalPrefs* prefs, QWidget *parent = 0, const char *name = 0 );
+ KCMKdePimConfig( QWidget *parent = 0, const char *name = 0 );
virtual void load();
virtual void save();
virtual void defaults();
private:
KDEPIMConfigWidget *mConfigWidget;
};
#endif
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index 703aeb1..00a07d9 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -25,29 +25,31 @@
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qlayout.h>
#include <qtabwidget.h>
#include <qcombobox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
+#include <qbuttongroup.h>
#include <qfile.h>
#include <kdialog.h>
#include <klocale.h>
-
+#include <kdateedit.h>
+#include <kglobal.h>
#include <stdlib.h>
/*US
#include <qcheckbox.h>
#include <qframe.h>
#include <qpushbutton.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qfile.h>
#include <kconfig.h>
@@ -62,67 +64,74 @@ $Id$
#ifndef KAB_EMBEDDED
#include <ktrader.h>
#else // KAB_EMBEDDED
#include <mergewidget.h>
#include <distributionlistwidget.h>
#endif // KAB_EMBEDDED
#include "addresseewidget.h"
#include "extensionconfigdialog.h"
#include "extensionwidget.h"
*/
+#include "qapplication.h"
+
#include "kpimglobalprefs.h"
#include "kdepimconfigwidget.h"
-KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name )
- : QWidget( parent, name )
+KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name )
+ : KPrefsWidget(prefs, parent, 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"));
mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP"));
QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
KDialog::spacingHint() );
- QTabWidget *tabWidget = new QTabWidget( this );
+ tabWidget = new QTabWidget( this );
topLayout->addWidget( tabWidget );
+ setupLocaleTab();
+ setupLocaleDateTab();
+ setupTimeZoneTab();
+ setupExternalAppTab();
+
+}
- // mailclient page
+void KDEPIMConfigWidget::setupExternalAppTab()
+{
QWidget *externalAppsPage = new QWidget( this );
QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
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 );
@@ -159,30 +168,200 @@ KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name )
lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox);
boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 );
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( mExternalAppGroupBox );
tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) );
}
+
+void KDEPIMConfigWidget::setupLocaleDateTab()
+{
+ QWidget *topFrame = new QWidget( this );
+ QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2);
+
+ topLayout->setSpacing(KDialog::spacingHint());
+ topLayout->setMargin(KDialog::marginHint());
+ int iii = 0;
+
+
+ KPrefsWidRadios *syncPrefsGroup =
+ addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame);
+ QString format;
+ if ( QApplication::desktop()->width() < 480 )
+ format = "(%d.%m.%Y)";
+ else
+ format = "(%d.%m.%Y|%A %d %B %Y)";
+ syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
+ if ( QApplication::desktop()->width() < 480 )
+ format = "(%m.%d.%Y)";
+ else
+ format = "(%m.%d.%Y|%A %B %d %Y)";
+ syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
+ if ( QApplication::desktop()->width() < 480 )
+ format = "(%Y-%m-%d)";
+ else
+ format = "(%Y-%m-%d|%A %Y %B %d)";
+ syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
+ syncPrefsGroup->addRadio(i18n("User defined"));
+ topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
+ ++iii;
+ ++iii;
+ QLabel * lab;
+ mUserDateFormatLong = new QLineEdit(topFrame);
+ lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
+ topLayout->addWidget(lab ,iii,0);
+ topLayout->addWidget(mUserDateFormatLong,iii,1);
+ ++iii;
+ mUserDateFormatShort = new QLineEdit(topFrame);
+ lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
+ topLayout->addWidget(lab ,iii,0);
+ topLayout->addWidget(mUserDateFormatShort,iii,1);
+ ++iii;
+ lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
+ topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
+ ++iii;
+ lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
+ topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
+ ++iii;
+ lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
+ topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
+ ++iii;
+
+ connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
+ connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
+
+
+ tabWidget->addTab( topFrame, i18n( "Date Format" ) );
+}
+
+void KDEPIMConfigWidget::setupLocaleTab()
+{
+
+ QWidget *topFrame = new QWidget( this );
+ QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
+
+ topLayout->setSpacing(KDialog::spacingHint());
+ topLayout->setMargin(KDialog::marginHint());
+ int iii = 0;
+ KPrefsWidRadios *syncPrefsGroup =
+ addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame);
+ syncPrefsGroup->addRadio(i18n("English"));
+ syncPrefsGroup->addRadio(i18n("German"));
+ syncPrefsGroup->addRadio(i18n("French"));
+ syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
+ if ( QApplication::desktop()->width() < 300 )
+ ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
+ topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
+ ++iii;
+
+ syncPrefsGroup =
+ addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame);
+ if ( QApplication::desktop()->width() > 300 )
+ syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
+ syncPrefsGroup->addRadio(i18n("24:00"));
+ syncPrefsGroup->addRadio(i18n("12:00am"));
+ syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
+ topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
+ ++iii;
+
+ KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"),
+ &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame);
+ topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
+ ++iii;
+
+
+ tabWidget->addTab( topFrame, i18n( "Locale" ) );
+
+}
+
+
+void KDEPIMConfigWidget::setupTimeZoneTab()
+{
+ QWidget *topFrame = new QWidget( this );
+ QGridLayout *topLayout = new QGridLayout( topFrame, 5, 2);
+ topLayout->setSpacing(KDialog::spacingHint());
+ topLayout->setMargin(KDialog::marginHint());
+
+ QHBox *timeZoneBox = new QHBox( topFrame );
+ topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
+
+ new QLabel( i18n("Timezone:"), timeZoneBox );
+ mTimeZoneCombo = new QComboBox( timeZoneBox );
+ if ( QApplication::desktop()->width() < 300 ) {
+ mTimeZoneCombo->setMaximumWidth(150);
+ }
+
+ QStringList list;
+ list = KGlobal::locale()->timeZoneList();
+ mTimeZoneCombo->insertStringList(list);
+
+ // find the currently set time zone and select it
+ QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId;
+ int nCurrentlySet = 11;
+ for (int i = 0; i < mTimeZoneCombo->count(); i++)
+ {
+ if (mTimeZoneCombo->text(i) == sCurrentlySet)
+ {
+ nCurrentlySet = i;
+ break;
+ }
+ }
+ mTimeZoneCombo->setCurrentItem(nCurrentlySet);
+ int iii = 1;
+ KPrefsWidBool *sb =
+ addWidBool(i18n("Timezone has daylight saving"),
+ &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame);
+ topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
+ ++iii;
+ QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame );
+ topLayout->addMultiCellWidget(lab, iii,iii,0,1);
+ ++iii;
+ lab = new QLabel( i18n("The year in the date is ignored."), topFrame );
+ topLayout->addMultiCellWidget(lab, iii,iii,0,1);
+ ++iii;
+ lab = new QLabel( i18n("Daylight start:"), topFrame );
+ topLayout->addWidget(lab, iii,0);
+ mStartDateSavingEdit = new KDateEdit(topFrame);
+ topLayout->addWidget(mStartDateSavingEdit, iii,1);
+ ++iii;
+
+ lab = new QLabel( i18n("Daylight end:"), topFrame );
+ topLayout->addWidget(lab, iii,0);
+ mEndDateSavingEdit = new KDateEdit(topFrame);
+ topLayout->addWidget(mEndDateSavingEdit, iii,1);
+ ++iii;
+ QDate current ( 2001, 1,1);
+ mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1));
+ mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1));
+
+ connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
+ connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
+ connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) );
+
+
+
+ tabWidget->addTab( topFrame, i18n( "Time Zone" ) );
+
+}
+
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):
@@ -219,25 +398,25 @@ void KDEPIMConfigWidget::client_changed( int newClient )
return;
// first store the current data
saveEditFieldSettings();
//then reset the clientvariable
mCurrentClient = newClient;
// and at last update the widgets
updateClientWidgets();
- modified();
+ KPrefsWidget::modified();
}
void KDEPIMConfigWidget::saveEditFieldSettings()
{
switch(mCurrentApp)
{
case(ExternalAppHandler::EMAIL):
mEmailClient = mClient->currentItem();
break;
case(ExternalAppHandler::PHONE):
mPhoneClient= mClient->currentItem();
@@ -435,32 +614,44 @@ void KDEPIMConfigWidget::updateClientWidgets()
}
if (enabled == true) {
mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
}
blockSignals( blocked );
}
-
-
-
-void KDEPIMConfigWidget::restoreSettings(KPimGlobalPrefs* prefs)
+void KDEPIMConfigWidget::usrReadConfig()
{
+ KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
+
bool blocked = signalsBlocked();
blockSignals( true );
+ QString dummy = prefs->mUserDateFormatLong;
+ mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
+ dummy = prefs->mUserDateFormatShort;
+ mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
+
+ QDate current ( 2001, 1,1);
+ mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1));
+ mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1));
+ setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId));
+
+
+
+
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;
@@ -482,32 +673,51 @@ void KDEPIMConfigWidget::restoreSettings(KPimGlobalPrefs* prefs)
mSipClient = prefs->mPagerClient;
mSipOtherChannel = prefs->mSipOtherChannel;
mSipOtherMessage = prefs->mSipOtherMessage;
mSipOtherMessageParameters = prefs->mSipOtherMessageParameters;
mCurrentApp = ExternalAppHandler::EMAIL;
mCurrentClient = mEmailClient;
updateClientWidgets();
blockSignals( blocked );
- emit changed( false );
-
}
-void KDEPIMConfigWidget::saveSettings(KPimGlobalPrefs* prefs)
+void KDEPIMConfigWidget::usrWriteConfig()
{
+ KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
+
saveEditFieldSettings();
+
+ prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
+ prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
+
+ prefs->mTimeZoneId = mTimeZoneCombo->currentText();
+ QDate date;
+ date = mStartDateSavingEdit->date();
+ int sub = 0;
+ if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
+ sub = 1;
+ prefs->mDaylightsavingStart = date.dayOfYear()-sub;
+ date = mEndDateSavingEdit->date();
+ if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
+ sub = 1;
+ else
+ sub = 0;
+ prefs->mDaylightsavingEnd = date.dayOfYear()-sub;
+
+
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;
@@ -523,82 +733,39 @@ void KDEPIMConfigWidget::saveSettings(KPimGlobalPrefs* prefs)
prefs->mPagerClient = mPagerClient;
prefs->mPagerOtherChannel = mPagerOtherChannel;
prefs->mPagerOtherMessage = mPagerOtherMessage;
prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters;
prefs->mSipClient = mSipClient;
prefs->mSipOtherChannel = mSipOtherChannel;
prefs->mSipOtherMessage = mSipOtherMessage;
prefs->mSipOtherMessageParameters = mSipOtherMessageParameters;
- prefs->writeConfig();
-
//release the cache that other views can access the changed values instantanious
ExternalAppHandler::instance()->loadConfig();
- emit changed( false );
}
-void KDEPIMConfigWidget::defaults(KPimGlobalPrefs* prefs)
-{
-
- 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;
-
-
- dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC);
-
- mSipClient = dai->_id;
- mSipOtherChannel = dai->_channel;
- mSipOtherMessage = dai->_message;
- mSipOtherMessageParameters = dai->_parameters;
-
-
- emit changed( true );
-}
-
-void KDEPIMConfigWidget::modified()
+void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text,
+ const QStringList *tags)
{
- emit changed( true );
+ if (tags) {
+ int i = tags->findIndex(text);
+ if (i > 0) combo->setCurrentItem(i);
+ } else {
+ for(int i=0;i<combo->count();++i) {
+ if (combo->text(i) == text) {
+ combo->setCurrentItem(i);
+ break;
+ }
+ }
+ }
}
+
void KDEPIMConfigWidget::textChanged( const QString& text )
{
emit changed( true );
}
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.h b/libkdepim/kcmconfigs/kdepimconfigwidget.h
index e3cfd81..6f26513 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.h
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.h
@@ -22,73 +22,82 @@
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KDEPIMCONFIGWIDGET_H
#define KDEPIMCONFIGWIDGET_H
-#include <qwidget.h>
+#include <kprefswidget.h>
#include <qmap.h>
#include "externalapphandler.h"
-/*
-class QCheckBox;
-class QListViewItem;
-class QPushButton;
-class KListView;
-*/
class QComboBox;
class QLineEdit;
class KPimGlobalPrefs;
class QGroupBox;
+class QTabWidget;
+class KDateEdit;
-class KDEPIMConfigWidget : public QWidget
+class KDEPIMConfigWidget : public KPrefsWidget
{
Q_OBJECT
public:
- KDEPIMConfigWidget( QWidget *parent, const char *name = 0 );
-
- void restoreSettings(KPimGlobalPrefs* prefs);
- void saveSettings(KPimGlobalPrefs* prefs);
- void defaults(KPimGlobalPrefs* prefs);
-
- signals:
- void changed( bool );
-
+ KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name = 0 );
public slots:
- void modified();
void textChanged( const QString& text );
+ 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* );
// void itemClicked( QListViewItem* );
void client_changed( int newClient );
void externalapp_changed( int newApp );
private:
+ void setupExternalAppTab();
+ void setupLocaleDateTab();
+ void setupLocaleTab();
+ void setupTimeZoneTab();
+
+ void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0);
+
+
void saveEditFieldSettings();
void updateClientWidgets();
+ QTabWidget *tabWidget;
+
+
+ QLineEdit* mUserDateFormatShort;
+ QLineEdit* mUserDateFormatLong;
+ QComboBox* mTimeZoneCombo;
+ KDateEdit* mStartDateSavingEdit;
+ KDateEdit* mEndDateSavingEdit;
+
// void restoreExtensionSettings();
// void saveExtensionSettings();
// KListView *mExtensionView;
// QCheckBox *mNameParsing;
// QCheckBox *mViewsSingleClickBox;
// QPushButton *mConfigureButton;
QComboBox* mExternalApps;
QGroupBox* mExternalAppGroupBox;