author | zautrix <zautrix> | 2005-04-21 17:43:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-21 17:43:18 (UTC) |
commit | fd38343ef53c9b2a48208f747100579703cc1814 (patch) (side-by-side diff) | |
tree | 2aeabdf01986d59d72044615b952a65b4d8ba292 /libkdepim | |
parent | 0a13a3490ec3bf4735e3435f80f58fa7d50b4448 (diff) | |
download | kdepimpi-fd38343ef53c9b2a48208f747100579703cc1814.zip kdepimpi-fd38343ef53c9b2a48208f747100579703cc1814.tar.gz kdepimpi-fd38343ef53c9b2a48208f747100579703cc1814.tar.bz2 |
backup impl
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.cpp | 28 | ||||
-rw-r--r-- | libkdepim/kpimglobalprefs.cpp | 6 | ||||
-rw-r--r-- | libkdepim/kpimprefs.cpp | 3 | ||||
-rw-r--r-- | libkdepim/kpimprefs.h | 1 |
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 @@ -129,32 +129,41 @@ void KDEPIMConfigWidget::setupBackupTab() 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" ) ); @@ -803,25 +812,29 @@ 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; @@ -863,12 +876,15 @@ void KDEPIMConfigWidget::usrReadConfig() 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; diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp index 90321b2..9c28425 100644 --- a/libkdepim/kpimglobalprefs.cpp +++ b/libkdepim/kpimglobalprefs.cpp @@ -197,12 +197,18 @@ void KPimGlobalPrefs::setGlobalConfig() 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); diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp index d68ccb6..714d1b7 100644 --- a/libkdepim/kpimprefs.cpp +++ b/libkdepim/kpimprefs.cpp @@ -47,12 +47,15 @@ KPimPrefs::KPimPrefs( const QString &name ) : 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() { } diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h index c177bd6..bf80042 100644 --- a/libkdepim/kpimprefs.h +++ b/libkdepim/kpimprefs.h @@ -58,12 +58,13 @@ class KPimPrefs : public KPrefs QString mPassiveSyncPort; QString mPassiveSyncPw; bool mPassiveSyncWithDesktop; bool mPassiveSyncAutoStart; int mRingSyncAlgoPrefs; QString mLastSyncedLocalFile; + int mLastBackupDate; protected: virtual void setCategoryDefaults(); |