summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorzautrix <zautrix>2005-04-21 17:43:18 (UTC)
committer zautrix <zautrix>2005-04-21 17:43:18 (UTC)
commitfd38343ef53c9b2a48208f747100579703cc1814 (patch) (side-by-side diff)
tree2aeabdf01986d59d72044615b952a65b4d8ba292 /libkdepim
parent0a13a3490ec3bf4735e3435f80f58fa7d50b4448 (diff)
downloadkdepimpi-fd38343ef53c9b2a48208f747100579703cc1814.zip
kdepimpi-fd38343ef53c9b2a48208f747100579703cc1814.tar.gz
kdepimpi-fd38343ef53c9b2a48208f747100579703cc1814.tar.bz2
backup impl
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
@@ -132,14 +132,15 @@ void KDEPIMConfigWidget::setupBackupTab()
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);
@@ -151,7 +152,15 @@ void KDEPIMConfigWidget::setupBackupTab()
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()
@@ -806,6 +815,13 @@ void KDEPIMConfigWidget::usrReadConfig()
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;
@@ -816,9 +832,6 @@ void KDEPIMConfigWidget::usrReadConfig()
mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1));
setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId));
-
-
-
mEmailClient = prefs->mEmailClient;
mEmailOtherChannel = prefs->mEmailOtherChannel;
mEmailOtherMessage = prefs->mEmailOtherMessage;
@@ -866,6 +879,9 @@ void KDEPIMConfigWidget::usrWriteConfig()
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") );
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index 90321b2..9c28425 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -200,6 +200,12 @@ void KPimGlobalPrefs::setGlobalConfig()
mDaylightsavingEnd );
KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min );
KGlobalSettings::setAlternateBackgroundColor(mAlternateColor);
+ QString localKdeDir;
+ localKdeDir = readEnvPath("LOCALMICROKDEHOME");
+ if ( ! localKdeDir.isEmpty() ) {
+ mBackupUseDefaultDir = true;
+ mBackupDatadir = KGlobalSettings::backupDataDir();
+ }
}
KPimGlobalPrefs::~KPimGlobalPrefs()
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp
index d68ccb6..714d1b7 100644
--- a/libkdepim/kpimprefs.cpp
+++ b/libkdepim/kpimprefs.cpp
@@ -50,6 +50,9 @@ KPimPrefs::KPimPrefs( const QString &name ) :
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
@@ -61,6 +61,7 @@ class KPimPrefs : public KPrefs
bool mPassiveSyncAutoStart;
int mRingSyncAlgoPrefs;
QString mLastSyncedLocalFile;
+ int mLastBackupDate;
protected: