-rw-r--r-- | kabc/stdaddressbook.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp index ec47a4e..181a09e 100644 --- a/kabc/stdaddressbook.cpp +++ b/kabc/stdaddressbook.cpp | |||
@@ -152,33 +152,38 @@ void StdAddressBook::init( bool ) | |||
152 | } | 152 | } |
153 | 153 | ||
154 | setStandardResource( res ); | 154 | setStandardResource( res ); |
155 | manager->writeConfig(); | 155 | manager->writeConfig(); |
156 | 156 | ||
157 | load(); | 157 | load(); |
158 | } | 158 | } |
159 | 159 | ||
160 | bool StdAddressBook::save() | 160 | bool StdAddressBook::save() |
161 | { | 161 | { |
162 | kdDebug(5700) << "StdAddressBook::save()" << endl; | 162 | kdDebug(5700) << "StdAddressBook::save()" << endl; |
163 | 163 | ||
164 | bool ok = true; | 164 | bool ok = true; |
165 | AddressBook *ab = self(); | 165 | AddressBook *ab = self(); |
166 | 166 | ||
167 | ab->deleteRemovedAddressees(); | 167 | ab->deleteRemovedAddressees(); |
168 | 168 | Iterator ait; | |
169 | for ( ait = ab->begin(); ait != ab->end(); ++ait ) { | ||
170 | if ( !(*ait).IDStr().isEmpty() ) { | ||
171 | (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() ); | ||
172 | } | ||
173 | } | ||
169 | KRES::Manager<Resource>::ActiveIterator it; | 174 | KRES::Manager<Resource>::ActiveIterator it; |
170 | KRES::Manager<Resource> *manager = ab->resourceManager(); | 175 | KRES::Manager<Resource> *manager = ab->resourceManager(); |
171 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { | 176 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { |
172 | if ( !(*it)->readOnly() && (*it)->isOpen() ) { | 177 | if ( !(*it)->readOnly() && (*it)->isOpen() ) { |
173 | Ticket *ticket = ab->requestSaveTicket( *it ); | 178 | Ticket *ticket = ab->requestSaveTicket( *it ); |
174 | // qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); | 179 | // qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); |
175 | if ( !ticket ) { | 180 | if ( !ticket ) { |
176 | ab->error( i18n( "Unable to save to resource '%1'. It is locked." ) | 181 | ab->error( i18n( "Unable to save to resource '%1'. It is locked." ) |
177 | .arg( (*it)->resourceName() ) ); | 182 | .arg( (*it)->resourceName() ) ); |
178 | return false; | 183 | return false; |
179 | } | 184 | } |
180 | 185 | ||
181 | if ( !ab->save( ticket ) ) | 186 | if ( !ab->save( ticket ) ) |
182 | ok = false; | 187 | ok = false; |
183 | } | 188 | } |
184 | } | 189 | } |