-rw-r--r-- | kabc/addressbook.cpp | 35 | ||||
-rw-r--r-- | kabc/addressbook.h | 2 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 146 | ||||
-rw-r--r-- | microkde/kresources/configdialog.cpp | 5 | ||||
-rw-r--r-- | microkde/kresources/configdialog.h | 1 | ||||
-rw-r--r-- | microkde/kresources/resource.cpp | 14 | ||||
-rw-r--r-- | microkde/kresources/resource.h | 2 |
7 files changed, 119 insertions, 86 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 8882259..592d78d 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -378,2 +378,3 @@ bool AddressBook::save( Ticket *ticket ) | |||
378 | } | 378 | } |
379 | // exports all Addressees, which are syncable | ||
379 | void AddressBook::export2File( QString fileName ) | 380 | void AddressBook::export2File( QString fileName ) |
@@ -392,11 +393,13 @@ void AddressBook::export2File( QString fileName ) | |||
392 | version = KABC::VCardConverter::v3_0; | 393 | version = KABC::VCardConverter::v3_0; |
393 | for ( it = begin(); it != end(); ++it ) { | 394 | for ( it = begin(); it != end(); ++it ) { |
394 | if ( !(*it).IDStr().isEmpty() ) { | 395 | if ( (*it).resource() && (*it).resource()->includeInSync() ) { |
395 | (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); | 396 | if ( !(*it).IDStr().isEmpty() ) { |
397 | (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); | ||
398 | } | ||
399 | KABC::VCardConverter converter; | ||
400 | QString vcard; | ||
401 | //Resource *resource() const; | ||
402 | converter.addresseeToVCard( *it, vcard, version ); | ||
403 | t << vcard << "\r\n"; | ||
396 | } | 404 | } |
397 | KABC::VCardConverter converter; | ||
398 | QString vcard; | ||
399 | //Resource *resource() const; | ||
400 | converter.addresseeToVCard( *it, vcard, version ); | ||
401 | t << vcard << "\r\n"; | ||
402 | } | 405 | } |
@@ -417,3 +420,3 @@ bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName ) | |||
417 | continue; | 420 | continue; |
418 | } | 421 | } |
419 | KABC::Addressee a = ( *it ); | 422 | KABC::Addressee a = ( *it ); |
@@ -421,2 +424,4 @@ bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName ) | |||
421 | continue; | 424 | continue; |
425 | if ( all && a.resource() && !a.resource()->includeInSync() ) | ||
426 | continue; | ||
422 | a.simplifyEmails(); | 427 | a.simplifyEmails(); |
@@ -478,3 +483,3 @@ void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool rem | |||
478 | if ( removeOld ) | 483 | if ( removeOld ) |
479 | setUntagged(); | 484 | setUntagged( true ); |
480 | KABC::Addressee::List list; | 485 | KABC::Addressee::List list; |
@@ -508,3 +513,3 @@ void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool rem | |||
508 | } | 513 | } |
509 | void AddressBook::setUntagged() | 514 | void AddressBook::setUntagged(bool setNonSyncTagged) // = false) |
510 | { | 515 | { |
@@ -512,3 +517,9 @@ void AddressBook::setUntagged() | |||
512 | for ( ait = begin(); ait != end(); ++ait ) { | 517 | for ( ait = begin(); ait != end(); ++ait ) { |
513 | (*ait).setTagged( false ); | 518 | if ( setNonSyncTagged ) { |
519 | if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) { | ||
520 | (*ait).setTagged( true ); | ||
521 | } else | ||
522 | (*ait).setTagged( false ); | ||
523 | } else | ||
524 | (*ait).setTagged( false ); | ||
514 | } | 525 | } |
diff --git a/kabc/addressbook.h b/kabc/addressbook.h index a6bf451..23bba02 100644 --- a/kabc/addressbook.h +++ b/kabc/addressbook.h | |||
@@ -150,3 +150,3 @@ class AddressBook : public QObject | |||
150 | void importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false ); | 150 | void importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false ); |
151 | void setUntagged(); | 151 | void setUntagged( bool setNonSyncTagged = false ); |
152 | void removeUntagged(); | 152 | void removeUntagged(); |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index ea34be2..47ed858 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2553,44 +2553,46 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
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 ( !inL.resource() || inL.resource()->includeInSync() ) { |
2555 | //qDebug("take %d %s ", take, inL.summary().latin1()); | 2555 | if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { |
2556 | if ( take == 3 ) | 2556 | //qDebug("take %d %s ", take, inL.summary().latin1()); |
2557 | return false; | 2557 | if ( take == 3 ) |
2558 | if ( take == 1 ) {// take local | 2558 | return false; |
2559 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2559 | if ( take == 1 ) {// take local |
2560 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 2560 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2561 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 2561 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
2562 | local->insertAddressee( inL, false ); | 2562 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
2563 | idS = inR.externalUID(); | 2563 | local->insertAddressee( inL, false ); |
2564 | OidS = inR.originalExternalUID(); | 2564 | idS = inR.externalUID(); |
2565 | } | 2565 | OidS = inR.originalExternalUID(); |
2566 | else | 2566 | } |
2567 | idS = inR.IDStr(); | 2567 | else |
2568 | remote->removeAddressee( inR ); | 2568 | idS = inR.IDStr(); |
2569 | inR = inL; | 2569 | remote->removeAddressee( inR ); |
2570 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 2570 | inR = inL; |
2571 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2571 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
2572 | inR.setOriginalExternalUID( OidS ); | 2572 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2573 | inR.setExternalUID( idS ); | 2573 | inR.setOriginalExternalUID( OidS ); |
2574 | } else { | 2574 | inR.setExternalUID( idS ); |
2575 | inR.setIDStr( idS ); | 2575 | } else { |
2576 | } | 2576 | inR.setIDStr( idS ); |
2577 | inR.setResource( 0 ); | 2577 | } |
2578 | remote->insertAddressee( inR , false); | 2578 | inR.setResource( 0 ); |
2579 | ++changedRemote; | 2579 | remote->insertAddressee( inR , false); |
2580 | } else { // take == 2 take remote | 2580 | ++changedRemote; |
2581 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2581 | } else { // take == 2 take remote |
2582 | if ( inR.revision().date().year() < 2004 ) | 2582 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2583 | inR.setRevision( modifiedCalendar ); | 2583 | if ( inR.revision().date().year() < 2004 ) |
2584 | } | 2584 | inR.setRevision( modifiedCalendar ); |
2585 | idS = inL.IDStr(); | 2585 | } |
2586 | local->removeAddressee( inL ); | 2586 | idS = inL.IDStr(); |
2587 | inL = inR; | 2587 | local->removeAddressee( inL ); |
2588 | inL.setIDStr( idS ); | 2588 | inL = inR; |
2589 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2589 | inL.setIDStr( idS ); |
2590 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 2590 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2591 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 2591 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
2592 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | ||
2593 | } | ||
2594 | inL.setResource( 0 ); | ||
2595 | local->insertAddressee( inL , false ); | ||
2596 | ++changedLocal; | ||
2592 | } | 2597 | } |
2593 | inL.setResource( 0 ); | ||
2594 | local->insertAddressee( inL , false ); | ||
2595 | ++changedLocal; | ||
2596 | } | 2598 | } |
@@ -2647,34 +2649,36 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2647 | inL = local->findByUid( uid ); | 2649 | inL = local->findByUid( uid ); |
2648 | inR = remote->findByUid( uid ); | 2650 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
2649 | if ( inR.isEmpty() ) { | 2651 | inR = remote->findByUid( uid ); |
2650 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2652 | if ( inR.isEmpty() ) { |
2651 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 2653 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2652 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 2654 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
2653 | local->removeAddressee( inL ); | 2655 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
2654 | ++deletedAddresseeL; | 2656 | local->removeAddressee( inL ); |
2655 | } else { | 2657 | ++deletedAddresseeL; |
2656 | if ( ! syncManager->mWriteBackExistingOnly ) { | 2658 | } else { |
2657 | inL.removeID(mCurrentSyncDevice ); | 2659 | if ( ! syncManager->mWriteBackExistingOnly ) { |
2658 | ++addedAddresseeR; | 2660 | inL.removeID(mCurrentSyncDevice ); |
2659 | inL.setRevision( modifiedCalendar ); | 2661 | ++addedAddresseeR; |
2660 | local->insertAddressee( inL, false ); | 2662 | inL.setRevision( modifiedCalendar ); |
2661 | inR = inL; | 2663 | local->insertAddressee( inL, false ); |
2662 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); | 2664 | inR = inL; |
2663 | inR.setResource( 0 ); | 2665 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); |
2664 | remote->insertAddressee( inR, false ); | 2666 | inR.setResource( 0 ); |
2667 | remote->insertAddressee( inR, false ); | ||
2668 | } | ||
2665 | } | 2669 | } |
2666 | } | ||
2667 | } else { | ||
2668 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { | ||
2669 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | ||
2670 | local->removeAddressee( inL ); | ||
2671 | ++deletedAddresseeL; | ||
2672 | } else { | 2670 | } else { |
2673 | if ( ! syncManager->mWriteBackExistingOnly ) { | 2671 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { |
2674 | ++addedAddresseeR; | 2672 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
2675 | inL.setRevision( modifiedCalendar ); | 2673 | local->removeAddressee( inL ); |
2676 | local->insertAddressee( inL, false ); | 2674 | ++deletedAddresseeL; |
2677 | inR = inL; | 2675 | } else { |
2678 | inR.setResource( 0 ); | 2676 | if ( ! syncManager->mWriteBackExistingOnly ) { |
2679 | remote->insertAddressee( inR, false ); | 2677 | ++addedAddresseeR; |
2678 | inL.setRevision( modifiedCalendar ); | ||
2679 | local->insertAddressee( inL, false ); | ||
2680 | inR = inL; | ||
2681 | inR.setResource( 0 ); | ||
2682 | remote->insertAddressee( inR, false ); | ||
2683 | } | ||
2680 | } | 2684 | } |
diff --git a/microkde/kresources/configdialog.cpp b/microkde/kresources/configdialog.cpp index f8240f9..030b547 100644 --- a/microkde/kresources/configdialog.cpp +++ b/microkde/kresources/configdialog.cpp | |||
@@ -77,4 +77,8 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, | |||
77 | if (!mResource->isSyncable()) { | 77 | if (!mResource->isSyncable()) { |
78 | new QLabel("", generalGroupBox ); | ||
78 | mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox ); | 79 | mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox ); |
79 | mReadOnly->setChecked( mResource->readOnly() ); | 80 | mReadOnly->setChecked( mResource->readOnly() ); |
81 | new QLabel("", generalGroupBox ); | ||
82 | mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox ); | ||
83 | mIncludeInSync->setChecked( mResource->includeInSync() ); | ||
80 | } | 84 | } |
@@ -222,2 +226,3 @@ void ConfigDialog::accept() | |||
222 | mResource->setReadOnly( mReadOnly->isChecked() ); | 226 | mResource->setReadOnly( mReadOnly->isChecked() ); |
227 | mResource->setIncludeInSync( mIncludeInSync->isChecked() ); | ||
223 | 228 | ||
diff --git a/microkde/kresources/configdialog.h b/microkde/kresources/configdialog.h index 63cd4e9..ed3ecab 100644 --- a/microkde/kresources/configdialog.h +++ b/microkde/kresources/configdialog.h | |||
@@ -60,2 +60,3 @@ class ConfigDialog : public KDialogBase | |||
60 | QCheckBox *mReadOnly; | 60 | QCheckBox *mReadOnly; |
61 | QCheckBox *mIncludeInSync; | ||
61 | //US add a persistent readonly flag. We need that for opie and qtopia addressbooks. | 62 | //US add a persistent readonly flag. We need that for opie and qtopia addressbooks. |
diff --git a/microkde/kresources/resource.cpp b/microkde/kresources/resource.cpp index 4f69540..f79bcd0 100644 --- a/microkde/kresources/resource.cpp +++ b/microkde/kresources/resource.cpp | |||
@@ -41,2 +41,3 @@ class Resource::ResourcePrivate | |||
41 | bool mReadOnly; | 41 | bool mReadOnly; |
42 | bool mIncludeInSync; | ||
42 | QString mName; | 43 | QString mName; |
@@ -65,2 +66,3 @@ Resource::Resource( const KConfig* config ) | |||
65 | d->mReadOnly = cfg->readBoolEntry( "ResourceIsReadOnly", false ); | 66 | d->mReadOnly = cfg->readBoolEntry( "ResourceIsReadOnly", false ); |
67 | d->mIncludeInSync = cfg->readBoolEntry( "ResourceIncludeInSync", true );; | ||
66 | d->mActive = cfg->readBoolEntry( "ResourceIsActive", true ); | 68 | d->mActive = cfg->readBoolEntry( "ResourceIsActive", true ); |
@@ -71,2 +73,3 @@ Resource::Resource( const KConfig* config ) | |||
71 | d->mReadOnly = false; | 73 | d->mReadOnly = false; |
74 | d->mIncludeInSync = true; | ||
72 | d->mActive = true; | 75 | d->mActive = true; |
@@ -84,4 +87,2 @@ void Resource::writeConfig( KConfig* config ) | |||
84 | { | 87 | { |
85 | |||
86 | |||
87 | config->writeEntry( "ResourceType", d->mType ); | 88 | config->writeEntry( "ResourceType", d->mType ); |
@@ -89,2 +90,3 @@ void Resource::writeConfig( KConfig* config ) | |||
89 | config->writeEntry( "ResourceIsReadOnly", d->mReadOnly ); | 90 | config->writeEntry( "ResourceIsReadOnly", d->mReadOnly ); |
91 | config->writeEntry( "ResourceIncludeInSync", d->mIncludeInSync ); | ||
90 | config->writeEntry( "ResourceIsActive", d->mActive ); | 92 | config->writeEntry( "ResourceIsActive", d->mActive ); |
@@ -151,2 +153,10 @@ QString Resource::type() const | |||
151 | 153 | ||
154 | void Resource::setIncludeInSync( bool value ) | ||
155 | { | ||
156 | d->mIncludeInSync = value; | ||
157 | } | ||
158 | bool Resource::includeInSync() const | ||
159 | { | ||
160 | return d->mIncludeInSync; | ||
161 | } | ||
152 | void Resource::setReadOnly( bool value ) | 162 | void Resource::setReadOnly( bool value ) |
diff --git a/microkde/kresources/resource.h b/microkde/kresources/resource.h index 580b5d1..70b5613 100644 --- a/microkde/kresources/resource.h +++ b/microkde/kresources/resource.h | |||
@@ -312,2 +312,4 @@ class Resource : public QObject | |||
312 | 312 | ||
313 | void setIncludeInSync( bool value ); | ||
314 | bool includeInSync() const; | ||
313 | /** | 315 | /** |