summaryrefslogtreecommitdiffabout
path: root/libkdepim
Side-by-side diff
Diffstat (limited to 'libkdepim') (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
-rw-r--r--libkdepim/kpimglobalprefs.cpp21
-rw-r--r--libkdepim/kpimglobalprefs.h15
-rw-r--r--libkdepim/kpimprefs.cpp6
-rw-r--r--libkdepim/kpimprefs.h2
-rw-r--r--libkdepim/kprefsdialog.cpp106
-rw-r--r--libkdepim/kprefsdialog.h70
-rw-r--r--libkdepim/libkdepimE.pro2
11 files changed, 410 insertions, 189 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
@@ -23,57 +23,58 @@
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qlayout.h>
#include <kdebug.h>
//#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
@@ -20,35 +20,35 @@
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KCMKDEPIMCONFIG_H
#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
@@ -13,128 +13,137 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
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>
#include <kdebug.h>
#include <kdialog.h>
#include <klistview.h>
#include <klocale.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <kstandarddirs.h>
#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 );
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 );
@@ -147,54 +156,224 @@ KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name )
lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox);
boxLayout->addWidget( lab, 6, 0 );
mMessage2 = new QLineEdit(mExternalAppGroupBox);
mMessage2->setReadOnly(true);
boxLayout->addWidget( mMessage2 , 7, 0);
lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox);
boxLayout->addWidget( lab, 6, 1 );
mParameters2 = new QLineEdit(mExternalAppGroupBox);
mParameters2->setReadOnly(true);
boxLayout->addWidget( mParameters2, 7, 1 );
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):
mCurrentClient = mEmailClient;
break;
case(ExternalAppHandler::PHONE):
mCurrentClient = mPhoneClient;
break;
case(ExternalAppHandler::SMS):
mCurrentClient = mSMSClient;
break;
case(ExternalAppHandler::FAX):
mCurrentClient = mFaxClient;
break;
case(ExternalAppHandler::PAGER):
@@ -207,49 +386,49 @@ void KDEPIMConfigWidget::externalapp_changed( int newApp )
return;
}
// and at last update the widgets
updateClientWidgets();
}
void KDEPIMConfigWidget::client_changed( int newClient )
{
if (newClient == mCurrentClient)
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();
break;
case(ExternalAppHandler::SMS):
mSMSClient = mClient->currentItem();
break;
case(ExternalAppHandler::FAX):
mFaxClient = mClient->currentItem();
break;
case(ExternalAppHandler::PAGER):
mPagerClient = mClient->currentItem();
break;
case(ExternalAppHandler::SIP):
mSipClient = mClient->currentItem();
@@ -423,182 +602,170 @@ void KDEPIMConfigWidget::updateClientWidgets()
mClient->setCurrentItem(mCurrentClient);
// enable/disable the extra message/parameter field
if (mCurrentApp == ExternalAppHandler::EMAIL)
{
}
else
{
mMessage2->setText( "" );
mParameters2->setText( "" );
}
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;
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;
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;
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;
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
@@ -10,97 +10,106 @@
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
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;
QComboBox* mClient;
QLineEdit* mChannel;
QLineEdit* mMessage;
QLineEdit* mParameters;
QLineEdit* mMessage2;
QLineEdit* mParameters2;
ExternalAppHandler::Types mCurrentApp;
int mCurrentClient;
int mEmailClient;
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index eb8f1de..12a503d 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -22,48 +22,69 @@
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <kglobal.h>
#include <kconfig.h>
#include <klocale.h>
#include <kdebug.h>
#include <kstaticdeleter.h>
#include "kpimglobalprefs.h"
KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0;
static KStaticDeleter<KPimGlobalPrefs> staticDeleter;
KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
: KPrefs("microkdeglobalrc")
{
+
+ KPrefs::setCurrentGroup("Locale");
+ addItemInt("PreferredLanguage",&mPreferredLanguage,0);
+ addItemInt("PreferredTime",&mPreferredTime,0);
+ addItemInt("PreferredDate",&mPreferredDate,0);
+ addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
+ //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false);
+ // addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
+ addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
+ addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
+
+ KPrefs::setCurrentGroup("Time & Date");
+
+ addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") );
+ addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
+ addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
+ addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
+
+
+
+
KPrefs::setCurrentGroup( "ExternalApplications" );
addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC );
addItemString( "EmailChannel", &mEmailOtherChannel, "" );
addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" );
addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" );
addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" );
addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" );
addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC );
addItemString( "PhoneChannel", &mPhoneOtherChannel, "" );
addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" );
addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" );
addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC );
addItemString( "FaxChannel", &mFaxOtherChannel, "" );
addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" );
addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" );
addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC );
addItemString( "SMSChannel", &mSMSOtherChannel, "" );
addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h
index 8bd543d..dad78e6 100644
--- a/libkdepim/kpimglobalprefs.h
+++ b/libkdepim/kpimglobalprefs.h
@@ -63,48 +63,63 @@ class KPimGlobalPrefs : public KPrefs
};
enum SMSClients {
NONE_SMC = 0,
OTHER_SMC = 1
};
enum PagerClients {
NONE_PAC = 0,
OTHER_PAC = 1
};
enum SIPClients {
NONE_SIC = 0,
OTHER_SIC = 1
};
private:
KPimGlobalPrefs( const QString &name = QString::null );
static KPimGlobalPrefs *sInstance;
public:
+ //US I copied the following "locale" settings from KOPrefs
+ int mPreferredDate;
+ QString mUserDateFormatLong;
+ QString mUserDateFormatShort;
+ int mPreferredLanguage;
+ int mPreferredTime;
+ bool mWeekStartsOnSunday;
+ QString mTimeZoneId;
+ bool mUseDaylightsaving;
+ int mDaylightsavingStart;
+ int mDaylightsavingEnd;
+
+
+
+
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;
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp
index 140a286..a9ea330 100644
--- a/libkdepim/kpimprefs.cpp
+++ b/libkdepim/kpimprefs.cpp
@@ -43,24 +43,30 @@ KPimPrefs::KPimPrefs( const QString &name ) :
KPimPrefs::~KPimPrefs()
{
}
void KPimPrefs::usrSetDefaults()
{
setCategoryDefaults();
}
void KPimPrefs::usrReadConfig()
{
kdDebug(5300) << "KPimPrefs::usrReadConfig()" << endl;
config()->setGroup("General");
mCustomCategories = config()->readListEntry("Custom Categories");
if (mCustomCategories.isEmpty()) setCategoryDefaults();
}
void KPimPrefs::usrWriteConfig()
{
config()->setGroup("General");
config()->writeEntry("Custom Categories",mCustomCategories);
}
+
+void KPimPrefs::setCategoryDefaults()
+{
+ // empty implementation
+}
+
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h
index 9bd9466..860665b 100644
--- a/libkdepim/kpimprefs.h
+++ b/libkdepim/kpimprefs.h
@@ -37,28 +37,28 @@ $Id$
class KPimPrefs : public KPrefs
{
public:
KPimPrefs( const QString &name = QString::null );
virtual ~KPimPrefs();
/** Set preferences to default values */
void usrSetDefaults();
/** Read preferences from config file */
void usrReadConfig();
/** Write preferences to config file */
void usrWriteConfig();
public:
QStringList mCustomCategories;
protected:
- virtual void setCategoryDefaults() = 0;
+ virtual void setCategoryDefaults();
};
#endif
diff --git a/libkdepim/kprefsdialog.cpp b/libkdepim/kprefsdialog.cpp
index 205c526..dd9a602 100644
--- a/libkdepim/kprefsdialog.cpp
+++ b/libkdepim/kprefsdialog.cpp
@@ -36,361 +36,361 @@
#include <qhbox.h>
#include <qspinbox.h>
#include <qdatetime.h>
#include <qframe.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qradiobutton.h>
#include <qpushbutton.h>
#include <qapplication.h>
#include <kcolorbutton.h>
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
#include <kfontdialog.h>
#include <kmessagebox.h>
#include <kcolordialog.h>
#include <kiconloader.h>
#include "kprefs.h"
#include "kprefsdialog.h"
//#include "kprefsdialog.moc"
-KPrefsWidBool::KPrefsWidBool(const QString &text,bool *reference,
+KPrefsDialogWidBool::KPrefsDialogWidBool(const QString &text,bool *reference,
QWidget *parent)
{
mReference = reference;
mCheck = new QCheckBox(text,parent);
}
-void KPrefsWidBool::readConfig()
+void KPrefsDialogWidBool::readConfig()
{
mCheck->setChecked(*mReference);
}
-void KPrefsWidBool::writeConfig()
+void KPrefsDialogWidBool::writeConfig()
{
*mReference = mCheck->isChecked();
}
-QCheckBox *KPrefsWidBool::checkBox()
+QCheckBox *KPrefsDialogWidBool::checkBox()
{
return mCheck;
}
-KPrefsWidColor::KPrefsWidColor(const QString &text,QColor *reference,
+KPrefsDialogWidColor::KPrefsDialogWidColor(const QString &text,QColor *reference,
QWidget *parent)
{
mReference = reference;
mButton = new KColorButton(parent);
mLabel = new QLabel(mButton, text, parent);
mButton->setColor( *mReference );
mButton->setColor( Qt::red );
}
-KPrefsWidColor::~KPrefsWidColor()
+KPrefsDialogWidColor::~KPrefsDialogWidColor()
{
-// kdDebug(5300) << "KPrefsWidColor::~KPrefsWidColor()" << endl;
+// kdDebug(5300) << "KPrefsDialogWidColor::~KPrefsDialogWidColor()" << endl;
}
-void KPrefsWidColor::readConfig()
+void KPrefsDialogWidColor::readConfig()
{
mButton->setColor(*mReference);
}
-void KPrefsWidColor::writeConfig()
+void KPrefsDialogWidColor::writeConfig()
{
*mReference = mButton->color();
}
-QLabel *KPrefsWidColor::label()
+QLabel *KPrefsDialogWidColor::label()
{
return mLabel;
}
-KColorButton *KPrefsWidColor::button()
+KColorButton *KPrefsDialogWidColor::button()
{
return mButton;
}
-KPrefsWidFont::KPrefsWidFont(const QString &sampleText,const QString &labelText,
+KPrefsDialogWidFont::KPrefsDialogWidFont(const QString &sampleText,const QString &labelText,
QFont *reference,QWidget *parent)
{
mReference = reference;
mLabel = new QLabel(labelText, parent);
mPreview = new QLabel(sampleText,parent);
mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken);
mButton = new QPushButton(i18n("Choose..."), parent);
connect(mButton,SIGNAL(clicked()),SLOT(selectFont()));
mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 );
mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 );
}
-KPrefsWidFont::~KPrefsWidFont()
+KPrefsDialogWidFont::~KPrefsDialogWidFont()
{
}
-void KPrefsWidFont::readConfig()
+void KPrefsDialogWidFont::readConfig()
{
mPreview->setFont(*mReference);
}
-void KPrefsWidFont::writeConfig()
+void KPrefsDialogWidFont::writeConfig()
{
*mReference = mPreview->font();
}
-QLabel *KPrefsWidFont::label()
+QLabel *KPrefsDialogWidFont::label()
{
return mLabel;
}
-QLabel *KPrefsWidFont::preview()
+QLabel *KPrefsDialogWidFont::preview()
{
return mPreview;
}
-QPushButton *KPrefsWidFont::button()
+QPushButton *KPrefsDialogWidFont::button()
{
return mButton;
}
-void KPrefsWidFont::selectFont()
+void KPrefsDialogWidFont::selectFont()
{
QFont myFont(mPreview->font());
bool ok;
myFont = KFontDialog::getFont(myFont, ok);
if ( ok ) {
mPreview->setFont(myFont);
}
}
-KPrefsWidTime::KPrefsWidTime(const QString &text,int *reference,
+KPrefsDialogWidTime::KPrefsDialogWidTime(const QString &text,int *reference,
QWidget *parent)
{
mReference = reference;
mLabel = new QLabel(text,parent);
mSpin = new QSpinBox(0,23,1,parent);
mSpin->setSuffix(":00");
}
-void KPrefsWidTime::readConfig()
+void KPrefsDialogWidTime::readConfig()
{
mSpin->setValue(*mReference);
}
-void KPrefsWidTime::writeConfig()
+void KPrefsDialogWidTime::writeConfig()
{
*mReference = mSpin->value();
}
-QLabel *KPrefsWidTime::label()
+QLabel *KPrefsDialogWidTime::label()
{
return mLabel;
}
-QSpinBox *KPrefsWidTime::spinBox()
+QSpinBox *KPrefsDialogWidTime::spinBox()
{
return mSpin;
}
-KPrefsWidRadios::KPrefsWidRadios(const QString &text,int *reference,
+KPrefsDialogWidRadios::KPrefsDialogWidRadios(const QString &text,int *reference,
QWidget *parent)
{
mReference = reference;
mBox = new QButtonGroup(1,Qt::Horizontal,text,parent);
}
-KPrefsWidRadios::~KPrefsWidRadios()
+KPrefsDialogWidRadios::~KPrefsDialogWidRadios()
{
}
-void KPrefsWidRadios::addRadio(const QString &text)
+void KPrefsDialogWidRadios::addRadio(const QString &text)
{
new QRadioButton(text,mBox);
}
-QButtonGroup *KPrefsWidRadios::groupBox()
+QButtonGroup *KPrefsDialogWidRadios::groupBox()
{
return mBox;
}
-void KPrefsWidRadios::readConfig()
+void KPrefsDialogWidRadios::readConfig()
{
mBox->setButton(*mReference);
}
-void KPrefsWidRadios::writeConfig()
+void KPrefsDialogWidRadios::writeConfig()
{
*mReference = mBox->id(mBox->selected());
}
-KPrefsWidString::KPrefsWidString(const QString &text,QString *reference,
+KPrefsDialogWidString::KPrefsDialogWidString(const QString &text,QString *reference,
QWidget *parent, QLineEdit::EchoMode echomode)
{
mReference = reference;
mLabel = new QLabel(text,parent);
mEdit = new QLineEdit(parent);
mEdit->setEchoMode( echomode );
}
-KPrefsWidString::~KPrefsWidString()
+KPrefsDialogWidString::~KPrefsDialogWidString()
{
}
-void KPrefsWidString::readConfig()
+void KPrefsDialogWidString::readConfig()
{
mEdit->setText(*mReference);
}
-void KPrefsWidString::writeConfig()
+void KPrefsDialogWidString::writeConfig()
{
*mReference = mEdit->text();
}
-QLabel *KPrefsWidString::label()
+QLabel *KPrefsDialogWidString::label()
{
return mLabel;
}
-QLineEdit *KPrefsWidString::lineEdit()
+QLineEdit *KPrefsDialogWidString::lineEdit()
{
return mEdit;
}
KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) :
KDialogBase(IconList,i18n("Preferences"),Ok|Cancel|Default,Ok,parent,
name,modal,true)
{
mPrefs = prefs;
// This seems to cause a crash on exit. Investigate later.
// mPrefsWids.setAutoDelete(true);
connect(this,SIGNAL(defaultClicked()),SLOT(slotDefault()));
//connect(this,SIGNAL(cancelClicked()),SLOT(slotDefault()));
//connect(this,SIGNAL(cancelClicked()),SLOT(reject()));
}
KPrefsDialog::~KPrefsDialog()
{
}
-void KPrefsDialog::addWid(KPrefsWid *wid)
+void KPrefsDialog::addWid(KPrefsDialogWid *wid)
{
mPrefsWids.append(wid);
}
-KPrefsWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent)
+KPrefsDialogWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent)
{
- KPrefsWidBool *w = new KPrefsWidBool(text,reference,parent);
+ KPrefsDialogWidBool *w = new KPrefsDialogWidBool(text,reference,parent);
addWid(w);
return w;
}
-KPrefsWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent)
+KPrefsDialogWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent)
{
- KPrefsWidTime *w = new KPrefsWidTime(text,reference,parent);
+ KPrefsDialogWidTime *w = new KPrefsDialogWidTime(text,reference,parent);
addWid(w);
return w;
}
-KPrefsWidColor *KPrefsDialog::addWidColor(const QString &text,QColor *reference,QWidget *parent)
+KPrefsDialogWidColor *KPrefsDialog::addWidColor(const QString &text,QColor *reference,QWidget *parent)
{
- KPrefsWidColor *w = new KPrefsWidColor(text,reference,parent);
+ KPrefsDialogWidColor *w = new KPrefsDialogWidColor(text,reference,parent);
addWid(w);
return w;
}
-KPrefsWidRadios *KPrefsDialog::addWidRadios(const QString &text,int *reference,QWidget *parent)
+KPrefsDialogWidRadios *KPrefsDialog::addWidRadios(const QString &text,int *reference,QWidget *parent)
{
- KPrefsWidRadios *w = new KPrefsWidRadios(text,reference,parent);
+ KPrefsDialogWidRadios *w = new KPrefsDialogWidRadios(text,reference,parent);
addWid(w);
return w;
}
-KPrefsWidString *KPrefsDialog::addWidString(const QString &text,QString *reference,QWidget *parent)
+KPrefsDialogWidString *KPrefsDialog::addWidString(const QString &text,QString *reference,QWidget *parent)
{
- KPrefsWidString *w = new KPrefsWidString(text,reference,parent);
+ KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent);
addWid(w);
return w;
}
-KPrefsWidString *KPrefsDialog::addWidPassword(const QString &text,QString *reference,QWidget *parent)
+KPrefsDialogWidString *KPrefsDialog::addWidPassword(const QString &text,QString *reference,QWidget *parent)
{
- KPrefsWidString *w = new KPrefsWidString(text,reference,parent,QLineEdit::Password);
+ KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent,QLineEdit::Password);
addWid(w);
return w;
}
-KPrefsWidFont *KPrefsDialog::addWidFont(const QString &sampleText,const QString &buttonText,
+KPrefsDialogWidFont *KPrefsDialog::addWidFont(const QString &sampleText,const QString &buttonText,
QFont *reference,QWidget *parent)
{
- KPrefsWidFont *w = new KPrefsWidFont(sampleText,buttonText,reference,parent);
+ KPrefsDialogWidFont *w = new KPrefsDialogWidFont(sampleText,buttonText,reference,parent);
addWid(w);
return w;
}
void KPrefsDialog::setDefaults()
{
mPrefs->setDefaults();
readConfig();
}
void KPrefsDialog::readConfig()
{
// kdDebug(5300) << "KPrefsDialog::readConfig()" << endl;
- KPrefsWid *wid;
+ KPrefsDialogWid *wid;
for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) {
wid->readConfig();
}
usrReadConfig();
}
void KPrefsDialog::writeConfig()
{
// kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl;
- KPrefsWid *wid;
+ KPrefsDialogWid *wid;
for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) {
wid->writeConfig();
}
usrWriteConfig();
// kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl;
mPrefs->writeConfig();
// kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl;
}
void KPrefsDialog::slotApply()
{
writeConfig();
emit configChanged();
}
void KPrefsDialog::slotOk()
{
slotApply();
QDialog::accept();
diff --git a/libkdepim/kprefsdialog.h b/libkdepim/kprefsdialog.h
index dceab01..ad13b78 100644
--- a/libkdepim/kprefsdialog.h
+++ b/libkdepim/kprefsdialog.h
@@ -25,422 +25,422 @@
// $Id$
#include <qptrlist.h>
#include <qlineedit.h>
#include <kdialogbase.h>
class KPrefs;
class KPrefsDialog;
class KColorButton;
class QCheckBox;
class QLabel;
class QSpinBox;
class QButtonGroup;
/**
@short Base class for widgets used by @ref KPrefsDialog.
@author Cornelius Schumacher
@see KPrefsDialog
This class provides the interface for the preferences widgets used by
KPrefsDialog.
*/
-class KPrefsWid
+class KPrefsDialogWid
{
public:
/**
This function is called to read value of the setting from the
stored configuration and display it in the widget.
*/
virtual void readConfig() = 0;
/**
This function is called to write the current setting of the widget to the
stored configuration.
*/
virtual void writeConfig() = 0;
};
/**
@short Widget for bool settings in @ref KPrefsDialog.
This class provides a widget for configuring bool values. It is meant to be
used by KPrefsDialog. The user is responsible for the layout management.
*/
-class KPrefsWidBool : public KPrefsWid
+class KPrefsDialogWidBool : public KPrefsDialogWid
{
public:
/**
Create a bool widget consisting of a QCheckbox.
@param text Text of QCheckBox.
@param reference Pointer to variable read and written by this widget.
@param parent Parent widget.
*/
- KPrefsWidBool(const QString &text,bool *reference,QWidget *parent);
+ KPrefsDialogWidBool(const QString &text,bool *reference,QWidget *parent);
/**
Return the QCheckbox used by this widget.
*/
QCheckBox *checkBox();
void readConfig();
void writeConfig();
private:
bool *mReference;
QCheckBox *mCheck;
};
/**
@short Widget for time settings in @ref KPrefsDialog.
This class provides a widget for configuring time values. It is meant to be
used by KPrefsDialog. The user is responsible for the layout management.
*/
-class KPrefsWidTime : public KPrefsWid
+class KPrefsDialogWidTime : public KPrefsDialogWid
{
public:
/**
Create a time widget consisting of a label and a spinbox.
@param text Text of Label.
@param reference Pointer to variable read and written by this widget.
@param parent Parent widget.
*/
- KPrefsWidTime(const QString &text,int *reference,QWidget *parent);
+ KPrefsDialogWidTime(const QString &text,int *reference,QWidget *parent);
/**
Return QLabel used by this widget.
*/
QLabel *label();
/**
Return QSpinBox used by this widget.
*/
QSpinBox *spinBox();
void readConfig();
void writeConfig();
private:
int *mReference;
QLabel *mLabel;
QSpinBox *mSpin;
};
/**
@short Widget for color settings in @ref KPrefsDialog.
This class provides a widget for configuring color values. It is meant to be
used by KPrefsDialog. The user is responsible for the layout management.
*/
-class KPrefsWidColor : public QObject, public KPrefsWid
+class KPrefsDialogWidColor : public QObject, public KPrefsDialogWid
{
Q_OBJECT
public:
/**
Create a color widget consisting of a test field and a button for opening
a color dialog.
@param text Text of button.
@param reference Pointer to variable read and written by this widget.
@param parent Parent widget.
*/
- KPrefsWidColor(const QString &text,QColor *reference,QWidget *parent);
+ KPrefsDialogWidColor(const QString &text,QColor *reference,QWidget *parent);
/**
Destruct color setting widget.
*/
- ~KPrefsWidColor();
+ ~KPrefsDialogWidColor();
/**
Return QLabel for the button
*/
QLabel *label();
/**
Return button opening the color dialog.
*/
KColorButton *button();
void readConfig();
void writeConfig();
private:
QColor *mReference;
QLabel *mLabel;
KColorButton *mButton;
};
/**
@short Widget for font settings in @ref KPrefsDialog.
This class provides a widget for configuring font values. It is meant to be
used by KPrefsDialog. The user is responsible for the layout management.
*/
-class KPrefsWidFont : public QObject, public KPrefsWid
+class KPrefsDialogWidFont : public QObject, public KPrefsDialogWid
{
Q_OBJECT
public:
/**
Create a font widget consisting of a test field and a button for opening
a font dialog.
@param label Text of label.
@param reference Pointer to variable read and written by this widget.
@param parent Parent widget.
*/
- KPrefsWidFont(const QString &sampleText,const QString &labelText,
+ KPrefsDialogWidFont(const QString &sampleText,const QString &labelText,
QFont *reference,QWidget *parent);
/**
Destruct font setting widget.
*/
- ~KPrefsWidFont();
+ ~KPrefsDialogWidFont();
/**
Return label.
*/
QLabel *label();
/**
Return QFrame used as preview field.
*/
QLabel *preview();
/**
Return button opening the font dialog.
*/
QPushButton *button();
void readConfig();
void writeConfig();
protected slots:
void selectFont();
private:
QFont *mReference;
QLabel *mLabel;
QLabel *mPreview;
QPushButton *mButton;
};
/**
@short Widget for settings represented by a group of radio buttons in
@ref KPrefsDialog.
This class provides a widget for configuring selections. It is meant to be
used by KPrefsDialog. The user is responsible for the layout management. The
setting is interpreted as an int value, corresponding to the position of the
radio button. The position of the button is defined by the sequence of @ref
addRadio() calls, starting with 0.
*/
-class KPrefsWidRadios : public KPrefsWid
+class KPrefsDialogWidRadios : public KPrefsDialogWid
{
public:
/**
Create a widget for selection of an option. It consists of a box with
several radio buttons.
@param text Text of main box.
@param reference Pointer to variable read and written by this widget.
@param parent Parent widget.
*/
- KPrefsWidRadios(const QString &text,int *reference,QWidget *parent);
- virtual ~KPrefsWidRadios();
+ KPrefsDialogWidRadios(const QString &text,int *reference,QWidget *parent);
+ virtual ~KPrefsDialogWidRadios();
/**
Add a radio button.
@param text Text of the button.
*/
void addRadio(const QString &text);
/**
Return the box widget used by this widget.
*/
QButtonGroup *groupBox();
void readConfig();
void writeConfig();
private:
int *mReference;
QButtonGroup *mBox;
};
/**
@short Widget for string settings in @ref KPrefsDialog.
This class provides a widget for configuring string values. It is meant to be
used by KPrefsDialog. The user is responsible for the layout management.
*/
-class KPrefsWidString : public KPrefsWid
+class KPrefsDialogWidString : public KPrefsDialogWid
{
public:
/**
Create a string widget consisting of a test label and a line edit.
@param text Text of label.
@param reference Pointer to variable read and written by this widget.
@param parent Parent widget.
*/
- KPrefsWidString(const QString &text,QString *reference,QWidget *parent,QLineEdit::EchoMode echomode=QLineEdit::Normal);
+ KPrefsDialogWidString(const QString &text,QString *reference,QWidget *parent,QLineEdit::EchoMode echomode=QLineEdit::Normal);
/**
Destructor.
*/
- virtual ~KPrefsWidString();
+ virtual ~KPrefsDialogWidString();
/**
Return label used by this widget.
*/
QLabel *label();
/**
Return QLineEdit used by this widget.
*/
QLineEdit *lineEdit();
void readConfig();
void writeConfig();
private:
QString *mReference;
QLabel *mLabel;
QLineEdit *mEdit;
};
/**
@short Base class for a preferences dialog.
This class provides the framework for a preferences dialog. You have to
subclass it and add the code to create the actual configuration widgets and
do the layout management.
- KPrefsDialog provides functions to add subclasses of @ref KPrefsWid. For
+ KPrefsDialog provides functions to add subclasses of @ref KPrefsDialogWid. For
these widgets the reading, writing and setting to default values is handled
automatically. Custom widgets have to be handled in the functions @ref
usrReadConfig() and @ref usrWriteConfig().
*/
class KPrefsDialog : public KDialogBase
{
Q_OBJECT
public:
/**
Create a KPrefsDialog for a KPrefs object.
@param prefs KPrefs object used to access te configuration.
@param parent Parent widget.
@param name Widget name.
@param modal true, if dialog has to be modal, false for non-modal.
*/
KPrefsDialog(KPrefs *prefs,QWidget *parent=0,char *name=0,bool modal=false);
/**
Destructor.
*/
virtual ~KPrefsDialog();
/**
- Register a custom KPrefsWid object.
+ Register a custom KPrefsDialogWid object.
*/
- void addWid(KPrefsWid *);
+ void addWid(KPrefsDialogWid *);
/**
- Register a @ref KPrefsWidBool object.
+ Register a @ref KPrefsDialogWidBool object.
@param text Text of bool widget.
@param reference Reference to variable storing the setting.
@param parent Parent widget.
*/
- KPrefsWidBool *addWidBool(const QString &text,bool *reference,QWidget *parent);
+ KPrefsDialogWidBool *addWidBool(const QString &text,bool *reference,QWidget *parent);
/**
- Register a @ref KPrefsWidTime object.
+ Register a @ref KPrefsDialogWidTime object.
@param text Text of time widget.
@param reference Reference to variable storing the setting.
@param parent Parent widget.
*/
- KPrefsWidTime *addWidTime(const QString &text,int *reference,QWidget *parent);
+ KPrefsDialogWidTime *addWidTime(const QString &text,int *reference,QWidget *parent);
/**
- Register a @ref KPrefsWidColor object.
+ Register a @ref KPrefsDialogWidColor object.
@param text Text of color widget.
@param reference Reference to variable storing the setting.
@param parent Parent widget.
*/
- KPrefsWidColor *addWidColor(const QString &text,QColor *reference,QWidget *parent);
+ KPrefsDialogWidColor *addWidColor(const QString &text,QColor *reference,QWidget *parent);
/**
- Register a @ref KPrefsWidRadios object.
+ Register a @ref KPrefsDialogWidRadios object.
@param text Text of radio button box widget.
@param reference Reference to variable storing the setting.
@param parent Parent widget.
*/
- KPrefsWidRadios *addWidRadios(const QString &text,int *reference,QWidget *parent);
+ KPrefsDialogWidRadios *addWidRadios(const QString &text,int *reference,QWidget *parent);
/**
- Register a @ref KPrefsWidString object.
+ Register a @ref KPrefsDialogWidString object.
@param text Text of string widget.
@param reference Reference to variable storing the setting.
@param parent Parent widget.
*/
- KPrefsWidString *addWidString(const QString &text,QString *reference,QWidget *parent);
+ KPrefsDialogWidString *addWidString(const QString &text,QString *reference,QWidget *parent);
/**
- Register a password @ref KPrefsWidString object, with echomode set to QLineEdit::Password.
+ Register a password @ref KPrefsDialogWidString object, with echomode set to QLineEdit::Password.
@param text Text of string widget.
@param reference Reference to variable storing the setting.
@param parent Parent widget.
*/
- KPrefsWidString *addWidPassword (const QString &text,QString *reference,QWidget *parent);
+ KPrefsDialogWidString *addWidPassword (const QString &text,QString *reference,QWidget *parent);
/**
- Register a @ref KPrefsWidFont object.
+ Register a @ref KPrefsDialogWidFont object.
@param sampleText Sample text of font widget.
@param buttonText Button text of font widget.
@param reference Reference to variable storing the setting.
@param parent Parent widget.
*/
- KPrefsWidFont *addWidFont(const QString &sampleText,const QString &buttonText,
+ KPrefsDialogWidFont *addWidFont(const QString &sampleText,const QString &buttonText,
QFont *reference,QWidget *parent);
public slots:
/** Set all widgets to default values. */
void setDefaults();
/** Read preferences from config file. */
void readConfig();
/** Write preferences to config file. */
void writeConfig();
signals:
/** Emitted when the a changed configuration has been stored. */
void configChanged();
protected slots:
/** Apply changes to preferences */
void slotApply();
void accept();
/** Accept changes to preferences and close dialog */
void slotOk();
/** Set preferences to default values */
void slotDefault();
protected:
/** Implement this to read custom configuration widgets. */
virtual void usrReadConfig() {}
/** Implement this to write custom configuration widgets. */
virtual void usrWriteConfig() {}
private:
KPrefs *mPrefs;
- QPtrList<KPrefsWid> mPrefsWids;
+ QPtrList<KPrefsDialogWid> mPrefsWids;
};
#endif
diff --git a/libkdepim/libkdepimE.pro b/libkdepim/libkdepimE.pro
index 69980e3..2a30ee8 100644
--- a/libkdepim/libkdepimE.pro
+++ b/libkdepim/libkdepimE.pro
@@ -3,49 +3,51 @@ CONFIG += qt warn_on
TARGET = microkdepim
INCLUDEPATH += . $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(QPEDIR)/include
LIBS += -lmicrokde
#LIBS += -lmicrokcal
LIBS += -L$(QPEDIR)/lib
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR=$(QPEDIR)/lib
INTERFACES = \
HEADERS = \
categoryeditdialog.h \
categoryeditdialog_base.h \
categoryselectdialog.h \
categoryselectdialog_base.h \
externalapphandler.h \
kdateedit.h \
kdatepicker.h \
kinputdialog.h \
kpimprefs.h \
kpimglobalprefs.h \
kprefsdialog.h \
+ kprefswidget.h \
ksyncprofile.h \
ksyncprefsdialog.h \
kcmconfigs/kcmkdepimconfig.h \
kcmconfigs/kdepimconfigwidget.h
SOURCES = \
categoryeditdialog.cpp \
categoryeditdialog_base.cpp \
categoryselectdialog.cpp \
categoryselectdialog_base.cpp \
externalapphandler.cpp \
kdateedit.cpp \
kinputdialog.cpp \
kdatepicker.cpp \
kpimprefs.cpp \
kpimglobalprefs.cpp \
kprefsdialog.cpp \
+ kprefswidget.cpp \
ksyncprofile.cpp \
ksyncprefsdialog.cpp \
kcmconfigs/kcmkdepimconfig.cpp \
kcmconfigs/kdepimconfigwidget.cpp