resource.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_RESOURCE_H
#define KABC_RESOURCE_H
#include <kresources/resource.h>
#include "addressbook.h"
#include "plugin.h"
namespace KABC {
class KABC_EXPORT Ticket
{
friend class Resource;
public:
~Ticket();
Resource *resource();
private:
Ticket( Resource *resource );
Resource *mResource;
};
class KABC_EXPORT Resource : public KRES::Resource
{
Q_OBJECT
public:
class KABC_EXPORT Iterator
{
public:
Iterator();
Iterator( const Iterator & );
virtual ~Iterator();
virtual Iterator &operator=( const Iterator & );
virtual const Addressee &operator*() const;
virtual Addressee &operator*();
virtual Iterator &operator++();
virtual Iterator &operator++( int );
virtual Iterator &operator--();
virtual Iterator &operator--( int );
virtual bool operator==( const Iterator &it );
virtual bool operator!=( const Iterator &it );
struct IteratorData;
IteratorData *d;
};
class KABC_EXPORT ConstIterator
{
public:
ConstIterator();
ConstIterator( const ConstIterator & );
ConstIterator( const Iterator & );
virtual ~ConstIterator();
virtual ConstIterator &operator=( const ConstIterator & );
virtual const Addressee &operator*() const ;
virtual ConstIterator &operator++();
virtual ConstIterator &operator++( int );
virtual ConstIterator &operator--();
virtual ConstIterator &operator--( int );
virtual bool operator==( const ConstIterator &it );
virtual bool operator!=( const ConstIterator &it );
struct ConstIteratorData;
ConstIteratorData *d;
};
Resource( const KConfig *config );
virtual ~Resource();
virtual ConstIterator begin() const;
virtual Iterator begin();
virtual ConstIterator end() const;
virtual Iterator end();
AddressBook *addressBook();
virtual void writeConfig( KConfig *config );
virtual Ticket *requestSaveTicket() = 0;
virtual void releaseSaveTicket( Ticket* ) = 0;
virtual bool load() = 0;
virtual bool asyncLoad();
virtual void insertAddressee( const Addressee& );
virtual void removeAddressee( const Addressee& addr );
virtual bool save( Ticket *ticket ) = 0;
virtual bool asyncSave( Ticket *ticket );
virtual Addressee findByUid( const QString &uid );
virtual Addressee::List findByName( const QString &name );
virtual Addressee::List findByEmail( const QString &email );
virtual Addressee::List findByCategory( const QString &category );
virtual void clear();
void setAddressBook( AddressBook* );
signals:
void loadingFinished( Resource *resource );
void loadingError( Resource *resource, const QString &msg );
void savingFinished( Resource *resource );
void savingError( Resource *resource, const QString &msg );
protected:
Ticket *createTicket( Resource * );
Addressee::Map mAddrMap;
private:
AddressBook *mAddressBook;
class ResourcePrivate;
ResourcePrivate *d;
};
}
#endif
KABC::Resource::Iterator
Resource Iterator.
Definition: resource.h:68
KABC::Ticket
Helper class for handling coordinated save of address books.
Definition: resource.h:37
KABC::Addressee
address book entry
Definition: addressee.src.h:74
KConfig
KABC::Resource::ConstIterator
Resource Const Iterator.
Definition: resource.h:94
KABC::AddressBook
Address Book.
Definition: addressbook.h:43

KDE Home | KDE Accessibility Home | Description of Access Keys