author | zautrix <zautrix> | 2004-09-18 14:22:10 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-18 14:22:10 (UTC) |
commit | ca8fcf3fd4dc068747d8f31e2189145b22853d55 (patch) (side-by-side diff) | |
tree | 29417ffd55d1c4186922a64ed0cdf1c6a1cc69a3 /kabc | |
parent | bb16660f29fc709791aa0ee4cb63a40710a994a8 (diff) | |
download | kdepimpi-ca8fcf3fd4dc068747d8f31e2189145b22853d55.zip kdepimpi-ca8fcf3fd4dc068747d8f31e2189145b22853d55.tar.gz kdepimpi-ca8fcf3fd4dc068747d8f31e2189145b22853d55.tar.bz2 |
more AB sync
-rw-r--r-- | kabc/addressbook.cpp | 11 | ||||
-rw-r--r-- | kabc/addressbook.h | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 9332e21..6e8d027 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -484,105 +484,112 @@ void AddressBook::removeAddressee( const Addressee &a ) return; } } } void AddressBook::removeAddressee( const Iterator &it ) { d->mRemovedAddressees.append( (*it) ); d->mAddressees.remove( it.d->mIt ); } AddressBook::Iterator AddressBook::find( const Addressee &a ) { Iterator it; for ( it = begin(); it != end(); ++it ) { if ( a.uid() == (*it).uid() ) { return it; } } return end(); } Addressee AddressBook::findByUid( const QString &uid ) { Iterator it; for ( it = begin(); it != end(); ++it ) { if ( uid == (*it).uid() ) { return *it; } } return Addressee(); } Addressee::List AddressBook::getExternLastSyncAddressees() { Addressee::List results; Iterator it; for ( it = begin(); it != end(); ++it ) { if ( (*it).uid().left( 20 ) == "last-syncAddressee-" ) { if ( (*it).familyName().left(3) == "E: " ) results.append( *it ); } } return results; } void AddressBook::resetTempSyncStat() { - - Iterator it; for ( it = begin(); it != end(); ++it ) { (*it).setTempSyncStat ( SYNC_TEMPSTATE_INITIAL ); } } +QStringList AddressBook:: uidList() +{ + QStringList results; + Iterator it; + for ( it = begin(); it != end(); ++it ) { + results.append( (*it).uid() ); + } + return results; +} Addressee::List AddressBook::allAddressees() { return d->mAddressees; } Addressee::List AddressBook::findByName( const QString &name ) { Addressee::List results; Iterator it; for ( it = begin(); it != end(); ++it ) { if ( name == (*it).realName() ) { results.append( *it ); } } return results; } Addressee::List AddressBook::findByEmail( const QString &email ) { Addressee::List results; QStringList mailList; Iterator it; for ( it = begin(); it != end(); ++it ) { mailList = (*it).emails(); for ( QStringList::Iterator ite = mailList.begin(); ite != mailList.end(); ++ite ) { if ( email == (*ite) ) { results.append( *it ); } } } return results; } Addressee::List AddressBook::findByCategory( const QString &category ) { Addressee::List results; Iterator it; for ( it = begin(); it != end(); ++it ) { if ( (*it).hasCategory( category) ) { results.append( *it ); } diff --git a/kabc/addressbook.h b/kabc/addressbook.h index 05225f9..650a638 100644 --- a/kabc/addressbook.h +++ b/kabc/addressbook.h @@ -246,88 +246,89 @@ class AddressBook : public QObject /** Add custom field to address book. @param label User visible label of the field. @param category Ored list of field categories. @param key Identifier used as key for reading and writing the field. @param app String used as application key for reading and writing the field. */ bool addCustomField( const QString &label, int category = Field::All, const QString &key = QString::null, const QString &app = QString::null ); /** Add address book resource. */ bool addResource( Resource * ); /** Remove address book resource. */ bool removeResource( Resource * ); /** Return pointer list of all resources. */ QPtrList<Resource> resources(); /** Set the @p ErrorHandler, that is used by @ref error() to provide gui-independend error messages. */ void setErrorHandler( ErrorHandler * ); /** Shows gui independend error messages. */ void error( const QString& ); /** Query all resources to clean up their lock files */ void cleanUp(); // sync stuff Addressee::List getExternLastSyncAddressees(); void resetTempSyncStat(); + QStringList uidList(); signals: /** Emitted, when the address book has changed on disk. */ void addressBookChanged( AddressBook * ); /** Emitted, when the address book has been locked for writing. */ void addressBookLocked( AddressBook * ); /** Emitted, when the address book has been unlocked. */ void addressBookUnlocked( AddressBook * ); protected: void deleteRemovedAddressees(); void setStandardResource( Resource * ); Resource *standardResource(); KRES::Manager<Resource> *resourceManager(); void init(const QString &config, const QString &family); private: //US QPtrList<Resource> mDummy; // Remove in KDE 4 struct AddressBookData; AddressBookData *d; }; QDataStream &operator<<( QDataStream &, const AddressBook & ); QDataStream &operator>>( QDataStream &, AddressBook & ); } #endif |