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) (unidiff)
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
@@ -129,32 +129,41 @@ void KDEPIMConfigWidget::setupBackupTab()
129 topLayout->addWidget((QWidget*)sb->checkBox()); 129 topLayout->addWidget((QWidget*)sb->checkBox());
130 QWidget* bupFrame = new QWidget( topFrame ); 130 QWidget* bupFrame = new QWidget( topFrame );
131 topLayout->addWidget((bupFrame)); 131 topLayout->addWidget((bupFrame));
132 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) ); 132 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) );
133 QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame); 133 QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame);
134 sb = addWidBool(i18n("Use standard backup dir"), 134 sb = addWidBool(i18n("Use standard backup dir"),
135 &(KPimGlobalPrefs::instance()->mBackupEnabled),bupFrame); 135 &(KPimGlobalPrefs::instance()->mBackupUseDefaultDir),bupFrame);
136 bupLayout->addWidget((QWidget*)sb->checkBox()); 136 bupLayout->addWidget((QWidget*)sb->checkBox());
137 mBackupUrl = new KURLRequester( bupFrame ); 137 mBackupUrl = new KURLRequester( bupFrame );
138 mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); 138 mBackupUrl->setURL( KGlobalSettings::backupDataDir() );
139 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) ); 139 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) );
140 bupLayout->addWidget( mBackupUrl ); 140 bupLayout->addWidget( mBackupUrl );
141 141
142 142 mBackupUrl->setEnabled( !KPimGlobalPrefs::instance()->mBackupUseDefaultDir );
143 bupFrame->setEnabled( KPimGlobalPrefs::instance()->mBackupEnabled );
143 QHBox *dummy = new QHBox(bupFrame); 144 QHBox *dummy = new QHBox(bupFrame);
144 new QLabel(i18n("Number of Backups:"),dummy); 145 new QLabel(i18n("Number of Backups:"),dummy);
145 mBackupNumbersSpin = new QSpinBox(1,21,1,dummy); 146 mBackupNumbersSpin = new QSpinBox(1,21,1,dummy);
146 new QLabel(i18n(" "),dummy); 147 new QLabel(i18n(" "),dummy);
147 bupLayout->addWidget( dummy ); 148 bupLayout->addWidget( dummy );
148 149
149 dummy = new QHBox(bupFrame); 150 dummy = new QHBox(bupFrame);
150 new QLabel(i18n("Make backup every "),dummy); 151 new QLabel(i18n("Make backup every "),dummy);
151 mBackupDayCountSpin = new QSpinBox(1,28,1,dummy); 152 mBackupDayCountSpin = new QSpinBox(1,28,1,dummy);
152 new QLabel(i18n(" days"),dummy); 153 new QLabel(i18n(" days"),dummy);
153 new QLabel(i18n(" "),dummy); 154 new QLabel(i18n(" "),dummy);
154 bupLayout->addWidget( dummy ); 155 bupLayout->addWidget( dummy );
156 QString localKdeDir;
157 localKdeDir = readEnvPath("LOCALMICROKDEHOME");
158 if ( ! localKdeDir.isEmpty() ) {
159 sb->checkBox()->setEnabled( false );
160 sb->checkBox()->setChecked( true );
161 mBackupUrl->setEnabled( false );
162 KPimGlobalPrefs::instance()->mBackupUseDefaultDir = true;
163 }
155 164
156} 165}
157void KDEPIMConfigWidget::setupStoreTab() 166void KDEPIMConfigWidget::setupStoreTab()
158{ 167{
159 QVBox *colorPage = new QVBox( this ); 168 QVBox *colorPage = new QVBox( this );
160 tabWidget->addTab( colorPage, i18n( "Colors" ) ); 169 tabWidget->addTab( colorPage, i18n( "Colors" ) );
@@ -803,25 +812,29 @@ void KDEPIMConfigWidget::usrReadConfig()
803{ 812{
804 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); 813 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
805 814
806 bool blocked = signalsBlocked(); 815 bool blocked = signalsBlocked();
807 blockSignals( true ); 816 blockSignals( true );
808 817
818 if (KPimGlobalPrefs::instance()->mBackupUseDefaultDir )
819 mBackupUrl->setURL( KGlobalSettings::backupDataDir() );
820 else
821 mBackupUrl->setURL(prefs->mBackupDatadir);
822 mBackupNumbersSpin->setValue( prefs->mBackupNumbers );
823 mBackupDayCountSpin->setValue( prefs->mBackupDayCount);
824
809 QString dummy = prefs->mUserDateFormatLong; 825 QString dummy = prefs->mUserDateFormatLong;
810 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); 826 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
811 dummy = prefs->mUserDateFormatShort; 827 dummy = prefs->mUserDateFormatShort;
812 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); 828 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
813 829
814 QDate current ( 2001, 1,1); 830 QDate current ( 2001, 1,1);
815 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); 831 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1));
816 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); 832 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1));
817 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); 833 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId));
818 834
819
820
821
822 mEmailClient = prefs->mEmailClient; 835 mEmailClient = prefs->mEmailClient;
823 mEmailOtherChannel = prefs->mEmailOtherChannel; 836 mEmailOtherChannel = prefs->mEmailOtherChannel;
824 mEmailOtherMessage = prefs->mEmailOtherMessage; 837 mEmailOtherMessage = prefs->mEmailOtherMessage;
825 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; 838 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters;
826 mEmailOtherMessage2 = prefs->mEmailOtherMessage2; 839 mEmailOtherMessage2 = prefs->mEmailOtherMessage2;
827 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; 840 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2;
@@ -863,12 +876,15 @@ void KDEPIMConfigWidget::usrReadConfig()
863void KDEPIMConfigWidget::usrWriteConfig() 876void KDEPIMConfigWidget::usrWriteConfig()
864{ 877{
865 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); 878 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
866 879
867 saveEditFieldSettings(); 880 saveEditFieldSettings();
868 881
882 prefs->mBackupNumbers = mBackupNumbersSpin->value();
883 prefs->mBackupDayCount = mBackupDayCountSpin->value();
884 prefs->mBackupDatadir = mBackupUrl->url();
869 885
870 prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); 886 prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
871 prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); 887 prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
872 888
873 prefs->mTimeZoneId = mTimeZoneCombo->currentText(); 889 prefs->mTimeZoneId = mTimeZoneCombo->currentText();
874 QDate date; 890 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()
197 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 197 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
198 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, 198 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving,
199 mDaylightsavingStart, 199 mDaylightsavingStart,
200 mDaylightsavingEnd ); 200 mDaylightsavingEnd );
201 KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); 201 KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min );
202 KGlobalSettings::setAlternateBackgroundColor(mAlternateColor); 202 KGlobalSettings::setAlternateBackgroundColor(mAlternateColor);
203 QString localKdeDir;
204 localKdeDir = readEnvPath("LOCALMICROKDEHOME");
205 if ( ! localKdeDir.isEmpty() ) {
206 mBackupUseDefaultDir = true;
207 mBackupDatadir = KGlobalSettings::backupDataDir();
208 }
203 209
204} 210}
205KPimGlobalPrefs::~KPimGlobalPrefs() 211KPimGlobalPrefs::~KPimGlobalPrefs()
206{ 212{
207 if (sInstance == this) 213 if (sInstance == this)
208 sInstance = staticDeleterGP.setObject(0); 214 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 ) :
47 addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); 47 addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" );
48 addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" ); 48 addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" );
49 addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); 49 addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
50 addItemBool("PassiveSyncWithDesktop",&mPassiveSyncWithDesktop,false ); 50 addItemBool("PassiveSyncWithDesktop",&mPassiveSyncWithDesktop,false );
51 addItemBool("PassiveSyncAutoStart",&mPassiveSyncAutoStart,false ); 51 addItemBool("PassiveSyncAutoStart",&mPassiveSyncAutoStart,false );
52 addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); 52 addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
53
54 setCurrentGroup("BackupDate");
55 addItemInt("LastBackupDate",&mLastBackupDate,0);
53} 56}
54 57
55KPimPrefs::~KPimPrefs() 58KPimPrefs::~KPimPrefs()
56{ 59{
57} 60}
58 61
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
58 QString mPassiveSyncPort; 58 QString mPassiveSyncPort;
59 QString mPassiveSyncPw; 59 QString mPassiveSyncPw;
60 bool mPassiveSyncWithDesktop; 60 bool mPassiveSyncWithDesktop;
61 bool mPassiveSyncAutoStart; 61 bool mPassiveSyncAutoStart;
62 int mRingSyncAlgoPrefs; 62 int mRingSyncAlgoPrefs;
63 QString mLastSyncedLocalFile; 63 QString mLastSyncedLocalFile;
64 int mLastBackupDate;
64 65
65 66
66 protected: 67 protected:
67 virtual void setCategoryDefaults(); 68 virtual void setCategoryDefaults();
68 69
69 70