Diffstat (limited to 'libkdepim/ksyncprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 27f7932..744a914 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp | |||
@@ -338,520 +338,522 @@ void KSyncPrefsDialog::setupSyncAlgTab() | |||
338 | temphb = new QHBox( remoteFileWidget ); | 338 | temphb = new QHBox( remoteFileWidget ); |
339 | button = new QPushButton( i18n("ssh/scp"), temphb ); | 339 | button = new QPushButton( i18n("ssh/scp"), temphb ); |
340 | connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); | 340 | connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); |
341 | button = new QPushButton( i18n("ftp"), temphb ); | 341 | button = new QPushButton( i18n("ftp"), temphb ); |
342 | connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); | 342 | connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); |
343 | lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); | 343 | lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); |
344 | 344 | ||
345 | // *** pi-sync******************************* | 345 | // *** pi-sync******************************* |
346 | piWidget = new QVBox( topFrame); | 346 | piWidget = new QVBox( topFrame); |
347 | //topLayout->addMultiCellWidget(piWidget, iii,iii,0,1); | 347 | //topLayout->addMultiCellWidget(piWidget, iii,iii,0,1); |
348 | //++iii; | 348 | //++iii; |
349 | temphb = new QHBox( piWidget ); | 349 | temphb = new QHBox( piWidget ); |
350 | new QLabel( i18n("Calendar:"), temphb); | 350 | new QLabel( i18n("Calendar:"), temphb); |
351 | new QLabel( i18n("AddressBook:"), temphb); | 351 | new QLabel( i18n("AddressBook:"), temphb); |
352 | new QLabel( i18n("PWManager:"), temphb); | 352 | new QLabel( i18n("PWManager:"), temphb); |
353 | 353 | ||
354 | lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget); | 354 | lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget); |
355 | temphb = new QHBox( piWidget ); | 355 | temphb = new QHBox( piWidget ); |
356 | mRemotePw = new QLineEdit(temphb); | 356 | mRemotePw = new QLineEdit(temphb); |
357 | mRemotePwAB = new QLineEdit(temphb); | 357 | mRemotePwAB = new QLineEdit(temphb); |
358 | mRemotePwPWM = new QLineEdit(temphb); | 358 | mRemotePwPWM = new QLineEdit(temphb); |
359 | 359 | ||
360 | lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget); | 360 | lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget); |
361 | temphb = new QHBox( piWidget ); | 361 | temphb = new QHBox( piWidget ); |
362 | mRemoteIP = new QLineEdit(temphb); | 362 | mRemoteIP = new QLineEdit(temphb); |
363 | mRemoteIPAB = new QLineEdit(temphb); | 363 | mRemoteIPAB = new QLineEdit(temphb); |
364 | mRemoteIPPWM = new QLineEdit(temphb); | 364 | mRemoteIPPWM = new QLineEdit(temphb); |
365 | 365 | ||
366 | 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); |
367 | temphb = new QHBox( piWidget ); | 367 | temphb = new QHBox( piWidget ); |
368 | mRemotePort = new QLineEdit(temphb); | 368 | mRemotePort = new QLineEdit(temphb); |
369 | mRemotePortAB = new QLineEdit(temphb); | 369 | mRemotePortAB = new QLineEdit(temphb); |
370 | mRemotePortPWM = new QLineEdit(temphb); | 370 | mRemotePortPWM = new QLineEdit(temphb); |
371 | 371 | ||
372 | lab = new QLabel( i18n("Local/remote Resource sync partners"), piWidget); | 372 | lab = new QLabel( i18n("Local/remote Resource sync partners"), piWidget); |
373 | mTableBox = new QHBox( piWidget ); | 373 | mTableBox = new QHBox( piWidget ); |
374 | mResTableKopi = new QTable( 1, 1, mTableBox ); | 374 | mResTableKopi = new QTable( 1, 1, mTableBox ); |
375 | mResTableKapi = new QTable( 1, 1, mTableBox ); | 375 | mResTableKapi = new QTable( 1, 1, mTableBox ); |
376 | mResTablePwmpi = new QTable( 1, 1, mTableBox ); | 376 | mResTablePwmpi = new QTable( 1, 1, mTableBox ); |
377 | mResTableKopi->horizontalHeader()->setLabel( 0, i18n("Remote") ); | 377 | mResTableKopi->horizontalHeader()->setLabel( 0, i18n("Remote") ); |
378 | mResTableKapi->horizontalHeader()->setLabel( 0, i18n("Remote") ); | 378 | mResTableKapi->horizontalHeader()->setLabel( 0, i18n("Remote") ); |
379 | mResTablePwmpi->horizontalHeader()->setLabel( 0, i18n("Remote") ); | 379 | mResTablePwmpi->horizontalHeader()->setLabel( 0, i18n("Remote") ); |
380 | mResTableKopi->setLeftMargin( 80 ); | 380 | mResTableKopi->setLeftMargin( 80 ); |
381 | } | 381 | } |
382 | // ****************************************** | 382 | // ****************************************** |
383 | // Profile kind specific settings END | 383 | // Profile kind specific settings END |
384 | 384 | ||
385 | } | 385 | } |
386 | 386 | ||
387 | void KSyncPrefsDialog::readResources() | 387 | void KSyncPrefsDialog::readResources() |
388 | { | 388 | { |
389 | mResourcesKopi.clear(); | 389 | mResourcesKopi.clear(); |
390 | mResourcesKapi.clear(); | 390 | mResourcesKapi.clear(); |
391 | KConfig fc(locateLocal("config","kopicalendarrc")); | 391 | KConfig fc(locateLocal("config","kopicalendarrc")); |
392 | fc.setGroup("CC"); | 392 | fc.setGroup("CC"); |
393 | int numCals = fc.readNumEntry("NumberCalendars",0 ); | 393 | int numCals = fc.readNumEntry("NumberCalendars",0 ); |
394 | int curCal = 1; | 394 | int curCal = 1; |
395 | while ( curCal <= numCals ) { | 395 | while ( curCal <= numCals ) { |
396 | QString prefix = "Cal_" +QString::number( curCal ); | 396 | QString prefix = "Cal_" +QString::number( curCal ); |
397 | QString name = fc.readEntry( prefix+"_Name", "Calendar"); | 397 | QString name = fc.readEntry( prefix+"_Name", "Calendar"); |
398 | mResourcesKopi.append( name ); | 398 | mResourcesKopi.append( name ); |
399 | ++curCal; | 399 | ++curCal; |
400 | } | 400 | } |
401 | mResTableKopi->setNumRows( mResourcesKopi.count() ); | 401 | mResTableKopi->setNumRows( mResourcesKopi.count() ); |
402 | int i; | 402 | int i; |
403 | for ( i = 0;i < mResourcesKopi.count(); ++i ) { | 403 | for ( i = 0;i < mResourcesKopi.count(); ++i ) { |
404 | mResTableKopi->verticalHeader ()->setLabel( i, mResourcesKopi[i] ); | 404 | mResTableKopi->verticalHeader ()->setLabel( i, mResourcesKopi[i] ); |
405 | } | 405 | } |
406 | } | 406 | } |
407 | void KSyncPrefsDialog::readFilter() | 407 | void KSyncPrefsDialog::readFilter() |
408 | { | 408 | { |
409 | mFilterKapi.clear(); | 409 | mFilterKapi.clear(); |
410 | mFilterKopi.clear(); | 410 | mFilterKopi.clear(); |
411 | KConfig cfgko(locateLocal("config","korganizerrc")); | 411 | KConfig cfgko(locateLocal("config","korganizerrc")); |
412 | KConfig cfgka(locateLocal("config","kaddressbookrc")); | 412 | KConfig cfgka(locateLocal("config","kaddressbookrc")); |
413 | cfgko.setGroup("General"); | 413 | cfgko.setGroup("General"); |
414 | mFilterKopi = cfgko.readListEntry("CalendarFilters"); | 414 | mFilterKopi = cfgko.readListEntry("CalendarFilters"); |
415 | cfgka.setGroup("Filter"); | 415 | cfgka.setGroup("Filter"); |
416 | int count = cfgka.readNumEntry( "Count", 0 ); | 416 | int count = cfgka.readNumEntry( "Count", 0 ); |
417 | for ( int i = 0; i < count; i++ ) { | 417 | for ( int i = 0; i < count; i++ ) { |
418 | cfgka.setGroup("Filter_"+QString::number( i ) ); | 418 | cfgka.setGroup("Filter_"+QString::number( i ) ); |
419 | mFilterKapi.append( cfgka.readEntry("Name", "internal error") ); | 419 | mFilterKapi.append( cfgka.readEntry("Name", "internal error") ); |
420 | } | 420 | } |
421 | mFilterOutCal->clear(); | 421 | mFilterOutCal->clear(); |
422 | mFilterInCal->clear(); | 422 | mFilterInCal->clear(); |
423 | mFilterOutAB->clear(); | 423 | mFilterOutAB->clear(); |
424 | mFilterInAB->clear(); | 424 | mFilterInAB->clear(); |
425 | QStringList temp = mFilterKopi; | 425 | QStringList temp = mFilterKopi; |
426 | temp.prepend(i18n("No Filter") ); | 426 | temp.prepend(i18n("No Filter") ); |
427 | mFilterOutCal->insertStringList( temp ); | 427 | mFilterOutCal->insertStringList( temp ); |
428 | mFilterInCal->insertStringList( temp ); | 428 | mFilterInCal->insertStringList( temp ); |
429 | temp = mFilterKapi; | 429 | temp = mFilterKapi; |
430 | temp.prepend(i18n("No Filter") ); | 430 | temp.prepend(i18n("No Filter") ); |
431 | mFilterOutAB->insertStringList( temp ); | 431 | mFilterOutAB->insertStringList( temp ); |
432 | mFilterInAB->insertStringList( temp ); | 432 | mFilterInAB->insertStringList( temp ); |
433 | } | 433 | } |
434 | 434 | ||
435 | void KSyncPrefsDialog::slotOK() | 435 | void KSyncPrefsDialog::slotOK() |
436 | { | 436 | { |
437 | if ( mMyMachineName->text() == "undefined" ) { | 437 | if ( mMyMachineName->text() == "undefined" ) { |
438 | KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); | 438 | KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); |
439 | return; | 439 | return; |
440 | } | 440 | } |
441 | int i; | 441 | int i; |
442 | for (i = 0; i < mSyncProfileNames.count(); ++ i) { | 442 | for (i = 0; i < mSyncProfileNames.count(); ++ i) { |
443 | if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { | 443 | if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { |
444 | KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); | 444 | KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); |
445 | return; | 445 | return; |
446 | } | 446 | } |
447 | } | 447 | } |
448 | usrWriteConfig(); | 448 | usrWriteConfig(); |
449 | QDialog::accept(); | 449 | QDialog::accept(); |
450 | } | 450 | } |
451 | void KSyncPrefsDialog::accept() | 451 | void KSyncPrefsDialog::accept() |
452 | { | 452 | { |
453 | slotOK(); | 453 | slotOK(); |
454 | } | 454 | } |
455 | void KSyncPrefsDialog::chooseFile() | 455 | void KSyncPrefsDialog::chooseFile() |
456 | { | 456 | { |
457 | QString fn = QDir::homeDirPath(); | 457 | QString fn = QDir::homeDirPath(); |
458 | 458 | ||
459 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); | 459 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); |
460 | if ( fn == "" ) | 460 | if ( fn == "" ) |
461 | return; | 461 | return; |
462 | mRemoteFile->setText( fn ); | 462 | mRemoteFile->setText( fn ); |
463 | } | 463 | } |
464 | 464 | ||
465 | void KSyncPrefsDialog::chooseFileAB() | 465 | void KSyncPrefsDialog::chooseFileAB() |
466 | { | 466 | { |
467 | QString fn = QDir::homeDirPath(); | 467 | QString fn = QDir::homeDirPath(); |
468 | 468 | ||
469 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this ); | 469 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this ); |
470 | if ( fn == "" ) | 470 | if ( fn == "" ) |
471 | return; | 471 | return; |
472 | mRemoteFileAB->setText( fn ); | 472 | mRemoteFileAB->setText( fn ); |
473 | } | 473 | } |
474 | 474 | ||
475 | void KSyncPrefsDialog::chooseFilePWM() | 475 | void KSyncPrefsDialog::chooseFilePWM() |
476 | { | 476 | { |
477 | QString fn = QDir::homeDirPath(); | 477 | QString fn = QDir::homeDirPath(); |
478 | 478 | ||
479 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); | 479 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); |
480 | if ( fn == "" ) | 480 | if ( fn == "" ) |
481 | return; | 481 | return; |
482 | mRemoteFilePWM->setText( fn ); | 482 | mRemoteFilePWM->setText( fn ); |
483 | } | 483 | } |
484 | 484 | ||
485 | void KSyncPrefsDialog::textChanged( const QString & s ) | 485 | void KSyncPrefsDialog::textChanged( const QString & s ) |
486 | { | 486 | { |
487 | if ( mProfileBox->count() == 0 ) | 487 | if ( mProfileBox->count() == 0 ) |
488 | return; | 488 | return; |
489 | if ( currentSelection < 3 ) { | 489 | if ( currentSelection < 3 ) { |
490 | //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); | 490 | //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); |
491 | mProfileBox->blockSignals( true ); | 491 | mProfileBox->blockSignals( true ); |
492 | mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); | 492 | mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); |
493 | mProfileBox->blockSignals( false ); | 493 | mProfileBox->blockSignals( false ); |
494 | return; | 494 | return; |
495 | } | 495 | } |
496 | //qDebug("cur i %d ",mProfileBox-> currentItem () ); | 496 | //qDebug("cur i %d ",mProfileBox-> currentItem () ); |
497 | mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; | 497 | mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; |
498 | KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; | 498 | KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; |
499 | prof->setName( s ); | 499 | prof->setName( s ); |
500 | mSyncProfileNames[mProfileBox-> currentItem ()] = s; | 500 | mSyncProfileNames[mProfileBox-> currentItem ()] = s; |
501 | } | 501 | } |
502 | void KSyncPrefsDialog::profileChanged( int item ) | 502 | void KSyncPrefsDialog::profileChanged( int item ) |
503 | { | 503 | { |
504 | //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() ); | 504 | //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() ); |
505 | KSyncProfile* prof; | 505 | KSyncProfile* prof; |
506 | saveProfile(); | 506 | saveProfile(); |
507 | readFilter(); | 507 | readFilter(); |
508 | readResources(); | 508 | readResources(); |
509 | currentSelection = item; | 509 | currentSelection = item; |
510 | prof = mSyncProfiles.at(item) ; | 510 | prof = mSyncProfiles.at(item) ; |
511 | 511 | ||
512 | mRemotePw->setText(prof->getRemotePw()); | 512 | mRemotePw->setText(prof->getRemotePw()); |
513 | mRemoteIP->setText(prof->getRemoteIP()); | 513 | mRemoteIP->setText(prof->getRemoteIP()); |
514 | mRemotePort->setText(prof->getRemotePort()); | 514 | mRemotePort->setText(prof->getRemotePort()); |
515 | 515 | ||
516 | mRemotePwAB->setText(prof->getRemotePwAB()); | 516 | mRemotePwAB->setText(prof->getRemotePwAB()); |
517 | mRemoteIPAB->setText(prof->getRemoteIPAB()); | 517 | mRemoteIPAB->setText(prof->getRemoteIPAB()); |
518 | mRemotePortAB->setText(prof->getRemotePortAB()); | 518 | mRemotePortAB->setText(prof->getRemotePortAB()); |
519 | 519 | ||
520 | mRemotePwPWM->setText(prof->getRemotePwPWM()); | 520 | mRemotePwPWM->setText(prof->getRemotePwPWM()); |
521 | mRemoteIPPWM->setText(prof->getRemoteIPPWM()); | 521 | mRemoteIPPWM->setText(prof->getRemoteIPPWM()); |
522 | mRemotePortPWM->setText(prof->getRemotePortPWM()); | 522 | mRemotePortPWM->setText(prof->getRemotePortPWM()); |
523 | 523 | ||
524 | mRemotePrecommand->setText(prof->getPreSyncCommand()); | 524 | mRemotePrecommand->setText(prof->getPreSyncCommand()); |
525 | mRemotePostcommand->setText(prof->getPostSyncCommand()); | 525 | mRemotePostcommand->setText(prof->getPostSyncCommand()); |
526 | mLocalTempFile->setText(prof->getLocalTempFile()); | 526 | mLocalTempFile->setText(prof->getLocalTempFile()); |
527 | mRemoteFile->setText(prof->getRemoteFileName()) ; | 527 | mRemoteFile->setText(prof->getRemoteFileName()) ; |
528 | 528 | ||
529 | mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); | 529 | mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); |
530 | mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); | 530 | mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); |
531 | mLocalTempFileAB->setText(prof->getLocalTempFileAB()); | 531 | mLocalTempFileAB->setText(prof->getLocalTempFileAB()); |
532 | mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; | 532 | mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; |
533 | 533 | ||
534 | mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM()); | 534 | mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM()); |
535 | mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM()); | 535 | mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM()); |
536 | mLocalTempFilePWM->setText(prof->getLocalTempFilePWM()); | 536 | mLocalTempFilePWM->setText(prof->getLocalTempFilePWM()); |
537 | mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ; | 537 | mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ; |
538 | 538 | ||
539 | if ( mWriteContactToSIM ) | 539 | if ( mWriteContactToSIM ) |
540 | mWriteContactToSIM->setChecked( prof->getWriteContactToSIM()); | 540 | mWriteContactToSIM->setChecked( prof->getWriteContactToSIM()); |
541 | mPhoneDevice->setText(prof->getPhoneDevice()); | 541 | mPhoneDevice->setText(prof->getPhoneDevice()); |
542 | mPhoneConnection->setText(prof->getPhoneConnection()); | 542 | mPhoneConnection->setText(prof->getPhoneConnection()); |
543 | mPhoneModel->setText(prof->getPhoneModel()); | 543 | mPhoneModel->setText(prof->getPhoneModel()); |
544 | 544 | ||
545 | mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); | 545 | mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); |
546 | mAskForPreferences->setChecked( prof->getAskForPreferences()); | 546 | mAskForPreferences->setChecked( prof->getAskForPreferences()); |
547 | mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); | 547 | mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); |
548 | mWriteBackFile->setChecked( prof->getWriteBackFile()); | 548 | mWriteBackFile->setChecked( prof->getWriteBackFile()); |
549 | mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); | 549 | mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); |
550 | mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); | 550 | mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); |
551 | mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); | 551 | mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); |
552 | mWriteBackFuture->setChecked( prof->getWriteBackFuture()); | 552 | mWriteBackFuture->setChecked( prof->getWriteBackFuture()); |
553 | mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); | 553 | mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); |
554 | mWriteBackPastWeeks->setValue( prof->getWriteBackPastWeeks() ); | 554 | mWriteBackPastWeeks->setValue( prof->getWriteBackPastWeeks() ); |
555 | 555 | ||
556 | mFilterInCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterInCal () ) + 1 ); | 556 | mFilterInCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterInCal () ) + 1 ); |
557 | mFilterOutCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterOutCal () ) + 1 ); | 557 | mFilterOutCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterOutCal () ) + 1 ); |
558 | mFilterInAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterInAB () ) + 1 ); | 558 | mFilterInAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterInAB () ) + 1 ); |
559 | mFilterOutAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterOutAB () ) + 1 ); | 559 | mFilterOutAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterOutAB () ) + 1 ); |
560 | 560 | ||
561 | switch ( prof->getSyncPrefs() ) { | 561 | switch ( prof->getSyncPrefs() ) { |
562 | case 0: | 562 | case 0: |
563 | loc->setChecked( true); | 563 | loc->setChecked( true); |
564 | break; | 564 | break; |
565 | case 1: | 565 | case 1: |
566 | rem->setChecked( true ); | 566 | rem->setChecked( true ); |
567 | break; | 567 | break; |
568 | case 2: | 568 | case 2: |
569 | newest->setChecked( true); | 569 | newest->setChecked( true); |
570 | break; | 570 | break; |
571 | case 3: | 571 | case 3: |
572 | ask->setChecked( true); | 572 | ask->setChecked( true); |
573 | break; | 573 | break; |
574 | case 4: | 574 | case 4: |
575 | f_loc->setChecked( true); | 575 | f_loc->setChecked( true); |
576 | break; | 576 | break; |
577 | case 5: | 577 | case 5: |
578 | f_rem->setChecked( true); | 578 | f_rem->setChecked( true); |
579 | break; | 579 | break; |
580 | case 6: | 580 | case 6: |
581 | //both->setChecked( true); | 581 | //both->setChecked( true); |
582 | break; | 582 | break; |
583 | default: | 583 | default: |
584 | break; | 584 | break; |
585 | } | 585 | } |
586 | mIsLocal->setChecked(prof->getIsLocalFileSync()) ; | 586 | mIsLocal->setChecked(prof->getIsLocalFileSync()) ; |
587 | mIsPhone->setChecked(prof->getIsPhoneSync()) ; | 587 | mIsPhone->setChecked(prof->getIsPhoneSync()) ; |
588 | mIsPi->setChecked(prof->getIsPiSync()) ; | 588 | mIsPi->setChecked(prof->getIsPiSync()) ; |
589 | mIsPiSpecific->setChecked(prof->getIsPiSyncSpec()) ; | 589 | mIsPiSpecific->setChecked(prof->getIsPiSyncSpec()) ; |
590 | mIsKapiFileL->setChecked(prof->getIsKapiFile()) ; | 590 | mIsKapiFileL->setChecked(prof->getIsKapiFile()) ; |
591 | mIsKapiFileR->setChecked(prof->getIsKapiFile()) ; | 591 | mIsKapiFileR->setChecked(prof->getIsKapiFile()) ; |
592 | 592 | ||
593 | 593 | ||
594 | QStringList res = QStringList::split( ":",prof->getResSpecKopi()); | 594 | QStringList res = QStringList::split( ":",prof->getResSpecKopi(), true ); |
595 | int i= res.count()/2; | 595 | int add = res.count()/2; |
596 | for ( ;i < res.count(); ++i ) { | 596 | int i; |
597 | mResTableKopi->setText( i, 0, res[i] ); | 597 | for ( i = 0;i < add ; ++i ) { |
598 | mResTableKopi->setText( i, 0, res[i+add] ); | ||
598 | } | 599 | } |
599 | res = QStringList::split( ":",prof->getResSpecKapi()); | 600 | res = QStringList::split( ":",prof->getResSpecKapi(), true); |
600 | for ( i = 0;i < res.count(); ++i ) { | 601 | add = res.count()/2; |
601 | mResTableKapi->setText( i, 0, res[i] ); | 602 | for ( i = 0;i < add; ++i ) { |
603 | mResTableKapi->setText( i, 0, res[i+add] ); | ||
602 | } | 604 | } |
603 | mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() &&!prof->getIsPiSyncSpec()); | 605 | mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() &&!prof->getIsPiSyncSpec()); |
604 | proGr->setEnabled( item > 2 ); | 606 | proGr->setEnabled( item > 2 ); |
605 | if ( item < 3 ) { | 607 | if ( item < 3 ) { |
606 | localFileWidget->hide(); | 608 | localFileWidget->hide(); |
607 | remoteFileWidget->hide(); | 609 | remoteFileWidget->hide(); |
608 | phoneWidget->hide(); | 610 | phoneWidget->hide(); |
609 | piWidget->hide(); | 611 | piWidget->hide(); |
610 | 612 | ||
611 | } else | 613 | } else |
612 | kindChanged( prof->getIsLocalFileSync() ); | 614 | kindChanged( prof->getIsLocalFileSync() ); |
613 | } | 615 | } |
614 | 616 | ||
615 | void KSyncPrefsDialog::fillSSH() | 617 | void KSyncPrefsDialog::fillSSH() |
616 | { | 618 | { |
617 | mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); | 619 | mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); |
618 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); | 620 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); |
619 | mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); | 621 | mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); |
620 | mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); | 622 | mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); |
621 | mLocalTempFileAB->setText("/tmp/std.vcf" ); | 623 | mLocalTempFileAB->setText("/tmp/std.vcf" ); |
622 | mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); | 624 | mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); |
623 | mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); | 625 | mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); |
624 | mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); | 626 | mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); |
625 | mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" ); | 627 | mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" ); |
626 | } | 628 | } |
627 | void KSyncPrefsDialog::fillFTP() | 629 | void KSyncPrefsDialog::fillFTP() |
628 | { | 630 | { |
629 | mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); | 631 | mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); |
630 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); | 632 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); |
631 | mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); | 633 | mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); |
632 | mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); | 634 | mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); |
633 | mLocalTempFileAB->setText("/tmp/std.vcf" ); | 635 | mLocalTempFileAB->setText("/tmp/std.vcf" ); |
634 | mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); | 636 | mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); |
635 | 637 | ||
636 | mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" ); | 638 | mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" ); |
637 | mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); | 639 | mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); |
638 | mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); | 640 | mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); |
639 | 641 | ||
640 | } | 642 | } |
641 | void KSyncPrefsDialog::kindChanged( bool b ) | 643 | void KSyncPrefsDialog::kindChanged( bool b ) |
642 | { | 644 | { |
643 | 645 | ||
644 | if ( mIsLocal->isChecked () ) { | 646 | if ( mIsLocal->isChecked () ) { |
645 | mIsKapiFileL->setChecked( mIsKapiFileR->isChecked() ); | 647 | mIsKapiFileL->setChecked( mIsKapiFileR->isChecked() ); |
646 | } else { | 648 | } else { |
647 | mIsKapiFileR->setChecked( mIsKapiFileL->isChecked() ); | 649 | mIsKapiFileR->setChecked( mIsKapiFileL->isChecked() ); |
648 | } | 650 | } |
649 | 651 | ||
650 | if ( mIsLocal->isChecked () ) | 652 | if ( mIsLocal->isChecked () ) |
651 | localFileWidget->show(); | 653 | localFileWidget->show(); |
652 | else | 654 | else |
653 | localFileWidget->hide(); | 655 | localFileWidget->hide(); |
654 | 656 | ||
655 | if ( mIsNotLocal->isChecked () ) | 657 | if ( mIsNotLocal->isChecked () ) |
656 | remoteFileWidget->show(); | 658 | remoteFileWidget->show(); |
657 | else | 659 | else |
658 | remoteFileWidget->hide(); | 660 | remoteFileWidget->hide(); |
659 | 661 | ||
660 | if ( mIsPhone->isChecked () ) { | 662 | if ( mIsPhone->isChecked () ) { |
661 | phoneWidget->show(); | 663 | phoneWidget->show(); |
662 | } | 664 | } |
663 | else { | 665 | else { |
664 | phoneWidget->hide(); | 666 | phoneWidget->hide(); |
665 | } | 667 | } |
666 | 668 | ||
667 | if ( mIsPi->isChecked () || mIsPiSpecific->isChecked () ) { | 669 | if ( mIsPi->isChecked () || mIsPiSpecific->isChecked () ) { |
668 | piWidget->show(); | 670 | piWidget->show(); |
669 | if (mIsPiSpecific->isChecked () ) { | 671 | if (mIsPiSpecific->isChecked () ) { |
670 | mTableBox->show(); | 672 | mTableBox->show(); |
671 | } | 673 | } |
672 | else { | 674 | else { |
673 | mTableBox->hide(); | 675 | mTableBox->hide(); |
674 | } | 676 | } |
675 | } | 677 | } |
676 | else { | 678 | else { |
677 | piWidget->hide(); | 679 | piWidget->hide(); |
678 | } | 680 | } |
679 | 681 | ||
680 | 682 | ||
681 | } | 683 | } |
682 | void KSyncPrefsDialog::deleteProfile() | 684 | void KSyncPrefsDialog::deleteProfile() |
683 | { | 685 | { |
684 | //qDebug("KSyncPrefsDialog::deleteProfile() "); | 686 | //qDebug("KSyncPrefsDialog::deleteProfile() "); |
685 | if ( currentSelection >= 0 ) { | 687 | if ( currentSelection >= 0 ) { |
686 | if ( currentSelection < 3 ) { | 688 | if ( currentSelection < 3 ) { |
687 | KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); | 689 | KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); |
688 | return; | 690 | return; |
689 | } | 691 | } |
690 | KSyncProfile* temp = mSyncProfiles.at(currentSelection); | 692 | KSyncProfile* temp = mSyncProfiles.at(currentSelection); |
691 | mSyncProfiles.remove( temp ); | 693 | mSyncProfiles.remove( temp ); |
692 | mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); | 694 | mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); |
693 | insertProfiles(); | 695 | insertProfiles(); |
694 | } | 696 | } |
695 | } | 697 | } |
696 | 698 | ||
697 | void KSyncPrefsDialog::saveProfile() | 699 | void KSyncPrefsDialog::saveProfile() |
698 | { | 700 | { |
699 | KSyncProfile* prof; | 701 | KSyncProfile* prof; |
700 | if ( currentSelection >= 0 ) { | 702 | if ( currentSelection >= 0 ) { |
701 | prof = mSyncProfiles.at(currentSelection) ; | 703 | prof = mSyncProfiles.at(currentSelection) ; |
702 | 704 | ||
703 | prof->setRemotePw( mRemotePw->text()); | 705 | prof->setRemotePw( mRemotePw->text()); |
704 | prof->setRemoteIP( mRemoteIP->text()); | 706 | prof->setRemoteIP( mRemoteIP->text()); |
705 | prof->setRemotePort( mRemotePort->text()); | 707 | prof->setRemotePort( mRemotePort->text()); |
706 | 708 | ||
707 | prof->setRemotePwAB( mRemotePwAB->text()); | 709 | prof->setRemotePwAB( mRemotePwAB->text()); |
708 | prof->setRemoteIPAB( mRemoteIPAB->text()); | 710 | prof->setRemoteIPAB( mRemoteIPAB->text()); |
709 | prof->setRemotePortAB( mRemotePortAB->text()); | 711 | prof->setRemotePortAB( mRemotePortAB->text()); |
710 | 712 | ||
711 | prof->setRemotePwPWM( mRemotePwPWM->text()); | 713 | prof->setRemotePwPWM( mRemotePwPWM->text()); |
712 | prof->setRemoteIPPWM( mRemoteIPPWM->text()); | 714 | prof->setRemoteIPPWM( mRemoteIPPWM->text()); |
713 | prof->setRemotePortPWM( mRemotePortPWM->text()); | 715 | prof->setRemotePortPWM( mRemotePortPWM->text()); |
714 | 716 | ||
715 | prof->setPreSyncCommand( mRemotePrecommand->text()); | 717 | prof->setPreSyncCommand( mRemotePrecommand->text()); |
716 | prof->setPostSyncCommand( mRemotePostcommand->text() ); | 718 | prof->setPostSyncCommand( mRemotePostcommand->text() ); |
717 | prof->setLocalTempFile( mLocalTempFile->text()); | 719 | prof->setLocalTempFile( mLocalTempFile->text()); |
718 | prof->setRemoteFileName( mRemoteFile->text() ); | 720 | prof->setRemoteFileName( mRemoteFile->text() ); |
719 | prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); | 721 | prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); |
720 | prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); | 722 | prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); |
721 | prof->setLocalTempFileAB( mLocalTempFileAB->text()); | 723 | prof->setLocalTempFileAB( mLocalTempFileAB->text()); |
722 | prof->setRemoteFileNameAB( mRemoteFileAB->text() ); | 724 | prof->setRemoteFileNameAB( mRemoteFileAB->text() ); |
723 | prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text()); | 725 | prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text()); |
724 | prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() ); | 726 | prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() ); |
725 | prof->setLocalTempFilePWM( mLocalTempFilePWM->text()); | 727 | prof->setLocalTempFilePWM( mLocalTempFilePWM->text()); |
726 | prof->setRemoteFileNamePWM( mRemoteFilePWM->text() ); | 728 | prof->setRemoteFileNamePWM( mRemoteFilePWM->text() ); |
727 | prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); | 729 | prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); |
728 | prof->setAskForPreferences( mAskForPreferences->isChecked()); | 730 | prof->setAskForPreferences( mAskForPreferences->isChecked()); |
729 | prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); | 731 | prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); |
730 | prof->setWriteBackFile( mWriteBackFile->isChecked()); | 732 | prof->setWriteBackFile( mWriteBackFile->isChecked()); |
731 | prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); | 733 | prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); |
732 | prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); | 734 | prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); |
733 | prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() ); | 735 | prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() ); |
734 | int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; | 736 | int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; |
735 | prof->setSyncPrefs( syncprefs); | 737 | prof->setSyncPrefs( syncprefs); |
736 | prof->setIsLocalFileSync( mIsLocal->isChecked() ); | 738 | prof->setIsLocalFileSync( mIsLocal->isChecked() ); |
737 | prof->setIsPhoneSync( mIsPhone->isChecked() ); | 739 | prof->setIsPhoneSync( mIsPhone->isChecked() ); |
738 | prof->setIsPiSync( mIsPi->isChecked() ); | 740 | prof->setIsPiSync( mIsPi->isChecked() ); |
739 | prof->setIsPiSyncSpec( mIsPiSpecific->isChecked() ); | 741 | prof->setIsPiSyncSpec( mIsPiSpecific->isChecked() ); |
740 | prof->setIsKapiFile( mIsKapiFileL->isChecked() ); | 742 | prof->setIsKapiFile( mIsKapiFileL->isChecked() ); |
741 | prof->setWriteBackFuture(mWriteBackFuture->isChecked()); | 743 | prof->setWriteBackFuture(mWriteBackFuture->isChecked()); |
742 | prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); | 744 | prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); |
743 | prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value()); | 745 | prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value()); |
744 | if ( mWriteContactToSIM ) | 746 | if ( mWriteContactToSIM ) |
745 | prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); | 747 | prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); |
746 | prof->setPhoneDevice( mPhoneDevice->text() ); | 748 | prof->setPhoneDevice( mPhoneDevice->text() ); |
747 | prof->setPhoneConnection( mPhoneConnection->text() ); | 749 | prof->setPhoneConnection( mPhoneConnection->text() ); |
748 | prof->setPhoneModel( mPhoneModel->text() ); | 750 | prof->setPhoneModel( mPhoneModel->text() ); |
749 | prof->setFilterInCal ( mFilterInCal->currentText ()); | 751 | prof->setFilterInCal ( mFilterInCal->currentText ()); |
750 | prof->setFilterOutCal ( mFilterOutCal ->currentText ()); | 752 | prof->setFilterOutCal ( mFilterOutCal ->currentText ()); |
751 | prof->setFilterInAB ( mFilterInAB ->currentText ()); | 753 | prof->setFilterInAB ( mFilterInAB ->currentText ()); |
752 | prof->setFilterOutAB ( mFilterOutAB ->currentText ()); | 754 | prof->setFilterOutAB ( mFilterOutAB ->currentText ()); |
753 | if ( mIsPiSpecific->isChecked() ) { | 755 | if ( mIsPiSpecific->isChecked() ) { |
754 | 756 | ||
755 | QStringList res = mResourcesKopi; | 757 | QStringList res = mResourcesKopi; |
756 | int i; | 758 | int i; |
757 | for ( i = 0;i < mResourcesKopi.count(); ++i ) { | 759 | for ( i = 0;i < mResourcesKopi.count(); ++i ) { |
758 | res.append( mResTableKopi->text( i, 0 )); | 760 | res.append( mResTableKopi->text( i, 0 )); |
759 | } | 761 | } |
760 | prof->setResSpecKopi( res.join(":")); | 762 | prof->setResSpecKopi( res.join(":")); |
761 | } | 763 | } |
762 | } | 764 | } |
763 | } | 765 | } |
764 | 766 | ||
765 | void KSyncPrefsDialog::insertProfiles() | 767 | void KSyncPrefsDialog::insertProfiles() |
766 | { | 768 | { |
767 | int curItem = mProfileBox->currentItem(); | 769 | int curItem = mProfileBox->currentItem(); |
768 | mProfileBox->blockSignals( true ); | 770 | mProfileBox->blockSignals( true ); |
769 | mProfileBox->clear(); | 771 | mProfileBox->clear(); |
770 | mProfileBox->insertStringList (mSyncProfileNames ); | 772 | mProfileBox->insertStringList (mSyncProfileNames ); |
771 | int item = mSyncProfileNames.count() -1; | 773 | int item = mSyncProfileNames.count() -1; |
772 | if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) | 774 | if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) |
773 | mProfileBox->setCurrentItem( curItem ); | 775 | mProfileBox->setCurrentItem( curItem ); |
774 | else if ( item >= 0 ) { | 776 | else if ( item >= 0 ) { |
775 | mProfileBox->setCurrentItem( item ); | 777 | mProfileBox->setCurrentItem( item ); |
776 | } | 778 | } |
777 | currentSelection = -1; | 779 | currentSelection = -1; |
778 | if ( mSyncProfileNames.count() > 0 ) { | 780 | if ( mSyncProfileNames.count() > 0 ) { |
779 | //qDebug(" profileChanged( mProfileBox->currentItem() "); | 781 | //qDebug(" profileChanged( mProfileBox->currentItem() "); |
780 | profileChanged( mProfileBox->currentItem() ); | 782 | profileChanged( mProfileBox->currentItem() ); |
781 | currentSelection = mProfileBox->currentItem(); | 783 | currentSelection = mProfileBox->currentItem(); |
782 | } | 784 | } |
783 | mProfileBox->blockSignals( false ); | 785 | mProfileBox->blockSignals( false ); |
784 | } | 786 | } |
785 | 787 | ||
786 | void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) | 788 | void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) |
787 | { | 789 | { |
788 | saveProfile(); | 790 | saveProfile(); |
789 | mSyncProfiles.append( temp ); | 791 | mSyncProfiles.append( temp ); |
790 | mSyncProfileNames << temp->getName(); | 792 | mSyncProfileNames << temp->getName(); |
791 | insertProfiles(); | 793 | insertProfiles(); |
792 | int last = mProfileBox->count() -1; | 794 | int last = mProfileBox->count() -1; |
793 | mProfileBox->blockSignals( true ); | 795 | mProfileBox->blockSignals( true ); |
794 | mProfileBox->setCurrentItem( last ); | 796 | mProfileBox->setCurrentItem( last ); |
795 | mProfileBox->blockSignals( false ); | 797 | mProfileBox->blockSignals( false ); |
796 | profileChanged(last); | 798 | profileChanged(last); |
797 | } | 799 | } |
798 | void KSyncPrefsDialog::newProfile() | 800 | void KSyncPrefsDialog::newProfile() |
799 | { | 801 | { |
800 | addProfile ( new KSyncProfile () ); | 802 | addProfile ( new KSyncProfile () ); |
801 | } | 803 | } |
802 | 804 | ||
803 | void KSyncPrefsDialog::cloneProfile() | 805 | void KSyncPrefsDialog::cloneProfile() |
804 | { | 806 | { |
805 | if ( currentSelection >= 0 ) | 807 | if ( currentSelection >= 0 ) |
806 | addProfile (mSyncProfiles.at(currentSelection)->clone()) ; | 808 | addProfile (mSyncProfiles.at(currentSelection)->clone()) ; |
807 | else | 809 | else |
808 | newProfile(); | 810 | newProfile(); |
809 | } | 811 | } |
810 | 812 | ||
811 | void KSyncPrefsDialog::setLocalMachineName ( const QString& name ) | 813 | void KSyncPrefsDialog::setLocalMachineName ( const QString& name ) |
812 | { | 814 | { |
813 | mMyMachineName->setText( name ); | 815 | mMyMachineName->setText( name ); |
814 | 816 | ||
815 | } | 817 | } |
816 | QString KSyncPrefsDialog::getLocalMachineName ( ) | 818 | QString KSyncPrefsDialog::getLocalMachineName ( ) |
817 | { | 819 | { |
818 | return mMyMachineName->text(); | 820 | return mMyMachineName->text(); |
819 | } | 821 | } |
820 | 822 | ||
821 | QStringList KSyncPrefsDialog::getSyncProfileNames() | 823 | QStringList KSyncPrefsDialog::getSyncProfileNames() |
822 | { | 824 | { |
823 | return mSyncProfileNames; | 825 | return mSyncProfileNames; |
824 | } | 826 | } |
825 | void KSyncPrefsDialog::usrReadConfig() | 827 | void KSyncPrefsDialog::usrReadConfig() |
826 | { | 828 | { |
827 | //KConfig *config = KOGlobals::config(); | 829 | //KConfig *config = KOGlobals::config(); |
828 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 830 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
829 | config.setGroup("General"); | 831 | config.setGroup("General"); |
830 | mSyncProfileNames =config.readListEntry("SyncProfileNames"); | 832 | mSyncProfileNames =config.readListEntry("SyncProfileNames"); |
831 | mMyMachineName->setText(config.readEntry("LocalMachineName","undefined")); | 833 | mMyMachineName->setText(config.readEntry("LocalMachineName","undefined")); |
832 | int i; | 834 | int i; |
833 | KSyncProfile* temp ; | 835 | KSyncProfile* temp ; |
834 | mSyncProfiles.clear(); | 836 | mSyncProfiles.clear(); |
835 | for ( i = 0; i < mSyncProfileNames.count();++i ) { | 837 | for ( i = 0; i < mSyncProfileNames.count();++i ) { |
836 | temp = new KSyncProfile (); | 838 | temp = new KSyncProfile (); |
837 | temp->setName( mSyncProfileNames[i] ); | 839 | temp->setName( mSyncProfileNames[i] ); |
838 | temp->readConfig( &config ); | 840 | temp->readConfig( &config ); |
839 | mSyncProfiles.append( temp ); | 841 | mSyncProfiles.append( temp ); |
840 | } | 842 | } |
841 | insertProfiles(); | 843 | insertProfiles(); |
842 | //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); | 844 | //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); |
843 | } | 845 | } |
844 | 846 | ||
845 | 847 | ||
846 | void KSyncPrefsDialog::usrWriteConfig() | 848 | void KSyncPrefsDialog::usrWriteConfig() |
847 | { | 849 | { |
848 | saveProfile(); | 850 | saveProfile(); |
849 | if ( currentSelection >= 0 ) | 851 | if ( currentSelection >= 0 ) |
850 | profileChanged(currentSelection); | 852 | profileChanged(currentSelection); |
851 | //KConfig *config = KOGlobals::config(); | 853 | //KConfig *config = KOGlobals::config(); |
852 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 854 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
853 | KSyncProfile* prof = mSyncProfiles.first(); | 855 | KSyncProfile* prof = mSyncProfiles.first(); |
854 | QStringList externalSyncProfileNames; | 856 | QStringList externalSyncProfileNames; |
855 | externalSyncProfileNames.append("Sharp_DTM");; | 857 | externalSyncProfileNames.append("Sharp_DTM");; |
856 | while ( prof ) { | 858 | while ( prof ) { |
857 | prof->writeConfig(&config); | 859 | prof->writeConfig(&config); |