Diffstat (limited to 'libkdepim/ksyncprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 6f46d19..2b87298 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp | |||
@@ -410,193 +410,192 @@ void KSyncPrefsDialog::readResources() | |||
410 | } | 410 | } |
411 | 411 | ||
412 | mResourcesKapi.clear(); | 412 | mResourcesKapi.clear(); |
413 | 413 | ||
414 | KConfig conf ( locateLocal("config", "kabcrc") ); | 414 | KConfig conf ( locateLocal("config", "kabcrc") ); |
415 | 415 | ||
416 | conf.setGroup( "General" ); | 416 | conf.setGroup( "General" ); |
417 | 417 | ||
418 | QStringList keys = conf.readListEntry( "ResourceKeys" ); | 418 | QStringList keys = conf.readListEntry( "ResourceKeys" ); |
419 | //keys += conf->readListEntry( "PassiveResourceKeys" ); | 419 | //keys += conf->readListEntry( "PassiveResourceKeys" ); |
420 | 420 | ||
421 | //QString standardKey = mConfig->readEntry( "Standard" ); | 421 | //QString standardKey = mConfig->readEntry( "Standard" ); |
422 | 422 | ||
423 | for ( QStringList::Iterator it = keys.begin(); it != keys.end(); ++it ) { | 423 | for ( QStringList::Iterator it = keys.begin(); it != keys.end(); ++it ) { |
424 | conf.setGroup("Resource_"+ (*it) ); | 424 | conf.setGroup("Resource_"+ (*it) ); |
425 | QString name = conf.readEntry( "ResourceName" ); | 425 | QString name = conf.readEntry( "ResourceName" ); |
426 | mResourcesKapi.append( name ); | 426 | mResourcesKapi.append( name ); |
427 | } | 427 | } |
428 | mResTableKapi->setNumRows( mResourcesKapi.count() ); | 428 | mResTableKapi->setNumRows( mResourcesKapi.count() ); |
429 | for ( i = 0;i < mResourcesKopi.count(); ++i ) { | 429 | for ( i = 0;i < mResourcesKopi.count(); ++i ) { |
430 | mResTableKapi->verticalHeader ()->setLabel( i, mResourcesKapi[i] ); | 430 | mResTableKapi->verticalHeader ()->setLabel( i, mResourcesKapi[i] ); |
431 | } | 431 | } |
432 | 432 | ||
433 | 433 | ||
434 | } | 434 | } |
435 | void KSyncPrefsDialog::readFilter() | 435 | void KSyncPrefsDialog::readFilter() |
436 | { | 436 | { |
437 | mFilterKapi.clear(); | 437 | mFilterKapi.clear(); |
438 | mFilterKopi.clear(); | 438 | mFilterKopi.clear(); |
439 | KConfig cfgko(locateLocal("config","korganizerrc")); | 439 | KConfig cfgko(locateLocal("config","korganizerrc")); |
440 | KConfig cfgka(locateLocal("config","kaddressbookrc")); | 440 | KConfig cfgka(locateLocal("config","kaddressbookrc")); |
441 | cfgko.setGroup("General"); | 441 | cfgko.setGroup("General"); |
442 | mFilterKopi = cfgko.readListEntry("CalendarFilters"); | 442 | mFilterKopi = cfgko.readListEntry("CalendarFilters"); |
443 | cfgka.setGroup("Filter"); | 443 | cfgka.setGroup("Filter"); |
444 | int count = cfgka.readNumEntry( "Count", 0 ); | 444 | int count = cfgka.readNumEntry( "Count", 0 ); |
445 | for ( int i = 0; i < count; i++ ) { | 445 | for ( int i = 0; i < count; i++ ) { |
446 | cfgka.setGroup("Filter_"+QString::number( i ) ); | 446 | cfgka.setGroup("Filter_"+QString::number( i ) ); |
447 | mFilterKapi.append( cfgka.readEntry("Name", "internal error") ); | 447 | mFilterKapi.append( cfgka.readEntry("Name", "internal error") ); |
448 | } | 448 | } |
449 | mFilterOutCal->clear(); | 449 | mFilterOutCal->clear(); |
450 | mFilterInCal->clear(); | 450 | mFilterInCal->clear(); |
451 | mFilterOutAB->clear(); | 451 | mFilterOutAB->clear(); |
452 | mFilterInAB->clear(); | 452 | mFilterInAB->clear(); |
453 | QStringList temp = mFilterKopi; | 453 | QStringList temp = mFilterKopi; |
454 | temp.prepend(i18n("No Filter") ); | 454 | temp.prepend(i18n("No Filter") ); |
455 | mFilterOutCal->insertStringList( temp ); | 455 | mFilterOutCal->insertStringList( temp ); |
456 | mFilterInCal->insertStringList( temp ); | 456 | mFilterInCal->insertStringList( temp ); |
457 | temp = mFilterKapi; | 457 | temp = mFilterKapi; |
458 | temp.prepend(i18n("No Filter") ); | 458 | temp.prepend(i18n("No Filter") ); |
459 | mFilterOutAB->insertStringList( temp ); | 459 | mFilterOutAB->insertStringList( temp ); |
460 | mFilterInAB->insertStringList( temp ); | 460 | mFilterInAB->insertStringList( temp ); |
461 | } | 461 | } |
462 | 462 | ||
463 | void KSyncPrefsDialog::slotOK() | 463 | void KSyncPrefsDialog::slotOK() |
464 | { | 464 | { |
465 | if ( mMyMachineName->text() == "undefined" ) { | 465 | if ( mMyMachineName->text() == "undefined" ) { |
466 | KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); | 466 | KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); |
467 | return; | 467 | return; |
468 | } | 468 | } |
469 | int i; | 469 | int i; |
470 | for (i = 0; i < mSyncProfileNames.count(); ++ i) { | 470 | for (i = 0; i < mSyncProfileNames.count(); ++ i) { |
471 | if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { | 471 | if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { |
472 | KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); | 472 | KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); |
473 | return; | 473 | return; |
474 | } | 474 | } |
475 | } | 475 | } |
476 | usrWriteConfig(); | 476 | usrWriteConfig(); |
477 | QDialog::accept(); | 477 | QDialog::accept(); |
478 | } | 478 | } |
479 | void KSyncPrefsDialog::accept() | 479 | void KSyncPrefsDialog::accept() |
480 | { | 480 | { |
481 | slotOK(); | 481 | slotOK(); |
482 | } | 482 | } |
483 | void KSyncPrefsDialog::chooseFile() | 483 | void KSyncPrefsDialog::chooseFile() |
484 | { | 484 | { |
485 | QString fn = QDir::homeDirPath(); | 485 | QString fn = QDir::homeDirPath(); |
486 | 486 | ||
487 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); | 487 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); |
488 | if ( fn == "" ) | 488 | if ( fn == "" ) |
489 | return; | 489 | return; |
490 | mRemoteFile->setText( fn ); | 490 | mRemoteFile->setText( fn ); |
491 | } | 491 | } |
492 | 492 | ||
493 | void KSyncPrefsDialog::chooseFileAB() | 493 | void KSyncPrefsDialog::chooseFileAB() |
494 | { | 494 | { |
495 | QString fn = QDir::homeDirPath(); | 495 | QString fn = QDir::homeDirPath(); |
496 | 496 | ||
497 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this ); | 497 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this ); |
498 | if ( fn == "" ) | 498 | if ( fn == "" ) |
499 | return; | 499 | return; |
500 | mRemoteFileAB->setText( fn ); | 500 | mRemoteFileAB->setText( fn ); |
501 | } | 501 | } |
502 | 502 | ||
503 | void KSyncPrefsDialog::chooseFilePWM() | 503 | void KSyncPrefsDialog::chooseFilePWM() |
504 | { | 504 | { |
505 | QString fn = QDir::homeDirPath(); | 505 | QString fn = QDir::homeDirPath(); |
506 | |||
507 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); | 506 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); |
508 | if ( fn == "" ) | 507 | if ( fn == "" ) |
509 | return; | 508 | return; |
510 | mRemoteFilePWM->setText( fn ); | 509 | mRemoteFilePWM->setText( fn ); |
511 | } | 510 | } |
512 | void KSyncPrefsDialog::updateMyCaption() | 511 | void KSyncPrefsDialog::updateMyCaption() |
513 | { | 512 | { |
514 | setCaption( mProfileBox->currentText() + " : " +i18n("Synchronization Preferences")); | 513 | setCaption( mProfileBox->currentText() + " : " +i18n("Synchronization Preferences")); |
515 | } | 514 | } |
516 | void KSyncPrefsDialog::textChanged( const QString & s ) | 515 | void KSyncPrefsDialog::textChanged( const QString & s ) |
517 | { | 516 | { |
518 | if ( mProfileBox->count() == 0 ) | 517 | if ( mProfileBox->count() == 0 ) |
519 | return; | 518 | return; |
520 | if ( currentSelection < 3 ) { | 519 | if ( currentSelection < 3 ) { |
521 | //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); | 520 | //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); |
522 | mProfileBox->blockSignals( true ); | 521 | mProfileBox->blockSignals( true ); |
523 | mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); | 522 | mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); |
524 | mProfileBox->blockSignals( false ); | 523 | mProfileBox->blockSignals( false ); |
525 | return; | 524 | return; |
526 | } | 525 | } |
527 | //qDebug("cur i %d ",mProfileBox-> currentItem () ); | 526 | //qDebug("cur i %d ",mProfileBox-> currentItem () ); |
528 | mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; | 527 | mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; |
529 | KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; | 528 | KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; |
530 | prof->setName( s ); | 529 | prof->setName( s ); |
531 | mSyncProfileNames[mProfileBox-> currentItem ()] = s; | 530 | mSyncProfileNames[mProfileBox-> currentItem ()] = s; |
532 | updateMyCaption(); | 531 | updateMyCaption(); |
533 | } | 532 | } |
534 | void KSyncPrefsDialog::profileChanged( int item ) | 533 | void KSyncPrefsDialog::profileChanged( int item ) |
535 | { | 534 | { |
536 | //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() ); | 535 | //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() ); |
537 | KSyncProfile* prof; | 536 | KSyncProfile* prof; |
538 | saveProfile(); | 537 | saveProfile(); |
539 | readFilter(); | 538 | readFilter(); |
540 | readResources(); | 539 | readResources(); |
541 | currentSelection = item; | 540 | currentSelection = item; |
542 | prof = mSyncProfiles.at(item) ; | 541 | prof = mSyncProfiles.at(item) ; |
543 | 542 | ||
544 | mRemotePw->setText(prof->getRemotePw()); | 543 | mRemotePw->setText(prof->getRemotePw()); |
545 | mRemoteIP->setText(prof->getRemoteIP()); | 544 | mRemoteIP->setText(prof->getRemoteIP()); |
546 | mRemotePort->setText(prof->getRemotePort()); | 545 | mRemotePort->setText(prof->getRemotePort()); |
547 | 546 | ||
548 | mRemotePwAB->setText(prof->getRemotePwAB()); | 547 | mRemotePwAB->setText(prof->getRemotePwAB()); |
549 | mRemoteIPAB->setText(prof->getRemoteIPAB()); | 548 | mRemoteIPAB->setText(prof->getRemoteIPAB()); |
550 | mRemotePortAB->setText(prof->getRemotePortAB()); | 549 | mRemotePortAB->setText(prof->getRemotePortAB()); |
551 | 550 | ||
552 | mRemotePwPWM->setText(prof->getRemotePwPWM()); | 551 | mRemotePwPWM->setText(prof->getRemotePwPWM()); |
553 | mRemoteIPPWM->setText(prof->getRemoteIPPWM()); | 552 | mRemoteIPPWM->setText(prof->getRemoteIPPWM()); |
554 | mRemotePortPWM->setText(prof->getRemotePortPWM()); | 553 | mRemotePortPWM->setText(prof->getRemotePortPWM()); |
555 | 554 | ||
556 | mRemotePrecommand->setText(prof->getPreSyncCommand()); | 555 | mRemotePrecommand->setText(prof->getPreSyncCommand()); |
557 | mRemotePostcommand->setText(prof->getPostSyncCommand()); | 556 | mRemotePostcommand->setText(prof->getPostSyncCommand()); |
558 | mLocalTempFile->setText(prof->getLocalTempFile()); | 557 | mLocalTempFile->setText(prof->getLocalTempFile()); |
559 | mRemoteFile->setText(prof->getRemoteFileName()) ; | 558 | mRemoteFile->setText(prof->getRemoteFileName()) ; |
560 | 559 | ||
561 | mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); | 560 | mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); |
562 | mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); | 561 | mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); |
563 | mLocalTempFileAB->setText(prof->getLocalTempFileAB()); | 562 | mLocalTempFileAB->setText(prof->getLocalTempFileAB()); |
564 | mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; | 563 | mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; |
565 | 564 | ||
566 | mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM()); | 565 | mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM()); |
567 | mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM()); | 566 | mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM()); |
568 | mLocalTempFilePWM->setText(prof->getLocalTempFilePWM()); | 567 | mLocalTempFilePWM->setText(prof->getLocalTempFilePWM()); |
569 | mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ; | 568 | mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ; |
570 | 569 | ||
571 | if ( mWriteContactToSIM ) | 570 | if ( mWriteContactToSIM ) |
572 | mWriteContactToSIM->setChecked( prof->getWriteContactToSIM()); | 571 | mWriteContactToSIM->setChecked( prof->getWriteContactToSIM()); |
573 | mPhoneDevice->setText(prof->getPhoneDevice()); | 572 | mPhoneDevice->setText(prof->getPhoneDevice()); |
574 | mPhoneConnection->setText(prof->getPhoneConnection()); | 573 | mPhoneConnection->setText(prof->getPhoneConnection()); |
575 | mPhoneModel->setText(prof->getPhoneModel()); | 574 | mPhoneModel->setText(prof->getPhoneModel()); |
576 | 575 | ||
577 | mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); | 576 | mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); |
578 | mAskForPreferences->setChecked( prof->getAskForPreferences()); | 577 | mAskForPreferences->setChecked( prof->getAskForPreferences()); |
579 | mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); | 578 | mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); |
580 | mWriteBackFile->setChecked( prof->getWriteBackFile()); | 579 | mWriteBackFile->setChecked( prof->getWriteBackFile()); |
581 | mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); | 580 | mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); |
582 | mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); | 581 | mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); |
583 | mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); | 582 | mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); |
584 | mWriteBackFuture->setChecked( prof->getWriteBackFuture()); | 583 | mWriteBackFuture->setChecked( prof->getWriteBackFuture()); |
585 | mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); | 584 | mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); |
586 | mWriteBackPastWeeks->setValue( prof->getWriteBackPastWeeks() ); | 585 | mWriteBackPastWeeks->setValue( prof->getWriteBackPastWeeks() ); |
587 | 586 | ||
588 | mFilterInCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterInCal () ) + 1 ); | 587 | mFilterInCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterInCal () ) + 1 ); |
589 | mFilterOutCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterOutCal () ) + 1 ); | 588 | mFilterOutCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterOutCal () ) + 1 ); |
590 | mFilterInAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterInAB () ) + 1 ); | 589 | mFilterInAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterInAB () ) + 1 ); |
591 | mFilterOutAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterOutAB () ) + 1 ); | 590 | mFilterOutAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterOutAB () ) + 1 ); |
592 | 591 | ||
593 | switch ( prof->getSyncPrefs() ) { | 592 | switch ( prof->getSyncPrefs() ) { |
594 | case 0: | 593 | case 0: |
595 | loc->setChecked( true); | 594 | loc->setChecked( true); |
596 | break; | 595 | break; |
597 | case 1: | 596 | case 1: |
598 | rem->setChecked( true ); | 597 | rem->setChecked( true ); |
599 | break; | 598 | break; |
600 | case 2: | 599 | case 2: |
601 | newest->setChecked( true); | 600 | newest->setChecked( true); |
602 | break; | 601 | break; |