summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-13 14:23:28 (UTC)
committer zautrix <zautrix>2004-10-13 14:23:28 (UTC)
commit2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6 (patch) (side-by-side diff)
treef1e664ddf31aae347b1a119c9111cbd1c931bf89
parentd41893fb0a49fbb080326a4c1fd98e1a032a182a (diff)
downloadkdepimpi-2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6.zip
kdepimpi-2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6.tar.gz
kdepimpi-2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6.tar.bz2
more sync fixes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kabc/addressbook.cpp15
-rw-r--r--kabc/addressbook.h2
-rw-r--r--kaddressbook/kabcore.cpp4
-rw-r--r--microkde/kresources/configdialog.cpp5
-rw-r--r--microkde/kresources/configdialog.h1
-rw-r--r--microkde/kresources/resource.cpp14
-rw-r--r--microkde/kresources/resource.h2
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
@@ -377,4 +377,5 @@ bool AddressBook::save( Ticket *ticket )
return false;
}
+// exports all Addressees, which are syncable
void AddressBook::export2File( QString fileName )
{
@@ -392,4 +393,5 @@ void AddressBook::export2File( QString fileName )
version = KABC::VCardConverter::v3_0;
for ( it = begin(); it != end(); ++it ) {
+ if ( (*it).resource() && (*it).resource()->includeInSync() ) {
if ( !(*it).IDStr().isEmpty() ) {
(*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() );
@@ -401,4 +403,5 @@ void AddressBook::export2File( QString fileName )
t << vcard << "\r\n";
}
+ }
t << "\r\n\r\n";
outFile.close();
@@ -420,4 +423,6 @@ bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName )
if ( a.isEmpty() )
continue;
+ if ( all && a.resource() && !a.resource()->includeInSync() )
+ continue;
a.simplifyEmails();
a.simplifyPhoneNumbers();
@@ -477,5 +482,5 @@ void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool rem
if ( removeOld )
- setUntagged();
+ setUntagged( true );
KABC::Addressee::List list;
QFile file( fileName );
@@ -507,8 +512,14 @@ void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool rem
removeUntagged();
}
-void AddressBook::setUntagged()
+void AddressBook::setUntagged(bool setNonSyncTagged) // = false)
{
Iterator ait;
for ( ait = begin(); ait != end(); ++ait ) {
+ if ( setNonSyncTagged ) {
+ if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) {
+ (*ait).setTagged( true );
+ } else
+ (*ait).setTagged( false );
+ } else
(*ait).setTagged( false );
}
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index a6bf451..23bba02 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -149,5 +149,5 @@ class AddressBook : public QObject
bool export2PhoneFormat( QStringList uids ,QString fileName );
void importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false );
- void setUntagged();
+ void setUntagged( bool setNonSyncTagged = false );
void removeUntagged();
void findNewExtIds( QString fileName, QString currentSyncDevice );
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index ea34be2..47ed858 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2552,4 +2552,5 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
//inR.setResource( 0 );
if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars
+ if ( !inL.resource() || inL.resource()->includeInSync() ) {
if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) {
//qDebug("take %d %s ", take, inL.summary().latin1());
@@ -2596,4 +2597,5 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
}
}
+ }
} else { // no conflict
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
@@ -2646,4 +2648,5 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
if ( !skipIncidence ) {
inL = local->findByUid( uid );
+ if ( !inL.resource() || inL.resource()->includeInSync() ) {
inR = remote->findByUid( uid );
if ( inR.isEmpty() ) {
@@ -2683,4 +2686,5 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
}
}
+ }
++incCounter;
}
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
@@ -76,6 +76,10 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily,
if (!mResource->isSyncable()) {
+ new QLabel("", generalGroupBox );
mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox );
mReadOnly->setChecked( mResource->readOnly() );
+ new QLabel("", generalGroupBox );
+ mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox );
+ mIncludeInSync->setChecked( mResource->includeInSync() );
}
@@ -221,4 +225,5 @@ void ConfigDialog::accept()
if (!mResource->isSyncable())
mResource->setReadOnly( mReadOnly->isChecked() );
+ mResource->setIncludeInSync( mIncludeInSync->isChecked() );
if ( mConfigWidget ) {
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
@@ -59,4 +59,5 @@ class ConfigDialog : public KDialogBase
KLineEdit *mName;
QCheckBox *mReadOnly;
+ QCheckBox *mIncludeInSync;
//US add a persistent readonly flag. We need that for opie and qtopia addressbooks.
bool mPersistentReadOnly;
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
@@ -40,4 +40,5 @@ class Resource::ResourcePrivate
QString mIdentifier;
bool mReadOnly;
+ bool mIncludeInSync;
QString mName;
bool mActive;
@@ -64,4 +65,5 @@ Resource::Resource( const KConfig* config )
d->mName = cfg->readEntry( "ResourceName" );
d->mReadOnly = cfg->readBoolEntry( "ResourceIsReadOnly", false );
+ d->mIncludeInSync = cfg->readBoolEntry( "ResourceIncludeInSync", true );;
d->mActive = cfg->readBoolEntry( "ResourceIsActive", true );
d->mIdentifier = cfg->readEntry( "ResourceIdentifier" );
@@ -70,4 +72,5 @@ Resource::Resource( const KConfig* config )
d->mName = "resource-name";
d->mReadOnly = false;
+ d->mIncludeInSync = true;
d->mActive = true;
d->mIdentifier = KApplication::randomString( 10 );
@@ -83,9 +86,8 @@ Resource::~Resource()
void Resource::writeConfig( KConfig* config )
{
-
-
config->writeEntry( "ResourceType", d->mType );
config->writeEntry( "ResourceName", d->mName );
config->writeEntry( "ResourceIsReadOnly", d->mReadOnly );
+ config->writeEntry( "ResourceIncludeInSync", d->mIncludeInSync );
config->writeEntry( "ResourceIsActive", d->mActive );
config->writeEntry( "ResourceIdentifier", d->mIdentifier );
@@ -150,4 +152,12 @@ QString Resource::type() const
}
+void Resource::setIncludeInSync( bool value )
+{
+ d->mIncludeInSync = value;
+}
+bool Resource::includeInSync() const
+{
+ return d->mIncludeInSync;
+}
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
@@ -311,4 +311,6 @@ class Resource : public QObject
virtual bool readOnly() const;
+ void setIncludeInSync( bool value );
+ bool includeInSync() const;
/**
* Set the name of resource.You can override this method,