summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp17
-rw-r--r--libkdepim/ksyncmanager.cpp1
-rw-r--r--libkdepim/ksyncmanager.h1
-rw-r--r--libkdepim/ksyncprefsdialog.cpp14
-rw-r--r--libkdepim/ksyncprefsdialog.h2
-rw-r--r--libkdepim/ksyncprofile.cpp4
-rw-r--r--libkdepim/ksyncprofile.h3
7 files changed, 25 insertions, 17 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 282560f..205dbc8 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2481,410 +2481,395 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2481 if ( !addresseeR.isEmpty() ) { 2481 if ( !addresseeR.isEmpty() ) {
2482 addresseeRSync = addresseeR; 2482 addresseeRSync = addresseeR;
2483 remote->removeAddressee(addresseeR ); 2483 remote->removeAddressee(addresseeR );
2484 2484
2485 } else { 2485 } else {
2486 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2486 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2487 addresseeRSync = addresseeLSync ; 2487 addresseeRSync = addresseeLSync ;
2488 } else { 2488 } else {
2489 qDebug("FULLDATE 1"); 2489 qDebug("FULLDATE 1");
2490 fullDateRange = true; 2490 fullDateRange = true;
2491 Addressee newAdd; 2491 Addressee newAdd;
2492 addresseeRSync = newAdd; 2492 addresseeRSync = newAdd;
2493 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); 2493 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee"));
2494 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); 2494 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName );
2495 addresseeRSync.setRevision( mLastAddressbookSync ); 2495 addresseeRSync.setRevision( mLastAddressbookSync );
2496 addresseeRSync.setCategories( i18n("SyncAddressee") ); 2496 addresseeRSync.setCategories( i18n("SyncAddressee") );
2497 } 2497 }
2498 } 2498 }
2499 if ( addresseeLSync.revision() == mLastAddressbookSync ) { 2499 if ( addresseeLSync.revision() == mLastAddressbookSync ) {
2500 qDebug("FULLDATE 2"); 2500 qDebug("FULLDATE 2");
2501 fullDateRange = true; 2501 fullDateRange = true;
2502 } 2502 }
2503 if ( ! fullDateRange ) { 2503 if ( ! fullDateRange ) {
2504 if ( addresseeLSync.revision() != addresseeRSync.revision() ) { 2504 if ( addresseeLSync.revision() != addresseeRSync.revision() ) {
2505 2505
2506 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); 2506 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() );
2507 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); 2507 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
2508 fullDateRange = true; 2508 fullDateRange = true;
2509 qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); 2509 qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() );
2510 } 2510 }
2511 } 2511 }
2512 // fullDateRange = true; // debug only! 2512 // fullDateRange = true; // debug only!
2513 if ( fullDateRange ) 2513 if ( fullDateRange )
2514 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); 2514 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365);
2515 else 2515 else
2516 mLastAddressbookSync = addresseeLSync.revision(); 2516 mLastAddressbookSync = addresseeLSync.revision();
2517 // for resyncing if own file has changed 2517 // for resyncing if own file has changed
2518 // PENDING fixme later when implemented 2518 // PENDING fixme later when implemented
2519#if 0 2519#if 0
2520 if ( mCurrentSyncDevice == "deleteaftersync" ) { 2520 if ( mCurrentSyncDevice == "deleteaftersync" ) {
2521 mLastAddressbookSync = loadedFileVersion; 2521 mLastAddressbookSync = loadedFileVersion;
2522 qDebug("setting mLastAddressbookSync "); 2522 qDebug("setting mLastAddressbookSync ");
2523 } 2523 }
2524#endif 2524#endif
2525 2525
2526 //qDebug("*************************** "); 2526 //qDebug("*************************** ");
2527 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); 2527 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() );
2528 QStringList er = remote->uidList(); 2528 QStringList er = remote->uidList();
2529 Addressee inR ;//= er.first(); 2529 Addressee inR ;//= er.first();
2530 Addressee inL; 2530 Addressee inL;
2531 2531
2532 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); 2532 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count());
2533 2533
2534 int modulo = (er.count()/10)+1; 2534 int modulo = (er.count()/10)+1;
2535 int incCounter = 0; 2535 int incCounter = 0;
2536 while ( incCounter < er.count()) { 2536 while ( incCounter < er.count()) {
2537 if (syncManager->isProgressBarCanceled()) 2537 if (syncManager->isProgressBarCanceled())
2538 return false; 2538 return false;
2539 if ( incCounter % modulo == 0 ) 2539 if ( incCounter % modulo == 0 )
2540 syncManager->showProgressBar(incCounter); 2540 syncManager->showProgressBar(incCounter);
2541 2541
2542 uid = er[ incCounter ]; 2542 uid = er[ incCounter ];
2543 bool skipIncidence = false; 2543 bool skipIncidence = false;
2544 if ( uid.left(19) == QString("last-syncAddressee-") ) 2544 if ( uid.left(19) == QString("last-syncAddressee-") )
2545 skipIncidence = true; 2545 skipIncidence = true;
2546 QString idS,OidS; 2546 QString idS,OidS;
2547 qApp->processEvents(); 2547 qApp->processEvents();
2548 if ( !skipIncidence ) { 2548 if ( !skipIncidence ) {
2549 inL = local->findByUid( uid ); 2549 inL = local->findByUid( uid );
2550 inR = remote->findByUid( uid ); 2550 inR = remote->findByUid( uid );
2551 //inL.setResource( 0 ); 2551 //inL.setResource( 0 );
2552 //inR.setResource( 0 ); 2552 //inR.setResource( 0 );
2553 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars 2553 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars
2554 if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { 2554 if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) {
2555 //qDebug("take %d %s ", take, inL.summary().latin1()); 2555 //qDebug("take %d %s ", take, inL.summary().latin1());
2556 if ( take == 3 ) 2556 if ( take == 3 )
2557 return false; 2557 return false;
2558 if ( take == 1 ) {// take local 2558 if ( take == 1 ) {// take local
2559 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2559 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2560 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2560 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2561 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2561 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2562 local->insertAddressee( inL, false ); 2562 local->insertAddressee( inL, false );
2563 idS = inR.externalUID(); 2563 idS = inR.externalUID();
2564 OidS = inR.originalExternalUID(); 2564 OidS = inR.originalExternalUID();
2565 } 2565 }
2566 else 2566 else
2567 idS = inR.IDStr(); 2567 idS = inR.IDStr();
2568 remote->removeAddressee( inR ); 2568 remote->removeAddressee( inR );
2569 inR = inL; 2569 inR = inL;
2570 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 2570 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
2571 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2571 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2572 inR.setOriginalExternalUID( OidS ); 2572 inR.setOriginalExternalUID( OidS );
2573 inR.setExternalUID( idS ); 2573 inR.setExternalUID( idS );
2574 } else { 2574 } else {
2575 inR.setIDStr( idS ); 2575 inR.setIDStr( idS );
2576 } 2576 }
2577 inR.setResource( 0 ); 2577 inR.setResource( 0 );
2578 remote->insertAddressee( inR , false); 2578 remote->insertAddressee( inR , false);
2579 ++changedRemote; 2579 ++changedRemote;
2580 } else { // take == 2 take remote 2580 } else { // take == 2 take remote
2581 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2581 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2582 if ( inR.revision().date().year() < 2004 ) 2582 if ( inR.revision().date().year() < 2004 )
2583 inR.setRevision( modifiedCalendar ); 2583 inR.setRevision( modifiedCalendar );
2584 } 2584 }
2585 idS = inL.IDStr(); 2585 idS = inL.IDStr();
2586 local->removeAddressee( inL ); 2586 local->removeAddressee( inL );
2587 inL = inR; 2587 inL = inR;
2588 inL.setIDStr( idS ); 2588 inL.setIDStr( idS );
2589 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2589 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2590 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2590 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2591 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2591 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2592 } 2592 }
2593 inL.setResource( 0 ); 2593 inL.setResource( 0 );
2594 local->insertAddressee( inL , false ); 2594 local->insertAddressee( inL , false );
2595 ++changedLocal; 2595 ++changedLocal;
2596 } 2596 }
2597 } 2597 }
2598 } else { // no conflict 2598 } else { // no conflict
2599 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2599 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2600 QString des = addresseeLSync.note(); 2600 QString des = addresseeLSync.note();
2601 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 2601 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
2602 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 2602 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE );
2603 remote->insertAddressee( inR, false ); 2603 remote->insertAddressee( inR, false );
2604 ++deletedAddresseeR; 2604 ++deletedAddresseeR;
2605 } else { 2605 } else {
2606 inR.setRevision( modifiedCalendar ); 2606 inR.setRevision( modifiedCalendar );
2607 remote->insertAddressee( inR, false ); 2607 remote->insertAddressee( inR, false );
2608 inL = inR; 2608 inL = inR;
2609 inL.setResource( 0 ); 2609 inL.setResource( 0 );
2610 local->insertAddressee( inL , false); 2610 local->insertAddressee( inL , false);
2611 ++addedAddressee; 2611 ++addedAddressee;
2612 } 2612 }
2613 } else { 2613 } else {
2614 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { 2614 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) {
2615 inR.setRevision( modifiedCalendar ); 2615 inR.setRevision( modifiedCalendar );
2616 remote->insertAddressee( inR, false ); 2616 remote->insertAddressee( inR, false );
2617 inR.setResource( 0 ); 2617 inR.setResource( 0 );
2618 local->insertAddressee( inR, false ); 2618 local->insertAddressee( inR, false );
2619 ++addedAddressee; 2619 ++addedAddressee;
2620 } else { 2620 } else {
2621 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); 2621 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR);
2622 remote->removeAddressee( inR ); 2622 remote->removeAddressee( inR );
2623 ++deletedAddresseeR; 2623 ++deletedAddresseeR;
2624 } 2624 }
2625 } 2625 }
2626 } 2626 }
2627 } 2627 }
2628 ++incCounter; 2628 ++incCounter;
2629 } 2629 }
2630 er.clear(); 2630 er.clear();
2631 QStringList el = local->uidList(); 2631 QStringList el = local->uidList();
2632 modulo = (el.count()/10)+1; 2632 modulo = (el.count()/10)+1;
2633 2633
2634 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); 2634 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count());
2635 incCounter = 0; 2635 incCounter = 0;
2636 while ( incCounter < el.count()) { 2636 while ( incCounter < el.count()) {
2637 qApp->processEvents(); 2637 qApp->processEvents();
2638 if (syncManager->isProgressBarCanceled()) 2638 if (syncManager->isProgressBarCanceled())
2639 return false; 2639 return false;
2640 if ( incCounter % modulo == 0 ) 2640 if ( incCounter % modulo == 0 )
2641 syncManager->showProgressBar(incCounter); 2641 syncManager->showProgressBar(incCounter);
2642 uid = el[ incCounter ]; 2642 uid = el[ incCounter ];
2643 bool skipIncidence = false; 2643 bool skipIncidence = false;
2644 if ( uid.left(19) == QString("last-syncAddressee-") ) 2644 if ( uid.left(19) == QString("last-syncAddressee-") )
2645 skipIncidence = true; 2645 skipIncidence = true;
2646 if ( !skipIncidence ) { 2646 if ( !skipIncidence ) {
2647 inL = local->findByUid( uid ); 2647 inL = local->findByUid( uid );
2648 inR = remote->findByUid( uid ); 2648 inR = remote->findByUid( uid );
2649 if ( inR.isEmpty() ) { 2649 if ( inR.isEmpty() ) {
2650 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2650 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2651 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 2651 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
2652 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2652 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2653 local->removeAddressee( inL ); 2653 local->removeAddressee( inL );
2654 ++deletedAddresseeL; 2654 ++deletedAddresseeL;
2655 } else { 2655 } else {
2656 if ( ! syncManager->mWriteBackExistingOnly ) { 2656 if ( ! syncManager->mWriteBackExistingOnly ) {
2657 inL.removeID(mCurrentSyncDevice ); 2657 inL.removeID(mCurrentSyncDevice );
2658 ++addedAddresseeR; 2658 ++addedAddresseeR;
2659 inL.setRevision( modifiedCalendar ); 2659 inL.setRevision( modifiedCalendar );
2660 local->insertAddressee( inL, false ); 2660 local->insertAddressee( inL, false );
2661 inR = inL; 2661 inR = inL;
2662 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); 2662 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL );
2663 inR.setResource( 0 ); 2663 inR.setResource( 0 );
2664 remote->insertAddressee( inR, false ); 2664 remote->insertAddressee( inR, false );
2665 } 2665 }
2666 } 2666 }
2667 } else { 2667 } else {
2668 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { 2668 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) {
2669 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2669 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2670 local->removeAddressee( inL ); 2670 local->removeAddressee( inL );
2671 ++deletedAddresseeL; 2671 ++deletedAddresseeL;
2672 } else { 2672 } else {
2673 if ( ! syncManager->mWriteBackExistingOnly ) { 2673 if ( ! syncManager->mWriteBackExistingOnly ) {
2674 ++addedAddresseeR; 2674 ++addedAddresseeR;
2675 inL.setRevision( modifiedCalendar ); 2675 inL.setRevision( modifiedCalendar );
2676 local->insertAddressee( inL, false ); 2676 local->insertAddressee( inL, false );
2677 inR = inL; 2677 inR = inL;
2678 inR.setResource( 0 ); 2678 inR.setResource( 0 );
2679 remote->insertAddressee( inR, false ); 2679 remote->insertAddressee( inR, false );
2680 } 2680 }
2681 } 2681 }
2682 } 2682 }
2683 } 2683 }
2684 } 2684 }
2685 ++incCounter; 2685 ++incCounter;
2686 } 2686 }
2687 el.clear(); 2687 el.clear();
2688 syncManager->hideProgressBar(); 2688 syncManager->hideProgressBar();
2689 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); 2689 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 );
2690 // get rid of micro seconds 2690 // get rid of micro seconds
2691 QTime t = mLastAddressbookSync.time(); 2691 QTime t = mLastAddressbookSync.time();
2692 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 2692 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) );
2693 addresseeLSync.setRevision( mLastAddressbookSync ); 2693 addresseeLSync.setRevision( mLastAddressbookSync );
2694 addresseeRSync.setRevision( mLastAddressbookSync ); 2694 addresseeRSync.setRevision( mLastAddressbookSync );
2695 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; 2695 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
2696 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); 2696 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName );
2697 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; 2697 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ;
2698 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); 2698 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") );
2699 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; 2699 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ;
2700 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); 2700 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
2701 addresseeRSync.setNote( "" ) ; 2701 addresseeRSync.setNote( "" ) ;
2702 addresseeLSync.setNote( "" ); 2702 addresseeLSync.setNote( "" );
2703 2703
2704 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 2704 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
2705 remote->insertAddressee( addresseeRSync, false ); 2705 remote->insertAddressee( addresseeRSync, false );
2706 local->insertAddressee( addresseeLSync, false ); 2706 local->insertAddressee( addresseeLSync, false );
2707 QString mes; 2707 QString mes;
2708 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR ); 2708 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR );
2709 if ( syncManager->mShowSyncSummary ) { 2709 if ( syncManager->mShowSyncSummary ) {
2710 KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") ); 2710 KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") );
2711 } 2711 }
2712 qDebug( mes ); 2712 qDebug( mes );
2713 return syncOK; 2713 return syncOK;
2714} 2714}
2715 2715
2716 2716
2717//this is a overwritten callbackmethods from the syncinterface 2717//this is a overwritten callbackmethods from the syncinterface
2718bool KABCore::sync(KSyncManager* manager, QString filename, int mode) 2718bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
2719{ 2719{
2720 2720
2721 //pending prepare addresseeview for output 2721 //pending prepare addresseeview for output
2722 //pending detect, if remote file has REV field. if not switch to external sync 2722 //pending detect, if remote file has REV field. if not switch to external sync
2723 mGlobalSyncMode = SYNC_MODE_NORMAL; 2723 mGlobalSyncMode = SYNC_MODE_NORMAL;
2724 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2724 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2725 2725
2726 AddressBook abLocal(filename,"syncContact"); 2726 AddressBook abLocal(filename,"syncContact");
2727 bool syncOK = false; 2727 bool syncOK = false;
2728 if ( abLocal.load() ) { 2728 if ( abLocal.load() ) {
2729 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); 2729 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode );
2730 bool external = false; 2730 bool external = false;
2731 bool isXML = false; 2731 bool isXML = false;
2732 if ( filename.right(4) == ".xml") { 2732 if ( filename.right(4) == ".xml") {
2733 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2733 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2734 isXML = true; 2734 isXML = true;
2735 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); 2735 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
2736 } else { 2736 } else {
2737 Addressee lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2737 external = !manager->mIsKapiFile;
2738 if ( ! lse.isEmpty() ) {
2739 if ( lse.familyName().left(4) == "!E: " )
2740 external = true;
2741 } else {
2742 bool found = false;
2743 AddressBook::Iterator it;
2744 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2745 if ( (*it).revision().date().year() > 2003 ) {
2746 found = true;
2747 break;
2748 }
2749 }
2750 external = ! found;
2751 }
2752
2753 if ( external ) { 2738 if ( external ) {
2754 qDebug("Setting vcf mode to external "); 2739 qDebug("Setting vcf mode to external ");
2755 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2740 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2756 AddressBook::Iterator it; 2741 AddressBook::Iterator it;
2757 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2742 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2758 (*it).setID( mCurrentSyncDevice, (*it).uid() ); 2743 (*it).setID( mCurrentSyncDevice, (*it).uid() );
2759 (*it).computeCsum( mCurrentSyncDevice ); 2744 (*it).computeCsum( mCurrentSyncDevice );
2760 } 2745 }
2761 } 2746 }
2762 } 2747 }
2763 //AddressBook::Iterator it; 2748 //AddressBook::Iterator it;
2764 //QStringList vcards; 2749 //QStringList vcards;
2765 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2750 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2766 // qDebug("Name %s ", (*it).familyName().latin1()); 2751 // qDebug("Name %s ", (*it).familyName().latin1());
2767 //} 2752 //}
2768 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); 2753 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
2769 if ( syncOK ) { 2754 if ( syncOK ) {
2770 if ( syncManager->mWriteBackFile ) 2755 if ( syncManager->mWriteBackFile )
2771 { 2756 {
2772 if ( external ) 2757 if ( external )
2773 abLocal.removeSyncAddressees( !isXML); 2758 abLocal.removeSyncAddressees( !isXML);
2774 qDebug("Saving remote AB "); 2759 qDebug("Saving remote AB ");
2775 if ( ! abLocal.saveAB()) 2760 if ( ! abLocal.saveAB())
2776 qDebug("Error writing back AB to file "); 2761 qDebug("Error writing back AB to file ");
2777 if ( isXML ) { 2762 if ( isXML ) {
2778 // afterwrite processing 2763 // afterwrite processing
2779 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2764 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2780 } 2765 }
2781 } 2766 }
2782 } 2767 }
2783 setModified(); 2768 setModified();
2784 2769
2785 } 2770 }
2786 if ( syncOK ) 2771 if ( syncOK )
2787 mViewManager->refreshView(); 2772 mViewManager->refreshView();
2788 return syncOK; 2773 return syncOK;
2789 2774
2790} 2775}
2791 2776
2792 2777
2793//this is a overwritten callbackmethods from the syncinterface 2778//this is a overwritten callbackmethods from the syncinterface
2794bool KABCore::syncExternal(KSyncManager* manager, QString resource) 2779bool KABCore::syncExternal(KSyncManager* manager, QString resource)
2795{ 2780{
2796 if ( resource == "phone" ) 2781 if ( resource == "phone" )
2797 return syncPhone(); 2782 return syncPhone();
2798 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2783 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2799 2784
2800 AddressBook abLocal( resource,"syncContact"); 2785 AddressBook abLocal( resource,"syncContact");
2801 bool syncOK = false; 2786 bool syncOK = false;
2802 if ( abLocal.load() ) { 2787 if ( abLocal.load() ) {
2803 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2788 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
2804 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2789 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2805 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); 2790 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
2806 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2791 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2807 if ( syncOK ) { 2792 if ( syncOK ) {
2808 if ( syncManager->mWriteBackFile ) { 2793 if ( syncManager->mWriteBackFile ) {
2809 abLocal.removeSyncAddressees( false ); 2794 abLocal.removeSyncAddressees( false );
2810 abLocal.saveAB(); 2795 abLocal.saveAB();
2811 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2796 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2812 } 2797 }
2813 } 2798 }
2814 setModified(); 2799 setModified();
2815 } 2800 }
2816 if ( syncOK ) 2801 if ( syncOK )
2817 mViewManager->refreshView(); 2802 mViewManager->refreshView();
2818 return syncOK; 2803 return syncOK;
2819 2804
2820} 2805}
2821void KABCore::message( QString m ) 2806void KABCore::message( QString m )
2822{ 2807{
2823 2808
2824 topLevelWidget()->setCaption( m ); 2809 topLevelWidget()->setCaption( m );
2825 QTimer::singleShot( 15000, this , SLOT ( setCaptionBack())); 2810 QTimer::singleShot( 15000, this , SLOT ( setCaptionBack()));
2826} 2811}
2827bool KABCore::syncPhone() 2812bool KABCore::syncPhone()
2828{ 2813{
2829 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2814 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2830 QString fileName; 2815 QString fileName;
2831#ifdef _WIN32_ 2816#ifdef _WIN32_
2832 fileName = locateLocal("tmp", "phonefile.vcf"); 2817 fileName = locateLocal("tmp", "phonefile.vcf");
2833#else 2818#else
2834 fileName = "/tmp/phonefile.vcf"; 2819 fileName = "/tmp/phonefile.vcf";
2835#endif 2820#endif
2836 if ( !PhoneAccess::readFromPhone( fileName) ) { 2821 if ( !PhoneAccess::readFromPhone( fileName) ) {
2837 message(i18n("Phone access failed!")); 2822 message(i18n("Phone access failed!"));
2838 return false; 2823 return false;
2839 } 2824 }
2840 AddressBook abLocal( fileName,"syncContact"); 2825 AddressBook abLocal( fileName,"syncContact");
2841 bool syncOK = false; 2826 bool syncOK = false;
2842 { 2827 {
2843 abLocal.importFromFile( fileName ); 2828 abLocal.importFromFile( fileName );
2844 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2829 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
2845 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2830 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2846 abLocal.preparePhoneSync( mCurrentSyncDevice, true ); 2831 abLocal.preparePhoneSync( mCurrentSyncDevice, true );
2847 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); 2832 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
2848 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2833 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2849 if ( syncOK ) { 2834 if ( syncOK ) {
2850 if ( syncManager->mWriteBackFile ) { 2835 if ( syncManager->mWriteBackFile ) {
2851 abLocal.removeSyncAddressees( true ); 2836 abLocal.removeSyncAddressees( true );
2852 abLocal.saveABphone( fileName ); 2837 abLocal.saveABphone( fileName );
2853 abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); 2838 abLocal.findNewExtIds( fileName, mCurrentSyncDevice );
2854 //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); 2839 //abLocal.preparePhoneSync( mCurrentSyncDevice, false );
2855 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2840 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2856 } 2841 }
2857 } 2842 }
2858 setModified(); 2843 setModified();
2859 } 2844 }
2860 if ( syncOK ) 2845 if ( syncOK )
2861 mViewManager->refreshView(); 2846 mViewManager->refreshView();
2862 return syncOK; 2847 return syncOK;
2863} 2848}
2864void KABCore::getFile( bool success ) 2849void KABCore::getFile( bool success )
2865{ 2850{
2866 if ( ! success ) { 2851 if ( ! success ) {
2867 message( i18n("Error receiving file. Nothing changed!") ); 2852 message( i18n("Error receiving file. Nothing changed!") );
2868 return; 2853 return;
2869 } 2854 }
2870 mAddressBook->importFromFile( sentSyncFile() , false, true ); 2855 mAddressBook->importFromFile( sentSyncFile() , false, true );
2871 message( i18n("Pi-Sync successful!") ); 2856 message( i18n("Pi-Sync successful!") );
2872 mViewManager->refreshView(); 2857 mViewManager->refreshView();
2873} 2858}
2874void KABCore::syncFileRequest() 2859void KABCore::syncFileRequest()
2875{ 2860{
2876 mAddressBook->export2File( sentSyncFile() ); 2861 mAddressBook->export2File( sentSyncFile() );
2877} 2862}
2878QString KABCore::sentSyncFile() 2863QString KABCore::sentSyncFile()
2879{ 2864{
2880#ifdef _WIN32_ 2865#ifdef _WIN32_
2881 return locateLocal( "tmp", "copysyncab.vcf" ); 2866 return locateLocal( "tmp", "copysyncab.vcf" );
2882#else 2867#else
2883 return QString( "/tmp/copysyncab.vcf" ); 2868 return QString( "/tmp/copysyncab.vcf" );
2884#endif 2869#endif
2885} 2870}
2886 2871
2887void KABCore::setCaptionBack() 2872void KABCore::setCaptionBack()
2888{ 2873{
2889 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); 2874 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
2890} 2875}
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 6baa2ee..5175f94 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -1,438 +1,439 @@
1/* 1/*
2 This file is part of KDE-Pim/Pi. 2 This file is part of KDE-Pim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21// $Id$ 21// $Id$
22 22
23#include "ksyncmanager.h" 23#include "ksyncmanager.h"
24 24
25#include <stdlib.h> 25#include <stdlib.h>
26 26
27#ifndef _WIN32_ 27#ifndef _WIN32_
28#include <unistd.h> 28#include <unistd.h>
29#endif 29#endif
30 30
31 31
32#include "ksyncprofile.h" 32#include "ksyncprofile.h"
33#include "ksyncprefsdialog.h" 33#include "ksyncprefsdialog.h"
34#include "kpimprefs.h" 34#include "kpimprefs.h"
35#include <kmessagebox.h> 35#include <kmessagebox.h>
36 36
37#include <qdir.h> 37#include <qdir.h>
38#include <qprogressbar.h> 38#include <qprogressbar.h>
39#include <qpopupmenu.h> 39#include <qpopupmenu.h>
40#include <qpushbutton.h> 40#include <qpushbutton.h>
41#include <qradiobutton.h> 41#include <qradiobutton.h>
42#include <qbuttongroup.h> 42#include <qbuttongroup.h>
43#include <qtimer.h> 43#include <qtimer.h>
44#include <qmessagebox.h> 44#include <qmessagebox.h>
45#include <qapplication.h> 45#include <qapplication.h>
46#include <qlineedit.h> 46#include <qlineedit.h>
47#include <qdialog.h> 47#include <qdialog.h>
48#include <qlayout.h> 48#include <qlayout.h>
49#include <qtextcodec.h> 49#include <qtextcodec.h>
50#include <qlabel.h> 50#include <qlabel.h>
51 51
52#include <klocale.h> 52#include <klocale.h>
53#include <kglobal.h> 53#include <kglobal.h>
54#include <kconfig.h> 54#include <kconfig.h>
55#include <kfiledialog.h> 55#include <kfiledialog.h>
56 56
57KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) 57KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu)
58 : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu) 58 : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu)
59{ 59{
60 mServerSocket = 0; 60 mServerSocket = 0;
61 bar = new QProgressBar ( 1, 0 ); 61 bar = new QProgressBar ( 1, 0 );
62 bar->setCaption (""); 62 bar->setCaption ("");
63 63
64 int w = 300; 64 int w = 300;
65 if ( QApplication::desktop()->width() < 320 ) 65 if ( QApplication::desktop()->width() < 320 )
66 w = 220; 66 w = 220;
67 int h = bar->sizeHint().height() ; 67 int h = bar->sizeHint().height() ;
68 int dw = QApplication::desktop()->width(); 68 int dw = QApplication::desktop()->width();
69 int dh = QApplication::desktop()->height(); 69 int dh = QApplication::desktop()->height();
70 bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 70 bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
71 71
72} 72}
73 73
74KSyncManager::~KSyncManager() 74KSyncManager::~KSyncManager()
75{ 75{
76 delete bar; 76 delete bar;
77} 77}
78 78
79 79
80void KSyncManager::fillSyncMenu() 80void KSyncManager::fillSyncMenu()
81{ 81{
82 if ( mSyncMenu->count() ) 82 if ( mSyncMenu->count() )
83 mSyncMenu->clear(); 83 mSyncMenu->clear();
84 84
85 mSyncMenu->insertItem( i18n("Configure..."), 0 ); 85 mSyncMenu->insertItem( i18n("Configure..."), 0 );
86 mSyncMenu->insertSeparator(); 86 mSyncMenu->insertSeparator();
87 if ( mServerSocket == 0 ) { 87 if ( mServerSocket == 0 ) {
88 mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); 88 mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 );
89 } else { 89 } else {
90 mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); 90 mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 );
91 } 91 }
92 mSyncMenu->insertSeparator(); 92 mSyncMenu->insertSeparator();
93 mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); 93 mSyncMenu->insertItem( i18n("Multiple sync"), 1 );
94 mSyncMenu->insertSeparator(); 94 mSyncMenu->insertSeparator();
95 95
96 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 96 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
97 config.setGroup("General"); 97 config.setGroup("General");
98 QStringList prof = config.readListEntry("SyncProfileNames"); 98 QStringList prof = config.readListEntry("SyncProfileNames");
99 mLocalMachineName = config.readEntry("LocalMachineName","undefined"); 99 mLocalMachineName = config.readEntry("LocalMachineName","undefined");
100 if ( prof.count() < 2 ) { 100 if ( prof.count() < 2 ) {
101 prof.clear(); 101 prof.clear();
102 prof << i18n("Sharp_DTM"); 102 prof << i18n("Sharp_DTM");
103 prof << i18n("Local_file"); 103 prof << i18n("Local_file");
104 prof << i18n("Last_file"); 104 prof << i18n("Last_file");
105 KSyncProfile* temp = new KSyncProfile (); 105 KSyncProfile* temp = new KSyncProfile ();
106 temp->setName( prof[0] ); 106 temp->setName( prof[0] );
107 temp->writeConfig(&config); 107 temp->writeConfig(&config);
108 temp->setName( prof[1] ); 108 temp->setName( prof[1] );
109 temp->writeConfig(&config); 109 temp->writeConfig(&config);
110 temp->setName( prof[2] ); 110 temp->setName( prof[2] );
111 temp->writeConfig(&config); 111 temp->writeConfig(&config);
112 config.setGroup("General"); 112 config.setGroup("General");
113 config.writeEntry("SyncProfileNames",prof); 113 config.writeEntry("SyncProfileNames",prof);
114 config.writeEntry("ExternSyncProfiles","Sharp_DTM"); 114 config.writeEntry("ExternSyncProfiles","Sharp_DTM");
115 config.sync(); 115 config.sync();
116 delete temp; 116 delete temp;
117 } 117 }
118 mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); 118 mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
119 mSyncProfileNames = prof; 119 mSyncProfileNames = prof;
120 unsigned int i; 120 unsigned int i;
121 for ( i = 0; i < prof.count(); ++i ) { 121 for ( i = 0; i < prof.count(); ++i ) {
122 mSyncMenu->insertItem( prof[i], 1000+i ); 122 mSyncMenu->insertItem( prof[i], 1000+i );
123 if ( i == 2 ) 123 if ( i == 2 )
124 mSyncMenu->insertSeparator(); 124 mSyncMenu->insertSeparator();
125 } 125 }
126 QDir app_dir; 126 QDir app_dir;
127 //US do not display SharpDTM if app is pwmpi, or no sharpfiles available 127 //US do not display SharpDTM if app is pwmpi, or no sharpfiles available
128 if ( mTargetApp == PWMPI) { 128 if ( mTargetApp == PWMPI) {
129 mSyncMenu->removeItem( 1000 ); 129 mSyncMenu->removeItem( 1000 );
130 } 130 }
131 else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { 131 else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
132 mSyncMenu->removeItem( 1000 ); 132 mSyncMenu->removeItem( 1000 );
133 } 133 }
134 mSyncMenu->removeItem( 1002 ); 134 mSyncMenu->removeItem( 1002 );
135} 135}
136 136
137void KSyncManager::slotSyncMenu( int action ) 137void KSyncManager::slotSyncMenu( int action )
138{ 138{
139 //qDebug("syncaction %d ", action); 139 //qDebug("syncaction %d ", action);
140 if ( action == 0 ) { 140 if ( action == 0 ) {
141 141
142 // seems to be a Qt2 event handling bug 142 // seems to be a Qt2 event handling bug
143 // syncmenu.clear causes a segfault at first time 143 // syncmenu.clear causes a segfault at first time
144 // when we call it after the main event loop, it is ok 144 // when we call it after the main event loop, it is ok
145 // same behaviour when calling OM/Pi via QCOP for the first time 145 // same behaviour when calling OM/Pi via QCOP for the first time
146 QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); 146 QTimer::singleShot ( 1, this, SLOT ( confSync() ) );
147 //confSync(); 147 //confSync();
148 148
149 return; 149 return;
150 } 150 }
151 if ( action == 1 ) { 151 if ( action == 1 ) {
152 multiSync( true ); 152 multiSync( true );
153 return; 153 return;
154 } 154 }
155 if ( action == 2 ) { 155 if ( action == 2 ) {
156 enableQuick(); 156 enableQuick();
157 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 157 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
158 return; 158 return;
159 } 159 }
160 if ( action == 3 ) { 160 if ( action == 3 ) {
161 delete mServerSocket; 161 delete mServerSocket;
162 mServerSocket = 0; 162 mServerSocket = 0;
163 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 163 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
164 return; 164 return;
165 } 165 }
166 166
167 if (blockSave()) 167 if (blockSave())
168 return; 168 return;
169 169
170 setBlockSave(true); 170 setBlockSave(true);
171 171
172 mCurrentSyncProfile = action - 1000 ; 172 mCurrentSyncProfile = action - 1000 ;
173 mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; 173 mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ;
174 mCurrentSyncName = mLocalMachineName ; 174 mCurrentSyncName = mLocalMachineName ;
175 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 175 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
176 KSyncProfile* temp = new KSyncProfile (); 176 KSyncProfile* temp = new KSyncProfile ();
177 temp->setName(mSyncProfileNames[mCurrentSyncProfile]); 177 temp->setName(mSyncProfileNames[mCurrentSyncProfile]);
178 temp->readConfig(&config); 178 temp->readConfig(&config);
179 mAskForPreferences = temp->getAskForPreferences(); 179 mAskForPreferences = temp->getAskForPreferences();
180 mSyncAlgoPrefs = temp->getSyncPrefs(); 180 mSyncAlgoPrefs = temp->getSyncPrefs();
181 mWriteBackFile = temp->getWriteBackFile(); 181 mWriteBackFile = temp->getWriteBackFile();
182 mWriteBackExistingOnly = temp->getWriteBackExisting(); 182 mWriteBackExistingOnly = temp->getWriteBackExisting();
183 mIsKapiFile = temp->getIsKapiFile();
183 mWriteBackInFuture = 0; 184 mWriteBackInFuture = 0;
184 if ( temp->getWriteBackFuture() ) 185 if ( temp->getWriteBackFuture() )
185 mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 186 mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
186 mShowSyncSummary = temp->getShowSummaryAfterSync(); 187 mShowSyncSummary = temp->getShowSummaryAfterSync();
187 if ( action == 1000 ) { 188 if ( action == 1000 ) {
188 syncSharp(); 189 syncSharp();
189 190
190 } else if ( action == 1001 ) { 191 } else if ( action == 1001 ) {
191 syncLocalFile(); 192 syncLocalFile();
192 193
193 } else if ( action == 1002 ) { 194 } else if ( action == 1002 ) {
194 mWriteBackFile = false; 195 mWriteBackFile = false;
195 mAskForPreferences = false; 196 mAskForPreferences = false;
196 mShowSyncSummary = false; 197 mShowSyncSummary = false;
197 mSyncAlgoPrefs = 3; 198 mSyncAlgoPrefs = 3;
198 quickSyncLocalFile(); 199 quickSyncLocalFile();
199 200
200 } else if ( action >= 1003 ) { 201 } else if ( action >= 1003 ) {
201 if ( temp->getIsLocalFileSync() ) { 202 if ( temp->getIsLocalFileSync() ) {
202 switch(mTargetApp) 203 switch(mTargetApp)
203 { 204 {
204 case (KAPI): 205 case (KAPI):
205 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) 206 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
206 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); 207 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
207 break; 208 break;
208 case (KOPI): 209 case (KOPI):
209 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 210 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
210 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); 211 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
211 break; 212 break;
212 case (PWMPI): 213 case (PWMPI):
213 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) 214 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
214 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); 215 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
215 break; 216 break;
216 default: 217 default:
217 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); 218 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
218 break; 219 break;
219 220
220 } 221 }
221 } else { 222 } else {
222 if ( temp->getIsPhoneSync() ) { 223 if ( temp->getIsPhoneSync() ) {
223 mPhoneDevice = temp->getPhoneDevice( ) ; 224 mPhoneDevice = temp->getPhoneDevice( ) ;
224 mPhoneConnection = temp->getPhoneConnection( ); 225 mPhoneConnection = temp->getPhoneConnection( );
225 mPhoneModel = temp->getPhoneModel( ); 226 mPhoneModel = temp->getPhoneModel( );
226 syncPhone(); 227 syncPhone();
227 } else if ( temp->getIsPiSync() ) { 228 } else if ( temp->getIsPiSync() ) {
228 if ( mTargetApp == KAPI ) { 229 if ( mTargetApp == KAPI ) {
229 mPassWordPiSync = temp->getRemotePwAB(); 230 mPassWordPiSync = temp->getRemotePwAB();
230 mActiveSyncPort = temp->getRemotePortAB(); 231 mActiveSyncPort = temp->getRemotePortAB();
231 mActiveSyncIP = temp->getRemoteIPAB(); 232 mActiveSyncIP = temp->getRemoteIPAB();
232 } else if ( mTargetApp == KOPI ) { 233 } else if ( mTargetApp == KOPI ) {
233 mPassWordPiSync = temp->getRemotePw(); 234 mPassWordPiSync = temp->getRemotePw();
234 mActiveSyncPort = temp->getRemotePort(); 235 mActiveSyncPort = temp->getRemotePort();
235 mActiveSyncIP = temp->getRemoteIP(); 236 mActiveSyncIP = temp->getRemoteIP();
236 } else { 237 } else {
237 mPassWordPiSync = temp->getRemotePwPWM(); 238 mPassWordPiSync = temp->getRemotePwPWM();
238 mActiveSyncPort = temp->getRemotePortPWM(); 239 mActiveSyncPort = temp->getRemotePortPWM();
239 mActiveSyncIP = temp->getRemoteIPPWM(); 240 mActiveSyncIP = temp->getRemoteIPPWM();
240 } 241 }
241 syncPi(); 242 syncPi();
242 } else 243 } else
243 syncRemote( temp ); 244 syncRemote( temp );
244 245
245 } 246 }
246 } 247 }
247 delete temp; 248 delete temp;
248 setBlockSave(false); 249 setBlockSave(false);
249} 250}
250 251
251void KSyncManager::enableQuick() 252void KSyncManager::enableQuick()
252{ 253{
253 QDialog dia ( 0, "input-dialog", true ); 254 QDialog dia ( 0, "input-dialog", true );
254 QLineEdit lab ( &dia ); 255 QLineEdit lab ( &dia );
255 QVBoxLayout lay( &dia ); 256 QVBoxLayout lay( &dia );
256 lab.setText( mPrefs->mPassiveSyncPort ); 257 lab.setText( mPrefs->mPassiveSyncPort );
257 lay.setMargin(7); 258 lay.setMargin(7);
258 lay.setSpacing(7); 259 lay.setSpacing(7);
259 int po = 9197+mTargetApp; 260 int po = 9197+mTargetApp;
260 QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia ); 261 QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia );
261 lay.addWidget( &label); 262 lay.addWidget( &label);
262 lay.addWidget( &lab); 263 lay.addWidget( &lab);
263 264
264 QLineEdit lepw ( &dia ); 265 QLineEdit lepw ( &dia );
265 lepw.setText( mPrefs->mPassiveSyncPw ); 266 lepw.setText( mPrefs->mPassiveSyncPw );
266 QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); 267 QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia );
267 lay.addWidget( &label2); 268 lay.addWidget( &label2);
268 lay.addWidget( &lepw); 269 lay.addWidget( &lepw);
269 dia.setFixedSize( 230,80 ); 270 dia.setFixedSize( 230,80 );
270 dia.setCaption( i18n("Enter port for Pi-Sync") ); 271 dia.setCaption( i18n("Enter port for Pi-Sync") );
271 QPushButton pb ( "OK", &dia); 272 QPushButton pb ( "OK", &dia);
272 lay.addWidget( &pb ); 273 lay.addWidget( &pb );
273 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 274 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
274 dia.show(); 275 dia.show();
275 if ( ! dia.exec() ) 276 if ( ! dia.exec() )
276 return; 277 return;
277 dia.hide(); 278 dia.hide();
278 qApp->processEvents(); 279 qApp->processEvents();
279 mPrefs->mPassiveSyncPw = lepw.text(); 280 mPrefs->mPassiveSyncPw = lepw.text();
280 mPrefs->mPassiveSyncPort = lab.text(); 281 mPrefs->mPassiveSyncPort = lab.text();
281 bool ok; 282 bool ok;
282 Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); 283 Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok);
283 if ( ! ok ) { 284 if ( ! ok ) {
284 KMessageBox::information( 0, i18n("No valid port")); 285 KMessageBox::information( 0, i18n("No valid port"));
285 return; 286 return;
286 } 287 }
287 //qDebug("port %d ", port); 288 //qDebug("port %d ", port);
288 mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); 289 mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 );
289 mServerSocket->setFileName( defaultFileName() ); 290 mServerSocket->setFileName( defaultFileName() );
290 //qDebug("connected "); 291 //qDebug("connected ");
291 if ( !mServerSocket->ok() ) { 292 if ( !mServerSocket->ok() ) {
292 KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); 293 KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!"));
293 delete mServerSocket; 294 delete mServerSocket;
294 mServerSocket = 0; 295 mServerSocket = 0;
295 return; 296 return;
296 } 297 }
297 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); 298 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) );
298 connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); 299 connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) );
299} 300}
300 301
301void KSyncManager::syncLocalFile() 302void KSyncManager::syncLocalFile()
302{ 303{
303 304
304 QString fn =mPrefs->mLastSyncedLocalFile; 305 QString fn =mPrefs->mLastSyncedLocalFile;
305 QString ext; 306 QString ext;
306 307
307 switch(mTargetApp) 308 switch(mTargetApp)
308 { 309 {
309 case (KAPI): 310 case (KAPI):
310 ext = "(*.vcf)"; 311 ext = "(*.vcf)";
311 break; 312 break;
312 case (KOPI): 313 case (KOPI):
313 ext = "(*.ics/*.vcs)"; 314 ext = "(*.ics/*.vcs)";
314 break; 315 break;
315 case (PWMPI): 316 case (PWMPI):
316 ext = "(*.pwm)"; 317 ext = "(*.pwm)";
317 break; 318 break;
318 default: 319 default:
319 qDebug("KSyncManager::syncLocalFile: invalid apptype selected"); 320 qDebug("KSyncManager::syncLocalFile: invalid apptype selected");
320 break; 321 break;
321 322
322 } 323 }
323 324
324 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); 325 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent );
325 if ( fn == "" ) 326 if ( fn == "" )
326 return; 327 return;
327 if ( syncWithFile( fn, false ) ) { 328 if ( syncWithFile( fn, false ) ) {
328 qDebug("syncLocalFile() successful "); 329 qDebug("syncLocalFile() successful ");
329 } 330 }
330 331
331} 332}
332 333
333bool KSyncManager::syncWithFile( QString fn , bool quick ) 334bool KSyncManager::syncWithFile( QString fn , bool quick )
334{ 335{
335 bool ret = false; 336 bool ret = false;
336 QFileInfo info; 337 QFileInfo info;
337 info.setFile( fn ); 338 info.setFile( fn );
338 QString mess; 339 QString mess;
339 bool loadbup = true; 340 bool loadbup = true;
340 if ( !info. exists() ) { 341 if ( !info. exists() ) {
341 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); 342 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) );
342 int result = QMessageBox::warning( mParent, i18n("Warning!"), 343 int result = QMessageBox::warning( mParent, i18n("Warning!"),
343 mess ); 344 mess );
344 return ret; 345 return ret;
345 } 346 }
346 int result = 0; 347 int result = 0;
347 if ( !quick ) { 348 if ( !quick ) {
348 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 349 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
349 result = QMessageBox::warning( mParent, i18n("Warning!"), 350 result = QMessageBox::warning( mParent, i18n("Warning!"),
350 mess, 351 mess,
351 i18n("Sync"), i18n("Cancel"), 0, 352 i18n("Sync"), i18n("Cancel"), 0,
352 0, 1 ); 353 0, 1 );
353 if ( result ) 354 if ( result )
354 return false; 355 return false;
355 } 356 }
356 if ( mAskForPreferences ) 357 if ( mAskForPreferences )
357 edit_sync_options(); 358 edit_sync_options();
358 if ( result == 0 ) { 359 if ( result == 0 ) {
359 //qDebug("Now sycing ... "); 360 //qDebug("Now sycing ... ");
360 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) 361 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) )
361 mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); 362 mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") );
362 else 363 else
363 mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); 364 mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") );
364 if ( ! quick ) 365 if ( ! quick )
365 mPrefs->mLastSyncedLocalFile = fn; 366 mPrefs->mLastSyncedLocalFile = fn;
366 } 367 }
367 return ret; 368 return ret;
368} 369}
369 370
370void KSyncManager::quickSyncLocalFile() 371void KSyncManager::quickSyncLocalFile()
371{ 372{
372 373
373 if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { 374 if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) {
374 qDebug("quick syncLocalFile() successful "); 375 qDebug("quick syncLocalFile() successful ");
375 376
376 } 377 }
377} 378}
378 379
379void KSyncManager::multiSync( bool askforPrefs ) 380void KSyncManager::multiSync( bool askforPrefs )
380{ 381{
381 if (blockSave()) 382 if (blockSave())
382 return; 383 return;
383 setBlockSave(true); 384 setBlockSave(true);
384 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 385 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
385 if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), 386 if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"),
386 question, 387 question,
387 i18n("Yes"), i18n("No"), 388 i18n("Yes"), i18n("No"),
388 0, 0 ) != 0 ) { 389 0, 0 ) != 0 ) {
389 setBlockSave(false); 390 setBlockSave(false);
390 mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); 391 mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!"));
391 return; 392 return;
392 } 393 }
393 mCurrentSyncDevice = i18n("Multiple profiles") ; 394 mCurrentSyncDevice = i18n("Multiple profiles") ;
394 mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; 395 mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs;
395 if ( askforPrefs ) { 396 if ( askforPrefs ) {
396 edit_sync_options(); 397 edit_sync_options();
397 mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; 398 mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs;
398 } 399 }
399 mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); 400 mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") );
400 qApp->processEvents(); 401 qApp->processEvents();
401 int num = ringSync() ; 402 int num = ringSync() ;
402 if ( num > 1 ) 403 if ( num > 1 )
403 ringSync(); 404 ringSync();
404 setBlockSave(false); 405 setBlockSave(false);
405 if ( num ) 406 if ( num )
406 emit save(); 407 emit save();
407 if ( num ) 408 if ( num )
408 mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); 409 mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) );
409 else 410 else
410 mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 411 mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
411 return; 412 return;
412} 413}
413 414
414int KSyncManager::ringSync() 415int KSyncManager::ringSync()
415{ 416{
416 int syncedProfiles = 0; 417 int syncedProfiles = 0;
417 unsigned int i; 418 unsigned int i;
418 QTime timer; 419 QTime timer;
419 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 420 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
420 QStringList syncProfileNames = mSyncProfileNames; 421 QStringList syncProfileNames = mSyncProfileNames;
421 KSyncProfile* temp = new KSyncProfile (); 422 KSyncProfile* temp = new KSyncProfile ();
422 mAskForPreferences = false; 423 mAskForPreferences = false;
423 for ( i = 0; i < syncProfileNames.count(); ++i ) { 424 for ( i = 0; i < syncProfileNames.count(); ++i ) {
424 mCurrentSyncProfile = i; 425 mCurrentSyncProfile = i;
425 temp->setName(syncProfileNames[mCurrentSyncProfile]); 426 temp->setName(syncProfileNames[mCurrentSyncProfile]);
426 temp->readConfig(&config); 427 temp->readConfig(&config);
427 428
428 bool includeInRingSync; 429 bool includeInRingSync;
429 switch(mTargetApp) 430 switch(mTargetApp)
430 { 431 {
431 case (KAPI): 432 case (KAPI):
432 includeInRingSync = temp->getIncludeInRingSyncAB(); 433 includeInRingSync = temp->getIncludeInRingSyncAB();
433 break; 434 break;
434 case (KOPI): 435 case (KOPI):
435 includeInRingSync = temp->getIncludeInRingSync(); 436 includeInRingSync = temp->getIncludeInRingSync();
436 break; 437 break;
437 case (PWMPI): 438 case (PWMPI):
438 includeInRingSync = temp->getIncludeInRingSyncPWM(); 439 includeInRingSync = temp->getIncludeInRingSyncPWM();
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 5b05383..9094aac 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -1,208 +1,209 @@
1/* 1/*
2 This file is part of KDE-Pim/Pi. 2 This file is part of KDE-Pim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19 19
20 $Id$ 20 $Id$
21*/ 21*/
22#ifndef _KSYNCMANAGER_H 22#ifndef _KSYNCMANAGER_H
23#define _KSYNCMANAGER_H 23#define _KSYNCMANAGER_H
24 24
25#include <qobject.h> 25#include <qobject.h>
26#include <qstring.h> 26#include <qstring.h>
27#include <qsocket.h> 27#include <qsocket.h>
28#include <qdatetime.h> 28#include <qdatetime.h>
29#include <qserversocket.h> 29#include <qserversocket.h>
30#include <qtextstream.h> 30#include <qtextstream.h>
31#include <qregexp.h> 31#include <qregexp.h>
32 32
33class QPopupMenu; 33class QPopupMenu;
34class KSyncProfile; 34class KSyncProfile;
35class KPimPrefs; 35class KPimPrefs;
36class QWidget; 36class QWidget;
37class KSyncManager; 37class KSyncManager;
38class KSyncInterface; 38class KSyncInterface;
39class QProgressBar; 39class QProgressBar;
40 40
41 41
42class KServerSocket : public QServerSocket 42class KServerSocket : public QServerSocket
43{ 43{
44 Q_OBJECT 44 Q_OBJECT
45 45
46 public: 46 public:
47 KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); 47 KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 );
48 48
49 void newConnection ( int socket ) ; 49 void newConnection ( int socket ) ;
50 void setFileName( QString fn ) {mFileName = fn;}; 50 void setFileName( QString fn ) {mFileName = fn;};
51 signals: 51 signals:
52 void file_received( bool ); 52 void file_received( bool );
53 void request_file(); 53 void request_file();
54 void saveFile(); 54 void saveFile();
55 void endConnect(); 55 void endConnect();
56 private slots: 56 private slots:
57 void discardClient(); 57 void discardClient();
58 void readClient(); 58 void readClient();
59 void readBackFileFromSocket(); 59 void readBackFileFromSocket();
60 private : 60 private :
61 bool blockRC; 61 bool blockRC;
62 void send_file(); 62 void send_file();
63 void get_file(); 63 void get_file();
64 void end_connect(); 64 void end_connect();
65 QDialog* mSyncActionDialog; 65 QDialog* mSyncActionDialog;
66 QSocket* mSocket; 66 QSocket* mSocket;
67 QString mPassWord; 67 QString mPassWord;
68 QString mFileName; 68 QString mFileName;
69 QTime piTime; 69 QTime piTime;
70 QString piFileString; 70 QString piFileString;
71}; 71};
72 72
73class KCommandSocket : public QObject 73class KCommandSocket : public QObject
74{ 74{
75 Q_OBJECT 75 Q_OBJECT
76 public: 76 public:
77 enum state { successR, errorR, successW, errorW, errorTO, quiet }; 77 enum state { successR, errorR, successW, errorW, errorTO, quiet };
78 KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, const char * name=0 ); 78 KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, const char * name=0 );
79 void readFile( QString ); 79 void readFile( QString );
80 void writeFile( QString ); 80 void writeFile( QString );
81 void sendStop(); 81 void sendStop();
82 82
83 signals: 83 signals:
84 void commandFinished( KCommandSocket*, int ); 84 void commandFinished( KCommandSocket*, int );
85 private slots: 85 private slots:
86 void startReadFileFromSocket(); 86 void startReadFileFromSocket();
87 void readFileFromSocket(); 87 void readFileFromSocket();
88 void deleteSocket(); 88 void deleteSocket();
89 void writeFileToSocket(); 89 void writeFileToSocket();
90 private : 90 private :
91 QSocket* mSocket; 91 QSocket* mSocket;
92 QString mPassWord; 92 QString mPassWord;
93 Q_UINT16 mPort; 93 Q_UINT16 mPort;
94 QString mHost; 94 QString mHost;
95 QString mFileName; 95 QString mFileName;
96 QTimer* mTimerSocket; 96 QTimer* mTimerSocket;
97 int mRetVal; 97 int mRetVal;
98 QTime mTime; 98 QTime mTime;
99 QString mFileString; 99 QString mFileString;
100 bool mFirst; 100 bool mFirst;
101}; 101};
102 102
103 103
104class KSyncManager : public QObject 104class KSyncManager : public QObject
105{ 105{
106 Q_OBJECT 106 Q_OBJECT
107 107
108 public: 108 public:
109 enum TargetApp { 109 enum TargetApp {
110 KOPI = 0, 110 KOPI = 0,
111 KAPI = 1, 111 KAPI = 1,
112 PWMPI = 2 }; 112 PWMPI = 2 };
113 113
114 KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); 114 KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu);
115 ~KSyncManager() ; 115 ~KSyncManager() ;
116 116
117 void multiSync( bool askforPrefs ); 117 void multiSync( bool askforPrefs );
118 bool blockSave() { return mBlockSaveFlag; } 118 bool blockSave() { return mBlockSaveFlag; }
119 void setBlockSave(bool sa) { mBlockSaveFlag = sa; } 119 void setBlockSave(bool sa) { mBlockSaveFlag = sa; }
120 void setDefaultFileName( QString s) { mDefFileName = s ;} 120 void setDefaultFileName( QString s) { mDefFileName = s ;}
121 QString defaultFileName() { return mDefFileName ;} 121 QString defaultFileName() { return mDefFileName ;}
122 QString syncFileName(); 122 QString syncFileName();
123 123
124 QString getCurrentSyncDevice() { return mCurrentSyncDevice; } 124 QString getCurrentSyncDevice() { return mCurrentSyncDevice; }
125 QString getCurrentSyncName() { return mCurrentSyncName; } 125 QString getCurrentSyncName() { return mCurrentSyncName; }
126 126
127 void showProgressBar(int percentage, QString caption = QString::null, int total=100); 127 void showProgressBar(int percentage, QString caption = QString::null, int total=100);
128 void hideProgressBar(); 128 void hideProgressBar();
129 bool isProgressBarCanceled(); 129 bool isProgressBarCanceled();
130 130
131 // sync stuff 131 // sync stuff
132 QString mLocalMachineName; 132 QString mLocalMachineName;
133 QStringList mExternSyncProfiles; 133 QStringList mExternSyncProfiles;
134 QStringList mSyncProfileNames; 134 QStringList mSyncProfileNames;
135 bool mAskForPreferences; 135 bool mAskForPreferences;
136 bool mShowSyncSummary; 136 bool mShowSyncSummary;
137 bool mIsKapiFile;
137 bool mWriteBackExistingOnly; 138 bool mWriteBackExistingOnly;
138 int mSyncAlgoPrefs; 139 int mSyncAlgoPrefs;
139 bool mWriteBackFile; 140 bool mWriteBackFile;
140 int mWriteBackInFuture; 141 int mWriteBackInFuture;
141 QString mPhoneDevice; 142 QString mPhoneDevice;
142 QString mPhoneConnection; 143 QString mPhoneConnection;
143 QString mPhoneModel; 144 QString mPhoneModel;
144 QString mPassWordPiSync; 145 QString mPassWordPiSync;
145 QString mActiveSyncPort; 146 QString mActiveSyncPort;
146 QString mActiveSyncIP ; 147 QString mActiveSyncIP ;
147 148
148 signals: 149 signals:
149 void save(); 150 void save();
150 void request_file(); 151 void request_file();
151 void getFile( bool ); 152 void getFile( bool );
152 153
153 public slots: 154 public slots:
154 void slotSyncMenu( int ); 155 void slotSyncMenu( int );
155 void deleteCommandSocket(KCommandSocket*s, int state); 156 void deleteCommandSocket(KCommandSocket*s, int state);
156 void readFileFromSocket(); 157 void readFileFromSocket();
157 void fillSyncMenu(); 158 void fillSyncMenu();
158 159
159 private: 160 private:
160 void syncPi(); 161 void syncPi();
161 KServerSocket * mServerSocket; 162 KServerSocket * mServerSocket;
162 void enableQuick(); 163 void enableQuick();
163 KPimPrefs* mPrefs; 164 KPimPrefs* mPrefs;
164 QString mDefFileName; 165 QString mDefFileName;
165 QString mCurrentSyncDevice; 166 QString mCurrentSyncDevice;
166 QString mCurrentSyncName; 167 QString mCurrentSyncName;
167 void quickSyncLocalFile(); 168 void quickSyncLocalFile();
168 bool syncWithFile( QString fn , bool quick ); 169 bool syncWithFile( QString fn , bool quick );
169 void syncLocalFile(); 170 void syncLocalFile();
170 void syncPhone(); 171 void syncPhone();
171 void syncSharp(); 172 void syncSharp();
172 bool syncExternalApplication(QString); 173 bool syncExternalApplication(QString);
173 int mCurrentSyncProfile ; 174 int mCurrentSyncProfile ;
174 void syncRemote( KSyncProfile* prof, bool ask = true); 175 void syncRemote( KSyncProfile* prof, bool ask = true);
175 void edit_sync_options(); 176 void edit_sync_options();
176 void edit_pisync_options(); 177 void edit_pisync_options();
177 int ringSync(); 178 int ringSync();
178 QString getPassword( ); 179 QString getPassword( );
179 180
180 private slots: 181 private slots:
181 void confSync(); 182 void confSync();
182 private: 183 private:
183 bool mBlockSaveFlag; 184 bool mBlockSaveFlag;
184 QWidget* mParent; 185 QWidget* mParent;
185 KSyncInterface* mImplementation; 186 KSyncInterface* mImplementation;
186 TargetApp mTargetApp; 187 TargetApp mTargetApp;
187 QPopupMenu* mSyncMenu; 188 QPopupMenu* mSyncMenu;
188 QProgressBar* bar; 189 QProgressBar* bar;
189 190
190}; 191};
191 192
192 193
193class KSyncInterface 194class KSyncInterface
194{ 195{
195 public : 196 public :
196 virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; 197 virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0;
197 virtual bool syncExternal(KSyncManager* manager, QString resource) 198 virtual bool syncExternal(KSyncManager* manager, QString resource)
198 { 199 {
199 // empty implementation, because some syncable applications do not 200 // empty implementation, because some syncable applications do not
200 // have an external(sharpdtm) syncmode, like pwmanager. 201 // have an external(sharpdtm) syncmode, like pwmanager.
201 return false; 202 return false;
202 } 203 }
203 204
204 205
205}; 206};
206 207
207 208
208#endif 209#endif
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index cf8f996..03265d2 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -1,732 +1,744 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> 3 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qgroupbox.h> 26#include <qgroupbox.h>
27#include <qbuttongroup.h> 27#include <qbuttongroup.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qfont.h> 29#include <qfont.h>
30#include <qslider.h> 30#include <qslider.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qdir.h> 32#include <qdir.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qvbox.h> 35#include <qvbox.h>
36#include <qhbox.h> 36#include <qhbox.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qdatetime.h> 38#include <qdatetime.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qradiobutton.h> 40#include <qradiobutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qstrlist.h> 42#include <qstrlist.h>
43#include <qapplication.h> 43#include <qapplication.h>
44#include <qlayout.h> 44#include <qlayout.h>
45#include <qscrollview.h> 45#include <qscrollview.h>
46 46
47#include <kcolorbutton.h> 47#include <kcolorbutton.h>
48#include <kdebug.h> 48#include <kdebug.h>
49#include <klocale.h> 49#include <klocale.h>
50#include <kglobal.h> 50#include <kglobal.h>
51#include <kfontdialog.h> 51#include <kfontdialog.h>
52#include <kmessagebox.h> 52#include <kmessagebox.h>
53#include <kcolordialog.h> 53#include <kcolordialog.h>
54#include <kiconloader.h> 54#include <kiconloader.h>
55#include <kemailsettings.h> 55#include <kemailsettings.h>
56#include <kstandarddirs.h> 56#include <kstandarddirs.h>
57#include <kfiledialog.h> 57#include <kfiledialog.h>
58#include <kmessagebox.h> 58#include <kmessagebox.h>
59 59
60//#include <kurlrequester.h> 60//#include <kurlrequester.h>
61#include <klineedit.h> 61#include <klineedit.h>
62#include "ksyncprofile.h" 62#include "ksyncprofile.h"
63 63
64 64
65//#include "koprefs.h" 65//#include "koprefs.h"
66 66
67#include "ksyncprefsdialog.h" 67#include "ksyncprefsdialog.h"
68//#include "koglobals.h" 68//#include "koglobals.h"
69 69
70 70
71KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) : 71KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) :
72 KDialog(parent,name,true) 72 KDialog(parent,name,true)
73{ 73{
74 74
75 setCaption( i18n("Synchronization Preferences")); 75 setCaption( i18n("Synchronization Preferences"));
76 76
77 mSyncProfiles.setAutoDelete( true ); 77 mSyncProfiles.setAutoDelete( true );
78 setupSyncAlgTab(); 78 setupSyncAlgTab();
79} 79}
80 80
81 81
82KSyncPrefsDialog::~KSyncPrefsDialog() 82KSyncPrefsDialog::~KSyncPrefsDialog()
83{ 83{
84} 84}
85 85
86void KSyncPrefsDialog::setupSyncAlgTab() 86void KSyncPrefsDialog::setupSyncAlgTab()
87{ 87{
88 QLabel * lab; 88 QLabel * lab;
89 //QFrame *page = addPage(i18n("Sync Prefs"),0,0); 89 //QFrame *page = addPage(i18n("Sync Prefs"),0,0);
90 QVBox * mainbox = new QVBox( this ); 90 QVBox * mainbox = new QVBox( this );
91 QScrollView* sv = new QScrollView( mainbox ); 91 QScrollView* sv = new QScrollView( mainbox );
92 QHBoxLayout * lay = new QHBoxLayout( this ); 92 QHBoxLayout * lay = new QHBoxLayout( this );
93 lay->addWidget( mainbox ); 93 lay->addWidget( mainbox );
94 QHBox * b_box = new QHBox( mainbox ); 94 QHBox * b_box = new QHBox( mainbox );
95 95
96 QPushButton* button = new QPushButton( i18n("Ok"), b_box ); 96 QPushButton* button = new QPushButton( i18n("Ok"), b_box );
97 connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) ); 97 connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) );
98 button = new QPushButton( i18n("Cancel"), b_box ); 98 button = new QPushButton( i18n("Cancel"), b_box );
99 connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) ); 99 connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) );
100 //QBoxLayout * sl = new QVBoxLayout(this ); 100 //QBoxLayout * sl = new QVBoxLayout(this );
101 //sl->addWidget ( sv ); 101 //sl->addWidget ( sv );
102 sv->setResizePolicy ( QScrollView::AutoOneFit ); 102 sv->setResizePolicy ( QScrollView::AutoOneFit );
103 QFrame *topFrame = new QFrame ( sv ); 103 QFrame *topFrame = new QFrame ( sv );
104 sv->addChild( topFrame ); 104 sv->addChild( topFrame );
105 mSetupSyncAlgTab = topFrame; 105 mSetupSyncAlgTab = topFrame;
106 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 106 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
107 topLayout->setSpacing(spacingHint()); 107 topLayout->setSpacing(spacingHint());
108 topLayout->setMargin(marginHint()); 108 topLayout->setMargin(marginHint());
109 109
110 //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame); 110 //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame);
111 int iii = 0; 111 int iii = 0;
112 //topLayout->addMultiCellWidget(lab , iii,iii,0,1); 112 //topLayout->addMultiCellWidget(lab , iii,iii,0,1);
113 //++iii; 113 //++iii;
114 114
115 mMyMachineName = new QLineEdit(topFrame); 115 mMyMachineName = new QLineEdit(topFrame);
116 lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); 116 lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame);
117 topLayout->addWidget(lab ,iii,0); 117 topLayout->addWidget(lab ,iii,0);
118 topLayout->addWidget(mMyMachineName,iii,1); 118 topLayout->addWidget(mMyMachineName,iii,1);
119 ++iii; 119 ++iii;
120 120
121 QHBox* buttonbox = new QHBox( topFrame); 121 QHBox* buttonbox = new QHBox( topFrame);
122 topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); 122 topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1);
123 ++iii; 123 ++iii;
124 button = new QPushButton( i18n("New profile"), buttonbox ); 124 button = new QPushButton( i18n("New profile"), buttonbox );
125 connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); 125 connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) );
126 126
127 button = new QPushButton( i18n("Clone profile"), buttonbox ); 127 button = new QPushButton( i18n("Clone profile"), buttonbox );
128 connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); 128 connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) );
129 129
130 button = new QPushButton( i18n("Delete profile"), buttonbox ); 130 button = new QPushButton( i18n("Delete profile"), buttonbox );
131 connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); 131 connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) );
132 132
133 mProfileBox = new QComboBox(topFrame); 133 mProfileBox = new QComboBox(topFrame);
134 mProfileBox->setEditable ( true ); 134 mProfileBox->setEditable ( true );
135 mProfileBox->setInsertionPolicy(QComboBox::NoInsertion); 135 mProfileBox->setInsertionPolicy(QComboBox::NoInsertion);
136 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); 136 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) );
137 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); 137 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) );
138 138
139 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); 139 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame);
140 topLayout->addWidget(lab ,iii,0); 140 topLayout->addWidget(lab ,iii,0);
141 topLayout->addWidget(mProfileBox, iii,1); 141 topLayout->addWidget(mProfileBox, iii,1);
142 ++iii; 142 ++iii;
143 143
144 QHBox *iims = new QHBox( topFrame ); 144 QHBox *iims = new QHBox( topFrame );
145 new QLabel( i18n("Include in multiple "), iims ); 145 new QLabel( i18n("Include in multiple "), iims );
146 mIncludeInRing = new QCheckBox( i18n("calendar "), iims ); 146 mIncludeInRing = new QCheckBox( i18n("calendar "), iims );
147 mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims ); 147 mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims );
148 mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims ); 148 mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims );
149 new QLabel( i18n(" sync"), iims ); 149 new QLabel( i18n(" sync"), iims );
150 topLayout->addMultiCellWidget(iims, iii,iii,0,1); 150 topLayout->addMultiCellWidget(iims, iii,iii,0,1);
151 ++iii; 151 ++iii;
152 152
153 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); 153 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame );
154 topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); 154 topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1);
155 ++iii; 155 ++iii;
156 QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); 156 QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame);
157 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 157 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
158 ++iii; 158 ++iii;
159 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); 159 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr );
160 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); 160 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr );
161 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); 161 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr );
162 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); 162 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr );
163 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); 163 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr );
164 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); 164 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr );
165 // both = new QRadioButton ( i18n("Take both on conflict"), gr ); 165 // both = new QRadioButton ( i18n("Take both on conflict"), gr );
166 166
167 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); 167 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame );
168 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); 168 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1);
169 ++iii; 169 ++iii;
170 170
171 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); 171 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame );
172 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); 172 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
173 ++iii; 173 ++iii;
174 174
175 mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame ); 175 mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame );
176 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); 176 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1);
177 ++iii; 177 ++iii;
178 178
179 mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame ); 179 mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame );
180 topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); 180 topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1);
181 ++iii; 181 ++iii;
182 topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0); 182 topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0);
183 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame); 183 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame);
184 topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); 184 topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1);
185 ++iii; 185 ++iii;
186 186
187 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); 187 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
188 gr = proGr; 188 gr = proGr;
189 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 189 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
190 ++iii; 190 ++iii;
191 mIsLocal = new QRadioButton ( i18n("Local file"), gr ); 191 mIsLocal = new QRadioButton ( i18n("Local file"), gr );
192 mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr ); 192 mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr );
193 connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 193 connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
194 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); 194 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr );
195 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 195 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
196 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); 196 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr );
197 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 197 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
198 198
199 199
200 phoneWidget = new QVBox( topFrame); 200 phoneWidget = new QVBox( topFrame);
201 topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); 201 topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1);
202 ++iii; 202 ++iii;
203 mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget ); 203 mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget );
204 QHBox* temphb = new QHBox( phoneWidget ); 204 QHBox* temphb = new QHBox( phoneWidget );
205 new QLabel( i18n("I/O device: "), temphb ); 205 new QLabel( i18n("I/O device: "), temphb );
206 mPhoneDevice = new QLineEdit( temphb); 206 mPhoneDevice = new QLineEdit( temphb);
207 button = new QPushButton( i18n("Help..."), temphb ); 207 button = new QPushButton( i18n("Help..."), temphb );
208 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) ); 208 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) );
209 209
210 210
211 temphb = new QHBox( phoneWidget ); 211 temphb = new QHBox( phoneWidget );
212 new QLabel( i18n("Connection: "), temphb ); 212 new QLabel( i18n("Connection: "), temphb );
213 mPhoneConnection = new QLineEdit( temphb); 213 mPhoneConnection = new QLineEdit( temphb);
214 button = new QPushButton( i18n("Help..."), temphb ); 214 button = new QPushButton( i18n("Help..."), temphb );
215 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) ); 215 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) );
216 216
217 217
218 temphb = new QHBox( phoneWidget ); 218 temphb = new QHBox( phoneWidget );
219 new QLabel( i18n("Model(opt.): "), temphb ); 219 new QLabel( i18n("Model(opt.): "), temphb );
220 mPhoneModel = new QLineEdit( temphb); 220 mPhoneModel = new QLineEdit( temphb);
221 button = new QPushButton( i18n("Help..."), temphb ); 221 button = new QPushButton( i18n("Help..."), temphb );
222 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) ); 222 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) );
223 223
224 // *** local 224 // *** local
225 localFileWidget = new QVBox( topFrame); 225 localFileWidget = new QVBox( topFrame);
226 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); 226 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1);
227 ++iii; 227 ++iii;
228 temphb = new QHBox( localFileWidget ); 228 temphb = new QHBox( localFileWidget );
229 229
230 lab = new QLabel( i18n("Local file Cal:"), temphb ); 230 lab = new QLabel( i18n("Local file Cal:"), temphb );
231 lab = new QLabel( i18n("Local file ABook:"), temphb ); 231 lab = new QLabel( i18n("Local file ABook:"), temphb );
232 lab = new QLabel( i18n("Local file PWMgr:"), temphb ); 232 lab = new QLabel( i18n("Local file PWMgr:"), temphb );
233 temphb = new QHBox( localFileWidget ); 233 temphb = new QHBox( localFileWidget );
234 button = new QPushButton( i18n("Choose..."), temphb ); 234 button = new QPushButton( i18n("Choose..."), temphb );
235 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); 235 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) );
236 button = new QPushButton( i18n("Choose..."), temphb ); 236 button = new QPushButton( i18n("Choose..."), temphb );
237 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) ); 237 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) );
238 button = new QPushButton( i18n("Choose..."), temphb ); 238 button = new QPushButton( i18n("Choose..."), temphb );
239 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) ); 239 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) );
240 temphb = new QHBox( localFileWidget ); 240 temphb = new QHBox( localFileWidget );
241 241
242 mRemoteFile = new QLineEdit( temphb); 242 mRemoteFile = new QLineEdit( temphb);
243 mRemoteFileAB = new QLineEdit( temphb); 243 mRemoteFileAB = new QLineEdit( temphb);
244 mRemoteFilePWM = new QLineEdit( temphb); 244 mRemoteFilePWM = new QLineEdit( temphb);
245 mIsKapiFileL = new QCheckBox( i18n("Addressbook file (*.vcf) is used by KA/Pi"), localFileWidget );
246
245 247
246 // *** remote 248 // *** remote
247 remoteFileWidget = new QVBox( topFrame); 249 remoteFileWidget = new QVBox( topFrame);
248 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); 250 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1);
249 ++iii; 251 ++iii;
250 temphb = new QHBox( remoteFileWidget ); 252 temphb = new QHBox( remoteFileWidget );
251 new QLabel( i18n("Calendar:"), temphb); 253 new QLabel( i18n("Calendar:"), temphb);
252 new QLabel( i18n("AddressBook:"), temphb); 254 new QLabel( i18n("AddressBook:"), temphb);
253 new QLabel( i18n("PWManager:"), temphb); 255 new QLabel( i18n("PWManager:"), temphb);
254 256
255 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); 257 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget);
256 temphb = new QHBox( remoteFileWidget ); 258 temphb = new QHBox( remoteFileWidget );
257 mRemotePrecommand = new QLineEdit(temphb); 259 mRemotePrecommand = new QLineEdit(temphb);
258 mRemotePrecommandAB = new QLineEdit(temphb); 260 mRemotePrecommandAB = new QLineEdit(temphb);
259 mRemotePrecommandPWM = new QLineEdit(temphb); 261 mRemotePrecommandPWM = new QLineEdit(temphb);
260 262
261 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); 263 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget);
262 temphb = new QHBox( remoteFileWidget ); 264 temphb = new QHBox( remoteFileWidget );
263 mLocalTempFile = new QLineEdit(temphb); 265 mLocalTempFile = new QLineEdit(temphb);
264 mLocalTempFileAB = new QLineEdit(temphb); 266 mLocalTempFileAB = new QLineEdit(temphb);
265 mLocalTempFilePWM = new QLineEdit(temphb); 267 mLocalTempFilePWM = new QLineEdit(temphb);
266 268
267 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); 269 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget);
268 temphb = new QHBox( remoteFileWidget ); 270 temphb = new QHBox( remoteFileWidget );
269 mRemotePostcommand = new QLineEdit(temphb ); 271 mRemotePostcommand = new QLineEdit(temphb );
270 mRemotePostcommandAB = new QLineEdit(temphb ); 272 mRemotePostcommandAB = new QLineEdit(temphb );
271 mRemotePostcommandPWM = new QLineEdit(temphb ); 273 mRemotePostcommandPWM = new QLineEdit(temphb );
272 274 mIsKapiFileR = new QCheckBox( i18n("Addressbook file is used by KA/Pi"), remoteFileWidget );
273 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); 275 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget);
274 temphb = new QHBox( remoteFileWidget ); 276 temphb = new QHBox( remoteFileWidget );
275 button = new QPushButton( i18n("ssh/scp"), temphb ); 277 button = new QPushButton( i18n("ssh/scp"), temphb );
276 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); 278 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) );
277 button = new QPushButton( i18n("ftp"), temphb ); 279 button = new QPushButton( i18n("ftp"), temphb );
278 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); 280 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
279 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); 281 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget);
280 282
281 // *** pi-sync 283 // *** pi-sync
282 piWidget = new QVBox( topFrame); 284 piWidget = new QVBox( topFrame);
283 topLayout->addMultiCellWidget(piWidget, iii,iii,0,1); 285 topLayout->addMultiCellWidget(piWidget, iii,iii,0,1);
284 ++iii; 286 ++iii;
285 temphb = new QHBox( piWidget ); 287 temphb = new QHBox( piWidget );
286 new QLabel( i18n("Calendar:"), temphb); 288 new QLabel( i18n("Calendar:"), temphb);
287 new QLabel( i18n("AddressBook:"), temphb); 289 new QLabel( i18n("AddressBook:"), temphb);
288 new QLabel( i18n("PWManager:"), temphb); 290 new QLabel( i18n("PWManager:"), temphb);
289 291
290 lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget); 292 lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget);
291 temphb = new QHBox( piWidget ); 293 temphb = new QHBox( piWidget );
292 mRemotePw = new QLineEdit(temphb); 294 mRemotePw = new QLineEdit(temphb);
293 mRemotePwAB = new QLineEdit(temphb); 295 mRemotePwAB = new QLineEdit(temphb);
294 mRemotePwPWM = new QLineEdit(temphb); 296 mRemotePwPWM = new QLineEdit(temphb);
295 297
296 lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget); 298 lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget);
297 temphb = new QHBox( piWidget ); 299 temphb = new QHBox( piWidget );
298 mRemoteIP = new QLineEdit(temphb); 300 mRemoteIP = new QLineEdit(temphb);
299 mRemoteIPAB = new QLineEdit(temphb); 301 mRemoteIPAB = new QLineEdit(temphb);
300 mRemoteIPPWM = new QLineEdit(temphb); 302 mRemoteIPPWM = new QLineEdit(temphb);
301 303
302 lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget); 304 lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget);
303 temphb = new QHBox( piWidget ); 305 temphb = new QHBox( piWidget );
304 mRemotePort = new QLineEdit(temphb); 306 mRemotePort = new QLineEdit(temphb);
305 mRemotePortAB = new QLineEdit(temphb); 307 mRemotePortAB = new QLineEdit(temphb);
306 mRemotePortPWM = new QLineEdit(temphb); 308 mRemotePortPWM = new QLineEdit(temphb);
307 309
308} 310}
309 311
310 312
311 313
312 314
313 315
314void KSyncPrefsDialog::slotOK() 316void KSyncPrefsDialog::slotOK()
315{ 317{
316 if ( mMyMachineName->text() == "undefined" ) { 318 if ( mMyMachineName->text() == "undefined" ) {
317 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); 319 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error"));
318 return; 320 return;
319 } 321 }
320 int i; 322 int i;
321 for (i = 0; i < mSyncProfileNames.count(); ++ i) { 323 for (i = 0; i < mSyncProfileNames.count(); ++ i) {
322 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { 324 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) {
323 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); 325 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error"));
324 return; 326 return;
325 } 327 }
326 } 328 }
327 usrWriteConfig(); 329 usrWriteConfig();
328 QDialog::accept(); 330 QDialog::accept();
329} 331}
330void KSyncPrefsDialog::accept() 332void KSyncPrefsDialog::accept()
331{ 333{
332 slotOK(); 334 slotOK();
333} 335}
334void KSyncPrefsDialog::chooseFile() 336void KSyncPrefsDialog::chooseFile()
335{ 337{
336 QString fn = QDir::homeDirPath(); 338 QString fn = QDir::homeDirPath();
337 339
338 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 340 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
339 if ( fn == "" ) 341 if ( fn == "" )
340 return; 342 return;
341 mRemoteFile->setText( fn ); 343 mRemoteFile->setText( fn );
342} 344}
343 345
344void KSyncPrefsDialog::chooseFileAB() 346void KSyncPrefsDialog::chooseFileAB()
345{ 347{
346 QString fn = QDir::homeDirPath(); 348 QString fn = QDir::homeDirPath();
347 349
348 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this ); 350 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this );
349 if ( fn == "" ) 351 if ( fn == "" )
350 return; 352 return;
351 mRemoteFileAB->setText( fn ); 353 mRemoteFileAB->setText( fn );
352} 354}
353 355
354void KSyncPrefsDialog::chooseFilePWM() 356void KSyncPrefsDialog::chooseFilePWM()
355{ 357{
356 QString fn = QDir::homeDirPath(); 358 QString fn = QDir::homeDirPath();
357 359
358 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); 360 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this );
359 if ( fn == "" ) 361 if ( fn == "" )
360 return; 362 return;
361 mRemoteFilePWM->setText( fn ); 363 mRemoteFilePWM->setText( fn );
362} 364}
363 365
364void KSyncPrefsDialog::textChanged( const QString & s ) 366void KSyncPrefsDialog::textChanged( const QString & s )
365{ 367{
366 if ( mProfileBox->count() == 0 ) 368 if ( mProfileBox->count() == 0 )
367 return; 369 return;
368 if ( currentSelection < 3 ) { 370 if ( currentSelection < 3 ) {
369 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); 371 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error"));
370 mProfileBox->blockSignals( true ); 372 mProfileBox->blockSignals( true );
371 mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); 373 mProfileBox->setCurrentItem(mProfileBox-> currentItem ());
372 mProfileBox->blockSignals( false ); 374 mProfileBox->blockSignals( false );
373 return; 375 return;
374 } 376 }
375 //qDebug("cur i %d ",mProfileBox-> currentItem () ); 377 //qDebug("cur i %d ",mProfileBox-> currentItem () );
376 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; 378 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ;
377 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; 379 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ;
378 prof->setName( s ); 380 prof->setName( s );
379 mSyncProfileNames[mProfileBox-> currentItem ()] = s; 381 mSyncProfileNames[mProfileBox-> currentItem ()] = s;
380} 382}
381void KSyncPrefsDialog::profileChanged( int item ) 383void KSyncPrefsDialog::profileChanged( int item )
382{ 384{
383 //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() ); 385 //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() );
384 KSyncProfile* prof; 386 KSyncProfile* prof;
385 saveProfile(); 387 saveProfile();
386 currentSelection = item; 388 currentSelection = item;
387 prof = mSyncProfiles.at(item) ; 389 prof = mSyncProfiles.at(item) ;
388 390
389 mRemotePw->setText(prof->getRemotePw()); 391 mRemotePw->setText(prof->getRemotePw());
390 mRemoteIP->setText(prof->getRemoteIP()); 392 mRemoteIP->setText(prof->getRemoteIP());
391 mRemotePort->setText(prof->getRemotePort()); 393 mRemotePort->setText(prof->getRemotePort());
392 394
393 mRemotePwAB->setText(prof->getRemotePwAB()); 395 mRemotePwAB->setText(prof->getRemotePwAB());
394 mRemoteIPAB->setText(prof->getRemoteIPAB()); 396 mRemoteIPAB->setText(prof->getRemoteIPAB());
395 mRemotePortAB->setText(prof->getRemotePortAB()); 397 mRemotePortAB->setText(prof->getRemotePortAB());
396 398
397 mRemotePwPWM->setText(prof->getRemotePwPWM()); 399 mRemotePwPWM->setText(prof->getRemotePwPWM());
398 mRemoteIPPWM->setText(prof->getRemoteIPPWM()); 400 mRemoteIPPWM->setText(prof->getRemoteIPPWM());
399 mRemotePortPWM->setText(prof->getRemotePortPWM()); 401 mRemotePortPWM->setText(prof->getRemotePortPWM());
400 402
401 mRemotePrecommand->setText(prof->getPreSyncCommand()); 403 mRemotePrecommand->setText(prof->getPreSyncCommand());
402 mRemotePostcommand->setText(prof->getPostSyncCommand()); 404 mRemotePostcommand->setText(prof->getPostSyncCommand());
403 mLocalTempFile->setText(prof->getLocalTempFile()); 405 mLocalTempFile->setText(prof->getLocalTempFile());
404 mRemoteFile->setText(prof->getRemoteFileName()) ; 406 mRemoteFile->setText(prof->getRemoteFileName()) ;
405 407
406 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); 408 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB());
407 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); 409 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB());
408 mLocalTempFileAB->setText(prof->getLocalTempFileAB()); 410 mLocalTempFileAB->setText(prof->getLocalTempFileAB());
409 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; 411 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ;
410 412
411 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM()); 413 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM());
412 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM()); 414 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM());
413 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM()); 415 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM());
414 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ; 416 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ;
415 417
416 if ( mWriteContactToSIM ) 418 if ( mWriteContactToSIM )
417 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM()); 419 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM());
418 mPhoneDevice->setText(prof->getPhoneDevice()); 420 mPhoneDevice->setText(prof->getPhoneDevice());
419 mPhoneConnection->setText(prof->getPhoneConnection()); 421 mPhoneConnection->setText(prof->getPhoneConnection());
420 mPhoneModel->setText(prof->getPhoneModel()); 422 mPhoneModel->setText(prof->getPhoneModel());
421 423
422 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); 424 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync());
423 mAskForPreferences->setChecked( prof->getAskForPreferences()); 425 mAskForPreferences->setChecked( prof->getAskForPreferences());
424 mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); 426 mWriteBackExisting->setChecked( prof->getWriteBackExisting() );
425 mWriteBackFile->setChecked( prof->getWriteBackFile()); 427 mWriteBackFile->setChecked( prof->getWriteBackFile());
426 mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); 428 mIncludeInRing->setChecked( prof->getIncludeInRingSync() );
427 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); 429 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() );
428 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); 430 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() );
429 mWriteBackFuture->setChecked( prof->getWriteBackFuture()); 431 mWriteBackFuture->setChecked( prof->getWriteBackFuture());
430 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); 432 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() );
431 433
432 switch ( prof->getSyncPrefs() ) { 434 switch ( prof->getSyncPrefs() ) {
433 case 0: 435 case 0:
434 loc->setChecked( true); 436 loc->setChecked( true);
435 break; 437 break;
436 case 1: 438 case 1:
437 rem->setChecked( true ); 439 rem->setChecked( true );
438 break; 440 break;
439 case 2: 441 case 2:
440 newest->setChecked( true); 442 newest->setChecked( true);
441 break; 443 break;
442 case 3: 444 case 3:
443 ask->setChecked( true); 445 ask->setChecked( true);
444 break; 446 break;
445 case 4: 447 case 4:
446 f_loc->setChecked( true); 448 f_loc->setChecked( true);
447 break; 449 break;
448 case 5: 450 case 5:
449 f_rem->setChecked( true); 451 f_rem->setChecked( true);
450 break; 452 break;
451 case 6: 453 case 6:
452 //both->setChecked( true); 454 //both->setChecked( true);
453 break; 455 break;
454 default: 456 default:
455 break; 457 break;
456 } 458 }
457 mIsLocal->setChecked(prof->getIsLocalFileSync()) ; 459 mIsLocal->setChecked(prof->getIsLocalFileSync()) ;
458 mIsPhone->setChecked(prof->getIsPhoneSync()) ; 460 mIsPhone->setChecked(prof->getIsPhoneSync()) ;
459 mIsPi->setChecked(prof->getIsPiSync()) ; 461 mIsPi->setChecked(prof->getIsPiSync()) ;
462 mIsKapiFileL->setChecked(prof->getIsKapiFile()) ;
463 mIsKapiFileR->setChecked(prof->getIsKapiFile()) ;
464
460 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() ); 465 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() );
461 proGr->setEnabled( item > 2 ); 466 proGr->setEnabled( item > 2 );
462 if ( item < 3 ) { 467 if ( item < 3 ) {
463 localFileWidget->hide(); 468 localFileWidget->hide();
464 remoteFileWidget->hide(); 469 remoteFileWidget->hide();
465 phoneWidget->hide(); 470 phoneWidget->hide();
466 piWidget->hide(); 471 piWidget->hide();
467 472
468 } else 473 } else
469 kindChanged( prof->getIsLocalFileSync() ); 474 kindChanged( prof->getIsLocalFileSync() );
470} 475}
471 476
472void KSyncPrefsDialog::fillSSH() 477void KSyncPrefsDialog::fillSSH()
473{ 478{
474 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 479 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
475 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 480 mLocalTempFile->setText("/tmp/mycalendar.ics" );
476 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); 481 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" );
477 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 482 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
478 mLocalTempFileAB->setText("/tmp/std.vcf" ); 483 mLocalTempFileAB->setText("/tmp/std.vcf" );
479 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); 484 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" );
480 mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); 485 mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" );
481 mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); 486 mLocalTempFilePWM->setText("/tmp/passwords.pwm" );
482 mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" ); 487 mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" );
483} 488}
484void KSyncPrefsDialog::fillFTP() 489void KSyncPrefsDialog::fillFTP()
485{ 490{
486 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); 491 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" );
487 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 492 mLocalTempFile->setText("/tmp/mycalendar.ics" );
488 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 493 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
489 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); 494 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" );
490 mLocalTempFileAB->setText("/tmp/std.vcf" ); 495 mLocalTempFileAB->setText("/tmp/std.vcf" );
491 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 496 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
492 497
493 mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" ); 498 mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" );
494 mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); 499 mLocalTempFilePWM->setText("/tmp/passwords.pwm" );
495 mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); 500 mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" );
496 501
497} 502}
498void KSyncPrefsDialog::kindChanged( bool b ) 503void KSyncPrefsDialog::kindChanged( bool b )
499{ 504{
505
506 if ( mIsLocal->isChecked () ) {
507 mIsKapiFileL->setChecked( mIsKapiFileR->isChecked() );
508 } else {
509 mIsKapiFileR->setChecked( mIsKapiFileL->isChecked() );
510 }
500 511
501 if ( mIsLocal->isChecked () ) 512 if ( mIsLocal->isChecked () )
502 localFileWidget->show(); 513 localFileWidget->show();
503 else 514 else
504 localFileWidget->hide(); 515 localFileWidget->hide();
505 516
506 if ( mIsNotLocal->isChecked () ) 517 if ( mIsNotLocal->isChecked () )
507 remoteFileWidget->show(); 518 remoteFileWidget->show();
508 else 519 else
509 remoteFileWidget->hide(); 520 remoteFileWidget->hide();
510 521
511 if ( mIsPhone->isChecked () ) { 522 if ( mIsPhone->isChecked () ) {
512 phoneWidget->show(); 523 phoneWidget->show();
513 } 524 }
514 else { 525 else {
515 phoneWidget->hide(); 526 phoneWidget->hide();
516 } 527 }
517 if ( mIsPi->isChecked () ) { 528 if ( mIsPi->isChecked () ) {
518 piWidget->show(); 529 piWidget->show();
519 } 530 }
520 else { 531 else {
521 piWidget->hide(); 532 piWidget->hide();
522 } 533 }
523 534
524} 535}
525void KSyncPrefsDialog::deleteProfile() 536void KSyncPrefsDialog::deleteProfile()
526{ 537{
527 //qDebug("KSyncPrefsDialog::deleteProfile() "); 538 //qDebug("KSyncPrefsDialog::deleteProfile() ");
528 if ( currentSelection >= 0 ) { 539 if ( currentSelection >= 0 ) {
529 if ( currentSelection < 3 ) { 540 if ( currentSelection < 3 ) {
530 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); 541 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error"));
531 return; 542 return;
532 } 543 }
533 KSyncProfile* temp = mSyncProfiles.at(currentSelection); 544 KSyncProfile* temp = mSyncProfiles.at(currentSelection);
534 mSyncProfiles.remove( temp ); 545 mSyncProfiles.remove( temp );
535 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); 546 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection ));
536 insertProfiles(); 547 insertProfiles();
537 } 548 }
538} 549}
539 550
540void KSyncPrefsDialog::saveProfile() 551void KSyncPrefsDialog::saveProfile()
541{ 552{
542 KSyncProfile* prof; 553 KSyncProfile* prof;
543 if ( currentSelection >= 0 ) { 554 if ( currentSelection >= 0 ) {
544 prof = mSyncProfiles.at(currentSelection) ; 555 prof = mSyncProfiles.at(currentSelection) ;
545 556
546 prof->setRemotePw( mRemotePw->text()); 557 prof->setRemotePw( mRemotePw->text());
547 prof->setRemoteIP( mRemoteIP->text()); 558 prof->setRemoteIP( mRemoteIP->text());
548 prof->setRemotePort( mRemotePort->text()); 559 prof->setRemotePort( mRemotePort->text());
549 560
550 prof->setRemotePwAB( mRemotePwAB->text()); 561 prof->setRemotePwAB( mRemotePwAB->text());
551 prof->setRemoteIPAB( mRemoteIPAB->text()); 562 prof->setRemoteIPAB( mRemoteIPAB->text());
552 prof->setRemotePortAB( mRemotePortAB->text()); 563 prof->setRemotePortAB( mRemotePortAB->text());
553 564
554 prof->setRemotePwPWM( mRemotePwPWM->text()); 565 prof->setRemotePwPWM( mRemotePwPWM->text());
555 prof->setRemoteIPPWM( mRemoteIPPWM->text()); 566 prof->setRemoteIPPWM( mRemoteIPPWM->text());
556 prof->setRemotePortPWM( mRemotePortPWM->text()); 567 prof->setRemotePortPWM( mRemotePortPWM->text());
557 568
558 prof->setPreSyncCommand( mRemotePrecommand->text()); 569 prof->setPreSyncCommand( mRemotePrecommand->text());
559 prof->setPostSyncCommand( mRemotePostcommand->text() ); 570 prof->setPostSyncCommand( mRemotePostcommand->text() );
560 prof->setLocalTempFile( mLocalTempFile->text()); 571 prof->setLocalTempFile( mLocalTempFile->text());
561 prof->setRemoteFileName( mRemoteFile->text() ); 572 prof->setRemoteFileName( mRemoteFile->text() );
562 prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); 573 prof->setPreSyncCommandAB( mRemotePrecommandAB->text());
563 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); 574 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() );
564 prof->setLocalTempFileAB( mLocalTempFileAB->text()); 575 prof->setLocalTempFileAB( mLocalTempFileAB->text());
565 prof->setRemoteFileNameAB( mRemoteFileAB->text() ); 576 prof->setRemoteFileNameAB( mRemoteFileAB->text() );
566 prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text()); 577 prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text());
567 prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() ); 578 prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() );
568 prof->setLocalTempFilePWM( mLocalTempFilePWM->text()); 579 prof->setLocalTempFilePWM( mLocalTempFilePWM->text());
569 prof->setRemoteFileNamePWM( mRemoteFilePWM->text() ); 580 prof->setRemoteFileNamePWM( mRemoteFilePWM->text() );
570 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); 581 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() );
571 prof->setAskForPreferences( mAskForPreferences->isChecked()); 582 prof->setAskForPreferences( mAskForPreferences->isChecked());
572 prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); 583 prof->setWriteBackExisting(mWriteBackExisting->isChecked() );
573 prof->setWriteBackFile( mWriteBackFile->isChecked()); 584 prof->setWriteBackFile( mWriteBackFile->isChecked());
574 prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); 585 prof->setIncludeInRingSync( mIncludeInRing->isChecked() );
575 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); 586 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() );
576 prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() ); 587 prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() );
577 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; 588 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ;
578 prof->setSyncPrefs( syncprefs); 589 prof->setSyncPrefs( syncprefs);
579 prof->setIsLocalFileSync( mIsLocal->isChecked() ); 590 prof->setIsLocalFileSync( mIsLocal->isChecked() );
580 prof->setIsPhoneSync( mIsPhone->isChecked() ); 591 prof->setIsPhoneSync( mIsPhone->isChecked() );
581 prof->setIsPiSync( mIsPi->isChecked() ); 592 prof->setIsPiSync( mIsPi->isChecked() );
593 prof->setIsKapiFile( mIsKapiFileL->isChecked() );
582 prof->setWriteBackFuture(mWriteBackFuture->isChecked()); 594 prof->setWriteBackFuture(mWriteBackFuture->isChecked());
583 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); 595 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value());
584 if ( mWriteContactToSIM ) 596 if ( mWriteContactToSIM )
585 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); 597 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked());
586 prof->setPhoneDevice( mPhoneDevice->text() ); 598 prof->setPhoneDevice( mPhoneDevice->text() );
587 prof->setPhoneConnection( mPhoneConnection->text() ); 599 prof->setPhoneConnection( mPhoneConnection->text() );
588 prof->setPhoneModel( mPhoneModel->text() ); 600 prof->setPhoneModel( mPhoneModel->text() );
589 601
590 } 602 }
591 603
592} 604}
593 605
594void KSyncPrefsDialog::insertProfiles() 606void KSyncPrefsDialog::insertProfiles()
595{ 607{
596 int curItem = mProfileBox->currentItem(); 608 int curItem = mProfileBox->currentItem();
597 mProfileBox->blockSignals( true ); 609 mProfileBox->blockSignals( true );
598 mProfileBox->clear(); 610 mProfileBox->clear();
599 mProfileBox->insertStringList (mSyncProfileNames ); 611 mProfileBox->insertStringList (mSyncProfileNames );
600 int item = mSyncProfileNames.count() -1; 612 int item = mSyncProfileNames.count() -1;
601 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) 613 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() )
602 mProfileBox->setCurrentItem( curItem ); 614 mProfileBox->setCurrentItem( curItem );
603 else if ( item >= 0 ) { 615 else if ( item >= 0 ) {
604 mProfileBox->setCurrentItem( item ); 616 mProfileBox->setCurrentItem( item );
605 } 617 }
606 currentSelection = -1; 618 currentSelection = -1;
607 if ( mSyncProfileNames.count() > 0 ) { 619 if ( mSyncProfileNames.count() > 0 ) {
608 //qDebug(" profileChanged( mProfileBox->currentItem() "); 620 //qDebug(" profileChanged( mProfileBox->currentItem() ");
609 profileChanged( mProfileBox->currentItem() ); 621 profileChanged( mProfileBox->currentItem() );
610 currentSelection = mProfileBox->currentItem(); 622 currentSelection = mProfileBox->currentItem();
611 } 623 }
612 mProfileBox->blockSignals( false ); 624 mProfileBox->blockSignals( false );
613} 625}
614 626
615void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) 627void KSyncPrefsDialog::addProfile ( KSyncProfile* temp )
616{ 628{
617 saveProfile(); 629 saveProfile();
618 mSyncProfiles.append( temp ); 630 mSyncProfiles.append( temp );
619 mSyncProfileNames << temp->getName(); 631 mSyncProfileNames << temp->getName();
620 insertProfiles(); 632 insertProfiles();
621 int last = mProfileBox->count() -1; 633 int last = mProfileBox->count() -1;
622 mProfileBox->blockSignals( true ); 634 mProfileBox->blockSignals( true );
623 mProfileBox->setCurrentItem( last ); 635 mProfileBox->setCurrentItem( last );
624 mProfileBox->blockSignals( false ); 636 mProfileBox->blockSignals( false );
625 profileChanged(last); 637 profileChanged(last);
626} 638}
627void KSyncPrefsDialog::newProfile() 639void KSyncPrefsDialog::newProfile()
628{ 640{
629 addProfile ( new KSyncProfile () ); 641 addProfile ( new KSyncProfile () );
630} 642}
631 643
632void KSyncPrefsDialog::cloneProfile() 644void KSyncPrefsDialog::cloneProfile()
633{ 645{
634 if ( currentSelection >= 0 ) 646 if ( currentSelection >= 0 )
635 addProfile (mSyncProfiles.at(currentSelection)->clone()) ; 647 addProfile (mSyncProfiles.at(currentSelection)->clone()) ;
636 else 648 else
637 newProfile(); 649 newProfile();
638} 650}
639 651
640void KSyncPrefsDialog::setLocalMachineName ( const QString& name ) 652void KSyncPrefsDialog::setLocalMachineName ( const QString& name )
641{ 653{
642 mMyMachineName->setText( name ); 654 mMyMachineName->setText( name );
643 655
644} 656}
645QString KSyncPrefsDialog::getLocalMachineName ( ) 657QString KSyncPrefsDialog::getLocalMachineName ( )
646{ 658{
647 return mMyMachineName->text(); 659 return mMyMachineName->text();
648} 660}
649 661
650QStringList KSyncPrefsDialog::getSyncProfileNames() 662QStringList KSyncPrefsDialog::getSyncProfileNames()
651{ 663{
652 return mSyncProfileNames; 664 return mSyncProfileNames;
653} 665}
654void KSyncPrefsDialog::usrReadConfig() 666void KSyncPrefsDialog::usrReadConfig()
655{ 667{
656 //KConfig *config = KOGlobals::config(); 668 //KConfig *config = KOGlobals::config();
657 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 669 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
658 config.setGroup("General"); 670 config.setGroup("General");
659 mSyncProfileNames =config.readListEntry("SyncProfileNames"); 671 mSyncProfileNames =config.readListEntry("SyncProfileNames");
660 mMyMachineName->setText(config.readEntry("LocalMachineName","undefined")); 672 mMyMachineName->setText(config.readEntry("LocalMachineName","undefined"));
661 int i; 673 int i;
662 KSyncProfile* temp ; 674 KSyncProfile* temp ;
663 mSyncProfiles.clear(); 675 mSyncProfiles.clear();
664 for ( i = 0; i < mSyncProfileNames.count();++i ) { 676 for ( i = 0; i < mSyncProfileNames.count();++i ) {
665 temp = new KSyncProfile (); 677 temp = new KSyncProfile ();
666 temp->setName( mSyncProfileNames[i] ); 678 temp->setName( mSyncProfileNames[i] );
667 temp->readConfig( &config ); 679 temp->readConfig( &config );
668 mSyncProfiles.append( temp ); 680 mSyncProfiles.append( temp );
669 } 681 }
670 insertProfiles(); 682 insertProfiles();
671 //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); 683 //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName );
672} 684}
673 685
674 686
675void KSyncPrefsDialog::usrWriteConfig() 687void KSyncPrefsDialog::usrWriteConfig()
676{ 688{
677 saveProfile(); 689 saveProfile();
678 if ( currentSelection >= 0 ) 690 if ( currentSelection >= 0 )
679 profileChanged(currentSelection); 691 profileChanged(currentSelection);
680 //KConfig *config = KOGlobals::config(); 692 //KConfig *config = KOGlobals::config();
681 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 693 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
682 KSyncProfile* prof = mSyncProfiles.first(); 694 KSyncProfile* prof = mSyncProfiles.first();
683 QStringList externalSyncProfileNames; 695 QStringList externalSyncProfileNames;
684 externalSyncProfileNames.append("Sharp_DTM");; 696 externalSyncProfileNames.append("Sharp_DTM");;
685 while ( prof ) { 697 while ( prof ) {
686 prof->writeConfig(&config); 698 prof->writeConfig(&config);
687 if ( prof->getIsPhoneSync( ) ) 699 if ( prof->getIsPhoneSync( ) )
688 externalSyncProfileNames.append(prof->getName( ) ); 700 externalSyncProfileNames.append(prof->getName( ) );
689 prof = mSyncProfiles.next(); 701 prof = mSyncProfiles.next();
690 } 702 }
691 //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; 703 //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames;
692 //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); 704 //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text();
693 config.setGroup("General"); 705 config.setGroup("General");
694 config.writeEntry("SyncProfileNames",mSyncProfileNames); 706 config.writeEntry("SyncProfileNames",mSyncProfileNames);
695 config.writeEntry("ExternSyncProfiles",externalSyncProfileNames); 707 config.writeEntry("ExternSyncProfiles",externalSyncProfileNames);
696 config.writeEntry("LocalMachineName",mMyMachineName->text()); 708 config.writeEntry("LocalMachineName",mMyMachineName->text());
697 config.sync(); 709 config.sync();
698} 710}
699 711
700void KSyncPrefsDialog::helpDevice() 712void KSyncPrefsDialog::helpDevice()
701{ 713{
702 QString hint = i18n("Insert device where\nphone is connected. E.g.:\n"); 714 QString hint = i18n("Insert device where\nphone is connected. E.g.:\n");
703#ifdef _WIN32_ 715#ifdef _WIN32_
704 hint += "Leave empty for Irda.\n" 716 hint += "Leave empty for Irda.\n"
705 "com1:\n(first serial port)\n" 717 "com1:\n(first serial port)\n"
706 "usb not supported\n" 718 "usb not supported\n"
707 "???\n(bluetooth device address)\n"; 719 "???\n(bluetooth device address)\n";
708 720
709#else 721#else
710 hint += "/dev/ircomm\n(Irda)\n" 722 hint += "/dev/ircomm\n(Irda)\n"
711 "/dev/ttyS0\n(first serial port)\n" 723 "/dev/ttyS0\n(first serial port)\n"
712 "/dev/ttyUSB0\n(first device usb port)\n" 724 "/dev/ttyUSB0\n(first device usb port)\n"
713 "???\n(bluetooth device address)\n"; 725 "???\n(bluetooth device address)\n";
714#endif 726#endif
715 KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); 727 KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
716} 728}
717void KSyncPrefsDialog::helpModel() 729void KSyncPrefsDialog::helpModel()
718{ 730{
719 QString hint = i18n("Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n"); 731 QString hint = i18n("Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n");
720 hint += "E.g. for Nokia 6310i:\n6310i\nAlso possible:\nobex\nfor Obex connection"; 732 hint += "E.g. for Nokia 6310i:\n6310i\nAlso possible:\nobex\nfor Obex connection";
721 KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); 733 KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
722 734
723} 735}
724void KSyncPrefsDialog::helpConnection() 736void KSyncPrefsDialog::helpConnection()
725{ 737{
726 QString hint = i18n("Insert kind of connection,e.g.:\n"); 738 QString hint = i18n("Insert kind of connection,e.g.:\n");
727 hint += "irda | Nokia FBUS over infrared\n" 739 hint += "irda | Nokia FBUS over infrared\n"
728 "irdaat | AT commands infrared\n(for Siemens/Sony-Erricsson)\n" 740 "irdaat | AT commands infrared\n(for Siemens/Sony-Erricsson)\n"
729 "irdaobex | set also model as obex\n" 741 "irdaobex | set also model as obex\n"
730 "fbus | Nokia FBUS2 serial\n"; 742 "fbus | Nokia FBUS2 serial\n";
731 KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); 743 KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
732} 744}
diff --git a/libkdepim/ksyncprefsdialog.h b/libkdepim/ksyncprefsdialog.h
index d3f8f4c..c601a58 100644
--- a/libkdepim/ksyncprefsdialog.h
+++ b/libkdepim/ksyncprefsdialog.h
@@ -1,151 +1,153 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef _KSYNCPREFSDIALOG_H 23#ifndef _KSYNCPREFSDIALOG_H
24#define _KSYNCPREFSDIALOG_H 24#define _KSYNCPREFSDIALOG_H
25 25
26 26
27#include <kdialogbase.h> 27#include <kdialogbase.h>
28#include <qptrlist.h> 28#include <qptrlist.h>
29 29
30//#include <libkdepim/kprefsdialog.h> 30//#include <libkdepim/kprefsdialog.h>
31 31
32class KColorButton; 32class KColorButton;
33class QSpinBox;; 33class QSpinBox;;
34class QRadioButton; 34class QRadioButton;
35class QCheckBox; 35class QCheckBox;
36class QSlider; 36class QSlider;
37class KURLRequester; 37class KURLRequester;
38class QComboBox; 38class QComboBox;
39class QButtonGroup; 39class QButtonGroup;
40class QLineEdit; 40class QLineEdit;
41class QVBox; 41class QVBox;
42class QStringList; 42class QStringList;
43class KSyncProfile; 43class KSyncProfile;
44 44
45/** Dialog to change the korganizer configuration. 45/** Dialog to change the korganizer configuration.
46 */ 46 */
47class KSyncPrefsDialog : public KDialog 47class KSyncPrefsDialog : public KDialog
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 /** Initialize dialog and pages */ 51 /** Initialize dialog and pages */
52 KSyncPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); 52 KSyncPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false);
53 ~KSyncPrefsDialog(); 53 ~KSyncPrefsDialog();
54 void usrReadConfig(); 54 void usrReadConfig();
55 void setLocalMachineName ( const QString& name ); 55 void setLocalMachineName ( const QString& name );
56 QString getLocalMachineName ( ); 56 QString getLocalMachineName ( );
57 57
58 QStringList getSyncProfileNames(); 58 QStringList getSyncProfileNames();
59 59
60 public slots: 60 public slots:
61 protected slots: 61 protected slots:
62 void accept(); 62 void accept();
63 void deleteProfile(); 63 void deleteProfile();
64 void newProfile(); 64 void newProfile();
65 void cloneProfile(); 65 void cloneProfile();
66 void kindChanged(bool); 66 void kindChanged(bool);
67 void fillSSH(); 67 void fillSSH();
68 void fillFTP(); 68 void fillFTP();
69 void textChanged( const QString & ); 69 void textChanged( const QString & );
70 void profileChanged( int ); 70 void profileChanged( int );
71 void chooseFile(); 71 void chooseFile();
72 void chooseFileAB(); 72 void chooseFileAB();
73 void chooseFilePWM(); 73 void chooseFilePWM();
74 void slotOK(); 74 void slotOK();
75 void helpDevice(); 75 void helpDevice();
76 void helpModel(); 76 void helpModel();
77 void helpConnection(); 77 void helpConnection();
78 78
79 protected: 79 protected:
80 void usrWriteConfig(); 80 void usrWriteConfig();
81 81
82 void setupSyncAlgTab(); 82 void setupSyncAlgTab();
83 83
84 private: 84 private:
85 int currentSelection; 85 int currentSelection;
86 QPtrList<KSyncProfile> mSyncProfiles; 86 QPtrList<KSyncProfile> mSyncProfiles;
87 QStringList mSyncProfileNames; 87 QStringList mSyncProfileNames;
88 QLineEdit * mMyMachineName; 88 QLineEdit * mMyMachineName;
89 QComboBox * mProfileBox; 89 QComboBox * mProfileBox;
90 QRadioButton* mIsLocal; 90 QRadioButton* mIsLocal;
91 QRadioButton* mIsNotLocal; 91 QRadioButton* mIsNotLocal;
92 QRadioButton* mIsPhone; 92 QRadioButton* mIsPhone;
93 QRadioButton* mIsPi; 93 QRadioButton* mIsPi;
94 QCheckBox* mIncludeInRing; 94 QCheckBox* mIncludeInRing;
95 QCheckBox* mIncludeInRingAB; 95 QCheckBox* mIncludeInRingAB;
96 QCheckBox* mIncludeInRingPWM; 96 QCheckBox* mIncludeInRingPWM;
97 void addProfile ( KSyncProfile* ); 97 void addProfile ( KSyncProfile* );
98 void insertProfiles(); 98 void insertProfiles();
99 void saveProfile(); 99 void saveProfile();
100 QButtonGroup* proGr; 100 QButtonGroup* proGr;
101 101
102 QRadioButton* loc, *rem, *newest, *ask, *f_loc,* f_rem, *both; 102 QRadioButton* loc, *rem, *newest, *ask, *f_loc,* f_rem, *both;
103 103
104 104
105 QLineEdit * mRemotePostcommand; 105 QLineEdit * mRemotePostcommand;
106 QLineEdit * mRemotePrecommand; 106 QLineEdit * mRemotePrecommand;
107 QLineEdit * mRemoteFile; 107 QLineEdit * mRemoteFile;
108 QLineEdit * mLocalTempFile; 108 QLineEdit * mLocalTempFile;
109 109
110 QLineEdit * mRemotePostcommandAB; 110 QLineEdit * mRemotePostcommandAB;
111 QLineEdit * mRemotePrecommandAB; 111 QLineEdit * mRemotePrecommandAB;
112 QLineEdit * mRemoteFileAB; 112 QLineEdit * mRemoteFileAB;
113 QLineEdit * mLocalTempFileAB; 113 QLineEdit * mLocalTempFileAB;
114 114
115 QLineEdit * mRemotePostcommandPWM; 115 QLineEdit * mRemotePostcommandPWM;
116 QLineEdit * mRemotePrecommandPWM; 116 QLineEdit * mRemotePrecommandPWM;
117 QLineEdit * mRemoteFilePWM; 117 QLineEdit * mRemoteFilePWM;
118 QLineEdit * mLocalTempFilePWM; 118 QLineEdit * mLocalTempFilePWM;
119 119
120 120
121 QLineEdit * mRemotePw; 121 QLineEdit * mRemotePw;
122 QLineEdit * mRemoteIP; 122 QLineEdit * mRemoteIP;
123 QLineEdit * mRemotePort; 123 QLineEdit * mRemotePort;
124 124
125 QLineEdit * mRemotePwAB; 125 QLineEdit * mRemotePwAB;
126 QLineEdit * mRemoteIPAB; 126 QLineEdit * mRemoteIPAB;
127 QLineEdit * mRemotePortAB; 127 QLineEdit * mRemotePortAB;
128 128
129 QLineEdit * mRemotePwPWM; 129 QLineEdit * mRemotePwPWM;
130 QLineEdit * mRemoteIPPWM; 130 QLineEdit * mRemoteIPPWM;
131 QLineEdit * mRemotePortPWM; 131 QLineEdit * mRemotePortPWM;
132 132
133 QLineEdit * mPhoneDevice; 133 QLineEdit * mPhoneDevice;
134 QLineEdit * mPhoneConnection; 134 QLineEdit * mPhoneConnection;
135 QLineEdit * mPhoneModel; 135 QLineEdit * mPhoneModel;
136 136
137 QWidget* mSetupSyncAlgTab; 137 QWidget* mSetupSyncAlgTab;
138 QVBox* localFileWidget; 138 QVBox* localFileWidget;
139 QVBox* remoteFileWidget; 139 QVBox* remoteFileWidget;
140 QVBox* phoneWidget; 140 QVBox* phoneWidget;
141 QVBox* piWidget; 141 QVBox* piWidget;
142 QCheckBox* mWriteBackFile; 142 QCheckBox* mWriteBackFile;
143 QCheckBox* mWriteBackFuture; 143 QCheckBox* mWriteBackFuture;
144 QSpinBox* mWriteBackFutureWeeks; 144 QSpinBox* mWriteBackFutureWeeks;
145 QCheckBox* mWriteBackExisting; 145 QCheckBox* mWriteBackExisting;
146 QCheckBox* mAskForPreferences; 146 QCheckBox* mAskForPreferences;
147 QCheckBox* mShowSummaryAfterSync; 147 QCheckBox* mShowSummaryAfterSync;
148 QCheckBox* mWriteContactToSIM; 148 QCheckBox* mWriteContactToSIM;
149 QCheckBox* mIsKapiFileL;
150 QCheckBox* mIsKapiFileR;
149}; 151};
150 152
151#endif 153#endif
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp
index 76dfe00..029b70b 100644
--- a/libkdepim/ksyncprofile.cpp
+++ b/libkdepim/ksyncprofile.cpp
@@ -1,248 +1,252 @@
1/* 1/*
2 This file is part of KDE-Pim/Pi. 2 This file is part of KDE-Pim/Pi.
3 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> 3 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21// $Id$ 21// $Id$
22 22
23#include <qcolor.h> 23#include <qcolor.h>
24 24
25#include <kconfig.h> 25#include <kconfig.h>
26#include <kstandarddirs.h> 26#include <kstandarddirs.h>
27#include <kglobal.h> 27#include <kglobal.h>
28#include <kdebug.h> 28#include <kdebug.h>
29 29
30#include "ksyncprofile.h" 30#include "ksyncprofile.h"
31 31
32 32
33KSyncProfile::KSyncProfile(): QObject () 33KSyncProfile::KSyncProfile(): QObject ()
34{ 34{
35 setDefault(); 35 setDefault();
36} 36}
37KSyncProfile::~KSyncProfile() 37KSyncProfile::~KSyncProfile()
38{ 38{
39 39
40} 40}
41 41
42 42
43KSyncProfile* KSyncProfile::clone() 43KSyncProfile* KSyncProfile::clone()
44{ 44{
45 KSyncProfile* myClone = new KSyncProfile(); 45 KSyncProfile* myClone = new KSyncProfile();
46 myClone->setRemotePw(mRemotePw); 46 myClone->setRemotePw(mRemotePw);
47 myClone->setRemoteIP(mRemoteIP); 47 myClone->setRemoteIP(mRemoteIP);
48 myClone->setRemotePort(mRemotePort); 48 myClone->setRemotePort(mRemotePort);
49 myClone->setRemotePwAB(mRemotePwAB); 49 myClone->setRemotePwAB(mRemotePwAB);
50 myClone->setRemoteIPAB(mRemoteIPAB); 50 myClone->setRemoteIPAB(mRemoteIPAB);
51 myClone->setRemotePortAB(mRemotePortAB); 51 myClone->setRemotePortAB(mRemotePortAB);
52 myClone->setRemotePwPWM(mRemotePwPWM); 52 myClone->setRemotePwPWM(mRemotePwPWM);
53 myClone->setRemoteIPPWM(mRemoteIPPWM); 53 myClone->setRemoteIPPWM(mRemoteIPPWM);
54 myClone->setRemotePortPWM (mRemotePortPWM); 54 myClone->setRemotePortPWM (mRemotePortPWM);
55 myClone->setPreSyncCommand( mPreSyncCommand ); 55 myClone->setPreSyncCommand( mPreSyncCommand );
56 myClone->setPostSyncCommand( mPostSyncCommand ); 56 myClone->setPostSyncCommand( mPostSyncCommand );
57 myClone->setLocalTempFile( mLocalTempFile); 57 myClone->setLocalTempFile( mLocalTempFile);
58 myClone->setRemoteFileName( mRemoteFileName ); 58 myClone->setRemoteFileName( mRemoteFileName );
59 myClone->setPreSyncCommandAB( mPreSyncCommandAB ); 59 myClone->setPreSyncCommandAB( mPreSyncCommandAB );
60 myClone->setPostSyncCommandAB( mPostSyncCommandAB ); 60 myClone->setPostSyncCommandAB( mPostSyncCommandAB );
61 myClone->setLocalTempFileAB( mLocalTempFileAB); 61 myClone->setLocalTempFileAB( mLocalTempFileAB);
62 myClone->setRemoteFileNameAB( mRemoteFileNameAB ); 62 myClone->setRemoteFileNameAB( mRemoteFileNameAB );
63 myClone->setPreSyncCommandPWM( mPreSyncCommandPWM ); 63 myClone->setPreSyncCommandPWM( mPreSyncCommandPWM );
64 myClone->setPostSyncCommandPWM( mPostSyncCommandPWM ); 64 myClone->setPostSyncCommandPWM( mPostSyncCommandPWM );
65 myClone->setLocalTempFilePWM( mLocalTempFilePWM); 65 myClone->setLocalTempFilePWM( mLocalTempFilePWM);
66 myClone->setRemoteFileNamePWM( mRemoteFileNamePWM ); 66 myClone->setRemoteFileNamePWM( mRemoteFileNamePWM );
67 myClone->setShowSummaryAfterSync( mShowSummaryAfterSync ); 67 myClone->setShowSummaryAfterSync( mShowSummaryAfterSync );
68 myClone->setAskForPreferences( mAskForPreferences); 68 myClone->setAskForPreferences( mAskForPreferences);
69 myClone->setWriteBackExisting(mWriteBackExisting ); 69 myClone->setWriteBackExisting(mWriteBackExisting );
70 myClone->setWriteBackFile( mWriteBackFile); 70 myClone->setWriteBackFile( mWriteBackFile);
71 myClone->setWriteBackFuture( mWriteBackFuture ); 71 myClone->setWriteBackFuture( mWriteBackFuture );
72 myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks ); 72 myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks );
73 myClone->setIncludeInRingSync( mIncludeInRingSync ); 73 myClone->setIncludeInRingSync( mIncludeInRingSync );
74 myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); 74 myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB );
75 myClone->setIncludeInRingSyncPWM( mIncludeInRingSyncPWM ); 75 myClone->setIncludeInRingSyncPWM( mIncludeInRingSyncPWM );
76 myClone->setSyncPrefs( mSyncPrefs); 76 myClone->setSyncPrefs( mSyncPrefs);
77 myClone->setIsLocalFileSync( mIsLocalFileSync ); 77 myClone->setIsLocalFileSync( mIsLocalFileSync );
78 myClone->setIsPhoneSync( mIsPhoneSync ); 78 myClone->setIsPhoneSync( mIsPhoneSync );
79 myClone->setIsKapiFile( mIsKapiFile );
79 myClone->setIsPiSync( mIsPiSync ); 80 myClone->setIsPiSync( mIsPiSync );
80 myClone->setWriteContactToSIM( mWriteContactToSIM ); 81 myClone->setWriteContactToSIM( mWriteContactToSIM );
81 myClone->setName( "noName" ); 82 myClone->setName( "noName" );
82 //myClone->setIdentifier( "noID" ); 83 //myClone->setIdentifier( "noID" );
83 return myClone; 84 return myClone;
84} 85}
85 86
86 87
87void KSyncProfile::setDefault() 88void KSyncProfile::setDefault()
88{ 89{
89 mPreSyncCommand = i18n("command for downloading remote file to local device"); 90 mPreSyncCommand = i18n("command for downloading remote file to local device");
90 mPostSyncCommand = i18n("command for uploading local temp file to remote device"); 91 mPostSyncCommand = i18n("command for uploading local temp file to remote device");
91 mLocalTempFile = "/tmp/mycalendar.ics"; 92 mLocalTempFile = "/tmp/mycalendar.ics";
92 mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; 93 mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics";
93 mPreSyncCommandAB = i18n("command for downloading remote file to local device"); 94 mPreSyncCommandAB = i18n("command for downloading remote file to local device");
94 mPostSyncCommandAB = i18n("command for uploading local temp file to remote device"); 95 mPostSyncCommandAB = i18n("command for uploading local temp file to remote device");
95 mLocalTempFileAB = "/tmp/std.vcf"; 96 mLocalTempFileAB = "/tmp/std.vcf";
96 mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf"; 97 mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf";
97 mPreSyncCommandPWM = i18n("command for downloading remote file to local device"); 98 mPreSyncCommandPWM = i18n("command for downloading remote file to local device");
98 mPostSyncCommandPWM = i18n("command for uploading local temp file to remote device"); 99 mPostSyncCommandPWM = i18n("command for uploading local temp file to remote device");
99 mLocalTempFilePWM = "/tmp/passwords.pwm"; 100 mLocalTempFilePWM = "/tmp/passwords.pwm";
100 mRemoteFileNamePWM = "/home/polo/kdepim/apps/pwmanager/localfile.pwm"; 101 mRemoteFileNamePWM = "/home/polo/kdepim/apps/pwmanager/localfile.pwm";
101 102
102 mRemotePw = "abc"; 103 mRemotePw = "abc";
103 mRemoteIP = "192.168.0.99"; 104 mRemoteIP = "192.168.0.99";
104 mRemotePort = "9197"; 105 mRemotePort = "9197";
105 106
106 mRemotePwAB = "abc"; 107 mRemotePwAB = "abc";
107 mRemoteIPAB = "192.168.0.99"; 108 mRemoteIPAB = "192.168.0.99";
108 mRemotePortAB = "9198"; 109 mRemotePortAB = "9198";
109 110
110 mRemotePwPWM = "abc"; 111 mRemotePwPWM = "abc";
111 mRemoteIPPWM = "192.168.0.99"; 112 mRemoteIPPWM = "192.168.0.99";
112 mRemotePortPWM = "9199"; 113 mRemotePortPWM = "9199";
113 114
114 mShowSummaryAfterSync = true; 115 mShowSummaryAfterSync = true;
115 mAskForPreferences = true; 116 mAskForPreferences = true;
116 mWriteBackExisting = false; 117 mWriteBackExisting = false;
117 mWriteBackFuture = false; 118 mWriteBackFuture = false;
118 mWriteBackFutureWeeks = 12; 119 mWriteBackFutureWeeks = 12;
119 mWriteBackFile = true; 120 mWriteBackFile = true;
120 mIncludeInRingSync = false; 121 mIncludeInRingSync = false;
121 mIncludeInRingSyncAB = false; 122 mIncludeInRingSyncAB = false;
122 mIncludeInRingSyncPWM = false; 123 mIncludeInRingSyncPWM = false;
123 mSyncPrefs = SYNC_PREF_ASK; 124 mSyncPrefs = SYNC_PREF_ASK;
124 mIsLocalFileSync = true; 125 mIsLocalFileSync = true;
125 mName = "noName"; 126 mName = "noName";
126 mIsPhoneSync = false; 127 mIsPhoneSync = false;
127 mIsPiSync = false; 128 mIsPiSync = false;
129 mIsKapiFile = false;
128 mWriteContactToSIM = false; 130 mWriteContactToSIM = false;
129 mPhoneDevice = "/dev/ircomm"; 131 mPhoneDevice = "/dev/ircomm";
130 mPhoneConnection = "irda"; 132 mPhoneConnection = "irda";
131 mPhoneModel = "6310i"; 133 mPhoneModel = "6310i";
132} 134}
133void KSyncProfile::readConfig(KConfig *config ) 135void KSyncProfile::readConfig(KConfig *config )
134{ 136{
135 if (config) 137 if (config)
136 { 138 {
137 139
138 config->setGroup( mName ); 140 config->setGroup( mName );
139 141
140 mName = config->readEntry( "Name", mName ); 142 mName = config->readEntry( "Name", mName );
141 143
142 mRemotePw = config->readEntry( "RemotePw",mRemotePw ); 144 mRemotePw = config->readEntry( "RemotePw",mRemotePw );
143 mRemoteIP = config->readEntry( "RemoteIP",mRemoteIP ); 145 mRemoteIP = config->readEntry( "RemoteIP",mRemoteIP );
144 mRemotePort = config->readEntry( "RemotePort", mRemotePort ); 146 mRemotePort = config->readEntry( "RemotePort", mRemotePort );
145 mRemotePwAB = config->readEntry( "RemotePwAB", mRemotePwAB ); 147 mRemotePwAB = config->readEntry( "RemotePwAB", mRemotePwAB );
146 mRemoteIPAB = config->readEntry( "RemoteIPAB", mRemoteIPAB ); 148 mRemoteIPAB = config->readEntry( "RemoteIPAB", mRemoteIPAB );
147 mRemotePortAB = config->readEntry( "RemotePortAB", mRemotePortAB ); 149 mRemotePortAB = config->readEntry( "RemotePortAB", mRemotePortAB );
148 mRemotePwPWM = config->readEntry( "RemotePwPWM", mRemotePwPWM ); 150 mRemotePwPWM = config->readEntry( "RemotePwPWM", mRemotePwPWM );
149 mRemoteIPPWM = config->readEntry( "RemoteIPPWM", mRemoteIPPWM ); 151 mRemoteIPPWM = config->readEntry( "RemoteIPPWM", mRemoteIPPWM );
150 mRemotePortPWM = config->readEntry( "RemotePortPWM", mRemotePortPWM ); 152 mRemotePortPWM = config->readEntry( "RemotePortPWM", mRemotePortPWM );
151 153
152 mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand ); 154 mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand );
153 mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand ); 155 mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand );
154 mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile ); 156 mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile );
155 mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName ); 157 mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName );
156 158
157 mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB ); 159 mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB );
158 mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB ); 160 mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB );
159 mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB ); 161 mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB );
160 mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB ); 162 mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB );
161 163
162 mPreSyncCommandPWM = config->readEntry( "PreSyncCommandPWM",mPreSyncCommandPWM ); 164 mPreSyncCommandPWM = config->readEntry( "PreSyncCommandPWM",mPreSyncCommandPWM );
163 mPostSyncCommandPWM = config->readEntry( "PostSyncCommandPWM", mPostSyncCommandPWM ); 165 mPostSyncCommandPWM = config->readEntry( "PostSyncCommandPWM", mPostSyncCommandPWM );
164 mLocalTempFilePWM = config->readEntry( "LocalTempFilePWM", mLocalTempFilePWM ); 166 mLocalTempFilePWM = config->readEntry( "LocalTempFilePWM", mLocalTempFilePWM );
165 mRemoteFileNamePWM = config->readEntry( "RemoteFileNamePWM", mRemoteFileNamePWM ); 167 mRemoteFileNamePWM = config->readEntry( "RemoteFileNamePWM", mRemoteFileNamePWM );
166 168
167 mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice ); 169 mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice );
168 mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection ); 170 mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection );
169 mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel ); 171 mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel );
170 172
171 mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync ); 173 mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync );
172 mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); 174 mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB );
173 mIncludeInRingSyncPWM = config->readBoolEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM ); 175 mIncludeInRingSyncPWM = config->readBoolEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM );
174 mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); 176 mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync );
175 mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences ); 177 mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences );
176 mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting ); 178 mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting );
177 mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture ); 179 mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture );
178 mWriteBackFile = config->readBoolEntry( "WriteBackFile",mWriteBackFile ); 180 mWriteBackFile = config->readBoolEntry( "WriteBackFile",mWriteBackFile );
179 mWriteContactToSIM = config->readBoolEntry( "WriteContactToSIM",mWriteContactToSIM ); 181 mWriteContactToSIM = config->readBoolEntry( "WriteContactToSIM",mWriteContactToSIM );
180 mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs ); 182 mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs );
181 mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks ); 183 mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks );
182 mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync ); 184 mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync );
183 mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync ); 185 mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync );
184 mIsPiSync= config->readBoolEntry( "IsPiSync", mIsPiSync ); 186 mIsPiSync= config->readBoolEntry( "IsPiSync", mIsPiSync );
187 mIsKapiFile = config->readBoolEntry( "IsKapiFile", mIsKapiFile );
185 } 188 }
186 else 189 else
187 { 190 {
188 setDefault(); 191 setDefault();
189 } 192 }
190} 193}
191 194
192void KSyncProfile::deleteConfig(KConfig *config ) 195void KSyncProfile::deleteConfig(KConfig *config )
193{ 196{
194 config->deleteGroup( mName ); 197 config->deleteGroup( mName );
195} 198}
196 199
197void KSyncProfile::writeConfig( KConfig * config ) 200void KSyncProfile::writeConfig( KConfig * config )
198{ 201{
199 config->setGroup(mName); 202 config->setGroup(mName);
200 203
201 config->writeEntry( "RemotePw", mRemotePw); 204 config->writeEntry( "RemotePw", mRemotePw);
202 config->writeEntry( "RemoteIP", mRemoteIP); 205 config->writeEntry( "RemoteIP", mRemoteIP);
203 config->writeEntry( "RemotePort", mRemotePort); 206 config->writeEntry( "RemotePort", mRemotePort);
204 207
205 config->writeEntry( "RemotePwAB", mRemotePwAB); 208 config->writeEntry( "RemotePwAB", mRemotePwAB);
206 config->writeEntry( "RemoteIPAB", mRemoteIPAB); 209 config->writeEntry( "RemoteIPAB", mRemoteIPAB);
207 config->writeEntry( "RemotePortAB", mRemotePortAB); 210 config->writeEntry( "RemotePortAB", mRemotePortAB);
208 211
209 config->writeEntry( "RemotePwPWM", mRemotePwPWM); 212 config->writeEntry( "RemotePwPWM", mRemotePwPWM);
210 config->writeEntry( "RemoteIPPWM", mRemoteIPPWM); 213 config->writeEntry( "RemoteIPPWM", mRemoteIPPWM);
211 config->writeEntry( "RemotePortPWM", mRemotePortPWM); 214 config->writeEntry( "RemotePortPWM", mRemotePortPWM);
212 215
213 config->writeEntry( "Name", mName ); 216 config->writeEntry( "Name", mName );
214 config->writeEntry( "PreSyncCommand",mPreSyncCommand ); 217 config->writeEntry( "PreSyncCommand",mPreSyncCommand );
215 config->writeEntry( "PostSyncCommand", mPostSyncCommand ); 218 config->writeEntry( "PostSyncCommand", mPostSyncCommand );
216 config->writeEntry( "LocalTempFile", mLocalTempFile ); 219 config->writeEntry( "LocalTempFile", mLocalTempFile );
217 config->writeEntry( "RemoteFileName", mRemoteFileName ); 220 config->writeEntry( "RemoteFileName", mRemoteFileName );
218 221
219 config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB ); 222 config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB );
220 config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB ); 223 config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB );
221 config->writeEntry( "LocalTempFileAB", mLocalTempFileAB ); 224 config->writeEntry( "LocalTempFileAB", mLocalTempFileAB );
222 config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB ); 225 config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB );
223 226
224 config->writeEntry( "PreSyncCommandPWM",mPreSyncCommandPWM ); 227 config->writeEntry( "PreSyncCommandPWM",mPreSyncCommandPWM );
225 config->writeEntry( "PostSyncCommandPWM", mPostSyncCommandPWM ); 228 config->writeEntry( "PostSyncCommandPWM", mPostSyncCommandPWM );
226 config->writeEntry( "LocalTempFilePWM", mLocalTempFilePWM ); 229 config->writeEntry( "LocalTempFilePWM", mLocalTempFilePWM );
227 config->writeEntry( "RemoteFileNamePWM", mRemoteFileNamePWM ); 230 config->writeEntry( "RemoteFileNamePWM", mRemoteFileNamePWM );
228 231
229 config->writeEntry( "PhoneDevice", mPhoneDevice ); 232 config->writeEntry( "PhoneDevice", mPhoneDevice );
230 config->writeEntry( "PhoneConnection", mPhoneConnection ); 233 config->writeEntry( "PhoneConnection", mPhoneConnection );
231 config->writeEntry( "PhoneModel", mPhoneModel ); 234 config->writeEntry( "PhoneModel", mPhoneModel );
232 235
233 config->writeEntry( "IncludeInRingSync",mIncludeInRingSync ); 236 config->writeEntry( "IncludeInRingSync",mIncludeInRingSync );
234 config->writeEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); 237 config->writeEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB );
235 config->writeEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM ); 238 config->writeEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM );
236 config->writeEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); 239 config->writeEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync );
237 config->writeEntry( "AskForPreferences",mAskForPreferences ); 240 config->writeEntry( "AskForPreferences",mAskForPreferences );
238 config->writeEntry( "WriteBackExisting",mWriteBackExisting ); 241 config->writeEntry( "WriteBackExisting",mWriteBackExisting );
239 config->writeEntry( "WriteBackFuture",mWriteBackFuture ); 242 config->writeEntry( "WriteBackFuture",mWriteBackFuture );
240 config->writeEntry( "WriteBackFile",mWriteBackFile ); 243 config->writeEntry( "WriteBackFile",mWriteBackFile );
241 config->writeEntry( "WriteContactToSIM",mWriteContactToSIM ); 244 config->writeEntry( "WriteContactToSIM",mWriteContactToSIM );
242 config->writeEntry( "SyncPrefs", mSyncPrefs ); 245 config->writeEntry( "SyncPrefs", mSyncPrefs );
243 config->writeEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks); 246 config->writeEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks);
244 config->writeEntry( "IsLocalFileSync", mIsLocalFileSync ); 247 config->writeEntry( "IsLocalFileSync", mIsLocalFileSync );
245 config->writeEntry( "IsPhoneSync", mIsPhoneSync ); 248 config->writeEntry( "IsPhoneSync", mIsPhoneSync );
246 config->writeEntry( "IsPiSync", mIsPiSync ); 249 config->writeEntry( "IsPiSync", mIsPiSync );
250 config->writeEntry( "IsKapiFile", mIsKapiFile );
247} 251}
248 252
diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h
index 6a68bd7..0a59111 100644
--- a/libkdepim/ksyncprofile.h
+++ b/libkdepim/ksyncprofile.h
@@ -1,185 +1,188 @@
1/* 1/*
2 This file is part of KDE-Pim/Pi. 2 This file is part of KDE-Pim/Pi.
3 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> 3 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef _KSYNCPROFILE_H 20#ifndef _KSYNCPROFILE_H
21#define _KSYNCPROFILE_H 21#define _KSYNCPROFILE_H
22 22
23#include <qptrlist.h> 23#include <qptrlist.h>
24#include <qcolor.h> 24#include <qcolor.h>
25#include <qfont.h> 25#include <qfont.h>
26#include <qstringlist.h> 26#include <qstringlist.h>
27#include <qobject.h> 27#include <qobject.h>
28#include <qstring.h> 28#include <qstring.h>
29 29
30#include <libkcal/syncdefines.h> 30#include <libkcal/syncdefines.h>
31 31
32 32
33 33
34class KConfig; 34class KConfig;
35 35
36 36
37class KSyncProfile : public QObject { 37class KSyncProfile : public QObject {
38 public: 38 public:
39 KSyncProfile(); 39 KSyncProfile();
40 ~KSyncProfile() ; 40 ~KSyncProfile() ;
41 41
42 KSyncProfile* clone(); 42 KSyncProfile* clone();
43 void setDefault(); 43 void setDefault();
44 void readConfig(KConfig *); 44 void readConfig(KConfig *);
45 void writeConfig(KConfig *); 45 void writeConfig(KConfig *);
46 void deleteConfig(KConfig *); 46 void deleteConfig(KConfig *);
47 47
48 void setRemotePw( const QString& n ) {mRemotePw = n;} 48 void setRemotePw( const QString& n ) {mRemotePw = n;}
49 QString getRemotePw( ) { return mRemotePw; } 49 QString getRemotePw( ) { return mRemotePw; }
50 void setRemotePwAB( const QString& n ) {mRemotePwAB = n;} 50 void setRemotePwAB( const QString& n ) {mRemotePwAB = n;}
51 QString getRemotePwAB( ) { return mRemotePwAB; } 51 QString getRemotePwAB( ) { return mRemotePwAB; }
52 void setRemotePwPWM( const QString& n ) {mRemotePwPWM = n;} 52 void setRemotePwPWM( const QString& n ) {mRemotePwPWM = n;}
53 QString getRemotePwPWM( ) { return mRemotePwPWM; } 53 QString getRemotePwPWM( ) { return mRemotePwPWM; }
54 54
55 void setRemoteIP( const QString& n ) {mRemoteIP = n;} 55 void setRemoteIP( const QString& n ) {mRemoteIP = n;}
56 QString getRemoteIP( ) { return mRemoteIP; } 56 QString getRemoteIP( ) { return mRemoteIP; }
57 void setRemoteIPAB( const QString& n ) {mRemoteIPAB = n;} 57 void setRemoteIPAB( const QString& n ) {mRemoteIPAB = n;}
58 QString getRemoteIPAB( ) { return mRemoteIPAB; } 58 QString getRemoteIPAB( ) { return mRemoteIPAB; }
59 void setRemoteIPPWM( const QString& n ) {mRemoteIPPWM = n;} 59 void setRemoteIPPWM( const QString& n ) {mRemoteIPPWM = n;}
60 QString getRemoteIPPWM( ) { return mRemoteIPPWM; } 60 QString getRemoteIPPWM( ) { return mRemoteIPPWM; }
61 61
62 void setRemotePort( const QString& n ) {mRemotePort = n;} 62 void setRemotePort( const QString& n ) {mRemotePort = n;}
63 QString getRemotePort( ) { return mRemotePort; } 63 QString getRemotePort( ) { return mRemotePort; }
64 void setRemotePortAB( const QString& n ) {mRemotePortAB = n;} 64 void setRemotePortAB( const QString& n ) {mRemotePortAB = n;}
65 QString getRemotePortAB( ) { return mRemotePortAB; } 65 QString getRemotePortAB( ) { return mRemotePortAB; }
66 void setRemotePortPWM( const QString& n ) {mRemotePortPWM = n;} 66 void setRemotePortPWM( const QString& n ) {mRemotePortPWM = n;}
67 QString getRemotePortPWM( ) { return mRemotePortPWM; } 67 QString getRemotePortPWM( ) { return mRemotePortPWM; }
68 68
69 void setPreSyncCommand( const QString& n ) {mPreSyncCommand = n;} 69 void setPreSyncCommand( const QString& n ) {mPreSyncCommand = n;}
70 QString getPreSyncCommand( ) { return mPreSyncCommand; } 70 QString getPreSyncCommand( ) { return mPreSyncCommand; }
71 void setPostSyncCommand( const QString& n ) {mPostSyncCommand = n;} 71 void setPostSyncCommand( const QString& n ) {mPostSyncCommand = n;}
72 QString getPostSyncCommand( ) { return mPostSyncCommand;} 72 QString getPostSyncCommand( ) { return mPostSyncCommand;}
73 void setLocalTempFile( const QString& n ) { mLocalTempFile= n;} 73 void setLocalTempFile( const QString& n ) { mLocalTempFile= n;}
74 QString getLocalTempFile( ) { return mLocalTempFile;} 74 QString getLocalTempFile( ) { return mLocalTempFile;}
75 void setRemoteFileName( const QString& n ) { mRemoteFileName = n;} 75 void setRemoteFileName( const QString& n ) { mRemoteFileName = n;}
76 QString getRemoteFileName( ) { return mRemoteFileName;} 76 QString getRemoteFileName( ) { return mRemoteFileName;}
77 77
78 void setPreSyncCommandAB( const QString& n ) {mPreSyncCommandAB = n;} 78 void setPreSyncCommandAB( const QString& n ) {mPreSyncCommandAB = n;}
79 QString getPreSyncCommandAB( ) { return mPreSyncCommandAB; } 79 QString getPreSyncCommandAB( ) { return mPreSyncCommandAB; }
80 void setPostSyncCommandAB( const QString& n ) {mPostSyncCommandAB = n;} 80 void setPostSyncCommandAB( const QString& n ) {mPostSyncCommandAB = n;}
81 QString getPostSyncCommandAB( ) { return mPostSyncCommandAB;} 81 QString getPostSyncCommandAB( ) { return mPostSyncCommandAB;}
82 void setLocalTempFileAB( const QString& n ) { mLocalTempFileAB= n;} 82 void setLocalTempFileAB( const QString& n ) { mLocalTempFileAB= n;}
83 QString getLocalTempFileAB( ) { return mLocalTempFileAB;} 83 QString getLocalTempFileAB( ) { return mLocalTempFileAB;}
84 void setRemoteFileNameAB( const QString& n ) { mRemoteFileNameAB = n;} 84 void setRemoteFileNameAB( const QString& n ) { mRemoteFileNameAB = n;}
85 QString getRemoteFileNameAB( ) { return mRemoteFileNameAB;} 85 QString getRemoteFileNameAB( ) { return mRemoteFileNameAB;}
86 86
87 void setPreSyncCommandPWM( const QString& n ) {mPreSyncCommandPWM = n;} 87 void setPreSyncCommandPWM( const QString& n ) {mPreSyncCommandPWM = n;}
88 QString getPreSyncCommandPWM( ) { return mPreSyncCommandPWM; } 88 QString getPreSyncCommandPWM( ) { return mPreSyncCommandPWM; }
89 void setPostSyncCommandPWM( const QString& n ) {mPostSyncCommandPWM = n;} 89 void setPostSyncCommandPWM( const QString& n ) {mPostSyncCommandPWM = n;}
90 QString getPostSyncCommandPWM( ) { return mPostSyncCommandPWM;} 90 QString getPostSyncCommandPWM( ) { return mPostSyncCommandPWM;}
91 void setLocalTempFilePWM( const QString& n ) { mLocalTempFilePWM= n;} 91 void setLocalTempFilePWM( const QString& n ) { mLocalTempFilePWM= n;}
92 QString getLocalTempFilePWM( ) { return mLocalTempFilePWM;} 92 QString getLocalTempFilePWM( ) { return mLocalTempFilePWM;}
93 void setRemoteFileNamePWM( const QString& n ) { mRemoteFileNamePWM = n;} 93 void setRemoteFileNamePWM( const QString& n ) { mRemoteFileNamePWM = n;}
94 QString getRemoteFileNamePWM( ) { return mRemoteFileNamePWM;} 94 QString getRemoteFileNamePWM( ) { return mRemoteFileNamePWM;}
95 95
96 void setPhoneDevice( const QString& n ) { mPhoneDevice = n;} 96 void setPhoneDevice( const QString& n ) { mPhoneDevice = n;}
97 QString getPhoneDevice( ) { return mPhoneDevice;} 97 QString getPhoneDevice( ) { return mPhoneDevice;}
98 void setPhoneConnection( const QString& n ) { mPhoneConnection = n;} 98 void setPhoneConnection( const QString& n ) { mPhoneConnection = n;}
99 QString getPhoneConnection( ) { return mPhoneConnection;} 99 QString getPhoneConnection( ) { return mPhoneConnection;}
100 void setPhoneModel( const QString& n ) { mPhoneModel = n;} 100 void setPhoneModel( const QString& n ) { mPhoneModel = n;}
101 QString getPhoneModel( ) { return mPhoneModel;} 101 QString getPhoneModel( ) { return mPhoneModel;}
102 /* 102 /*
103 void set( const QString& n ) { = n;} 103 void set( const QString& n ) { = n;}
104 QString get( ) { return ;} 104 QString get( ) { return ;}
105 */ 105 */
106 106
107 void setName( const QString& n ) {mName = n;} 107 void setName( const QString& n ) {mName = n;}
108 QString getName( ) { return mName;} 108 QString getName( ) { return mName;}
109 void setShowSummaryAfterSync( bool b ) { mShowSummaryAfterSync = b;} 109 void setShowSummaryAfterSync( bool b ) { mShowSummaryAfterSync = b;}
110 bool getShowSummaryAfterSync( ) { return mShowSummaryAfterSync ;} 110 bool getShowSummaryAfterSync( ) { return mShowSummaryAfterSync ;}
111 void setAskForPreferences( bool b ) { mAskForPreferences= b;} 111 void setAskForPreferences( bool b ) { mAskForPreferences= b;}
112 bool getAskForPreferences( ) { return mAskForPreferences;} 112 bool getAskForPreferences( ) { return mAskForPreferences;}
113 void setWriteBackExisting( bool b ) { mWriteBackExisting = b;} 113 void setWriteBackExisting( bool b ) { mWriteBackExisting = b;}
114 bool getWriteBackExisting( ) { return mWriteBackExisting;} 114 bool getWriteBackExisting( ) { return mWriteBackExisting;}
115 void setWriteBackFuture( bool b ) { mWriteBackFuture = b;} 115 void setWriteBackFuture( bool b ) { mWriteBackFuture = b;}
116 bool getWriteBackFuture( ) { return mWriteBackFuture;} 116 bool getWriteBackFuture( ) { return mWriteBackFuture;}
117 void setWriteBackFile( bool b ) { mWriteBackFile= b;} 117 void setWriteBackFile( bool b ) { mWriteBackFile= b;}
118 bool getWriteBackFile( ) { return mWriteBackFile;} 118 bool getWriteBackFile( ) { return mWriteBackFile;}
119 void setWriteContactToSIM( bool b ) { mWriteContactToSIM= b;} 119 void setWriteContactToSIM( bool b ) { mWriteContactToSIM= b;}
120 bool getWriteContactToSIM( ) { return mWriteContactToSIM;} 120 bool getWriteContactToSIM( ) { return mWriteContactToSIM;}
121 void setIncludeInRingSync( bool b ) {mIncludeInRingSync = b;} 121 void setIncludeInRingSync( bool b ) {mIncludeInRingSync = b;}
122 bool getIncludeInRingSync( ) { return mIncludeInRingSync;} 122 bool getIncludeInRingSync( ) { return mIncludeInRingSync;}
123 void setIncludeInRingSyncAB( bool b ) {mIncludeInRingSyncAB = b;} 123 void setIncludeInRingSyncAB( bool b ) {mIncludeInRingSyncAB = b;}
124 bool getIncludeInRingSyncAB( ) { return mIncludeInRingSyncAB;} 124 bool getIncludeInRingSyncAB( ) { return mIncludeInRingSyncAB;}
125 void setIncludeInRingSyncPWM( bool b ) {mIncludeInRingSyncPWM = b;} 125 void setIncludeInRingSyncPWM( bool b ) {mIncludeInRingSyncPWM = b;}
126 bool getIncludeInRingSyncPWM( ) { return mIncludeInRingSyncPWM;} 126 bool getIncludeInRingSyncPWM( ) { return mIncludeInRingSyncPWM;}
127 void setSyncPrefs( int n ) { mSyncPrefs= n;} 127 void setSyncPrefs( int n ) { mSyncPrefs= n;}
128 int getSyncPrefs( ) { return mSyncPrefs;} 128 int getSyncPrefs( ) { return mSyncPrefs;}
129 void setWriteBackFutureWeeks( int n ) { mWriteBackFutureWeeks= n;} 129 void setWriteBackFutureWeeks( int n ) { mWriteBackFutureWeeks= n;}
130 int getWriteBackFutureWeeks( ) { return mWriteBackFutureWeeks;} 130 int getWriteBackFutureWeeks( ) { return mWriteBackFutureWeeks;}
131 void setIsLocalFileSync( bool b ) { mIsLocalFileSync= b;} 131 void setIsLocalFileSync( bool b ) { mIsLocalFileSync= b;}
132 bool getIsLocalFileSync( ) { return mIsLocalFileSync;} 132 bool getIsLocalFileSync( ) { return mIsLocalFileSync;}
133 void setIsPhoneSync( bool b ) { mIsPhoneSync= b;} 133 void setIsPhoneSync( bool b ) { mIsPhoneSync= b;}
134 bool getIsPhoneSync( ) { return mIsPhoneSync;} 134 bool getIsPhoneSync( ) { return mIsPhoneSync;}
135 void setIsPiSync( bool b ) { mIsPiSync= b;} 135 void setIsPiSync( bool b ) { mIsPiSync= b;}
136 bool getIsPiSync( ) { return mIsPiSync;} 136 bool getIsPiSync( ) { return mIsPiSync;}
137 void setIsKapiFile( bool b ) { mIsKapiFile= b;}
138 bool getIsKapiFile( ) { return mIsKapiFile;}
137 private: 139 private:
138 QString mName; 140 QString mName;
139 QString mPreSyncCommand; 141 QString mPreSyncCommand;
140 QString mPostSyncCommand; 142 QString mPostSyncCommand;
141 QString mLocalTempFile; 143 QString mLocalTempFile;
142 QString mRemoteFileName; 144 QString mRemoteFileName;
143 QString mPreSyncCommandAB; 145 QString mPreSyncCommandAB;
144 QString mPostSyncCommandAB; 146 QString mPostSyncCommandAB;
145 QString mLocalTempFileAB; 147 QString mLocalTempFileAB;
146 QString mRemoteFileNameAB; 148 QString mRemoteFileNameAB;
147 QString mPreSyncCommandPWM; 149 QString mPreSyncCommandPWM;
148 QString mPostSyncCommandPWM; 150 QString mPostSyncCommandPWM;
149 QString mLocalTempFilePWM; 151 QString mLocalTempFilePWM;
150 QString mRemoteFileNamePWM; 152 QString mRemoteFileNamePWM;
151 153
152 QString mRemotePw; 154 QString mRemotePw;
153 QString mRemoteIP; 155 QString mRemoteIP;
154 QString mRemotePort; 156 QString mRemotePort;
155 157
156 QString mRemotePwAB; 158 QString mRemotePwAB;
157 QString mRemoteIPAB; 159 QString mRemoteIPAB;
158 QString mRemotePortAB; 160 QString mRemotePortAB;
159 161
160 QString mRemotePwPWM; 162 QString mRemotePwPWM;
161 QString mRemoteIPPWM; 163 QString mRemoteIPPWM;
162 QString mRemotePortPWM; 164 QString mRemotePortPWM;
163 165
164 QString mPhoneDevice; 166 QString mPhoneDevice;
165 QString mPhoneConnection; 167 QString mPhoneConnection;
166 QString mPhoneModel; 168 QString mPhoneModel;
167 169
168 bool mIncludeInRingSync; 170 bool mIncludeInRingSync;
169 bool mIncludeInRingSyncAB; 171 bool mIncludeInRingSyncAB;
170 bool mIncludeInRingSyncPWM; 172 bool mIncludeInRingSyncPWM;
171 int mSyncPrefs; 173 int mSyncPrefs;
172 bool mWriteBackFile; 174 bool mWriteBackFile;
173 bool mWriteBackExisting; 175 bool mWriteBackExisting;
174 bool mWriteBackFuture; 176 bool mWriteBackFuture;
175 int mWriteBackFutureWeeks; 177 int mWriteBackFutureWeeks;
176 bool mAskForPreferences; 178 bool mAskForPreferences;
177 bool mShowSummaryAfterSync; 179 bool mShowSummaryAfterSync;
178 bool mIsLocalFileSync; 180 bool mIsLocalFileSync;
179 bool mIsPhoneSync; 181 bool mIsPhoneSync;
180 bool mWriteContactToSIM; 182 bool mWriteContactToSIM;
181 183
182 bool mIsPiSync; 184 bool mIsPiSync;
185 bool mIsKapiFile;
183}; 186};
184 187
185#endif 188#endif