-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 45 | ||||
-rw-r--r-- | libkdepim/ksyncprefsdialog.h | 5 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.cpp | 19 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.h | 14 |
4 files changed, 80 insertions, 3 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 8a3f4cf..6e42fd4 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp @@ -1,791 +1,830 @@ /* This file is part of KOrganizer. Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qlayout.h> #include <qlabel.h> #include <qgroupbox.h> #include <qbuttongroup.h> #include <qlineedit.h> #include <qfont.h> #include <qslider.h> #include <qfile.h> #include <qdir.h> #include <qtextstream.h> #include <qcombobox.h> #include <qvbox.h> #include <qhbox.h> #include <qspinbox.h> #include <qdatetime.h> #include <qcheckbox.h> #include <qradiobutton.h> #include <qpushbutton.h> #include <qstrlist.h> #include <qapplication.h> #include <qlayout.h> #include <qscrollview.h> #include <qvgroupbox.h> #include <qhgroupbox.h> #include <kcolorbutton.h> #include <kdebug.h> #include <klocale.h> #include <kglobal.h> #include <kfontdialog.h> #include <kmessagebox.h> #include <kcolordialog.h> #include <kiconloader.h> #include <kemailsettings.h> #include <kstandarddirs.h> #include <kfiledialog.h> #include <kmessagebox.h> //#include <kurlrequester.h> #include <klineedit.h> #include "ksyncprofile.h" //#include "koprefs.h" #include "ksyncprefsdialog.h" //#include "koglobals.h" KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) : KDialog(parent,name,true) { setCaption( i18n("Synchronization Preferences")); mSyncProfiles.setAutoDelete( true ); setupSyncAlgTab(); } KSyncPrefsDialog::~KSyncPrefsDialog() { } void KSyncPrefsDialog::setupSyncAlgTab() { QLabel * lab; //QFrame *page = addPage(i18n("Sync Prefs"),0,0); QVBox * mainbox = new QVBox( this ); QScrollView* sv = new QScrollView( mainbox ); QHBoxLayout * lay = new QHBoxLayout( this ); lay->addWidget( mainbox ); QHBox * b_box = new QHBox( mainbox ); QPushButton* button = new QPushButton( i18n("Ok"), b_box ); connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) ); button = new QPushButton( i18n("Cancel"), b_box ); connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) ); //QBoxLayout * sl = new QVBoxLayout(this ); //sl->addWidget ( sv ); sv->setResizePolicy ( QScrollView::AutoOneFit ); QFrame *topFrame = new QFrame ( sv ); sv->addChild( topFrame ); mSetupSyncAlgTab = topFrame; QGridLayout *topLayout = new QGridLayout(topFrame,6,2); topLayout->setSpacing(spacingHint()); topLayout->setMargin(marginHint()); //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame); int iii = 0; //topLayout->addMultiCellWidget(lab , iii,iii,0,1); //++iii; mMyMachineName = new QLineEdit(topFrame); lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); topLayout->addWidget(lab ,iii,0); topLayout->addWidget(mMyMachineName,iii,1); ++iii; 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 ); mProfileBox->setInsertionPolicy(QComboBox::NoInsertion); 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; QHGroupBox *iims = new QHGroupBox( i18n("Multiple Sync options"), topFrame); new QLabel( i18n("Include in multiple "), iims ); mIncludeInRing = new QCheckBox( i18n("calendar "), iims ); mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims ); mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims ); new QLabel( i18n(" sync"), iims ); topLayout->addMultiCellWidget(iims, iii,iii,0,1); ++iii; QVGroupBox* gb0 = new QVGroupBox( i18n("Sync algo options"), topFrame); topLayout->addMultiCellWidget(gb0, iii,iii,0,1); ++iii; QButtonGroup* gr; { QVGroupBox* topFrame = gb0; + + + mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); //topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); //++iii; 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; + QHGroupBox* gb5 = new QHGroupBox( i18n("Apply filter when adding data to local:"), topFrame); + QVBox * fibo2 = new QVBox ( gb5 ); + new QLabel ( i18n("Incoming calendar filter:"), fibo2 ); + mFilterInCal = new QComboBox( fibo2 ); + fibo2 = new QVBox ( gb5 ); + new QLabel ( i18n("Incoming adressbook filter:"), fibo2 ); + mFilterInAB = new QComboBox( fibo2 ); + mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); // topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); // ++iii; QVGroupBox* gb2 = new QVGroupBox( i18n("Write back options"), topFrame); //topLayout->addMultiCellWidget(gb2, iii,iii,0,1); //++iii; { QVGroupBox*topFrame = gb2; mWriteBackExisting= new QCheckBox( i18n("Write back (on remote) existing entries only"), topFrame ); + QHGroupBox* gb4 = new QHGroupBox( i18n("Apply filter when adding data to remote:"), topFrame); + QVBox * fibo = new QVBox ( gb4 ); + new QLabel ( i18n("Outgoing calendar filter:"), fibo ); + mFilterOutCal = new QComboBox( fibo ); + fibo = new QVBox ( gb4 ); + new QLabel ( i18n("Outgoing addressbook filter:"), fibo ); + mFilterOutAB = new QComboBox( fibo ); //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); //++iii; mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame ); //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); //++iii; QHGroupBox* gb3 = new QHGroupBox( i18n("Time period"), topFrame); connect ( mWriteBackFuture, SIGNAL( toggled ( bool ) ), gb3, SLOT ( setEnabled ( bool ) ) ); new QLabel( i18n("From ") , gb3 ); mWriteBackPastWeeks= new QSpinBox(1,104, 1, gb3); new QLabel( i18n(" weeks in the past to ") , gb3 ); mWriteBackFutureWeeks= new QSpinBox(1,104, 1, gb3); new QLabel( i18n(" weeks in the future ") , gb3 ); //topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); //++iii; gb3->setEnabled( false ); + connect ( mWriteBackExisting, SIGNAL( toggled ( bool ) ), gb4, SLOT ( setDisabled ( bool ) ) ); } connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) ); } 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 ); mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr ); connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame); topLayout->addMultiCellWidget(gb1, iii,iii,0,1); ++iii; // ****************************************** // Profile kind specific settings { // *** phone ******************************* QVGroupBox* topFrame = gb1; phoneWidget = new QVBox( topFrame); //topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); //++iii; mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget ); QHBox* temphb = new QHBox( phoneWidget ); new QLabel( i18n("I/O device: "), temphb ); mPhoneDevice = new QLineEdit( temphb); button = new QPushButton( i18n("Help..."), temphb ); connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) ); temphb = new QHBox( phoneWidget ); new QLabel( i18n("Connection: "), temphb ); mPhoneConnection = new QLineEdit( temphb); button = new QPushButton( i18n("Help..."), temphb ); connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) ); temphb = new QHBox( phoneWidget ); new QLabel( i18n("Model(opt.): "), temphb ); mPhoneModel = new QLineEdit( temphb); button = new QPushButton( i18n("Help..."), temphb ); connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) ); // *** local******************************* localFileWidget = new QVBox( topFrame); //topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); //++iii; temphb = new QHBox( localFileWidget ); lab = new QLabel( i18n("Local file Cal:"), temphb ); lab = new QLabel( i18n("Local file ABook:"), temphb ); lab = new QLabel( i18n("Local file PWMgr:"), 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() ) ); button = new QPushButton( i18n("Choose..."), temphb ); connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) ); temphb = new QHBox( localFileWidget ); mRemoteFile = new QLineEdit( temphb); mRemoteFileAB = new QLineEdit( temphb); mRemoteFilePWM = new QLineEdit( temphb); mIsKapiFileL = new QCheckBox( i18n("Addressbook file (*.vcf) is used by KA/Pi"), localFileWidget ); // *** 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); new QLabel( i18n("PWManager:"), temphb); lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); temphb = new QHBox( remoteFileWidget ); mRemotePrecommand = new QLineEdit(temphb); mRemotePrecommandAB = new QLineEdit(temphb); mRemotePrecommandPWM = new QLineEdit(temphb); lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); temphb = new QHBox( remoteFileWidget ); mLocalTempFile = new QLineEdit(temphb); mLocalTempFileAB = new QLineEdit(temphb); mLocalTempFilePWM = new QLineEdit(temphb); lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); temphb = new QHBox( remoteFileWidget ); mRemotePostcommand = new QLineEdit(temphb ); mRemotePostcommandAB = new QLineEdit(temphb ); mRemotePostcommandPWM = new QLineEdit(temphb ); mIsKapiFileR = new QCheckBox( i18n("Addressbook file is used by KA/Pi"), remoteFileWidget ); 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); // *** pi-sync******************************* piWidget = new QVBox( topFrame); //topLayout->addMultiCellWidget(piWidget, iii,iii,0,1); //++iii; temphb = new QHBox( piWidget ); new QLabel( i18n("Calendar:"), temphb); new QLabel( i18n("AddressBook:"), temphb); new QLabel( i18n("PWManager:"), temphb); lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget); temphb = new QHBox( piWidget ); mRemotePw = new QLineEdit(temphb); mRemotePwAB = new QLineEdit(temphb); mRemotePwPWM = new QLineEdit(temphb); lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget); temphb = new QHBox( piWidget ); mRemoteIP = new QLineEdit(temphb); mRemoteIPAB = new QLineEdit(temphb); mRemoteIPPWM = new QLineEdit(temphb); lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget); temphb = new QHBox( piWidget ); mRemotePort = new QLineEdit(temphb); mRemotePortAB = new QLineEdit(temphb); mRemotePortPWM = new QLineEdit(temphb); } // ****************************************** // Profile kind specific settings END } void KSyncPrefsDialog::readFilter() { mFilterKapi.clear(); mFilterKopi.clear(); mFilterKopi.append(i18n("No Filter") ); mFilterKapi.append(i18n("No Filter") ); KConfig cfgko(locateLocal("config","korganizerrc")); KConfig cfgka(locateLocal("config","kaddressbookrc")); cfgko.setGroup("General"); mFilterKopi = cfgko.readListEntry("CalendarFilters"); - mFilterKopi.prepend(i18n("No Filter") ); + mFilterKapi = mFilterKopi; + mFilterOutCal->clear(); + mFilterInCal->clear(); + mFilterOutAB->clear(); + mFilterInAB->clear(); + QStringList temp = mFilterKopi; + temp.prepend(i18n("No Filter") ); + mFilterOutCal->insertStringList( temp ); + mFilterInCal->insertStringList( temp ); + temp = mFilterKapi; + temp.prepend(i18n("No Filter") ); + mFilterOutAB->insertStringList( temp ); + mFilterInAB->insertStringList( temp ); } 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(*.vcf)"), this ); if ( fn == "" ) return; mRemoteFileAB->setText( fn ); } void KSyncPrefsDialog::chooseFilePWM() { QString fn = QDir::homeDirPath(); fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); if ( fn == "" ) return; mRemoteFilePWM->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 before %d, count %d ", item, mProfileBox->count() ); KSyncProfile* prof; saveProfile(); + readFilter(); currentSelection = item; prof = mSyncProfiles.at(item) ; mRemotePw->setText(prof->getRemotePw()); mRemoteIP->setText(prof->getRemoteIP()); mRemotePort->setText(prof->getRemotePort()); mRemotePwAB->setText(prof->getRemotePwAB()); mRemoteIPAB->setText(prof->getRemoteIPAB()); mRemotePortAB->setText(prof->getRemotePortAB()); mRemotePwPWM->setText(prof->getRemotePwPWM()); mRemoteIPPWM->setText(prof->getRemoteIPPWM()); mRemotePortPWM->setText(prof->getRemotePortPWM()); 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()) ; mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM()); mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM()); mLocalTempFilePWM->setText(prof->getLocalTempFilePWM()); mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ; if ( mWriteContactToSIM ) mWriteContactToSIM->setChecked( prof->getWriteContactToSIM()); mPhoneDevice->setText(prof->getPhoneDevice()); mPhoneConnection->setText(prof->getPhoneConnection()); mPhoneModel->setText(prof->getPhoneModel()); mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); mAskForPreferences->setChecked( prof->getAskForPreferences()); mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); mWriteBackFile->setChecked( prof->getWriteBackFile()); mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); mWriteBackFuture->setChecked( prof->getWriteBackFuture()); mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); mWriteBackPastWeeks->setValue( prof->getWriteBackPastWeeks() ); + + mFilterInCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterInCal () ) + 1 ); + mFilterOutCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterOutCal () ) + 1 ); + mFilterInAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterInAB () ) + 1 ); + mFilterOutAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterOutAB () ) + 1 ); 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()) ; mIsPhone->setChecked(prof->getIsPhoneSync()) ; mIsPi->setChecked(prof->getIsPiSync()) ; mIsKapiFileL->setChecked(prof->getIsKapiFile()) ; mIsKapiFileR->setChecked(prof->getIsKapiFile()) ; mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() ); proGr->setEnabled( item > 2 ); if ( item < 3 ) { localFileWidget->hide(); remoteFileWidget->hide(); phoneWidget->hide(); piWidget->hide(); } 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" ); mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" ); } 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" ); mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" ); mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); } void KSyncPrefsDialog::kindChanged( bool b ) { if ( mIsLocal->isChecked () ) { mIsKapiFileL->setChecked( mIsKapiFileR->isChecked() ); } else { mIsKapiFileR->setChecked( mIsKapiFileL->isChecked() ); } if ( mIsLocal->isChecked () ) localFileWidget->show(); else localFileWidget->hide(); if ( mIsNotLocal->isChecked () ) remoteFileWidget->show(); else remoteFileWidget->hide(); if ( mIsPhone->isChecked () ) { phoneWidget->show(); } else { phoneWidget->hide(); } if ( mIsPi->isChecked () ) { piWidget->show(); } else { piWidget->hide(); } } 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->setRemotePw( mRemotePw->text()); prof->setRemoteIP( mRemoteIP->text()); prof->setRemotePort( mRemotePort->text()); prof->setRemotePwAB( mRemotePwAB->text()); prof->setRemoteIPAB( mRemoteIPAB->text()); prof->setRemotePortAB( mRemotePortAB->text()); prof->setRemotePwPWM( mRemotePwPWM->text()); prof->setRemoteIPPWM( mRemoteIPPWM->text()); prof->setRemotePortPWM( mRemotePortPWM->text()); 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->setPreSyncCommandPWM( mRemotePrecommandPWM->text()); prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() ); prof->setLocalTempFilePWM( mLocalTempFilePWM->text()); prof->setRemoteFileNamePWM( mRemoteFilePWM->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() ); prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->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->setIsPhoneSync( mIsPhone->isChecked() ); prof->setIsPiSync( mIsPi->isChecked() ); prof->setIsKapiFile( mIsKapiFileL->isChecked() ); prof->setWriteBackFuture(mWriteBackFuture->isChecked()); prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value()); if ( mWriteContactToSIM ) prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); prof->setPhoneDevice( mPhoneDevice->text() ); prof->setPhoneConnection( mPhoneConnection->text() ); prof->setPhoneModel( mPhoneModel->text() ); - + prof->setFilterInCal ( mFilterInCal->currentText ()); + prof->setFilterOutCal ( mFilterOutCal ->currentText ()); + prof->setFilterInAB ( mFilterInAB ->currentText ()); + prof->setFilterOutAB ( mFilterOutAB ->currentText ()); } - } 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(); } void KSyncPrefsDialog::setLocalMachineName ( const QString& name ) { mMyMachineName->setText( name ); } QString KSyncPrefsDialog::getLocalMachineName ( ) { return mMyMachineName->text(); } QStringList KSyncPrefsDialog::getSyncProfileNames() { return mSyncProfileNames; } void KSyncPrefsDialog::usrReadConfig() { //KConfig *config = KOGlobals::config(); KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); config.setGroup("General"); mSyncProfileNames =config.readListEntry("SyncProfileNames"); mMyMachineName->setText(config.readEntry("LocalMachineName","undefined")); int i; KSyncProfile* temp ; mSyncProfiles.clear(); for ( i = 0; i < mSyncProfileNames.count();++i ) { temp = new KSyncProfile (); temp->setName( mSyncProfileNames[i] ); temp->readConfig( &config ); mSyncProfiles.append( temp ); } insertProfiles(); //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); } void KSyncPrefsDialog::usrWriteConfig() { saveProfile(); if ( currentSelection >= 0 ) profileChanged(currentSelection); //KConfig *config = KOGlobals::config(); KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); KSyncProfile* prof = mSyncProfiles.first(); QStringList externalSyncProfileNames; externalSyncProfileNames.append("Sharp_DTM");; while ( prof ) { prof->writeConfig(&config); if ( prof->getIsPhoneSync( ) ) externalSyncProfileNames.append(prof->getName( ) ); prof = mSyncProfiles.next(); } //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); config.setGroup("General"); config.writeEntry("SyncProfileNames",mSyncProfileNames); config.writeEntry("ExternSyncProfiles",externalSyncProfileNames); config.writeEntry("LocalMachineName",mMyMachineName->text()); config.sync(); } void KSyncPrefsDialog::helpDevice() { QString hint = i18n("Insert device where\nphone is connected. E.g.:\n"); #ifdef _WIN32_ hint += "Leave empty for Irda.\n" "com1:\n(first serial port)\n" "usb not supported\n" "???\n(bluetooth device address)\n"; #else hint += "/dev/ircomm\n(Irda)\n" "/dev/ttyS0\n(first serial port)\n" "/dev/ttyUSB0\n(first device usb port)\n" "???\n(bluetooth device address)\n"; #endif KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); } void KSyncPrefsDialog::helpModel() { QString hint = i18n("Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n"); hint += "E.g. for Nokia 6310i:\n6310i\nAlso possible:\nobex\nfor Obex connection"; KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); } void KSyncPrefsDialog::helpConnection() { QString hint = i18n("Insert kind of connection,e.g.:\n"); hint += "irda | Nokia FBUS over infrared\n" "irdaat | AT commands infrared\n(for Siemens/Sony-Erricsson)\n" "irdaobex | set also model as obex\n" "fbus | Nokia FBUS2 serial\n"; KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); } diff --git a/libkdepim/ksyncprefsdialog.h b/libkdepim/ksyncprefsdialog.h index 997f524..24543e1 100644 --- a/libkdepim/ksyncprefsdialog.h +++ b/libkdepim/ksyncprefsdialog.h @@ -1,155 +1,160 @@ /* This file is part of KOrganizer. Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #ifndef _KSYNCPREFSDIALOG_H #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 chooseFilePWM(); void slotOK(); void helpDevice(); void helpModel(); void helpConnection(); protected: void usrWriteConfig(); void setupSyncAlgTab(); void readFilter(); private: int currentSelection; QPtrList<KSyncProfile> mSyncProfiles; QStringList mSyncProfileNames; QStringList mFilterKapi; QStringList mFilterKopi; QLineEdit * mMyMachineName; QComboBox * mProfileBox; QRadioButton* mIsLocal; QRadioButton* mIsNotLocal; QRadioButton* mIsPhone; QRadioButton* mIsPi; QCheckBox* mIncludeInRing; QCheckBox* mIncludeInRingAB; QCheckBox* mIncludeInRingPWM; void addProfile ( KSyncProfile* ); void insertProfiles(); void saveProfile(); QButtonGroup* proGr; + QComboBox * mFilterOutCal; + QComboBox * mFilterInCal; + QComboBox * mFilterOutAB; + QComboBox * mFilterInAB; + QRadioButton* loc, *rem, *newest, *ask, *f_loc,* f_rem, *both; QLineEdit * mRemotePostcommand; QLineEdit * mRemotePrecommand; QLineEdit * mRemoteFile; QLineEdit * mLocalTempFile; QLineEdit * mRemotePostcommandAB; QLineEdit * mRemotePrecommandAB; QLineEdit * mRemoteFileAB; QLineEdit * mLocalTempFileAB; QLineEdit * mRemotePostcommandPWM; QLineEdit * mRemotePrecommandPWM; QLineEdit * mRemoteFilePWM; QLineEdit * mLocalTempFilePWM; QLineEdit * mRemotePw; QLineEdit * mRemoteIP; QLineEdit * mRemotePort; QLineEdit * mRemotePwAB; QLineEdit * mRemoteIPAB; QLineEdit * mRemotePortAB; QLineEdit * mRemotePwPWM; QLineEdit * mRemoteIPPWM; QLineEdit * mRemotePortPWM; QLineEdit * mPhoneDevice; QLineEdit * mPhoneConnection; QLineEdit * mPhoneModel; QWidget* mSetupSyncAlgTab; QVBox* localFileWidget; QVBox* remoteFileWidget; QVBox* phoneWidget; QVBox* piWidget; QCheckBox* mWriteBackFile; QCheckBox* mWriteBackFuture; QSpinBox* mWriteBackFutureWeeks; QSpinBox* mWriteBackPastWeeks; QCheckBox* mWriteBackExisting; QCheckBox* mAskForPreferences; QCheckBox* mShowSummaryAfterSync; QCheckBox* mWriteContactToSIM; QCheckBox* mIsKapiFileL; QCheckBox* mIsKapiFileR; }; #endif diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp index 9f404cb..0d72fc9 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp @@ -1,256 +1,275 @@ /* This file is part of KDE-Pim/Pi. 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(): QObject () { setDefault(); } KSyncProfile::~KSyncProfile() { } KSyncProfile* KSyncProfile::clone() { KSyncProfile* myClone = new KSyncProfile(); myClone->setRemotePw(mRemotePw); myClone->setRemoteIP(mRemoteIP); myClone->setRemotePort(mRemotePort); myClone->setRemotePwAB(mRemotePwAB); myClone->setRemoteIPAB(mRemoteIPAB); myClone->setRemotePortAB(mRemotePortAB); myClone->setRemotePwPWM(mRemotePwPWM); myClone->setRemoteIPPWM(mRemoteIPPWM); myClone->setRemotePortPWM (mRemotePortPWM); 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->setPreSyncCommandPWM( mPreSyncCommandPWM ); myClone->setPostSyncCommandPWM( mPostSyncCommandPWM ); myClone->setLocalTempFilePWM( mLocalTempFilePWM); myClone->setRemoteFileNamePWM( mRemoteFileNamePWM ); myClone->setShowSummaryAfterSync( mShowSummaryAfterSync ); myClone->setAskForPreferences( mAskForPreferences); myClone->setWriteBackExisting(mWriteBackExisting ); myClone->setWriteBackFile( mWriteBackFile); myClone->setWriteBackFuture( mWriteBackFuture ); myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks ); myClone->setWriteBackPastWeeks( mWriteBackPastWeeks ); myClone->setIncludeInRingSync( mIncludeInRingSync ); myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); myClone->setIncludeInRingSyncPWM( mIncludeInRingSyncPWM ); myClone->setSyncPrefs( mSyncPrefs); myClone->setIsLocalFileSync( mIsLocalFileSync ); myClone->setIsPhoneSync( mIsPhoneSync ); myClone->setIsKapiFile( mIsKapiFile ); myClone->setIsPiSync( mIsPiSync ); myClone->setWriteContactToSIM( mWriteContactToSIM ); myClone->setName( "noName" ); + myClone->setFilterInCal ( mFilterInCal ); + myClone->setFilterOutCal ( mFilterOutCal ); + myClone->setFilterInAB ( mFilterInAB ); + myClone->setFilterOutAB ( mFilterOutAB ); //myClone->setIdentifier( "noID" ); return myClone; } void KSyncProfile::setDefault() { 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"; mPreSyncCommandPWM = i18n("command for downloading remote file to local device"); mPostSyncCommandPWM = i18n("command for uploading local temp file to remote device"); mLocalTempFilePWM = "/tmp/passwords.pwm"; mRemoteFileNamePWM = "/home/polo/kdepim/apps/pwmanager/localfile.pwm"; mRemotePw = "abc"; mRemoteIP = "192.168.0.99"; mRemotePort = "9197"; mRemotePwAB = "abc"; mRemoteIPAB = "192.168.0.99"; mRemotePortAB = "9198"; mRemotePwPWM = "abc"; mRemoteIPPWM = "192.168.0.99"; mRemotePortPWM = "9199"; mShowSummaryAfterSync = true; mAskForPreferences = true; mWriteBackExisting = false; mWriteBackFuture = false; mWriteBackFutureWeeks = 12; mWriteBackPastWeeks = 2; mWriteBackFile = true; mIncludeInRingSync = false; mIncludeInRingSyncAB = false; mIncludeInRingSyncPWM = false; mSyncPrefs = SYNC_PREF_ASK; mIsLocalFileSync = true; mName = "noName"; mIsPhoneSync = false; mIsPiSync = false; mIsKapiFile = false; mWriteContactToSIM = false; mPhoneDevice = "/dev/ircomm"; mPhoneConnection = "irda"; mPhoneModel = "6310i"; + mFilterInCal = "no filter"; + mFilterOutCal = "no filter"; + mFilterInAB = "no filter"; + mFilterOutAB = "no filter"; } void KSyncProfile::readConfig(KConfig *config ) { if (config) { config->setGroup( mName ); mName = config->readEntry( "Name", mName ); mRemotePw = config->readEntry( "RemotePw",mRemotePw ); mRemoteIP = config->readEntry( "RemoteIP",mRemoteIP ); mRemotePort = config->readEntry( "RemotePort", mRemotePort ); mRemotePwAB = config->readEntry( "RemotePwAB", mRemotePwAB ); mRemoteIPAB = config->readEntry( "RemoteIPAB", mRemoteIPAB ); mRemotePortAB = config->readEntry( "RemotePortAB", mRemotePortAB ); mRemotePwPWM = config->readEntry( "RemotePwPWM", mRemotePwPWM ); mRemoteIPPWM = config->readEntry( "RemoteIPPWM", mRemoteIPPWM ); mRemotePortPWM = config->readEntry( "RemotePortPWM", mRemotePortPWM ); mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand ); mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand ); mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile ); mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName ); mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB ); mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB ); mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB ); mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB ); mPreSyncCommandPWM = config->readEntry( "PreSyncCommandPWM",mPreSyncCommandPWM ); mPostSyncCommandPWM = config->readEntry( "PostSyncCommandPWM", mPostSyncCommandPWM ); mLocalTempFilePWM = config->readEntry( "LocalTempFilePWM", mLocalTempFilePWM ); mRemoteFileNamePWM = config->readEntry( "RemoteFileNamePWM", mRemoteFileNamePWM ); mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice ); mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection ); mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel ); mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync ); mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); mIncludeInRingSyncPWM = config->readBoolEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM ); mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences ); mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting ); mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture ); mWriteBackFile = config->readBoolEntry( "WriteBackFile",mWriteBackFile ); mWriteContactToSIM = config->readBoolEntry( "WriteContactToSIM",mWriteContactToSIM ); mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs ); mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks ); mWriteBackPastWeeks = config->readNumEntry( "WriteBackPastWeeks", mWriteBackPastWeeks ); mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync ); mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync ); mIsPiSync= config->readBoolEntry( "IsPiSync", mIsPiSync ); mIsKapiFile = config->readBoolEntry( "IsKapiFile", mIsKapiFile ); + + mFilterInCal = config->readEntry( "FilterInCal", mFilterInCal ); + mFilterOutCal = config->readEntry( "FilterOutCal", mFilterOutCal ); + mFilterInAB = config->readEntry( "FilterInAB", mFilterInAB ); + mFilterOutAB = config->readEntry( "FilterOutAB", mFilterOutAB ); + } else { setDefault(); } } void KSyncProfile::deleteConfig(KConfig *config ) { config->deleteGroup( mName ); } void KSyncProfile::writeConfig( KConfig * config ) { config->setGroup(mName); config->writeEntry( "RemotePw", mRemotePw); config->writeEntry( "RemoteIP", mRemoteIP); config->writeEntry( "RemotePort", mRemotePort); config->writeEntry( "RemotePwAB", mRemotePwAB); config->writeEntry( "RemoteIPAB", mRemoteIPAB); config->writeEntry( "RemotePortAB", mRemotePortAB); config->writeEntry( "RemotePwPWM", mRemotePwPWM); config->writeEntry( "RemoteIPPWM", mRemoteIPPWM); config->writeEntry( "RemotePortPWM", mRemotePortPWM); config->writeEntry( "Name", mName ); config->writeEntry( "PreSyncCommand",mPreSyncCommand ); config->writeEntry( "PostSyncCommand", mPostSyncCommand ); config->writeEntry( "LocalTempFile", mLocalTempFile ); config->writeEntry( "RemoteFileName", mRemoteFileName ); config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB ); config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB ); config->writeEntry( "LocalTempFileAB", mLocalTempFileAB ); config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB ); config->writeEntry( "PreSyncCommandPWM",mPreSyncCommandPWM ); config->writeEntry( "PostSyncCommandPWM", mPostSyncCommandPWM ); config->writeEntry( "LocalTempFilePWM", mLocalTempFilePWM ); config->writeEntry( "RemoteFileNamePWM", mRemoteFileNamePWM ); config->writeEntry( "PhoneDevice", mPhoneDevice ); config->writeEntry( "PhoneConnection", mPhoneConnection ); config->writeEntry( "PhoneModel", mPhoneModel ); config->writeEntry( "IncludeInRingSync",mIncludeInRingSync ); config->writeEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); config->writeEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM ); config->writeEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); config->writeEntry( "AskForPreferences",mAskForPreferences ); config->writeEntry( "WriteBackExisting",mWriteBackExisting ); config->writeEntry( "WriteBackFuture",mWriteBackFuture ); config->writeEntry( "WriteBackFile",mWriteBackFile ); config->writeEntry( "WriteContactToSIM",mWriteContactToSIM ); config->writeEntry( "SyncPrefs", mSyncPrefs ); config->writeEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks); config->writeEntry( "WriteBackPastWeeks", mWriteBackPastWeeks); config->writeEntry( "IsLocalFileSync", mIsLocalFileSync ); config->writeEntry( "IsPhoneSync", mIsPhoneSync ); config->writeEntry( "IsPiSync", mIsPiSync ); config->writeEntry( "IsKapiFile", mIsKapiFile ); + config->writeEntry( "FilterInCal", mFilterInCal ); + config->writeEntry( "FilterOutCal", mFilterOutCal ); + config->writeEntry( "FilterInAB", mFilterInAB ); + config->writeEntry( "FilterOutAB", mFilterOutAB ); + } diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h index e970b50..aad63d3 100644 --- a/libkdepim/ksyncprofile.h +++ b/libkdepim/ksyncprofile.h @@ -1,191 +1,205 @@ /* This file is part of KDE-Pim/Pi. 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. */ #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; class KSyncProfile : public QObject { public: KSyncProfile(); ~KSyncProfile() ; KSyncProfile* clone(); void setDefault(); void readConfig(KConfig *); void writeConfig(KConfig *); void deleteConfig(KConfig *); void setRemotePw( const QString& n ) {mRemotePw = n;} QString getRemotePw( ) { return mRemotePw; } void setRemotePwAB( const QString& n ) {mRemotePwAB = n;} QString getRemotePwAB( ) { return mRemotePwAB; } void setRemotePwPWM( const QString& n ) {mRemotePwPWM = n;} QString getRemotePwPWM( ) { return mRemotePwPWM; } void setRemoteIP( const QString& n ) {mRemoteIP = n;} QString getRemoteIP( ) { return mRemoteIP; } void setRemoteIPAB( const QString& n ) {mRemoteIPAB = n;} QString getRemoteIPAB( ) { return mRemoteIPAB; } void setRemoteIPPWM( const QString& n ) {mRemoteIPPWM = n;} QString getRemoteIPPWM( ) { return mRemoteIPPWM; } void setRemotePort( const QString& n ) {mRemotePort = n;} QString getRemotePort( ) { return mRemotePort; } void setRemotePortAB( const QString& n ) {mRemotePortAB = n;} QString getRemotePortAB( ) { return mRemotePortAB; } void setRemotePortPWM( const QString& n ) {mRemotePortPWM = n;} QString getRemotePortPWM( ) { return mRemotePortPWM; } 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 setPreSyncCommandPWM( const QString& n ) {mPreSyncCommandPWM = n;} QString getPreSyncCommandPWM( ) { return mPreSyncCommandPWM; } void setPostSyncCommandPWM( const QString& n ) {mPostSyncCommandPWM = n;} QString getPostSyncCommandPWM( ) { return mPostSyncCommandPWM;} void setLocalTempFilePWM( const QString& n ) { mLocalTempFilePWM= n;} QString getLocalTempFilePWM( ) { return mLocalTempFilePWM;} void setRemoteFileNamePWM( const QString& n ) { mRemoteFileNamePWM = n;} QString getRemoteFileNamePWM( ) { return mRemoteFileNamePWM;} void setPhoneDevice( const QString& n ) { mPhoneDevice = n;} QString getPhoneDevice( ) { return mPhoneDevice;} void setPhoneConnection( const QString& n ) { mPhoneConnection = n;} QString getPhoneConnection( ) { return mPhoneConnection;} void setPhoneModel( const QString& n ) { mPhoneModel = n;} QString getPhoneModel( ) { return mPhoneModel;} /* void set( const QString& n ) { = n;} QString get( ) { return ;} */ + void setFilterInCal (const QString& n ){ mFilterInCal = n;} + void setFilterOutCal (const QString& n ){ mFilterOutCal = n;} + void setFilterInAB (const QString& n ){ mFilterInAB = n;} + void setFilterOutAB (const QString& n ){ mFilterOutAB = n;} + QString getFilterInCal () { return mFilterInCal ;} + QString getFilterOutCal () { return mFilterOutCal ;} + QString getFilterInAB () { return mFilterInAB ;} + QString getFilterOutAB () { return mFilterOutAB ;} + void setName( const QString& n ) {mName = n;} QString getName( ) { return mName;} 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 setWriteContactToSIM( bool b ) { mWriteContactToSIM= b;} bool getWriteContactToSIM( ) { return mWriteContactToSIM;} void setIncludeInRingSync( bool b ) {mIncludeInRingSync = b;} bool getIncludeInRingSync( ) { return mIncludeInRingSync;} void setIncludeInRingSyncAB( bool b ) {mIncludeInRingSyncAB = b;} bool getIncludeInRingSyncAB( ) { return mIncludeInRingSyncAB;} void setIncludeInRingSyncPWM( bool b ) {mIncludeInRingSyncPWM = b;} bool getIncludeInRingSyncPWM( ) { return mIncludeInRingSyncPWM;} void setSyncPrefs( int n ) { mSyncPrefs= n;} int getSyncPrefs( ) { return mSyncPrefs;} void setWriteBackFutureWeeks( int n ) { mWriteBackFutureWeeks= n;} int getWriteBackFutureWeeks( ) { return mWriteBackFutureWeeks;} void setWriteBackPastWeeks( int n ) { mWriteBackPastWeeks= n;} int getWriteBackPastWeeks( ) { return mWriteBackPastWeeks;} void setIsLocalFileSync( bool b ) { mIsLocalFileSync= b;} bool getIsLocalFileSync( ) { return mIsLocalFileSync;} void setIsPhoneSync( bool b ) { mIsPhoneSync= b;} bool getIsPhoneSync( ) { return mIsPhoneSync;} void setIsPiSync( bool b ) { mIsPiSync= b;} bool getIsPiSync( ) { return mIsPiSync;} void setIsKapiFile( bool b ) { mIsKapiFile= b;} bool getIsKapiFile( ) { return mIsKapiFile;} private: QString mName; QString mPreSyncCommand; QString mPostSyncCommand; QString mLocalTempFile; QString mRemoteFileName; QString mPreSyncCommandAB; QString mPostSyncCommandAB; QString mLocalTempFileAB; QString mRemoteFileNameAB; QString mPreSyncCommandPWM; QString mPostSyncCommandPWM; QString mLocalTempFilePWM; QString mRemoteFileNamePWM; QString mRemotePw; QString mRemoteIP; QString mRemotePort; QString mRemotePwAB; QString mRemoteIPAB; QString mRemotePortAB; QString mRemotePwPWM; QString mRemoteIPPWM; QString mRemotePortPWM; QString mPhoneDevice; QString mPhoneConnection; QString mPhoneModel; + QString mFilterInCal; + QString mFilterOutCal; + QString mFilterInAB; + QString mFilterOutAB; + bool mIncludeInRingSync; bool mIncludeInRingSyncAB; bool mIncludeInRingSyncPWM; int mSyncPrefs; bool mWriteBackFile; bool mWriteBackExisting; bool mWriteBackFuture; int mWriteBackFutureWeeks; int mWriteBackPastWeeks; bool mAskForPreferences; bool mShowSummaryAfterSync; bool mIsLocalFileSync; bool mIsPhoneSync; bool mWriteContactToSIM; bool mIsPiSync; bool mIsKapiFile; }; #endif |