author | zautrix <zautrix> | 2005-11-25 09:55:37 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-25 09:55:37 (UTC) |
commit | 90b62d1158d00f162a258541e24aaed4c967480b (patch) (side-by-side diff) | |
tree | 96f76bc60fae40113101aa1f321ff869bbd7979b /libkdepim/ksyncprefsdialog.cpp | |
parent | d0de047797095f1862f4ff77b8dcd0d22643882d (diff) | |
download | kdepimpi-90b62d1158d00f162a258541e24aaed4c967480b.zip kdepimpi-90b62d1158d00f162a258541e24aaed4c967480b.tar.gz kdepimpi-90b62d1158d00f162a258541e24aaed4c967480b.tar.bz2 |
sync
Diffstat (limited to 'libkdepim/ksyncprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 72 |
1 files changed, 67 insertions, 5 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 8873ed1..292cde1 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp @@ -241,8 +241,10 @@ void KSyncPrefsDialog::setupSyncAlgTab() 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 ); + mIsPi = new QRadioButton ( i18n("Pi-Sync - all resources ( direct Kx/Pi to Kx/Pi sync )"), gr ); connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); + mIsPiSpecific = new QRadioButton ( i18n("Pi-Sync - selected resources ( direct Kx/Pi to Kx/Pi sync )"), gr ); + connect (mIsPiSpecific, 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 ); @@ -366,12 +368,42 @@ void KSyncPrefsDialog::setupSyncAlgTab() mRemotePort = new QLineEdit(temphb); mRemotePortAB = new QLineEdit(temphb); mRemotePortPWM = new QLineEdit(temphb); + + lab = new QLabel( i18n("Local/remote Resource sync partners"), piWidget); + mTableBox = new QHBox( piWidget ); + mResTableKopi = new QTable( 1, 1, mTableBox ); + mResTableKapi = new QTable( 1, 1, mTableBox ); + mResTablePwmpi = new QTable( 1, 1, mTableBox ); + mResTableKopi->horizontalHeader()->setLabel( 0, i18n("Remote") ); + mResTableKapi->horizontalHeader()->setLabel( 0, i18n("Remote") ); + mResTablePwmpi->horizontalHeader()->setLabel( 0, i18n("Remote") ); + mResTableKopi->setLeftMargin( 80 ); } // ****************************************** // Profile kind specific settings END } +void KSyncPrefsDialog::readResources() +{ + mResourcesKopi.clear(); + mResourcesKapi.clear(); + KConfig fc(locateLocal("config","kopicalendarrc")); + fc.setGroup("CC"); + int numCals = fc.readNumEntry("NumberCalendars",0 ); + int curCal = 1; + while ( curCal <= numCals ) { + QString prefix = "Cal_" +QString::number( curCal ); + QString name = fc.readEntry( prefix+"_Name", "Calendar"); + mResourcesKopi.append( name ); + ++curCal; + } + mResTableKopi->setNumRows( mResourcesKopi.count() ); + int i; + for ( i = 0;i < mResourcesKopi.count(); ++i ) { + mResTableKopi->verticalHeader ()->setLabel( i, mResourcesKopi[i] ); + } +} void KSyncPrefsDialog::readFilter() { mFilterKapi.clear(); @@ -473,6 +505,7 @@ void KSyncPrefsDialog::profileChanged( int item ) KSyncProfile* prof; saveProfile(); readFilter(); + readResources(); currentSelection = item; prof = mSyncProfiles.at(item) ; @@ -553,10 +586,21 @@ void KSyncPrefsDialog::profileChanged( int item ) mIsLocal->setChecked(prof->getIsLocalFileSync()) ; mIsPhone->setChecked(prof->getIsPhoneSync()) ; mIsPi->setChecked(prof->getIsPiSync()) ; + mIsPiSpecific->setChecked(prof->getIsPiSyncSpec()) ; mIsKapiFileL->setChecked(prof->getIsKapiFile()) ; mIsKapiFileR->setChecked(prof->getIsKapiFile()) ; - mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() ); + + QStringList res = QStringList::split( ":",prof->getResSpecKopi()); + int i; + for ( i = 0;i < res.count(); ++i ) { + mResTableKopi->setText( i, 0, res[i] ); + } + res = QStringList::split( ":",prof->getResSpecKapi()); + for ( i = 0;i < res.count(); ++i ) { + mResTableKapi->setText( i, 0, res[i] ); + } + mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() &&!prof->getIsPiSyncSpec()); proGr->setEnabled( item > 2 ); if ( item < 3 ) { localFileWidget->hide(); @@ -618,13 +662,21 @@ void KSyncPrefsDialog::kindChanged( bool b ) } else { phoneWidget->hide(); - } - if ( mIsPi->isChecked () ) { + } + + if ( mIsPi->isChecked () || mIsPiSpecific->isChecked () ) { piWidget->show(); + if (mIsPiSpecific->isChecked () ) { + mTableBox->show(); + } + else { + mTableBox->hide(); + } } else { piWidget->hide(); - } + } + } void KSyncPrefsDialog::deleteProfile() @@ -684,6 +736,7 @@ void KSyncPrefsDialog::saveProfile() prof->setIsLocalFileSync( mIsLocal->isChecked() ); prof->setIsPhoneSync( mIsPhone->isChecked() ); prof->setIsPiSync( mIsPi->isChecked() ); + prof->setIsPiSyncSpec( mIsPiSpecific->isChecked() ); prof->setIsKapiFile( mIsKapiFileL->isChecked() ); prof->setWriteBackFuture(mWriteBackFuture->isChecked()); prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); @@ -697,6 +750,15 @@ void KSyncPrefsDialog::saveProfile() prof->setFilterOutCal ( mFilterOutCal ->currentText ()); prof->setFilterInAB ( mFilterInAB ->currentText ()); prof->setFilterOutAB ( mFilterOutAB ->currentText ()); + if ( mIsPiSpecific->isChecked() ) { + + QStringList res; + int i; + for ( i = 0;i < mResourcesKopi.count(); ++i ) { + res.append( mResTableKopi->text( i, 0 )); + } + prof->setResSpecKopi( res.join(":")); + } } } |