summaryrefslogtreecommitdiffabout
path: root/kabc
authorzautrix <zautrix>2005-12-02 09:42:53 (UTC)
committer zautrix <zautrix>2005-12-02 09:42:53 (UTC)
commita75d2c26aba6cffae8c3f61e173940240042427b (patch) (side-by-side diff)
tree68f4b61c150bc263a98c78fdf8671bbbc17cdaf8 /kabc
parent64be8d64fc26d1025a24150d065197ba5d608f3d (diff)
downloadkdepimpi-a75d2c26aba6cffae8c3f61e173940240042427b.zip
kdepimpi-a75d2c26aba6cffae8c3f61e173940240042427b.tar.gz
kdepimpi-a75d2c26aba6cffae8c3f61e173940240042427b.tar.bz2
more sync
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp42
-rw-r--r--kabc/addressbook.h4
2 files changed, 35 insertions, 11 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index e04f4b1..bdc2762 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -485,3 +485,3 @@ bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName )
}
-int AddressBook::importFromFile( QString fileName, bool replaceLabel, bool removeOld )
+int AddressBook::importFromFile( QString fileName, bool replaceLabel, bool removeOld, QString resource )
{
@@ -489,3 +489,3 @@ int AddressBook::importFromFile( QString fileName, bool replaceLabel, bool remo
if ( removeOld )
- setUntagged( true );
+ setUntagged( true, resource );
KABC::Addressee::List list;
@@ -505,2 +505,16 @@ int AddressBook::importFromFile( QString fileName, bool replaceLabel, bool remo
KABC::Addressee::List::Iterator it;
+
+ Resource * setRes = 0;
+ if ( !resource.isEmpty() ) {
+ KRES::Manager<Resource>::ActiveIterator it;
+ KRES::Manager<Resource> *manager = d->mManager;
+ for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
+ qDebug("SaveAB::checking resource..." );
+ if ( (*it)->name() == resource ) {
+ setRes = (*it);
+ qDebug("Inserting imported contacs to resource %s", resource.latin1());
+ break;
+ }
+ }
+ }
for ( it = list.begin(); it != list.end(); ++it ) {
@@ -509,3 +523,3 @@ int AddressBook::importFromFile( QString fileName, bool replaceLabel, bool remo
(*it).setIDStr(id );
- (*it).setResource( 0 );
+ (*it).setResource( setRes );
if ( replaceLabel )
@@ -520,13 +534,23 @@ int AddressBook::importFromFile( QString fileName, bool replaceLabel, bool remo
}
-void AddressBook::setUntagged(bool setNonSyncTagged) // = false)
+void AddressBook::setUntagged(bool setNonSyncTagged, QString resource) // = false , "")
{
Iterator ait;
- for ( ait = begin(); ait != end(); ++ait ) {
- if ( setNonSyncTagged ) {
- if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) {
+ if ( !resource.isEmpty() ) {
+ for ( ait = begin(); ait != end(); ++ait ) {
+ if ( (*ait).resource() && (*ait).resource()->name() == resource ) {
+ (*ait).setTagged( false );
+ }
+ else
(*ait).setTagged( true );
+ }
+ } else {
+ 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 );
- } else
- (*ait).setTagged( false );
+ }
}
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index 4a0d0a3..e6daa5e 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -150,4 +150,4 @@ class AddressBook : public QObject
bool export2PhoneFormat( QStringList uids ,QString fileName );
- int importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false );
- void setUntagged( bool setNonSyncTagged = false );
+ int importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false, QString resource = "" );
+ void setUntagged( bool setNonSyncTagged = false, QString resource = "" );
void removeUntagged();