author | zautrix <zautrix> | 2004-10-13 14:23:28 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-13 14:23:28 (UTC) |
commit | 2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6 (patch) (unidiff) | |
tree | f1e664ddf31aae347b1a119c9111cbd1c931bf89 | |
parent | d41893fb0a49fbb080326a4c1fd98e1a032a182a (diff) | |
download | kdepimpi-2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6.zip kdepimpi-2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6.tar.gz kdepimpi-2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6.tar.bz2 |
more sync fixes
-rw-r--r-- | kabc/addressbook.cpp | 15 | ||||
-rw-r--r-- | kabc/addressbook.h | 2 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 4 | ||||
-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, 38 insertions, 5 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 8882259..592d78d 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -376,6 +376,7 @@ bool AddressBook::save( Ticket *ticket ) | |||
376 | 376 | ||
377 | return false; | 377 | return false; |
378 | } | 378 | } |
379 | // exports all Addressees, which are syncable | ||
379 | void AddressBook::export2File( QString fileName ) | 380 | void AddressBook::export2File( QString fileName ) |
380 | { | 381 | { |
381 | 382 | ||
@@ -391,6 +392,7 @@ void AddressBook::export2File( QString fileName ) | |||
391 | KABC::VCardConverter::Version version; | 392 | KABC::VCardConverter::Version version; |
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 ) { |
395 | if ( (*it).resource() && (*it).resource()->includeInSync() ) { | ||
394 | if ( !(*it).IDStr().isEmpty() ) { | 396 | if ( !(*it).IDStr().isEmpty() ) { |
395 | (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); | 397 | (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); |
396 | } | 398 | } |
@@ -400,6 +402,7 @@ void AddressBook::export2File( QString fileName ) | |||
400 | converter.addresseeToVCard( *it, vcard, version ); | 402 | converter.addresseeToVCard( *it, vcard, version ); |
401 | t << vcard << "\r\n"; | 403 | t << vcard << "\r\n"; |
402 | } | 404 | } |
405 | } | ||
403 | t << "\r\n\r\n"; | 406 | t << "\r\n\r\n"; |
404 | outFile.close(); | 407 | outFile.close(); |
405 | } | 408 | } |
@@ -419,6 +422,8 @@ bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName ) | |||
419 | KABC::Addressee a = ( *it ); | 422 | KABC::Addressee a = ( *it ); |
420 | if ( a.isEmpty() ) | 423 | if ( a.isEmpty() ) |
421 | continue; | 424 | continue; |
425 | if ( all && a.resource() && !a.resource()->includeInSync() ) | ||
426 | continue; | ||
422 | a.simplifyEmails(); | 427 | a.simplifyEmails(); |
423 | a.simplifyPhoneNumbers(); | 428 | a.simplifyPhoneNumbers(); |
424 | a.simplifyPhoneNumberTypes(); | 429 | a.simplifyPhoneNumberTypes(); |
@@ -476,7 +481,7 @@ void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool rem | |||
476 | { | 481 | { |
477 | 482 | ||
478 | if ( removeOld ) | 483 | if ( removeOld ) |
479 | setUntagged(); | 484 | setUntagged( true ); |
480 | KABC::Addressee::List list; | 485 | KABC::Addressee::List list; |
481 | QFile file( fileName ); | 486 | QFile file( fileName ); |
482 | file.open( IO_ReadOnly ); | 487 | file.open( IO_ReadOnly ); |
@@ -506,10 +511,16 @@ void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool rem | |||
506 | if ( removeOld ) | 511 | if ( removeOld ) |
507 | removeUntagged(); | 512 | removeUntagged(); |
508 | } | 513 | } |
509 | void AddressBook::setUntagged() | 514 | void AddressBook::setUntagged(bool setNonSyncTagged) // = false) |
510 | { | 515 | { |
511 | Iterator ait; | 516 | Iterator ait; |
512 | for ( ait = begin(); ait != end(); ++ait ) { | 517 | for ( ait = begin(); ait != end(); ++ait ) { |
518 | if ( setNonSyncTagged ) { | ||
519 | if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) { | ||
520 | (*ait).setTagged( true ); | ||
521 | } else | ||
522 | (*ait).setTagged( false ); | ||
523 | } else | ||
513 | (*ait).setTagged( false ); | 524 | (*ait).setTagged( false ); |
514 | } | 525 | } |
515 | } | 526 | } |
diff --git a/kabc/addressbook.h b/kabc/addressbook.h index a6bf451..23bba02 100644 --- a/kabc/addressbook.h +++ b/kabc/addressbook.h | |||
@@ -148,7 +148,7 @@ class AddressBook : public QObject | |||
148 | void export2File( QString fileName ); | 148 | void export2File( QString fileName ); |
149 | bool export2PhoneFormat( QStringList uids ,QString fileName ); | 149 | bool export2PhoneFormat( QStringList uids ,QString fileName ); |
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(); |
153 | void findNewExtIds( QString fileName, QString currentSyncDevice ); | 153 | void findNewExtIds( QString fileName, QString currentSyncDevice ); |
154 | /** | 154 | /** |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index ea34be2..47ed858 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2551,6 +2551,7 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
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 ( !inL.resource() || inL.resource()->includeInSync() ) { | ||
2554 | if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { | 2555 | if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { |
2555 | //qDebug("take %d %s ", take, inL.summary().latin1()); | 2556 | //qDebug("take %d %s ", take, inL.summary().latin1()); |
2556 | if ( take == 3 ) | 2557 | if ( take == 3 ) |
@@ -2595,6 +2596,7 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2595 | ++changedLocal; | 2596 | ++changedLocal; |
2596 | } | 2597 | } |
2597 | } | 2598 | } |
2599 | } | ||
2598 | } else { // no conflict | 2600 | } else { // no conflict |
2599 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2601 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2600 | QString des = addresseeLSync.note(); | 2602 | QString des = addresseeLSync.note(); |
@@ -2645,6 +2647,7 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2645 | skipIncidence = true; | 2647 | skipIncidence = true; |
2646 | if ( !skipIncidence ) { | 2648 | if ( !skipIncidence ) { |
2647 | inL = local->findByUid( uid ); | 2649 | inL = local->findByUid( uid ); |
2650 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | ||
2648 | inR = remote->findByUid( uid ); | 2651 | inR = remote->findByUid( uid ); |
2649 | if ( inR.isEmpty() ) { | 2652 | if ( inR.isEmpty() ) { |
2650 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2653 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
@@ -2682,6 +2685,7 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2682 | } | 2685 | } |
2683 | } | 2686 | } |
2684 | } | 2687 | } |
2688 | } | ||
2685 | ++incCounter; | 2689 | ++incCounter; |
2686 | } | 2690 | } |
2687 | el.clear(); | 2691 | el.clear(); |
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 | |||
@@ -75,8 +75,12 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, | |||
75 | mName = new KLineEdit( generalGroupBox ); | 75 | mName = new KLineEdit( generalGroupBox ); |
76 | 76 | ||
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 | } |
81 | 85 | ||
82 | mName->setText( mResource->resourceName() ); | 86 | mName->setText( mResource->resourceName() ); |
@@ -220,6 +224,7 @@ void ConfigDialog::accept() | |||
220 | mResource->setResourceName( mName->text() ); | 224 | mResource->setResourceName( mName->text() ); |
221 | if (!mResource->isSyncable()) | 225 | if (!mResource->isSyncable()) |
222 | mResource->setReadOnly( mReadOnly->isChecked() ); | 226 | mResource->setReadOnly( mReadOnly->isChecked() ); |
227 | mResource->setIncludeInSync( mIncludeInSync->isChecked() ); | ||
223 | 228 | ||
224 | if ( mConfigWidget ) { | 229 | if ( mConfigWidget ) { |
225 | // First save generic information | 230 | // First save generic information |
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 | |||
@@ -58,6 +58,7 @@ class ConfigDialog : public KDialogBase | |||
58 | 58 | ||
59 | KLineEdit *mName; | 59 | KLineEdit *mName; |
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. |
62 | bool mPersistentReadOnly; | 63 | bool mPersistentReadOnly; |
63 | }; | 64 | }; |
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 | |||
@@ -39,6 +39,7 @@ class Resource::ResourcePrivate | |||
39 | QString mType; | 39 | QString mType; |
40 | QString mIdentifier; | 40 | QString mIdentifier; |
41 | bool mReadOnly; | 41 | bool mReadOnly; |
42 | bool mIncludeInSync; | ||
42 | QString mName; | 43 | QString mName; |
43 | bool mActive; | 44 | bool mActive; |
44 | bool mIsOpen; | 45 | bool mIsOpen; |
@@ -63,12 +64,14 @@ Resource::Resource( const KConfig* config ) | |||
63 | d->mType = cfg->readEntry( "ResourceType" ); | 64 | d->mType = cfg->readEntry( "ResourceType" ); |
64 | d->mName = cfg->readEntry( "ResourceName" ); | 65 | d->mName = cfg->readEntry( "ResourceName" ); |
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 ); |
67 | d->mIdentifier = cfg->readEntry( "ResourceIdentifier" ); | 69 | d->mIdentifier = cfg->readEntry( "ResourceIdentifier" ); |
68 | } else { | 70 | } else { |
69 | d->mType = "type"; | 71 | d->mType = "type"; |
70 | d->mName = "resource-name"; | 72 | d->mName = "resource-name"; |
71 | d->mReadOnly = false; | 73 | d->mReadOnly = false; |
74 | d->mIncludeInSync = true; | ||
72 | d->mActive = true; | 75 | d->mActive = true; |
73 | d->mIdentifier = KApplication::randomString( 10 ); | 76 | d->mIdentifier = KApplication::randomString( 10 ); |
74 | } | 77 | } |
@@ -82,11 +85,10 @@ Resource::~Resource() | |||
82 | 85 | ||
83 | void Resource::writeConfig( KConfig* config ) | 86 | void Resource::writeConfig( KConfig* config ) |
84 | { | 87 | { |
85 | |||
86 | |||
87 | config->writeEntry( "ResourceType", d->mType ); | 88 | config->writeEntry( "ResourceType", d->mType ); |
88 | config->writeEntry( "ResourceName", d->mName ); | 89 | config->writeEntry( "ResourceName", d->mName ); |
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 ); |
91 | config->writeEntry( "ResourceIdentifier", d->mIdentifier ); | 93 | config->writeEntry( "ResourceIdentifier", d->mIdentifier ); |
92 | } | 94 | } |
@@ -149,6 +151,14 @@ QString Resource::type() const | |||
149 | return d->mType; | 151 | return d->mType; |
150 | } | 152 | } |
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 ) |
153 | { | 163 | { |
154 | d->mReadOnly = value; | 164 | d->mReadOnly = 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 | |||
@@ -310,6 +310,8 @@ class Resource : public QObject | |||
310 | */ | 310 | */ |
311 | virtual bool readOnly() const; | 311 | virtual bool readOnly() const; |
312 | 312 | ||
313 | void setIncludeInSync( bool value ); | ||
314 | bool includeInSync() const; | ||
313 | /** | 315 | /** |
314 | * Set the name of resource.You can override this method, | 316 | * Set the name of resource.You can override this method, |
315 | * but also remember to call Resource::setResourceName(). | 317 | * but also remember to call Resource::setResourceName(). |