-rw-r--r-- | korganizer/calendarview.cpp | 6 | ||||
-rw-r--r-- | libkcal/syncdefines.h | 6 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 10 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 1 | ||||
-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 333 | ||||
-rw-r--r-- | libkdepim/ksyncprefsdialog.h | 6 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.cpp | 4 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.h | 3 |
8 files changed, 218 insertions, 151 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 7ddbe23..363dc32 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1150,26 +1150,26 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int } } } inL = el.next(); } int delFut = 0; int remRem = 0; if ( mSyncManager->mWriteBackInFuture ) { er = remote->rawIncidences(); remRem = er.count(); inR = er.first(); QDateTime dt; - QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); - QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 ); + QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); + QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); while ( inR ) { if ( inR->type() == "Todo" ) { Todo * t = (Todo*)inR; if ( t->hasDueDate() ) dt = t->dtDue(); else dt = cur.addSecs( 62 ); } else if (inR->type() == "Event" ) { bool ok; dt = inR->getNextOccurence( cur, &ok ); if ( !ok ) @@ -1194,25 +1194,25 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); eventLSync->setReadOnly( true ); qDebug("********** %d %d ", mGlobalSyncMode == SYNC_MODE_NORMAL, mSyncManager->syncWithDesktop() ); if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... remote->addEvent( eventRSync ); else delete eventRSync; QString mes; mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); QString delmess; if ( delFut ) { - delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); + delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); mes += delmess; } mes = i18n("Local calendar changed!\n") +mes; mCalendar->checkAlarmForIncidence( 0, true ); qDebug( mes ); if ( mSyncManager->mShowSyncSummary ) { if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, i18n("KO/Pi Synchronization"),i18n("Write back"))) { qDebug("cancelled "); return false; } } diff --git a/libkcal/syncdefines.h b/libkcal/syncdefines.h index 704a670..f3204a2 100644 --- a/libkcal/syncdefines.h +++ b/libkcal/syncdefines.h @@ -1,16 +1,22 @@ #ifndef _KSYNC_DEFINES_H_ #define _KSYNC_DEFINES_H_ + enum TargetApp { + KOPI = 0, + KAPI = 1, + PWMPI = 2 }; + + #define SYNC_PREF_LOCAL 0 #define SYNC_PREF_REMOTE 1 #define SYNC_PREF_NEWEST 2 #define SYNC_PREF_ASK 3 #define SYNC_PREF_FORCE_LOCAL 4 #define SYNC_PREF_FORCE_REMOTE 5 #define SYNC_PREF_TAKE_BOTH 6 #define SYNC_MODE_NORMAL 0 #define SYNC_MODE_EXTERNAL 1 #define SYNC_TEMPSTATE_INITIAL 0 diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 6f68d84..33b4a65 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -55,25 +55,25 @@ #include <kconfig.h> #include <kfiledialog.h> QDateTime KSyncManager::mRequestedSyncEvent; KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu) { mServerSocket = 0; bar = new QProgressBar ( 1, 0 ); bar->setCaption (""); - + mWriteBackInPast = 2; int w = 300; if ( QApplication::desktop()->width() < 320 ) w = 220; int h = bar->sizeHint().height() ; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); if ( mPrefs->mPassiveSyncAutoStart ) enableQuick( false ); } @@ -239,26 +239,28 @@ void KSyncManager::slotSyncMenu( int action ) mWriteBackFile = true; mSyncAlgoPrefs = 2;// take newest } else { mAskForPreferences = temp->getAskForPreferences(); mShowSyncSummary = temp->getShowSummaryAfterSync(); mWriteBackFile = temp->getWriteBackFile(); mSyncAlgoPrefs = temp->getSyncPrefs(); } mWriteBackExistingOnly = temp->getWriteBackExisting(); mIsKapiFile = temp->getIsKapiFile(); mWriteBackInFuture = 0; - if ( temp->getWriteBackFuture() ) + if ( temp->getWriteBackFuture() ) { mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); + mWriteBackInPast = temp->getWriteBackPastWeeks( ); + } if ( action == 1000 ) { mIsKapiFile = false; #ifdef DESKTOP_VERSION syncKDE(); #else syncSharp(); #endif } else if ( action == 1001 ) { syncLocalFile(); @@ -569,26 +571,28 @@ int KSyncManager::ringSync() } if ( includeInRingSync && ( i < 1 || i > 2 )) { mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); ++syncedProfiles; mSyncWithDesktop = false; // mAskForPreferences = temp->getAskForPreferences(); mWriteBackFile = temp->getWriteBackFile(); mWriteBackExistingOnly = temp->getWriteBackExisting(); mIsKapiFile = temp->getIsKapiFile(); mWriteBackInFuture = 0; - if ( temp->getWriteBackFuture() ) + if ( temp->getWriteBackFuture() ) { mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); + mWriteBackInPast = temp->getWriteBackPastWeeks( ); + } mShowSyncSummary = false; mCurrentSyncDevice = syncProfileNames[i] ; mCurrentSyncName = mLocalMachineName; if ( i == 0 ) { mIsKapiFile = false; #ifdef DESKTOP_VERSION syncKDE(); #else syncSharp(); #endif } else { if ( temp->getIsLocalFileSync() ) { diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 6da0ee4..2d0a4ab 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h @@ -132,24 +132,25 @@ class KSyncManager : public QObject // sync stuff QString mLocalMachineName; QStringList mExternSyncProfiles; QStringList mSyncProfileNames; bool mAskForPreferences; bool mShowSyncSummary; bool mIsKapiFile; bool mWriteBackExistingOnly; int mSyncAlgoPrefs; bool mWriteBackFile; int mWriteBackInFuture; + int mWriteBackInPast; QString mPhoneDevice; QString mPhoneConnection; QString mPhoneModel; QString mPassWordPiSync; QString mActiveSyncPort; QString mActiveSyncIP ; static QDateTime mRequestedSyncEvent; signals: void save(); void request_file(); void getFile( bool ); diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 03265d2..8a3f4cf 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp @@ -34,24 +34,26 @@ #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> @@ -132,194 +134,237 @@ void KSyncPrefsDialog::setupSyncAlgTab() 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; - QHBox *iims = new QHBox( topFrame ); + + + 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; - - 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; - - mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); - topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); + 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; + + 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; - - 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; - + 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 ); + //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 ( 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) ) ); - - 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); + QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame); + topLayout->addMultiCellWidget(gb1, 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 + { + // *** 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") ); +} 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")); @@ -421,24 +466,25 @@ void KSyncPrefsDialog::profileChanged( int item ) 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() ); switch ( prof->getSyncPrefs() ) { case 0: loc->setChecked( true); break; case 1: rem->setChecked( true ); break; case 2: newest->setChecked( true); break; case 3: @@ -584,24 +630,25 @@ void KSyncPrefsDialog::saveProfile() 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() ); } } void KSyncPrefsDialog::insertProfiles() { diff --git a/libkdepim/ksyncprefsdialog.h b/libkdepim/ksyncprefsdialog.h index c601a58..997f524 100644 --- a/libkdepim/ksyncprefsdialog.h +++ b/libkdepim/ksyncprefsdialog.h @@ -69,31 +69,32 @@ class KSyncPrefsDialog : public KDialog 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(); @@ -133,21 +134,22 @@ class KSyncPrefsDialog : public KDialog 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 029b70b..9f404cb 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp @@ -61,24 +61,25 @@ KSyncProfile* KSyncProfile::clone() 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->setIdentifier( "noID" ); return myClone; @@ -108,24 +109,25 @@ void KSyncProfile::setDefault() 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"; @@ -172,24 +174,25 @@ void KSyncProfile::readConfig(KConfig *config ) 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 ); } else { setDefault(); } } void KSyncProfile::deleteConfig(KConfig *config ) @@ -235,18 +238,19 @@ void KSyncProfile::writeConfig( KConfig * config ) 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 ); } diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h index 0a59111..e970b50 100644 --- a/libkdepim/ksyncprofile.h +++ b/libkdepim/ksyncprofile.h @@ -119,24 +119,26 @@ class KSyncProfile : public QObject { 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; @@ -166,23 +168,24 @@ class KSyncProfile : public QObject { QString mPhoneDevice; QString mPhoneConnection; QString mPhoneModel; 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 |