summaryrefslogtreecommitdiffabout
path: root/kabc
Side-by-side diff
Diffstat (limited to 'kabc') (more/less context) (show whitespace changes)
-rw-r--r--kabc/addressbook.cpp15
-rw-r--r--kabc/addressbook.h2
2 files changed, 14 insertions, 3 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 8882259..592d78d 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -375,8 +375,9 @@ bool AddressBook::save( Ticket *ticket )
}
return false;
}
+// exports all Addressees, which are syncable
void AddressBook::export2File( QString fileName )
{
QFile outFile( fileName );
@@ -390,8 +391,9 @@ void AddressBook::export2File( QString fileName )
Iterator it;
KABC::VCardConverter::Version version;
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() );
}
KABC::VCardConverter converter;
@@ -399,8 +401,9 @@ void AddressBook::export2File( QString fileName )
//Resource *resource() const;
converter.addresseeToVCard( *it, vcard, version );
t << vcard << "\r\n";
}
+ }
t << "\r\n\r\n";
outFile.close();
}
// if QStringList uids is empty, all are exported
@@ -418,8 +421,10 @@ bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName )
}
KABC::Addressee a = ( *it );
if ( a.isEmpty() )
continue;
+ if ( all && a.resource() && !a.resource()->includeInSync() )
+ continue;
a.simplifyEmails();
a.simplifyPhoneNumbers();
a.simplifyPhoneNumberTypes();
a.simplifyAddresses();
@@ -475,9 +480,9 @@ bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName )
void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool removeOld )
{
if ( removeOld )
- setUntagged();
+ setUntagged( true );
KABC::Addressee::List list;
QFile file( fileName );
file.open( IO_ReadOnly );
QByteArray rawData = file.readAll();
@@ -505,12 +510,18 @@ void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool rem
}
if ( removeOld )
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 );
}
}
void AddressBook::removeUntagged()
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index a6bf451..23bba02 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -147,9 +147,9 @@ class AddressBook : public QObject
void preparePhoneSync( QString currentSyncDevice, bool isPreSync );
void export2File( QString fileName );
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 );
/**
Returns a iterator for first entry of address book.