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 | |||
@@ -238,14 +238,16 @@ void KSyncPrefsDialog::setupSyncAlgTab() | |||
238 | } | 238 | } |
239 | proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); | 239 | proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); |
240 | gr = proGr; | 240 | gr = proGr; |
241 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); | 241 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); |
242 | ++iii; | 242 | ++iii; |
243 | mIsLocal = new QRadioButton ( i18n("Local file"), gr ); | 243 | mIsLocal = new QRadioButton ( i18n("Local file"), gr ); |
244 | mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr ); | 244 | mIsPi = new QRadioButton ( i18n("Pi-Sync - all resources ( direct Kx/Pi to Kx/Pi sync )"), gr ); |
245 | connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 245 | connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
246 | mIsPiSpecific = new QRadioButton ( i18n("Pi-Sync - selected resources ( direct Kx/Pi to Kx/Pi sync )"), gr ); | ||
247 | connect (mIsPiSpecific, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | ||
246 | mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); | 248 | mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); |
247 | connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 249 | connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
248 | mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); | 250 | mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); |
249 | connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 251 | connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
250 | 252 | ||
251 | QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame); | 253 | QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame); |
@@ -363,18 +365,48 @@ void KSyncPrefsDialog::setupSyncAlgTab() | |||
363 | 365 | ||
364 | lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget); | 366 | lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget); |
365 | temphb = new QHBox( piWidget ); | 367 | temphb = new QHBox( piWidget ); |
366 | mRemotePort = new QLineEdit(temphb); | 368 | mRemotePort = new QLineEdit(temphb); |
367 | mRemotePortAB = new QLineEdit(temphb); | 369 | mRemotePortAB = new QLineEdit(temphb); |
368 | mRemotePortPWM = new QLineEdit(temphb); | 370 | mRemotePortPWM = new QLineEdit(temphb); |
371 | |||
372 | lab = new QLabel( i18n("Local/remote Resource sync partners"), piWidget); | ||
373 | mTableBox = new QHBox( piWidget ); | ||
374 | mResTableKopi = new QTable( 1, 1, mTableBox ); | ||
375 | mResTableKapi = new QTable( 1, 1, mTableBox ); | ||
376 | mResTablePwmpi = new QTable( 1, 1, mTableBox ); | ||
377 | mResTableKopi->horizontalHeader()->setLabel( 0, i18n("Remote") ); | ||
378 | mResTableKapi->horizontalHeader()->setLabel( 0, i18n("Remote") ); | ||
379 | mResTablePwmpi->horizontalHeader()->setLabel( 0, i18n("Remote") ); | ||
380 | mResTableKopi->setLeftMargin( 80 ); | ||
369 | } | 381 | } |
370 | // ****************************************** | 382 | // ****************************************** |
371 | // Profile kind specific settings END | 383 | // Profile kind specific settings END |
372 | 384 | ||
373 | } | 385 | } |
374 | 386 | ||
387 | void KSyncPrefsDialog::readResources() | ||
388 | { | ||
389 | mResourcesKopi.clear(); | ||
390 | mResourcesKapi.clear(); | ||
391 | KConfig fc(locateLocal("config","kopicalendarrc")); | ||
392 | fc.setGroup("CC"); | ||
393 | int numCals = fc.readNumEntry("NumberCalendars",0 ); | ||
394 | int curCal = 1; | ||
395 | while ( curCal <= numCals ) { | ||
396 | QString prefix = "Cal_" +QString::number( curCal ); | ||
397 | QString name = fc.readEntry( prefix+"_Name", "Calendar"); | ||
398 | mResourcesKopi.append( name ); | ||
399 | ++curCal; | ||
400 | } | ||
401 | mResTableKopi->setNumRows( mResourcesKopi.count() ); | ||
402 | int i; | ||
403 | for ( i = 0;i < mResourcesKopi.count(); ++i ) { | ||
404 | mResTableKopi->verticalHeader ()->setLabel( i, mResourcesKopi[i] ); | ||
405 | } | ||
406 | } | ||
375 | void KSyncPrefsDialog::readFilter() | 407 | void KSyncPrefsDialog::readFilter() |
376 | { | 408 | { |
377 | mFilterKapi.clear(); | 409 | mFilterKapi.clear(); |
378 | mFilterKopi.clear(); | 410 | mFilterKopi.clear(); |
379 | KConfig cfgko(locateLocal("config","korganizerrc")); | 411 | KConfig cfgko(locateLocal("config","korganizerrc")); |
380 | KConfig cfgka(locateLocal("config","kaddressbookrc")); | 412 | KConfig cfgka(locateLocal("config","kaddressbookrc")); |
@@ -470,12 +502,13 @@ void KSyncPrefsDialog::textChanged( const QString & s ) | |||
470 | void KSyncPrefsDialog::profileChanged( int item ) | 502 | void KSyncPrefsDialog::profileChanged( int item ) |
471 | { | 503 | { |
472 | //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() ); | 504 | //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() ); |
473 | KSyncProfile* prof; | 505 | KSyncProfile* prof; |
474 | saveProfile(); | 506 | saveProfile(); |
475 | readFilter(); | 507 | readFilter(); |
508 | readResources(); | ||
476 | currentSelection = item; | 509 | currentSelection = item; |
477 | prof = mSyncProfiles.at(item) ; | 510 | prof = mSyncProfiles.at(item) ; |
478 | 511 | ||
479 | mRemotePw->setText(prof->getRemotePw()); | 512 | mRemotePw->setText(prof->getRemotePw()); |
480 | mRemoteIP->setText(prof->getRemoteIP()); | 513 | mRemoteIP->setText(prof->getRemoteIP()); |
481 | mRemotePort->setText(prof->getRemotePort()); | 514 | mRemotePort->setText(prof->getRemotePort()); |
@@ -550,16 +583,27 @@ void KSyncPrefsDialog::profileChanged( int item ) | |||
550 | default: | 583 | default: |
551 | break; | 584 | break; |
552 | } | 585 | } |
553 | mIsLocal->setChecked(prof->getIsLocalFileSync()) ; | 586 | mIsLocal->setChecked(prof->getIsLocalFileSync()) ; |
554 | mIsPhone->setChecked(prof->getIsPhoneSync()) ; | 587 | mIsPhone->setChecked(prof->getIsPhoneSync()) ; |
555 | mIsPi->setChecked(prof->getIsPiSync()) ; | 588 | mIsPi->setChecked(prof->getIsPiSync()) ; |
589 | mIsPiSpecific->setChecked(prof->getIsPiSyncSpec()) ; | ||
556 | mIsKapiFileL->setChecked(prof->getIsKapiFile()) ; | 590 | mIsKapiFileL->setChecked(prof->getIsKapiFile()) ; |
557 | mIsKapiFileR->setChecked(prof->getIsKapiFile()) ; | 591 | mIsKapiFileR->setChecked(prof->getIsKapiFile()) ; |
558 | 592 | ||
559 | mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() ); | 593 | |
594 | QStringList res = QStringList::split( ":",prof->getResSpecKopi()); | ||
595 | int i; | ||
596 | for ( i = 0;i < res.count(); ++i ) { | ||
597 | mResTableKopi->setText( i, 0, res[i] ); | ||
598 | } | ||
599 | res = QStringList::split( ":",prof->getResSpecKapi()); | ||
600 | for ( i = 0;i < res.count(); ++i ) { | ||
601 | mResTableKapi->setText( i, 0, res[i] ); | ||
602 | } | ||
603 | mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() &&!prof->getIsPiSyncSpec()); | ||
560 | proGr->setEnabled( item > 2 ); | 604 | proGr->setEnabled( item > 2 ); |
561 | if ( item < 3 ) { | 605 | if ( item < 3 ) { |
562 | localFileWidget->hide(); | 606 | localFileWidget->hide(); |
563 | remoteFileWidget->hide(); | 607 | remoteFileWidget->hide(); |
564 | phoneWidget->hide(); | 608 | phoneWidget->hide(); |
565 | piWidget->hide(); | 609 | piWidget->hide(); |
@@ -615,19 +659,27 @@ void KSyncPrefsDialog::kindChanged( bool b ) | |||
615 | 659 | ||
616 | if ( mIsPhone->isChecked () ) { | 660 | if ( mIsPhone->isChecked () ) { |
617 | phoneWidget->show(); | 661 | phoneWidget->show(); |
618 | } | 662 | } |
619 | else { | 663 | else { |
620 | phoneWidget->hide(); | 664 | phoneWidget->hide(); |
621 | } | 665 | } |
622 | if ( mIsPi->isChecked () ) { | 666 | |
667 | if ( mIsPi->isChecked () || mIsPiSpecific->isChecked () ) { | ||
623 | piWidget->show(); | 668 | piWidget->show(); |
669 | if (mIsPiSpecific->isChecked () ) { | ||
670 | mTableBox->show(); | ||
671 | } | ||
672 | else { | ||
673 | mTableBox->hide(); | ||
674 | } | ||
624 | } | 675 | } |
625 | else { | 676 | else { |
626 | piWidget->hide(); | 677 | piWidget->hide(); |
627 | } | 678 | } |
679 | |||
628 | 680 | ||
629 | } | 681 | } |
630 | void KSyncPrefsDialog::deleteProfile() | 682 | void KSyncPrefsDialog::deleteProfile() |
631 | { | 683 | { |
632 | //qDebug("KSyncPrefsDialog::deleteProfile() "); | 684 | //qDebug("KSyncPrefsDialog::deleteProfile() "); |
633 | if ( currentSelection >= 0 ) { | 685 | if ( currentSelection >= 0 ) { |
@@ -681,12 +733,13 @@ void KSyncPrefsDialog::saveProfile() | |||
681 | prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() ); | 733 | prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() ); |
682 | int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; | 734 | int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; |
683 | prof->setSyncPrefs( syncprefs); | 735 | prof->setSyncPrefs( syncprefs); |
684 | prof->setIsLocalFileSync( mIsLocal->isChecked() ); | 736 | prof->setIsLocalFileSync( mIsLocal->isChecked() ); |
685 | prof->setIsPhoneSync( mIsPhone->isChecked() ); | 737 | prof->setIsPhoneSync( mIsPhone->isChecked() ); |
686 | prof->setIsPiSync( mIsPi->isChecked() ); | 738 | prof->setIsPiSync( mIsPi->isChecked() ); |
739 | prof->setIsPiSyncSpec( mIsPiSpecific->isChecked() ); | ||
687 | prof->setIsKapiFile( mIsKapiFileL->isChecked() ); | 740 | prof->setIsKapiFile( mIsKapiFileL->isChecked() ); |
688 | prof->setWriteBackFuture(mWriteBackFuture->isChecked()); | 741 | prof->setWriteBackFuture(mWriteBackFuture->isChecked()); |
689 | prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); | 742 | prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); |
690 | prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value()); | 743 | prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value()); |
691 | if ( mWriteContactToSIM ) | 744 | if ( mWriteContactToSIM ) |
692 | prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); | 745 | prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); |
@@ -694,12 +747,21 @@ void KSyncPrefsDialog::saveProfile() | |||
694 | prof->setPhoneConnection( mPhoneConnection->text() ); | 747 | prof->setPhoneConnection( mPhoneConnection->text() ); |
695 | prof->setPhoneModel( mPhoneModel->text() ); | 748 | prof->setPhoneModel( mPhoneModel->text() ); |
696 | prof->setFilterInCal ( mFilterInCal->currentText ()); | 749 | prof->setFilterInCal ( mFilterInCal->currentText ()); |
697 | prof->setFilterOutCal ( mFilterOutCal ->currentText ()); | 750 | prof->setFilterOutCal ( mFilterOutCal ->currentText ()); |
698 | prof->setFilterInAB ( mFilterInAB ->currentText ()); | 751 | prof->setFilterInAB ( mFilterInAB ->currentText ()); |
699 | prof->setFilterOutAB ( mFilterOutAB ->currentText ()); | 752 | prof->setFilterOutAB ( mFilterOutAB ->currentText ()); |
753 | if ( mIsPiSpecific->isChecked() ) { | ||
754 | |||
755 | QStringList res; | ||
756 | int i; | ||
757 | for ( i = 0;i < mResourcesKopi.count(); ++i ) { | ||
758 | res.append( mResTableKopi->text( i, 0 )); | ||
759 | } | ||
760 | prof->setResSpecKopi( res.join(":")); | ||
761 | } | ||
700 | } | 762 | } |
701 | } | 763 | } |
702 | 764 | ||
703 | void KSyncPrefsDialog::insertProfiles() | 765 | void KSyncPrefsDialog::insertProfiles() |
704 | { | 766 | { |
705 | int curItem = mProfileBox->currentItem(); | 767 | int curItem = mProfileBox->currentItem(); |