• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

kabc

  • sources
  • kde-4.12
  • kdepimlibs
  • kabc
addressbook.h
1 /*
2  This file is part of libkabc.
3  Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #ifndef KABC_ADDRESSBOOK_H
22 #define KABC_ADDRESSBOOK_H
23 
24 #include "kabc_export.h"
25 
26 #include "addressee.h"
27 #include "field.h"
28 
29 #include "kresources/manager.h"
30 
31 #include <QtCore/QObject>
32 #include <QtCore/QList>
33 
34 namespace KABC {
35 
36 class DistributionList;
37 class ErrorHandler;
38 class Resource;
39 class Ticket;
40 
46 class KABC_DEPRECATED_EXPORT AddressBook : public QObject
47 {
48  Q_OBJECT
49 
50  friend KABC_EXPORT QDataStream &operator<<( QDataStream &lhs,
51  const AddressBook &rhs );
52  friend KABC_EXPORT QDataStream &operator>>( QDataStream &lhs,
53  AddressBook &rhs );
54  friend class StdAddressBook;
55 
56  public:
57  class ConstIterator;
58 
64  class KABC_DEPRECATED_EXPORT Iterator //krazy:exclude=dpointer
65  {
66  friend class AddressBook;
67  friend class ConstIterator;
68  public:
72  Iterator();
73 
77  Iterator( const Iterator & );
78  ~Iterator();
79 
85  Iterator &operator=( const Iterator & );
86 
93  const Addressee &operator*() const;
94 
101  Addressee &operator*();
102 
109  Addressee *operator->();
110 
116  Iterator &operator++();
117 
124  Iterator &operator++(int);
125 
131  Iterator &operator--();
132 
139  Iterator &operator--(int);
140 
148  bool operator==( const Iterator &it ) const;
149 
157  bool operator!=( const Iterator &it ) const;
158 
159  private:
160  struct IteratorData;
161  IteratorData *const d;
162  };
163 
169  class KABC_DEPRECATED_EXPORT ConstIterator //krazy:exclude=dpointer
170  {
171  friend class AddressBook;
172  public:
176  ConstIterator();
177 
181  ConstIterator( const ConstIterator & );
182 
183 #ifndef QT_STRICT_ITERATORS
184 
188  ConstIterator( const Iterator & );
189 #endif
190 
191  ~ConstIterator();
192 
198  ConstIterator &operator=( const ConstIterator & );
199 
208  const Addressee &operator*() const;
209 
216  const Addressee *operator->() const;
217 
223  ConstIterator &operator++();
224 
231  ConstIterator &operator++(int);
232 
238  ConstIterator &operator--();
239 
246  ConstIterator &operator--(int);
247 
255  bool operator==( const ConstIterator &it ) const;
256 
264  bool operator!=( const ConstIterator &it ) const;
265 
266  private:
267  struct ConstIteratorData;
268  ConstIteratorData *const d;
269  };
270 
274  typedef Iterator iterator;
275 
279  typedef ConstIterator const_iterator;
280 
285  AddressBook();
286 
293  AddressBook( const QString &config );
294 
298  virtual ~AddressBook();
299 
311  Ticket *requestSaveTicket( Resource *resource = 0 );
312 
319  void releaseSaveTicket( Ticket *ticket );
320 
326  bool load();
327 
335  bool asyncLoad();
336 
344  bool save( Ticket *ticket );
345 
353  bool asyncSave( Ticket *ticket );
354 
359  ConstIterator begin() const;
360  ConstIterator constBegin() const { return begin(); }
361 
366  Iterator begin();
367 
372  ConstIterator end() const;
373  ConstIterator constEnd() const { return end(); }
374 
379  Iterator end();
380 
384  void clear();
385 
393  void insertAddressee( const Addressee &addr );
394 
400  void removeAddressee( const Addressee &addr );
401 
408  void removeAddressee( const Iterator &it );
409 
416  Iterator find( const Addressee &addr );
417 
424  ConstIterator find( const Addressee &addr ) const;
425 
433  Addressee findByUid( const QString &uid ) const;
434 
438  Addressee::List allAddressees() const;
439 
446  Addressee::List findByName( const QString &name ) const;
447 
454  Addressee::List findByEmail( const QString &email ) const;
455 
462  Addressee::List findByCategory( const QString &category ) const;
463 
477  DistributionList *createDistributionList( const QString &name, Resource *resource = 0 );
478 
484  void removeDistributionList( DistributionList *list );
485 
491  DistributionList *findDistributionListByIdentifier( const QString &identifier );
492 
500  DistributionList *findDistributionListByName(
501  const QString &name,
502  Qt::CaseSensitivity caseSensitivity = Qt::CaseSensitive );
503 
508  QList<DistributionList*> allDistributionLists();
509 
517  QStringList allDistributionListNames() const;
518 
523  virtual QString identifier() const;
524 
529  Field::List fields( int category = Field::All ) const;
530 
540  bool addCustomField( const QString &label, int category = Field::All,
541  const QString &key = QString(),
542  const QString &app = QString() ) const;
543 
550  bool addResource( Resource *resource );
551 
558  bool removeResource( Resource *resource );
559 
563  QList<Resource*> resources() const;
564 
571  void setErrorHandler( ErrorHandler *errorHandler );
572 
578  void error( const QString &msg );
579 
584  void dump() const;
585 
589  void emitAddressBookLocked() { addressBookLocked( this ); }
593  void emitAddressBookUnlocked() { addressBookUnlocked( this ); }
597  void emitAddressBookChanged() { addressBookChanged( this ); }
598 
603  bool loadingHasFinished() const;
604 
605  Q_SIGNALS:
614  void addressBookChanged( AddressBook *addressBook );
615 
621  void addressBookLocked( AddressBook *addressBook );
622 
631  void addressBookUnlocked( AddressBook *addressBook );
632 
639  void loadingFinished( Resource *resource );
640 
647  void savingFinished( Resource *resource );
648 
649  protected Q_SLOTS:
660  void resourceLoadingFinished( Resource *resource );
661 
669  void resourceSavingFinished( Resource *resource );
670 
681  void resourceLoadingError( Resource *resource, const QString &errMsg );
682 
691  void resourceSavingError( Resource *resource, const QString &errMsg );
692 
693  protected:
703  void setStandardResource( Resource *resource );
704 
712  Resource *standardResource();
713 
717  KRES::Manager<Resource> *resourceManager();
718 
719  private:
720  class Private;
721  Private *const d;
722 };
723 
724 KABC_EXPORT QDataStream &operator<<( QDataStream &lhs, const AddressBook &rhs );
725 KABC_EXPORT QDataStream &operator>>( QDataStream &lhs, AddressBook &rhs );
726 
727 }
728 
729 #endif
KABC::AddressBook::emitAddressBookChanged
void emitAddressBookChanged()
Emits the signal addressBookChanged() using this as the parameter.
Definition: addressbook.h:597
KABC::StdAddressBook
Standard KDE address book.
Definition: stdaddressbook.h:59
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:169
KABC::Field::List
QList< Field * > List
This type is used for a list of fields.
Definition: field.h:52
KABC::Addressee
address book entry
Definition: addressee.h:74
KABC::AddressBook::emitAddressBookUnlocked
void emitAddressBookUnlocked()
Emits the signal addressBookUnlocked() using this as the parameter.
Definition: addressbook.h:593
KABC::Resource
Definition: resource.h:64
KABC::AddressBook::Iterator
Address Book Iterator.
Definition: addressbook.h:64
KABC::AddressBook::emitAddressBookLocked
void emitAddressBookLocked()
Emits the signal addressBookLocked() using this as the parameter.
Definition: addressbook.h:589
KRES::Manager
KABC::AddressBook
Address Book.
Definition: addressbook.h:46
KABC::Field::All
All fields.
Definition: field.h:61
KABC::Addressee::List
AddresseeList List
A list of addressee objects.
Definition: addressee.h:83
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:01:05 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kabc

Skip menu "kabc"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal