addressbook.h
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KABC_ADDRESSBOOK_H
#define KABC_ADDRESSBOOK_H
#include <qobject.h>
#include <qptrlist.h>
#include <kresources/manager.h>
#include "addressee.h"
#include "field.h"
namespace KABC {
class ErrorHandler;
class Resource;
class Ticket;
class KABC_EXPORT AddressBook : public QObject
{
Q_OBJECT
friend KABC_EXPORT QDataStream &operator<<( QDataStream &, const AddressBook & );
friend KABC_EXPORT QDataStream &operator>>( QDataStream &, AddressBook & );
friend class StdAddressBook;
public:
class KABC_EXPORT Iterator
{
public:
Iterator();
Iterator( const Iterator & );
~Iterator();
Iterator &operator=( const Iterator & );
const Addressee &operator*() const;
Addressee &operator*();
Addressee* operator->();
Iterator &operator++();
Iterator &operator++(int);
Iterator &operator--();
Iterator &operator--(int);
bool operator==( const Iterator &it );
bool operator!=( const Iterator &it );
struct IteratorData;
IteratorData *d;
};
class KABC_EXPORT ConstIterator
{
public:
ConstIterator();
ConstIterator( const ConstIterator & );
ConstIterator( const Iterator & );
~ConstIterator();
ConstIterator &operator=( const ConstIterator & );
const Addressee &operator*() const;
const Addressee* operator->() const;
ConstIterator &operator++();
ConstIterator &operator++(int);
ConstIterator &operator--();
ConstIterator &operator--(int);
bool operator==( const ConstIterator &it );
bool operator!=( const ConstIterator &it );
struct ConstIteratorData;
ConstIteratorData *d;
};
AddressBook();
AddressBook( const QString &config );
virtual ~AddressBook();
Ticket *requestSaveTicket( Resource *resource = 0 );
void releaseSaveTicket( Ticket *ticket );
bool load();
bool asyncLoad();
bool save( Ticket *ticket );
bool asyncSave( Ticket *ticket );
ConstIterator begin() const;
Iterator begin();
ConstIterator end() const;
Iterator end();
void clear();
void insertAddressee( const Addressee &addr );
void removeAddressee( const Addressee &addr );
void removeAddressee( const Iterator &it );
Iterator find( const Addressee &addr ); // KDE4: const
Addressee findByUid( const QString &uid ); // KDE4: const
Addressee::List allAddressees(); // KDE4: const
Addressee::List findByName( const QString &name ); // KDE4: const
Addressee::List findByEmail( const QString &email ); // KDE4: const
Addressee::List findByCategory( const QString &category ); // KDE4: const
virtual QString identifier(); // KDE4: const
Field::List fields( int category = Field::All ); // KDE4: const
bool addCustomField( const QString &label, int category = Field::All,
const QString &key = QString::null,
const QString &app = QString::null );
bool addResource( Resource *resource );
bool removeResource( Resource *resource );
QPtrList<Resource> resources(); // KDE4: const
void setErrorHandler( ErrorHandler *errorHandler );
void error( const QString &msg );
void cleanUp() KDE_DEPRECATED;
void dump() const;
void emitAddressBookLocked() { emit addressBookLocked( this ); }
void emitAddressBookUnlocked() { emit addressBookUnlocked( this ); }
void emitAddressBookChanged() { emit addressBookChanged( this ); }
bool loadingHasFinished() const;
signals:
void addressBookChanged( AddressBook *addressBook );
void addressBookLocked( AddressBook *addressBook );
void addressBookUnlocked( AddressBook *addressBook );
void loadingFinished( Resource *resource );
void savingFinished( Resource *resource );
protected slots:
void resourceLoadingFinished( Resource* );
void resourceSavingFinished( Resource* );
void resourceLoadingError( Resource*, const QString& );
void resourceSavingError( Resource*, const QString& );
protected:
void deleteRemovedAddressees();
void setStandardResource( Resource* );
Resource *standardResource();
KRES::Manager<Resource> *resourceManager();
private:
QPtrList<Resource> mDummy; // Remove in KDE 4
struct AddressBookData;
AddressBookData *d;
};
KABC_EXPORT QDataStream &operator<<( QDataStream &, const AddressBook & );
KABC_EXPORT QDataStream &operator>>( QDataStream &, AddressBook & );
}
#endif
KABC::ErrorHandler
Abstract class that provides displaying of error messages.
Definition: errorhandler.h:40
KABC::StdAddressBook
Standard KDE address book.
Definition: stdaddressbook.h:56
KABC::Ticket
Helper class for handling coordinated save of address books.
Definition: resource.h:37
KABC::AddressBook::ConstIterator
Address Book Const Iterator.
Definition: addressbook.h:84
KABC::Addressee
address book entry
Definition: addressee.src.h:74
KABC::AddressBook::Iterator
Address Book Iterator.
Definition: addressbook.h:57
operator<<
kdbgstream & operator<<(const QValueList< T > &list)
KABC::AddressBook
Address Book.
Definition: addressbook.h:43

KDE Home | KDE Accessibility Home | Description of Access Keys