author | zautrix <zautrix> | 2004-09-18 16:32:35 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-18 16:32:35 (UTC) |
commit | a355a58898d0d08d797f872751254cfa958387c1 (patch) (unidiff) | |
tree | ce338c8cc9785d6351a8a8b66fb8e5c1602ceab0 /kabc | |
parent | bf18a7b4edb4121fd2ea974ac1ec634167c9b993 (diff) | |
download | kdepimpi-a355a58898d0d08d797f872751254cfa958387c1.zip kdepimpi-a355a58898d0d08d797f872751254cfa958387c1.tar.gz kdepimpi-a355a58898d0d08d797f872751254cfa958387c1.tar.bz2 |
time fixes
-rw-r--r-- | kabc/addressbook.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 3ec0795..d03dea3 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -415,98 +415,103 @@ AddressBook::ConstIterator AddressBook::end() const | |||
415 | ConstIterator it = ConstIterator(); | 415 | ConstIterator it = ConstIterator(); |
416 | it.d->mIt = d->mAddressees.end(); | 416 | it.d->mIt = d->mAddressees.end(); |
417 | return it; | 417 | return it; |
418 | } | 418 | } |
419 | 419 | ||
420 | void AddressBook::clear() | 420 | void AddressBook::clear() |
421 | { | 421 | { |
422 | d->mAddressees.clear(); | 422 | d->mAddressees.clear(); |
423 | } | 423 | } |
424 | 424 | ||
425 | Ticket *AddressBook::requestSaveTicket( Resource *resource ) | 425 | Ticket *AddressBook::requestSaveTicket( Resource *resource ) |
426 | { | 426 | { |
427 | kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl; | 427 | kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl; |
428 | 428 | ||
429 | if ( !resource ) | 429 | if ( !resource ) |
430 | { | 430 | { |
431 | qDebug("AddressBook::requestSaveTicket no resource" ); | 431 | qDebug("AddressBook::requestSaveTicket no resource" ); |
432 | resource = standardResource(); | 432 | resource = standardResource(); |
433 | } | 433 | } |
434 | 434 | ||
435 | KRES::Manager<Resource>::ActiveIterator it; | 435 | KRES::Manager<Resource>::ActiveIterator it; |
436 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { | 436 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { |
437 | if ( (*it) == resource ) { | 437 | if ( (*it) == resource ) { |
438 | if ( (*it)->readOnly() || !(*it)->isOpen() ) | 438 | if ( (*it)->readOnly() || !(*it)->isOpen() ) |
439 | return 0; | 439 | return 0; |
440 | else | 440 | else |
441 | return (*it)->requestSaveTicket(); | 441 | return (*it)->requestSaveTicket(); |
442 | } | 442 | } |
443 | } | 443 | } |
444 | 444 | ||
445 | return 0; | 445 | return 0; |
446 | } | 446 | } |
447 | 447 | ||
448 | void AddressBook::insertAddressee( const Addressee &a, bool setRev ) | 448 | void AddressBook::insertAddressee( const Addressee &a, bool setRev ) |
449 | { | 449 | { |
450 | Addressee::List::Iterator it; | 450 | Addressee::List::Iterator it; |
451 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { | 451 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { |
452 | if ( a.uid() == (*it).uid() ) { | 452 | if ( a.uid() == (*it).uid() ) { |
453 | bool changed = false; | 453 | bool changed = false; |
454 | Addressee addr = a; | 454 | Addressee addr = a; |
455 | if ( addr != (*it) ) | 455 | if ( addr != (*it) ) |
456 | changed = true; | 456 | changed = true; |
457 | 457 | ||
458 | (*it) = a; | 458 | (*it) = a; |
459 | if ( (*it).resource() == 0 ) | 459 | if ( (*it).resource() == 0 ) |
460 | (*it).setResource( standardResource() ); | 460 | (*it).setResource( standardResource() ); |
461 | 461 | ||
462 | if ( changed ) { | 462 | if ( changed ) { |
463 | if ( setRev ) | 463 | if ( setRev ) { |
464 | (*it).setRevision( QDateTime::currentDateTime() ); | 464 | // get rid of micro seconds |
465 | QDateTime dt = QDateTime::currentDateTime(); | ||
466 | QTime t = dt.time(); | ||
467 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | ||
468 | (*it).setRevision( dt ); | ||
469 | } | ||
465 | (*it).setChanged( true ); | 470 | (*it).setChanged( true ); |
466 | } | 471 | } |
467 | 472 | ||
468 | return; | 473 | return; |
469 | } | 474 | } |
470 | } | 475 | } |
471 | d->mAddressees.append( a ); | 476 | d->mAddressees.append( a ); |
472 | Addressee& addr = d->mAddressees.last(); | 477 | Addressee& addr = d->mAddressees.last(); |
473 | if ( addr.resource() == 0 ) | 478 | if ( addr.resource() == 0 ) |
474 | addr.setResource( standardResource() ); | 479 | addr.setResource( standardResource() ); |
475 | 480 | ||
476 | addr.setChanged( true ); | 481 | addr.setChanged( true ); |
477 | } | 482 | } |
478 | 483 | ||
479 | void AddressBook::removeAddressee( const Addressee &a ) | 484 | void AddressBook::removeAddressee( const Addressee &a ) |
480 | { | 485 | { |
481 | Iterator it; | 486 | Iterator it; |
482 | for ( it = begin(); it != end(); ++it ) { | 487 | for ( it = begin(); it != end(); ++it ) { |
483 | if ( a.uid() == (*it).uid() ) { | 488 | if ( a.uid() == (*it).uid() ) { |
484 | removeAddressee( it ); | 489 | removeAddressee( it ); |
485 | return; | 490 | return; |
486 | } | 491 | } |
487 | } | 492 | } |
488 | } | 493 | } |
489 | 494 | ||
490 | void AddressBook::removeAddressee( const Iterator &it ) | 495 | void AddressBook::removeAddressee( const Iterator &it ) |
491 | { | 496 | { |
492 | d->mRemovedAddressees.append( (*it) ); | 497 | d->mRemovedAddressees.append( (*it) ); |
493 | d->mAddressees.remove( it.d->mIt ); | 498 | d->mAddressees.remove( it.d->mIt ); |
494 | } | 499 | } |
495 | 500 | ||
496 | AddressBook::Iterator AddressBook::find( const Addressee &a ) | 501 | AddressBook::Iterator AddressBook::find( const Addressee &a ) |
497 | { | 502 | { |
498 | Iterator it; | 503 | Iterator it; |
499 | for ( it = begin(); it != end(); ++it ) { | 504 | for ( it = begin(); it != end(); ++it ) { |
500 | if ( a.uid() == (*it).uid() ) { | 505 | if ( a.uid() == (*it).uid() ) { |
501 | return it; | 506 | return it; |
502 | } | 507 | } |
503 | } | 508 | } |
504 | return end(); | 509 | return end(); |
505 | } | 510 | } |
506 | 511 | ||
507 | Addressee AddressBook::findByUid( const QString &uid ) | 512 | Addressee AddressBook::findByUid( const QString &uid ) |
508 | { | 513 | { |
509 | Iterator it; | 514 | Iterator it; |
510 | for ( it = begin(); it != end(); ++it ) { | 515 | for ( it = begin(); it != end(); ++it ) { |
511 | if ( uid == (*it).uid() ) { | 516 | if ( uid == (*it).uid() ) { |
512 | return *it; | 517 | return *it; |