summaryrefslogtreecommitdiffabout
path: root/libkdepim
Side-by-side diff
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp28
-rw-r--r--libkdepim/kpimglobalprefs.cpp6
-rw-r--r--libkdepim/kpimprefs.cpp3
-rw-r--r--libkdepim/kpimprefs.h1
4 files changed, 32 insertions, 6 deletions
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index fbfbc45..93538ec 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -111,68 +111,77 @@ KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent,
setupLocaleDateTab();
setupTimeZoneTab();
setupExternalAppTab();
setupStoreTab();
setupBackupTab();
}
void KDEPIMConfigWidget::showTimeZoneTab()
{
tabWidget->setCurrentPage ( 3 ) ;
}
void KDEPIMConfigWidget::setupBackupTab()
{
QVBox *colorPage = new QVBox( this );
tabWidget->addTab( colorPage, i18n( "Backup" ) );
QWidget* topFrame = new QWidget( colorPage );
QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"),
&(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame);
topLayout->addWidget((QWidget*)sb->checkBox());
QWidget* bupFrame = new QWidget( topFrame );
topLayout->addWidget((bupFrame));
QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) );
QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame);
sb = addWidBool(i18n("Use standard backup dir"),
- &(KPimGlobalPrefs::instance()->mBackupEnabled),bupFrame);
+ &(KPimGlobalPrefs::instance()->mBackupUseDefaultDir),bupFrame);
bupLayout->addWidget((QWidget*)sb->checkBox());
mBackupUrl = new KURLRequester( bupFrame );
mBackupUrl->setURL( KGlobalSettings::backupDataDir() );
QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) );
bupLayout->addWidget( mBackupUrl );
-
+ mBackupUrl->setEnabled( !KPimGlobalPrefs::instance()->mBackupUseDefaultDir );
+ bupFrame->setEnabled( KPimGlobalPrefs::instance()->mBackupEnabled );
QHBox *dummy = new QHBox(bupFrame);
new QLabel(i18n("Number of Backups:"),dummy);
mBackupNumbersSpin = new QSpinBox(1,21,1,dummy);
new QLabel(i18n(" "),dummy);
bupLayout->addWidget( dummy );
dummy = new QHBox(bupFrame);
new QLabel(i18n("Make backup every "),dummy);
mBackupDayCountSpin = new QSpinBox(1,28,1,dummy);
new QLabel(i18n(" days"),dummy);
new QLabel(i18n(" "),dummy);
- bupLayout->addWidget( dummy );
+ bupLayout->addWidget( dummy );
+ QString localKdeDir;
+ localKdeDir = readEnvPath("LOCALMICROKDEHOME");
+ if ( ! localKdeDir.isEmpty() ) {
+ sb->checkBox()->setEnabled( false );
+ sb->checkBox()->setChecked( true );
+ mBackupUrl->setEnabled( false );
+ KPimGlobalPrefs::instance()->mBackupUseDefaultDir = true;
+ }
}
void KDEPIMConfigWidget::setupStoreTab()
{
QVBox *colorPage = new QVBox( this );
tabWidget->addTab( colorPage, i18n( "Colors" ) );
QWidget* cw = new QWidget( colorPage );
KPrefsWidColor *holidayColor =
addWidColor(i18n("Alternating background of list views"),
&(KPimGlobalPrefs::instance()->mAlternateColor),cw);
QHBoxLayout *topLayout = new QHBoxLayout(cw);
topLayout->addWidget(holidayColor->label());
topLayout->addWidget( (QWidget* )holidayColor->button());
QVBox *storePage = new QVBox( this );
new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage );
new QLabel( i18n("<b>New data storage dir:</b>"), storePage );
mStoreUrl = new KURLRequester( storePage );
mStoreUrl->setURL( KGlobal::dirs()->localkdedir() );
#ifdef DESKTOP_VERSION
QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ;
QFileInfo fi ( confFile );
if ( fi.exists() ) {
@@ -785,108 +794,115 @@ void KDEPIMConfigWidget::updateClientWidgets()
}
else
{
mMessage2->setText( "" );
mParameters2->setText( "" );
}
if (enabled == true) {
mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
}
blockSignals( blocked );
}
void KDEPIMConfigWidget::usrReadConfig()
{
KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
bool blocked = signalsBlocked();
blockSignals( true );
+ if (KPimGlobalPrefs::instance()->mBackupUseDefaultDir )
+ mBackupUrl->setURL( KGlobalSettings::backupDataDir() );
+ else
+ mBackupUrl->setURL(prefs->mBackupDatadir);
+ mBackupNumbersSpin->setValue( prefs->mBackupNumbers );
+ mBackupDayCountSpin->setValue( prefs->mBackupDayCount);
+
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->mSipClient;
mSipOtherChannel = prefs->mSipOtherChannel;
mSipOtherMessage = prefs->mSipOtherMessage;
mSipOtherMessageParameters = prefs->mSipOtherMessageParameters;
mCurrentApp = ExternalAppHandler::EMAIL;
mCurrentClient = mEmailClient;
updateClientWidgets();
blockSignals( blocked );
}
void KDEPIMConfigWidget::usrWriteConfig()
{
KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
saveEditFieldSettings();
+ prefs->mBackupNumbers = mBackupNumbersSpin->value();
+ prefs->mBackupDayCount = mBackupDayCountSpin->value();
+ prefs->mBackupDatadir = mBackupUrl->url();
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;
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index 90321b2..9c28425 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -179,45 +179,51 @@ void KPimGlobalPrefs::setGlobalConfig()
br = nbr+1;
}
//qDebug("end *%s* ", end.latin1());
setLocaleDict( mLocaleDict );
} else {
qDebug("KO: Cannot find translation file %s",fileName.latin1() );
}
}
}
KGlobal::locale()->setHore24Format( !mPreferredTime );
KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday );
KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate );
KGlobal::locale()->setLanguage( mPreferredLanguage );
QString dummy = mUserDateFormatLong;
KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
dummy = mUserDateFormatShort;
KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
KGlobal::locale()->setDaylightSaving( mUseDaylightsaving,
mDaylightsavingStart,
mDaylightsavingEnd );
KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min );
KGlobalSettings::setAlternateBackgroundColor(mAlternateColor);
+ QString localKdeDir;
+ localKdeDir = readEnvPath("LOCALMICROKDEHOME");
+ if ( ! localKdeDir.isEmpty() ) {
+ mBackupUseDefaultDir = true;
+ mBackupDatadir = KGlobalSettings::backupDataDir();
+ }
}
KPimGlobalPrefs::~KPimGlobalPrefs()
{
if (sInstance == this)
sInstance = staticDeleterGP.setObject(0);
else
qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?");
if ( mLocaleDict )
delete mLocaleDict;
}
KPimGlobalPrefs *KPimGlobalPrefs::instance()
{
if ( !sInstance ) {
sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() );
sInstance->readConfig();
}
return sInstance;
}
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp
index d68ccb6..714d1b7 100644
--- a/libkdepim/kpimprefs.cpp
+++ b/libkdepim/kpimprefs.cpp
@@ -29,48 +29,51 @@ $Id$
*/
#include <kglobal.h>
#include <kconfig.h>
#include <klocale.h>
#include <kdebug.h>
#include "kpimprefs.h"
KPimPrefs::KPimPrefs( const QString &name ) :
KPrefs( name )
{
#ifdef _WIN32_
QString hdp= locateLocal("data","korganizer")+"\\\\";
#else
QString hdp= locateLocal("data","korganizer")+"/";
#endif
setCurrentGroup("SyncOptions");
addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" );
addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" );
addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
addItemBool("PassiveSyncWithDesktop",&mPassiveSyncWithDesktop,false );
addItemBool("PassiveSyncAutoStart",&mPassiveSyncAutoStart,false );
addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
+
+ setCurrentGroup("BackupDate");
+ addItemInt("LastBackupDate",&mLastBackupDate,0);
}
KPimPrefs::~KPimPrefs()
{
}
void KPimPrefs::usrSetDefaults()
{
setCategoryDefaults();
}
void KPimPrefs::usrReadConfig()
{
config()->setGroup("General");
mCustomCategories = config()->readListEntry("Custom Categories");
if (mCustomCategories.isEmpty()) setCategoryDefaults();
}
void KPimPrefs::usrWriteConfig()
{
config()->setGroup("General");
config()->writeEntry("Custom Categories",mCustomCategories);
}
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h
index c177bd6..bf80042 100644
--- a/libkdepim/kpimprefs.h
+++ b/libkdepim/kpimprefs.h
@@ -40,34 +40,35 @@ 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;
QString mPassiveSyncPort;
QString mPassiveSyncPw;
bool mPassiveSyncWithDesktop;
bool mPassiveSyncAutoStart;
int mRingSyncAlgoPrefs;
QString mLastSyncedLocalFile;
+ int mLastBackupDate;
protected:
virtual void setCategoryDefaults();
};
#endif