-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 77 | ||||
-rw-r--r-- | libkdepim/ksyncprefsdialog.h | 19 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.cpp | 37 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.h | 21 |
4 files changed, 131 insertions, 23 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 7c04f48..355c05d 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp @@ -164,14 +164,22 @@ void KSyncPrefsDialog::setupSyncAlgTab() mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); + ++iii; + + mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); + topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); ++iii; - mWriteBackExisting= new QCheckBox( i18n("Write back existing entries only"), topFrame ); + mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame ); topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); ++iii; - - mWriteBackFile = new QCheckBox( i18n("Write back file"), topFrame ); - topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); + + mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame ); + topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); ++iii; - + topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0); + mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame); + topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); + ++iii; + proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); gr = proGr; @@ -181,28 +189,44 @@ void KSyncPrefsDialog::setupSyncAlgTab() mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); - + // *** local localFileWidget = new QVBox( topFrame); topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); ++iii; QHBox* temphb = new QHBox( localFileWidget ); - lab = new QLabel( i18n("Local file:"), temphb); - mRemoteFile = new QLineEdit(localFileWidget); + lab = new QLabel( i18n("Local file Cal:"), temphb ); + lab = new QLabel( i18n("Local file ABook:"), temphb ); + temphb = new QHBox( localFileWidget ); button = new QPushButton( i18n("Choose..."), temphb ); connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); + button = new QPushButton( i18n("Choose..."), temphb ); + connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) ); + temphb = new QHBox( localFileWidget ); + mRemoteFile = new QLineEdit( temphb); + mRemoteFileAB = new QLineEdit( temphb); + // *** remote remoteFileWidget = new QVBox( topFrame); topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); ++iii; + temphb = new QHBox( remoteFileWidget ); + new QLabel( i18n("Calendar:"), temphb); + new QLabel( i18n("AddressBook:"), temphb); + lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); - mRemotePrecommand = new QLineEdit(remoteFileWidget); + temphb = new QHBox( remoteFileWidget ); + mRemotePrecommand = new QLineEdit(temphb); + mRemotePrecommandAB = new QLineEdit(temphb); lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); - mLocalTempFile = new QLineEdit(remoteFileWidget); + temphb = new QHBox( remoteFileWidget ); + mLocalTempFile = new QLineEdit(temphb); + mLocalTempFileAB = new QLineEdit(temphb); - lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); - mRemotePostcommand = new QLineEdit(remoteFileWidget); + temphb = new QHBox( remoteFileWidget ); + mRemotePostcommand = new QLineEdit(temphb ); + mRemotePostcommandAB = new QLineEdit(temphb ); lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); @@ -246,4 +270,14 @@ void KSyncPrefsDialog::chooseFile() } +void KSyncPrefsDialog::chooseFileAB() +{ + QString fn = QDir::homeDirPath(); + + fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); + if ( fn == "" ) + return; + mRemoteFileAB->setText( fn ); +} + void KSyncPrefsDialog::textChanged( const QString & s ) { @@ -274,4 +308,9 @@ void KSyncPrefsDialog::profileChanged( int item ) mLocalTempFile->setText(prof->getLocalTempFile()); mRemoteFile->setText(prof->getRemoteFileName()) ; + + mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); + mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); + mLocalTempFileAB->setText(prof->getLocalTempFileAB()); + mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); mAskForPreferences->setChecked( prof->getAskForPreferences()); @@ -280,4 +319,6 @@ void KSyncPrefsDialog::profileChanged( int item ) mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); + mWriteBackFuture->setChecked( prof->getWriteBackFuture()); + mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); switch ( prof->getSyncPrefs() ) { @@ -322,4 +363,7 @@ void KSyncPrefsDialog::fillSSH() mLocalTempFile->setText("/tmp/mycalendar.ics" ); mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); + mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); + mLocalTempFileAB->setText("/tmp/std.vcf" ); + mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); } void KSyncPrefsDialog::fillFTP() @@ -328,4 +372,7 @@ void KSyncPrefsDialog::fillFTP() mLocalTempFile->setText("/tmp/mycalendar.ics" ); mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); + mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); + mLocalTempFileAB->setText("/tmp/std.vcf" ); + mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); } @@ -361,4 +408,8 @@ void KSyncPrefsDialog::saveProfile() prof->setLocalTempFile( mLocalTempFile->text()); prof->setRemoteFileName( mRemoteFile->text() ); + prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); + prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); + prof->setLocalTempFileAB( mLocalTempFileAB->text()); + prof->setRemoteFileNameAB( mRemoteFileAB->text() ); prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); prof->setAskForPreferences( mAskForPreferences->isChecked()); @@ -370,4 +421,6 @@ void KSyncPrefsDialog::saveProfile() prof->setSyncPrefs( syncprefs); prof->setIsLocalFileSync( mIsLocal->isChecked() ); + prof->setWriteBackFuture(mWriteBackFuture->isChecked()); + prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); } diff --git a/libkdepim/ksyncprefsdialog.h b/libkdepim/ksyncprefsdialog.h index c663d22..8c2c59c 100644 --- a/libkdepim/ksyncprefsdialog.h +++ b/libkdepim/ksyncprefsdialog.h @@ -70,4 +70,5 @@ class KSyncPrefsDialog : public KDialog void profileChanged( int ); void chooseFile(); + void chooseFileAB(); void slotOK(); @@ -99,12 +100,20 @@ class KSyncPrefsDialog : public KDialog QLineEdit * mRemoteFile; QLineEdit * mLocalTempFile; - QWidget* mSetupSyncAlgTab; + QLineEdit * mRemotePostcommandAB; + QLineEdit * mRemotePrecommandAB; + QLineEdit * mRemoteFileAB; + QLineEdit * mLocalTempFileAB; + + + QWidget* mSetupSyncAlgTab; QVBox* localFileWidget; QVBox* remoteFileWidget; - QCheckBox* mWriteBackFile; - QCheckBox* mWriteBackExisting; - QCheckBox* mAskForPreferences; - QCheckBox* mShowSummaryAfterSync; + QCheckBox* mWriteBackFile; + QCheckBox* mWriteBackFuture; + QSpinBox* mWriteBackFutureWeeks; + QCheckBox* mWriteBackExisting; + QCheckBox* mAskForPreferences; + QCheckBox* mShowSummaryAfterSync; }; diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp index ea41a85..f34c309 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp @@ -48,8 +48,14 @@ KSyncProfile* KSyncProfile::clone() myClone->setLocalTempFile( mLocalTempFile); myClone->setRemoteFileName( mRemoteFileName ); + myClone->setPreSyncCommandAB( mPreSyncCommandAB ); + myClone->setPostSyncCommandAB( mPostSyncCommandAB ); + myClone->setLocalTempFileAB( mLocalTempFileAB); + myClone->setRemoteFileNameAB( mRemoteFileNameAB ); myClone->setShowSummaryAfterSync( mShowSummaryAfterSync ); myClone->setAskForPreferences( mAskForPreferences); myClone->setWriteBackExisting(mWriteBackExisting ); myClone->setWriteBackFile( mWriteBackFile); + myClone->setWriteBackFuture( mWriteBackFuture ); + myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks ); myClone->setIncludeInRingSync( mIncludeInRingSync ); myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); @@ -68,7 +74,13 @@ void KSyncProfile::setDefault() mLocalTempFile = "/tmp/mycalendar.ics"; mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; + mPreSyncCommandAB = i18n("command for downloading remote file to local device"); + mPostSyncCommandAB = i18n("command for uploading local temp file to remote device"); + mLocalTempFileAB = "/tmp/std.vcf"; + mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf"; mShowSummaryAfterSync = true; mAskForPreferences = true; mWriteBackExisting = false; + mWriteBackFuture = false; + mWriteBackFutureWeeks = 12; mWriteBackFile = true; mIncludeInRingSync = false; @@ -84,13 +96,21 @@ void KSyncProfile::readConfig(KConfig *config ) //mName = config->readEntry( prefix+ "Name", mName ); mPreSyncCommand = config->readEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); - mPostSyncCommand = config->readEntry( prefix+ "PostSyncCommand", mPostSyncCommand ); - mIncludeInRingSync = config->readBoolEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); - mIncludeInRingSyncAB = config->readBoolEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); + mPostSyncCommand = config->readEntry( prefix+ "PostSyncCommand", mPostSyncCommand );; mLocalTempFile = config->readEntry( prefix+ "LocalTempFile", mLocalTempFile ); mRemoteFileName = config->readEntry( prefix+ "RemoteFileName", mRemoteFileName ); + + mPreSyncCommandAB = config->readEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB ); + mPostSyncCommandAB = config->readEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB ); + mLocalTempFileAB = config->readEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB ); + mRemoteFileNameAB = config->readEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB ); + + mIncludeInRingSync = config->readBoolEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); + mIncludeInRingSyncAB = config->readBoolEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); mShowSummaryAfterSync = config->readBoolEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); mAskForPreferences = config->readBoolEntry( prefix+ "AskForPreferences",mAskForPreferences ); mWriteBackExisting = config->readBoolEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); + mWriteBackFuture = config->readBoolEntry( prefix+ "WriteBackFuture",mWriteBackFuture ); mSyncPrefs = config->readNumEntry( prefix+ "SyncPrefs", mSyncPrefs ); + mWriteBackFutureWeeks = config->readNumEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks ); mIsLocalFileSync= config->readBoolEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); } @@ -102,12 +122,19 @@ void KSyncProfile::writeConfig( KConfig * config ) config->writeEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); config->writeEntry( prefix+ "PostSyncCommand", mPostSyncCommand ); - config->writeEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); - config->writeEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); config->writeEntry( prefix+ "LocalTempFile", mLocalTempFile ); config->writeEntry( prefix+ "RemoteFileName", mRemoteFileName ); + + config->writeEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB ); + config->writeEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB ); + config->writeEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB ); + config->writeEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB ); + config->writeEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); + config->writeEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); config->writeEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); config->writeEntry( prefix+ "AskForPreferences",mAskForPreferences ); config->writeEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); + config->writeEntry( prefix+ "WriteBackFuture",mWriteBackFuture ); config->writeEntry( prefix+ "SyncPrefs", mSyncPrefs ); + config->writeEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks); config->writeEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); } diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h index df1b49e..80094b1 100644 --- a/libkdepim/ksyncprofile.h +++ b/libkdepim/ksyncprofile.h @@ -60,9 +60,18 @@ class KSyncProfile : public QObject { void setPostSyncCommand( const QString& n ) {mPostSyncCommand = n;} QString getPostSyncCommand( ) { return mPostSyncCommand;} - void setLocalTempFile( const QString& n ) { mLocalTempFile= n;} QString getLocalTempFile( ) { return mLocalTempFile;} void setRemoteFileName( const QString& n ) { mRemoteFileName = n;} QString getRemoteFileName( ) { return mRemoteFileName;} + + void setPreSyncCommandAB( const QString& n ) {mPreSyncCommandAB = n;} + QString getPreSyncCommandAB( ) { return mPreSyncCommandAB; } + void setPostSyncCommandAB( const QString& n ) {mPostSyncCommandAB = n;} + QString getPostSyncCommandAB( ) { return mPostSyncCommandAB;} + void setLocalTempFileAB( const QString& n ) { mLocalTempFileAB= n;} + QString getLocalTempFileAB( ) { return mLocalTempFileAB;} + void setRemoteFileNameAB( const QString& n ) { mRemoteFileNameAB = n;} + QString getRemoteFileNameAB( ) { return mRemoteFileNameAB;} + /* void set( const QString& n ) { = n;} @@ -76,4 +85,6 @@ class KSyncProfile : public QObject { void setWriteBackExisting( bool b ) { mWriteBackExisting = b;} bool getWriteBackExisting( ) { return mWriteBackExisting;} + void setWriteBackFuture( bool b ) { mWriteBackFuture = b;} + bool getWriteBackFuture( ) { return mWriteBackFuture;} void setWriteBackFile( bool b ) { mWriteBackFile= b;} bool getWriteBackFile( ) { return mWriteBackFile;} @@ -84,4 +95,6 @@ class KSyncProfile : public QObject { void setSyncPrefs( int n ) { mSyncPrefs= n;} int getSyncPrefs( ) { return mSyncPrefs;} + void setWriteBackFutureWeeks( int n ) { mWriteBackFutureWeeks= n;} + int getWriteBackFutureWeeks( ) { return mWriteBackFutureWeeks;} void setIsLocalFileSync( bool b ) { mIsLocalFileSync= b;} bool getIsLocalFileSync( ) { return mIsLocalFileSync;} @@ -93,4 +106,8 @@ class KSyncProfile : public QObject { QString mLocalTempFile; QString mRemoteFileName; + QString mPreSyncCommandAB; + QString mPostSyncCommandAB; + QString mLocalTempFileAB; + QString mRemoteFileNameAB; bool mIncludeInRingSync; bool mIncludeInRingSyncAB; @@ -98,4 +115,6 @@ class KSyncProfile : public QObject { bool mWriteBackFile; bool mWriteBackExisting; + bool mWriteBackFuture; + int mWriteBackFutureWeeks; bool mAskForPreferences; bool mShowSummaryAfterSync; |