-rw-r--r-- | kabc/addressbook.cpp | 31 | ||||
-rw-r--r-- | kabc/addressee.cpp | 19 | ||||
-rw-r--r-- | kabc/addressee.h | 1 | ||||
-rw-r--r-- | kabc/stdaddressbook.cpp | 7 |
4 files changed, 43 insertions, 15 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index ec9f893..46a9cf4 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -334,48 +334,58 @@ bool AddressBook::load() | |||
334 | clear(); | 334 | clear(); |
335 | 335 | ||
336 | KRES::Manager<Resource>::ActiveIterator it; | 336 | KRES::Manager<Resource>::ActiveIterator it; |
337 | bool ok = true; | 337 | bool ok = true; |
338 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) | 338 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) |
339 | if ( !(*it)->load() ) { | 339 | if ( !(*it)->load() ) { |
340 | error( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) ); | 340 | error( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) ); |
341 | ok = false; | 341 | ok = false; |
342 | } | 342 | } |
343 | 343 | ||
344 | // mark all addressees as unchanged | 344 | // mark all addressees as unchanged |
345 | Addressee::List::Iterator addrIt; | 345 | Addressee::List::Iterator addrIt; |
346 | for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) | 346 | for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) { |
347 | (*addrIt).setChanged( false ); | 347 | (*addrIt).setChanged( false ); |
348 | 348 | QString id = (*addrIt).custom( "KADDRESSBOOK", "X-ExternalID" ); | |
349 | if ( !id.isEmpty() ) { | ||
350 | //qDebug("setId aa %s ", id.latin1()); | ||
351 | (*addrIt).setIDStr(id ); | ||
352 | } | ||
353 | } | ||
349 | blockLSEchange = true; | 354 | blockLSEchange = true; |
350 | return ok; | 355 | return ok; |
351 | } | 356 | } |
352 | 357 | ||
353 | bool AddressBook::save( Ticket *ticket ) | 358 | bool AddressBook::save( Ticket *ticket ) |
354 | { | 359 | { |
355 | kdDebug(5700) << "AddressBook::save()"<< endl; | 360 | kdDebug(5700) << "AddressBook::save()"<< endl; |
356 | 361 | ||
357 | if ( ticket->resource() ) { | 362 | if ( ticket->resource() ) { |
358 | deleteRemovedAddressees(); | 363 | deleteRemovedAddressees(); |
359 | return ticket->resource()->save( ticket ); | 364 | return ticket->resource()->save( ticket ); |
360 | } | 365 | } |
361 | 366 | ||
362 | return false; | 367 | return false; |
363 | } | 368 | } |
364 | bool AddressBook::saveAB() | 369 | bool AddressBook::saveAB() |
365 | { | 370 | { |
366 | bool ok = true; | 371 | bool ok = true; |
367 | 372 | ||
368 | deleteRemovedAddressees(); | 373 | deleteRemovedAddressees(); |
369 | 374 | Iterator ait; | |
375 | for ( ait = begin(); ait != end(); ++ait ) { | ||
376 | if ( !(*ait).IDStr().isEmpty() ) { | ||
377 | (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() ); | ||
378 | } | ||
379 | } | ||
370 | KRES::Manager<Resource>::ActiveIterator it; | 380 | KRES::Manager<Resource>::ActiveIterator it; |
371 | KRES::Manager<Resource> *manager = d->mManager; | 381 | KRES::Manager<Resource> *manager = d->mManager; |
372 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { | 382 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { |
373 | if ( !(*it)->readOnly() && (*it)->isOpen() ) { | 383 | if ( !(*it)->readOnly() && (*it)->isOpen() ) { |
374 | Ticket *ticket = requestSaveTicket( *it ); | 384 | Ticket *ticket = requestSaveTicket( *it ); |
375 | // qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); | 385 | // qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); |
376 | if ( !ticket ) { | 386 | if ( !ticket ) { |
377 | error( i18n( "Unable to save to resource '%1'. It is locked." ) | 387 | error( i18n( "Unable to save to resource '%1'. It is locked." ) |
378 | .arg( (*it)->resourceName() ) ); | 388 | .arg( (*it)->resourceName() ) ); |
379 | return false; | 389 | return false; |
380 | } | 390 | } |
381 | 391 | ||
@@ -441,26 +451,28 @@ Ticket *AddressBook::requestSaveTicket( Resource *resource ) | |||
441 | return 0; | 451 | return 0; |
442 | else | 452 | else |
443 | return (*it)->requestSaveTicket(); | 453 | return (*it)->requestSaveTicket(); |
444 | } | 454 | } |
445 | } | 455 | } |
446 | 456 | ||
447 | return 0; | 457 | return 0; |
448 | } | 458 | } |
449 | 459 | ||
450 | void AddressBook::insertAddressee( const Addressee &a, bool setRev ) | 460 | void AddressBook::insertAddressee( const Addressee &a, bool setRev ) |
451 | { | 461 | { |
452 | if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) { | 462 | if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) { |
463 | //qDebug("block insert "); | ||
453 | return; | 464 | return; |
454 | } | 465 | } |
466 | //qDebug("inserting.... %s ",a.uid().latin1() ); | ||
455 | bool found = false; | 467 | bool found = false; |
456 | Addressee::List::Iterator it; | 468 | Addressee::List::Iterator it; |
457 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { | 469 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { |
458 | if ( a.uid() == (*it).uid() ) { | 470 | if ( a.uid() == (*it).uid() ) { |
459 | 471 | ||
460 | bool changed = false; | 472 | bool changed = false; |
461 | Addressee addr = a; | 473 | Addressee addr = a; |
462 | if ( addr != (*it) ) | 474 | if ( addr != (*it) ) |
463 | changed = true; | 475 | changed = true; |
464 | 476 | ||
465 | (*it) = a; | 477 | (*it) = a; |
466 | if ( (*it).resource() == 0 ) | 478 | if ( (*it).resource() == 0 ) |
@@ -471,25 +483,25 @@ void AddressBook::insertAddressee( const Addressee &a, bool setRev ) | |||
471 | 483 | ||
472 | // get rid of micro seconds | 484 | // get rid of micro seconds |
473 | QDateTime dt = QDateTime::currentDateTime(); | 485 | QDateTime dt = QDateTime::currentDateTime(); |
474 | QTime t = dt.time(); | 486 | QTime t = dt.time(); |
475 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | 487 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); |
476 | (*it).setRevision( dt ); | 488 | (*it).setRevision( dt ); |
477 | } | 489 | } |
478 | (*it).setChanged( true ); | 490 | (*it).setChanged( true ); |
479 | } | 491 | } |
480 | 492 | ||
481 | found = true; | 493 | found = true; |
482 | } else { | 494 | } else { |
483 | if ( (*it).uid() == QString("last-syncAddressee-") ) { | 495 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { |
484 | QString name = (*it).uid().mid( 19 ); | 496 | QString name = (*it).uid().mid( 19 ); |
485 | Addressee b = a; | 497 | Addressee b = a; |
486 | QString id = b.getID( name ); | 498 | QString id = b.getID( name ); |
487 | if ( ! id.isEmpty() ) { | 499 | if ( ! id.isEmpty() ) { |
488 | QString des = (*it).note(); | 500 | QString des = (*it).note(); |
489 | int startN; | 501 | int startN; |
490 | if( (startN = des.find( id ) ) >= 0 ) { | 502 | if( (startN = des.find( id ) ) >= 0 ) { |
491 | int endN = des.find( ",", startN+1 ); | 503 | int endN = des.find( ",", startN+1 ); |
492 | des = des.left( startN ) + des.mid( endN+1 ); | 504 | des = des.left( startN ) + des.mid( endN+1 ); |
493 | (*it).setNote( des ); | 505 | (*it).setNote( des ); |
494 | } | 506 | } |
495 | } | 507 | } |
@@ -507,25 +519,25 @@ void AddressBook::insertAddressee( const Addressee &a, bool setRev ) | |||
507 | } | 519 | } |
508 | 520 | ||
509 | void AddressBook::removeAddressee( const Addressee &a ) | 521 | void AddressBook::removeAddressee( const Addressee &a ) |
510 | { | 522 | { |
511 | Iterator it; | 523 | Iterator it; |
512 | Iterator it2; | 524 | Iterator it2; |
513 | bool found = false; | 525 | bool found = false; |
514 | for ( it = begin(); it != end(); ++it ) { | 526 | for ( it = begin(); it != end(); ++it ) { |
515 | if ( a.uid() == (*it).uid() ) { | 527 | if ( a.uid() == (*it).uid() ) { |
516 | found = true; | 528 | found = true; |
517 | it2 = it; | 529 | it2 = it; |
518 | } else { | 530 | } else { |
519 | if ( (*it).uid() == QString("last-syncAddressee-") ) { | 531 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { |
520 | QString name = (*it).uid().mid( 19 ); | 532 | QString name = (*it).uid().mid( 19 ); |
521 | Addressee b = a; | 533 | Addressee b = a; |
522 | QString id = b.getID( name ); | 534 | QString id = b.getID( name ); |
523 | if ( ! id.isEmpty() ) { | 535 | if ( ! id.isEmpty() ) { |
524 | QString des = (*it).note(); | 536 | QString des = (*it).note(); |
525 | if( des.find( id ) < 0 ) { | 537 | if( des.find( id ) < 0 ) { |
526 | des += id + ","; | 538 | des += id + ","; |
527 | (*it).setNote( des ); | 539 | (*it).setNote( des ); |
528 | } | 540 | } |
529 | } | 541 | } |
530 | } | 542 | } |
531 | 543 | ||
@@ -536,30 +548,35 @@ void AddressBook::removeAddressee( const Addressee &a ) | |||
536 | removeAddressee( it2 ); | 548 | removeAddressee( it2 ); |
537 | 549 | ||
538 | } | 550 | } |
539 | 551 | ||
540 | void AddressBook::removeDeletedAddressees() | 552 | void AddressBook::removeDeletedAddressees() |
541 | { | 553 | { |
542 | deleteRemovedAddressees(); | 554 | deleteRemovedAddressees(); |
543 | Iterator it = begin(); | 555 | Iterator it = begin(); |
544 | Iterator it2 ; | 556 | Iterator it2 ; |
545 | QDateTime dt ( QDate( 2004,1,1) ); | 557 | QDateTime dt ( QDate( 2004,1,1) ); |
546 | while ( it != end() ) { | 558 | while ( it != end() ) { |
547 | (*it).setRevision( dt ); | 559 | (*it).setRevision( dt ); |
548 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { | 560 | (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); |
561 | (*it).setIDStr(""); | ||
562 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE || (*it).uid().left( 19 ) == QString("last-syncAddressee-")) { | ||
549 | it2 = it; | 563 | it2 = it; |
564 | //qDebug("removing %s ",(*it).uid().latin1() ); | ||
550 | ++it; | 565 | ++it; |
551 | removeAddressee( it2 ); | 566 | removeAddressee( it2 ); |
552 | } else | 567 | } else { |
568 | //qDebug("skipping %s ",(*it).uid().latin1() ); | ||
553 | ++it; | 569 | ++it; |
570 | } | ||
554 | } | 571 | } |
555 | deleteRemovedAddressees(); | 572 | deleteRemovedAddressees(); |
556 | } | 573 | } |
557 | 574 | ||
558 | void AddressBook::removeAddressee( const Iterator &it ) | 575 | void AddressBook::removeAddressee( const Iterator &it ) |
559 | { | 576 | { |
560 | d->mRemovedAddressees.append( (*it) ); | 577 | d->mRemovedAddressees.append( (*it) ); |
561 | d->mAddressees.remove( it.d->mIt ); | 578 | d->mAddressees.remove( it.d->mIt ); |
562 | } | 579 | } |
563 | 580 | ||
564 | AddressBook::Iterator AddressBook::find( const Addressee &a ) | 581 | AddressBook::Iterator AddressBook::find( const Addressee &a ) |
565 | { | 582 | { |
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 0f5d605..d6b70c4 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -70,50 +70,49 @@ struct Addressee::AddresseeData : public KShared | |||
70 | Secrecy secrecy; | 70 | Secrecy secrecy; |
71 | Picture logo; | 71 | Picture logo; |
72 | Picture photo; | 72 | Picture photo; |
73 | Sound sound; | 73 | Sound sound; |
74 | Agent agent; | 74 | Agent agent; |
75 | QString mExternalId; | 75 | QString mExternalId; |
76 | PhoneNumber::List phoneNumbers; | 76 | PhoneNumber::List phoneNumbers; |
77 | Address::List addresses; | 77 | Address::List addresses; |
78 | Key::List keys; | 78 | Key::List keys; |
79 | QStringList emails; | 79 | QStringList emails; |
80 | QStringList categories; | 80 | QStringList categories; |
81 | QStringList custom; | 81 | QStringList custom; |
82 | 82 | int mTempSyncStat; | |
83 | Resource *resource; | 83 | Resource *resource; |
84 | 84 | ||
85 | bool empty :1; | 85 | bool empty :1; |
86 | bool changed :1; | 86 | bool changed :1; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | Addressee::Addressee() | 89 | Addressee::Addressee() |
90 | { | 90 | { |
91 | mData = new AddresseeData; | 91 | mData = new AddresseeData; |
92 | mData->empty = true; | 92 | mData->empty = true; |
93 | mData->changed = false; | 93 | mData->changed = false; |
94 | mData->resource = 0; | 94 | mData->resource = 0; |
95 | mData->mExternalId = ":"; | 95 | mData->mExternalId = ":"; |
96 | mData->revision = QDateTime ( QDate( 2004,1,1)); | 96 | mData->revision = QDateTime ( QDate( 2004,1,1)); |
97 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | 97 | mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; |
98 | } | 98 | } |
99 | 99 | ||
100 | Addressee::~Addressee() | 100 | Addressee::~Addressee() |
101 | { | 101 | { |
102 | } | 102 | } |
103 | 103 | ||
104 | Addressee::Addressee( const Addressee &a ) | 104 | Addressee::Addressee( const Addressee &a ) |
105 | { | 105 | { |
106 | mData = a.mData; | 106 | mData = a.mData; |
107 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | ||
108 | } | 107 | } |
109 | 108 | ||
110 | Addressee &Addressee::operator=( const Addressee &a ) | 109 | Addressee &Addressee::operator=( const Addressee &a ) |
111 | { | 110 | { |
112 | mData = a.mData; | 111 | mData = a.mData; |
113 | return (*this); | 112 | return (*this); |
114 | } | 113 | } |
115 | 114 | ||
116 | Addressee Addressee::copy() | 115 | Addressee Addressee::copy() |
117 | { | 116 | { |
118 | Addressee a; | 117 | Addressee a; |
119 | *(a.mData) = *mData; | 118 | *(a.mData) = *mData; |
@@ -259,55 +258,63 @@ void Addressee::computeCsum(const QString &dev) | |||
259 | t = mData->custom; | 258 | t = mData->custom; |
260 | t.sort(); | 259 | t.sort(); |
261 | for ( iii = 0; iii < t.count(); ++iii) | 260 | for ( iii = 0; iii < t.count(); ++iii) |
262 | l.append( t[iii] ); | 261 | l.append( t[iii] ); |
263 | KABC::Address::List::Iterator addressIter; | 262 | KABC::Address::List::Iterator addressIter; |
264 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 263 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
265 | ++addressIter ) { | 264 | ++addressIter ) { |
266 | t = (*addressIter).asList(); | 265 | t = (*addressIter).asList(); |
267 | t.sort(); | 266 | t.sort(); |
268 | for ( iii = 0; iii < t.count(); ++iii) | 267 | for ( iii = 0; iii < t.count(); ++iii) |
269 | l.append( t[iii] ); | 268 | l.append( t[iii] ); |
270 | } | 269 | } |
271 | setCsum( dev, QString::number (getCsum4List(l)) ); | 270 | uint cs = getCsum4List(l); |
271 | qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); | ||
272 | setCsum( dev, QString::number (cs )); | ||
272 | } | 273 | } |
273 | void Addressee::removeID(const QString &prof) | 274 | void Addressee::removeID(const QString &prof) |
274 | { | 275 | { |
275 | detach(); | 276 | detach(); |
276 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 277 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); |
277 | 278 | ||
278 | } | 279 | } |
279 | void Addressee::setID( const QString & prof , const QString & id ) | 280 | void Addressee::setID( const QString & prof , const QString & id ) |
280 | { | 281 | { |
281 | detach(); | 282 | detach(); |
283 | qDebug("setID1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | ||
282 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 284 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
285 | qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | ||
283 | } | 286 | } |
284 | void Addressee::setTempSyncStat( int id ) | 287 | void Addressee::setTempSyncStat( int id ) |
285 | { | 288 | { |
286 | mTempSyncStat = id; | 289 | if ( mData->mTempSyncStat == id ) return; |
290 | detach(); | ||
291 | mData->mTempSyncStat = id; | ||
287 | } | 292 | } |
288 | int Addressee::tempSyncStat() const | 293 | int Addressee::tempSyncStat() const |
289 | { | 294 | { |
290 | return mTempSyncStat; | 295 | return mData->mTempSyncStat; |
291 | } | 296 | } |
292 | 297 | ||
293 | QString Addressee::getID( const QString & prof) | 298 | QString Addressee::getID( const QString & prof) |
294 | { | 299 | { |
295 | return KIdManager::getId ( mData->mExternalId, prof ); | 300 | return KIdManager::getId ( mData->mExternalId, prof ); |
296 | } | 301 | } |
297 | 302 | ||
298 | void Addressee::setCsum( const QString & prof , const QString & id ) | 303 | void Addressee::setCsum( const QString & prof , const QString & id ) |
299 | { | 304 | { |
300 | detach(); | 305 | detach(); |
306 | qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | ||
301 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | 307 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); |
308 | qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); | ||
302 | } | 309 | } |
303 | 310 | ||
304 | QString Addressee::getCsum( const QString & prof) | 311 | QString Addressee::getCsum( const QString & prof) |
305 | { | 312 | { |
306 | return KIdManager::getCsum ( mData->mExternalId, prof ); | 313 | return KIdManager::getCsum ( mData->mExternalId, prof ); |
307 | } | 314 | } |
308 | 315 | ||
309 | void Addressee::setIDStr( const QString & s ) | 316 | void Addressee::setIDStr( const QString & s ) |
310 | { | 317 | { |
311 | detach(); | 318 | detach(); |
312 | mData->mExternalId = s; | 319 | mData->mExternalId = s; |
313 | } | 320 | } |
diff --git a/kabc/addressee.h b/kabc/addressee.h index 0805458..bfb0840 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h | |||
@@ -817,24 +817,23 @@ class Addressee | |||
817 | Mark addressee as changed. | 817 | Mark addressee as changed. |
818 | */ | 818 | */ |
819 | void setChanged( bool value ); | 819 | void setChanged( bool value ); |
820 | 820 | ||
821 | /** | 821 | /** |
822 | Return whether the addressee is changed. | 822 | Return whether the addressee is changed. |
823 | */ | 823 | */ |
824 | bool changed() const; | 824 | bool changed() const; |
825 | 825 | ||
826 | private: | 826 | private: |
827 | Addressee copy(); | 827 | Addressee copy(); |
828 | void detach(); | 828 | void detach(); |
829 | int mTempSyncStat; | ||
830 | 829 | ||
831 | struct AddresseeData; | 830 | struct AddresseeData; |
832 | mutable KSharedPtr<AddresseeData> mData; | 831 | mutable KSharedPtr<AddresseeData> mData; |
833 | }; | 832 | }; |
834 | 833 | ||
835 | QDataStream &operator<<( QDataStream &, const Addressee & ); | 834 | QDataStream &operator<<( QDataStream &, const Addressee & ); |
836 | QDataStream &operator>>( QDataStream &, Addressee & ); | 835 | QDataStream &operator>>( QDataStream &, Addressee & ); |
837 | 836 | ||
838 | } | 837 | } |
839 | 838 | ||
840 | #endif | 839 | #endif |
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp index ec47a4e..181a09e 100644 --- a/kabc/stdaddressbook.cpp +++ b/kabc/stdaddressbook.cpp | |||
@@ -156,25 +156,30 @@ void StdAddressBook::init( bool ) | |||
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 | ||