-rw-r--r-- | libkdepim/ksyncmanager.cpp | 10 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 1 | ||||
-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 113 | ||||
-rw-r--r-- | libkdepim/ksyncprefsdialog.h | 6 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.cpp | 4 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.h | 3 |
6 files changed, 99 insertions, 38 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 6f68d84..33b4a65 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -63,9 +63,9 @@ KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, Targ { 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() ; @@ -247,10 +247,12 @@ void KSyncManager::slotSyncMenu( int action ) } 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 @@ -577,10 +579,12 @@ int KSyncManager::ringSync() 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 ) { diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 6da0ee4..2d0a4ab 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h @@ -140,8 +140,9 @@ class KSyncManager : public QObject bool mWriteBackExistingOnly; int mSyncAlgoPrefs; bool mWriteBackFile; int mWriteBackInFuture; + int mWriteBackInPast; QString mPhoneDevice; QString mPhoneConnection; QString mPhoneModel; QString mPassWordPiSync; diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 03265d2..8a3f4cf 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp @@ -42,8 +42,10 @@ #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> @@ -140,23 +142,30 @@ void KSyncPrefsDialog::setupSyncAlgTab() 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); + 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 ); @@ -164,27 +173,40 @@ void KSyncPrefsDialog::setupSyncAlgTab() 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; + //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; + // topLayout->addMultiCellWidget(mWriteBackFile, 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; @@ -195,12 +217,20 @@ void KSyncPrefsDialog::setupSyncAlgTab() 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; + //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); @@ -220,12 +250,12 @@ void KSyncPrefsDialog::setupSyncAlgTab() mPhoneModel = new QLineEdit( temphb); button = new QPushButton( i18n("Help..."), temphb ); connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) ); - // *** local + // *** local******************************* localFileWidget = new QVBox( topFrame); - topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); - ++iii; + //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 ); @@ -244,12 +274,12 @@ void KSyncPrefsDialog::setupSyncAlgTab() mRemoteFilePWM = new QLineEdit( temphb); mIsKapiFileL = new QCheckBox( i18n("Addressbook file (*.vcf) is used by KA/Pi"), localFileWidget ); - // *** remote + // *** remote******************************* remoteFileWidget = new QVBox( topFrame); - topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); - ++iii; + //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); @@ -279,12 +309,12 @@ void KSyncPrefsDialog::setupSyncAlgTab() 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 + // *** pi-sync******************************* piWidget = new QVBox( topFrame); - topLayout->addMultiCellWidget(piWidget, iii,iii,0,1); - ++iii; + //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); @@ -305,13 +335,28 @@ void KSyncPrefsDialog::setupSyncAlgTab() 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() { @@ -429,8 +474,9 @@ void KSyncPrefsDialog::profileChanged( int item ) 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); @@ -592,8 +638,9 @@ void KSyncPrefsDialog::saveProfile() 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() ); diff --git a/libkdepim/ksyncprefsdialog.h b/libkdepim/ksyncprefsdialog.h index c601a58..997f524 100644 --- a/libkdepim/ksyncprefsdialog.h +++ b/libkdepim/ksyncprefsdialog.h @@ -77,15 +77,16 @@ class KSyncPrefsDialog : public KDialog 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; @@ -141,8 +142,9 @@ class KSyncPrefsDialog : public KDialog QVBox* piWidget; QCheckBox* mWriteBackFile; QCheckBox* mWriteBackFuture; QSpinBox* mWriteBackFutureWeeks; + QSpinBox* mWriteBackPastWeeks; QCheckBox* mWriteBackExisting; QCheckBox* mAskForPreferences; QCheckBox* mShowSummaryAfterSync; QCheckBox* mWriteContactToSIM; diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp index 029b70b..9f404cb 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp @@ -69,8 +69,9 @@ KSyncProfile* KSyncProfile::clone() 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); @@ -116,8 +117,9 @@ void KSyncProfile::setDefault() mAskForPreferences = true; mWriteBackExisting = false; mWriteBackFuture = false; mWriteBackFutureWeeks = 12; + mWriteBackPastWeeks = 2; mWriteBackFile = true; mIncludeInRingSync = false; mIncludeInRingSyncAB = false; mIncludeInRingSyncPWM = false; @@ -180,8 +182,9 @@ void KSyncProfile::readConfig(KConfig *config ) 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 ); @@ -243,8 +246,9 @@ void KSyncProfile::writeConfig( KConfig * config ) 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 @@ -127,8 +127,10 @@ class KSyncProfile : public QObject { void setSyncPrefs( int n ) { mSyncPrefs= n;} int getSyncPrefs( ) { return mSyncPrefs;} void setWriteBackFutureWeeks( int n ) { mWriteBackFutureWeeks= n;} int getWriteBackFutureWeeks( ) { return mWriteBackFutureWeeks;} + void 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;} @@ -174,8 +176,9 @@ class KSyncProfile : public QObject { bool mWriteBackFile; bool mWriteBackExisting; bool mWriteBackFuture; int mWriteBackFutureWeeks; + int mWriteBackPastWeeks; bool mAskForPreferences; bool mShowSummaryAfterSync; bool mIsLocalFileSync; bool mIsPhoneSync; |