-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 73 | ||||
-rw-r--r-- | libkdepim/ksyncprefsdialog.h | 11 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.cpp | 37 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.h | 21 |
4 files changed, 125 insertions, 17 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 7c04f48..355c05d 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp @@ -120,300 +120,353 @@ void KSyncPrefsDialog::setupSyncAlgTab() QHBox* buttonbox = new QHBox( topFrame); topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); ++iii; button = new QPushButton( i18n("New profile"), buttonbox ); connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); button = new QPushButton( i18n("Clone profile"), buttonbox ); connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); button = new QPushButton( i18n("Delete profile"), buttonbox ); connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); mProfileBox = new QComboBox(topFrame); mProfileBox->setEditable ( true ); connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); topLayout->addWidget(lab ,iii,0); topLayout->addWidget(mProfileBox, iii,1); ++iii; mIncludeInRing = new QCheckBox( i18n("Include in multiple calendar sync"), topFrame ); topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1); ++iii; mIncludeInRingAB = new QCheckBox( i18n("Include in multiple addressbook sync"), topFrame ); topLayout->addMultiCellWidget(mIncludeInRingAB, iii,iii,0,1); ++iii; mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); ++iii; QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); topLayout->addMultiCellWidget(gr, iii,iii,0,1); ++iii; loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); // both = new QRadioButton ( i18n("Take both on conflict"), gr ); mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); ++iii; - mWriteBackExisting= new QCheckBox( i18n("Write back existing entries only"), topFrame ); + mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); + topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); + ++iii; + + 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; topLayout->addMultiCellWidget(gr, iii,iii,0,1); ++iii; mIsLocal = new QRadioButton ( i18n("Local file"), gr ); 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); temphb = new QHBox( remoteFileWidget ); button = new QPushButton( i18n("ssh/scp"), temphb ); connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); button = new QPushButton( i18n("ftp"), temphb ); connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); } void KSyncPrefsDialog::slotOK() { if ( mMyMachineName->text() == "undefined" ) { KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); return; } int i; for (i = 0; i < mSyncProfileNames.count(); ++ i) { if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); return; } } usrWriteConfig(); QDialog::accept(); } void KSyncPrefsDialog::accept() { slotOK(); } void KSyncPrefsDialog::chooseFile() { QString fn = QDir::homeDirPath(); fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); if ( fn == "" ) return; mRemoteFile->setText( fn ); } +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 ) { if ( mProfileBox->count() == 0 ) return; if ( currentSelection < 3 ) { //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); mProfileBox->blockSignals( true ); mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); mProfileBox->blockSignals( false ); return; } //qDebug("cur i %d ",mProfileBox-> currentItem () ); mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; prof->setName( s ); mSyncProfileNames[mProfileBox-> currentItem ()] = s; } void KSyncPrefsDialog::profileChanged( int item ) { //qDebug("KSyncPrefsDialog::profileChanged %d ", item ); KSyncProfile* prof; saveProfile(); currentSelection = item; prof = mSyncProfiles.at(item) ; mRemotePrecommand->setText(prof->getPreSyncCommand()); mRemotePostcommand->setText(prof->getPostSyncCommand()); 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()); mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); mWriteBackFile->setChecked( prof->getWriteBackFile()); mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); + mWriteBackFuture->setChecked( prof->getWriteBackFuture()); + mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); switch ( prof->getSyncPrefs() ) { case 0: loc->setChecked( true); break; case 1: rem->setChecked( true ); break; case 2: newest->setChecked( true); break; case 3: ask->setChecked( true); break; case 4: f_loc->setChecked( true); break; case 5: f_rem->setChecked( true); break; case 6: //both->setChecked( true); break; default: break; } mIsLocal->setChecked(prof->getIsLocalFileSync()) ; mIsNotLocal->setChecked(!prof->getIsLocalFileSync()); proGr->setEnabled( item > 2 ); if ( item < 3 ) { localFileWidget->setEnabled(false); remoteFileWidget->setEnabled(false); } else kindChanged( prof->getIsLocalFileSync() ); } void KSyncPrefsDialog::fillSSH() { mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 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() { mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); 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" ); } void KSyncPrefsDialog::kindChanged( bool b ) { localFileWidget->setEnabled(b); remoteFileWidget->setEnabled(!b); } void KSyncPrefsDialog::deleteProfile() { //qDebug("KSyncPrefsDialog::deleteProfile() "); if ( currentSelection >= 0 ) { if ( currentSelection < 3 ) { KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); return; } KSyncProfile* temp = mSyncProfiles.at(currentSelection); mSyncProfiles.remove( temp ); mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); insertProfiles(); } } void KSyncPrefsDialog::saveProfile() { KSyncProfile* prof; if ( currentSelection >= 0 ) { prof = mSyncProfiles.at(currentSelection) ; prof->setPreSyncCommand( mRemotePrecommand->text()); prof->setPostSyncCommand( mRemotePostcommand->text() ); 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()); prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); prof->setWriteBackFile( mWriteBackFile->isChecked()); prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; prof->setSyncPrefs( syncprefs); prof->setIsLocalFileSync( mIsLocal->isChecked() ); + prof->setWriteBackFuture(mWriteBackFuture->isChecked()); + prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); } } void KSyncPrefsDialog::insertProfiles() { int curItem = mProfileBox->currentItem(); mProfileBox->blockSignals( true ); mProfileBox->clear(); mProfileBox->insertStringList (mSyncProfileNames ); int item = mSyncProfileNames.count() -1; if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) mProfileBox->setCurrentItem( curItem ); else if ( item >= 0 ) { mProfileBox->setCurrentItem( item ); } currentSelection = -1; if ( mSyncProfileNames.count() > 0 ) { //qDebug(" profileChanged( mProfileBox->currentItem() "); profileChanged( mProfileBox->currentItem() ); currentSelection = mProfileBox->currentItem(); } mProfileBox->blockSignals( false ); } void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) { saveProfile(); mSyncProfiles.append( temp ); mSyncProfileNames << temp->getName(); insertProfiles(); int last = mProfileBox->count() -1; mProfileBox->blockSignals( true ); mProfileBox->setCurrentItem( last ); mProfileBox->blockSignals( false ); profileChanged(last); } void KSyncPrefsDialog::newProfile() { addProfile ( new KSyncProfile () ); } void KSyncPrefsDialog::cloneProfile() { if ( currentSelection >= 0 ) addProfile (mSyncProfiles.at(currentSelection)->clone()) ; else newProfile(); diff --git a/libkdepim/ksyncprefsdialog.h b/libkdepim/ksyncprefsdialog.h index c663d22..8c2c59c 100644 --- a/libkdepim/ksyncprefsdialog.h +++ b/libkdepim/ksyncprefsdialog.h @@ -24,88 +24,97 @@ #define _KSYNCPREFSDIALOG_H #include <kdialogbase.h> #include <qptrlist.h> //#include <libkdepim/kprefsdialog.h> class KColorButton; class QSpinBox;; class QRadioButton; class QCheckBox; class QSlider; class KURLRequester; class QComboBox; class QButtonGroup; class QLineEdit; class QVBox; class QStringList; class KSyncProfile; /** Dialog to change the korganizer configuration. */ class KSyncPrefsDialog : public KDialog { Q_OBJECT public: /** Initialize dialog and pages */ KSyncPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); ~KSyncPrefsDialog(); void usrReadConfig(); void setLocalMachineName ( const QString& name ); QString getLocalMachineName ( ); QStringList getSyncProfileNames(); public slots: protected slots: void accept(); void deleteProfile(); void newProfile(); void cloneProfile(); void kindChanged(bool); void fillSSH(); void fillFTP(); void textChanged( const QString & ); void profileChanged( int ); void chooseFile(); + void chooseFileAB(); void slotOK(); protected: void usrWriteConfig(); void setupSyncAlgTab(); private: int currentSelection; QPtrList<KSyncProfile> mSyncProfiles; QStringList mSyncProfileNames; QLineEdit * mMyMachineName; QComboBox * mProfileBox; QRadioButton* mIsLocal; QRadioButton* mIsNotLocal; QCheckBox* mIncludeInRing; QCheckBox* mIncludeInRingAB; void addProfile ( KSyncProfile* ); void insertProfiles(); void saveProfile(); QButtonGroup* proGr; QRadioButton* loc, *rem, *newest, *ask, *f_loc,* f_rem, *both; QLineEdit * mRemotePostcommand; QLineEdit * mRemotePrecommand; QLineEdit * mRemoteFile; QLineEdit * mLocalTempFile; - QWidget* mSetupSyncAlgTab; + QLineEdit * mRemotePostcommandAB; + QLineEdit * mRemotePrecommandAB; + QLineEdit * mRemoteFileAB; + QLineEdit * mLocalTempFileAB; + + + QWidget* mSetupSyncAlgTab; QVBox* localFileWidget; QVBox* remoteFileWidget; QCheckBox* mWriteBackFile; + QCheckBox* mWriteBackFuture; + QSpinBox* mWriteBackFutureWeeks; QCheckBox* mWriteBackExisting; QCheckBox* mAskForPreferences; QCheckBox* mShowSummaryAfterSync; }; #endif diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp index ea41a85..f34c309 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp @@ -2,128 +2,155 @@ This file is part of KOrganizer. Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // $Id$ #include <qcolor.h> #include <kconfig.h> #include <kstandarddirs.h> #include <kglobal.h> #include <kdebug.h> #include "ksyncprofile.h" KSyncProfile::KSyncProfile( const char * name): QObject (0, name ) { setDefault(); } KSyncProfile::~KSyncProfile() { } KSyncProfile* KSyncProfile::clone() { KSyncProfile* myClone = new KSyncProfile(); myClone->setPreSyncCommand( mPreSyncCommand ); myClone->setPostSyncCommand( mPostSyncCommand ); 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 ); myClone->setSyncPrefs( mSyncPrefs); myClone->setIsLocalFileSync( mIsLocalFileSync ); myClone->setName( "noName" ); return myClone; } void KSyncProfile::setDefault() { mName = "noName"; mPreSyncCommand = i18n("command for downloading remote file to local device"); mPostSyncCommand = i18n("command for uploading local temp file to remote device"); 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; mIncludeInRingSyncAB = false; mSyncPrefs = SYNC_PREF_ASK; mIsLocalFileSync = true; } void KSyncProfile::readConfig(KConfig *config ) { config->setGroup("SyncProfiles"); QString prefix = "Profile_"+mName+"_"; //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 ); } void KSyncProfile::writeConfig( KConfig * config ) { config->setGroup("SyncProfiles"); QString prefix = "Profile_"+mName+"_"; // config->writeEntry( prefix+ "Name", mName ); 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 ); } /* class KPrefsItemInt : public KPrefsItem { public: KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0); virtual ~KPrefsItemInt() {} void setDefault(); void readConfig(KConfig *); void writeConfig(KConfig *); private: int *mReference; int mDefault; }; */ diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h index df1b49e..80094b1 100644 --- a/libkdepim/ksyncprofile.h +++ b/libkdepim/ksyncprofile.h @@ -14,92 +14,111 @@ You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _KSYNCPROFILE_H #define _KSYNCPROFILE_H #include <qptrlist.h> #include <qcolor.h> #include <qfont.h> #include <qstringlist.h> #include <qobject.h> #include <qstring.h> #include <libkcal/syncdefines.h> class KConfig; /** @short Class for storing a preferences setting @author Cornelius Schumacher @see KPref This class represents one preferences setting as used by @ref KPrefs. Subclasses of KPrefsItem implement storage functions for a certain type of setting. Normally you don't have to use this class directly. Use the special addItem() functions of KPrefs instead. If you subclass this class you will have to register instances with the function KPrefs::addItem(). */ class KSyncProfile : public QObject { public: KSyncProfile( const char * name = 0); ~KSyncProfile() ; KSyncProfile* clone(); void setDefault(); void readConfig(KConfig *); void writeConfig(KConfig *); void setName( const QString& n ) {mName = n;} QString getName( ) { return mName;} void setPreSyncCommand( const QString& n ) {mPreSyncCommand = n;} QString getPreSyncCommand( ) { return mPreSyncCommand; } 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;} QString get( ) { return ;} */ void setShowSummaryAfterSync( bool b ) { mShowSummaryAfterSync = b;} bool getShowSummaryAfterSync( ) { return mShowSummaryAfterSync ;} void setAskForPreferences( bool b ) { mAskForPreferences= b;} bool getAskForPreferences( ) { return mAskForPreferences;} 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;} void setIncludeInRingSync( bool b ) {mIncludeInRingSync = b;} bool getIncludeInRingSync( ) { return mIncludeInRingSync;} void setIncludeInRingSyncAB( bool b ) {mIncludeInRingSyncAB = b;} bool getIncludeInRingSyncAB( ) { return mIncludeInRingSyncAB;} 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;} private: QString mName; QString mPreSyncCommand; QString mPostSyncCommand; QString mLocalTempFile; QString mRemoteFileName; + QString mPreSyncCommandAB; + QString mPostSyncCommandAB; + QString mLocalTempFileAB; + QString mRemoteFileNameAB; bool mIncludeInRingSync; bool mIncludeInRingSyncAB; int mSyncPrefs; bool mWriteBackFile; bool mWriteBackExisting; + bool mWriteBackFuture; + int mWriteBackFutureWeeks; bool mAskForPreferences; bool mShowSummaryAfterSync; bool mIsLocalFileSync; }; #endif |