• Skip to content
  • Skip to link menu
KDE API Documentation - personsmodel.h Source File (KPeople)
  • KDE Home
  • Contact Us
 

KPeople

  • frameworks
  • kpeople
  • src
personsmodel.h
1 /*
2  Persons Model
3  Copyright (C) 2012 Martin Klapetek <martin.klapetek@gmail.com>
4  Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
5  Copyright (C) 2013 David Edmundson <davidedmundson@kde.org>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21 
22 #ifndef PERSONS_MODEL_H
23 #define PERSONS_MODEL_H
24 
25 #include <kpeople/kpeople_export.h>
26 #include <QAbstractItemModel>
27 
28 #include "global.h"
29 
30 namespace KPeople
31 {
32 class ContactItem;
33 class PersonItem;
34 class MetaContact;
35 class PersonsModelPrivate;
36 
42 class KPEOPLE_EXPORT PersonsModel : public QAbstractItemModel
43 {
44  Q_OBJECT
46  Q_PROPERTY(bool isInitialized READ isInitialized NOTIFY modelInitialized)
47 public:
48  enum Role {
49  FormattedNameRole = Qt::DisplayRole,//QString best name for this person
50  PhotoRole = Qt::DecorationRole, //QPixmap best photo for this person
51  PersonUriRole = Qt::UserRole, //QString ID of this person
52  PersonVCardRole, //AbstractContact::Ptr
53  ContactsVCardRole, //AbstractContact::List (FIXME or map?)
54 
55  GroupsRole,
56 
57  UserRole = Qt::UserRole + 0x1000
58  };
59  Q_ENUMS(Role)
60 
61  PersonsModel(QObject *parent = 0);
62 
63  virtual ~PersonsModel();
64 
65  virtual int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
66  virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
67  virtual QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
68  virtual QModelIndex parent(const QModelIndex &index) const Q_DECL_OVERRIDE;
69  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
70  virtual QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
71 
73  QModelIndex indexForPersonUri(const QString &personUri) const;
74 
76  bool isInitialized() const;
77 
79  Q_SCRIPTABLE QVariant get(int row, int role);
80 
86  QVariant contactCustomProperty(const QModelIndex &index, const QString &key) const;
87 
88 Q_SIGNALS:
90  void modelInitialized(bool success);
91 
92 private:
93  Q_DISABLE_COPY(PersonsModel)
94 
95  QScopedPointer<PersonsModelPrivate> const d_ptr;
96  Q_DECLARE_PRIVATE(PersonsModel);
97 };
98 }
99 
100 #endif // PERSONS_MODEL_H
KPeople::PersonsModel::Role
Role
Definition: personsmodel.h:48
KPeople
The KPeople namespace contains all the classes for Libkpeople.
KPeople::PersonsModel
This class creates a model of all known contacts from all sources Contacts are represented as a tree ...
Definition: personsmodel.h:42
This file is part of the KDE documentation.
Documentation copyright © 1996-2015 The KDE developers.
Generated on Fri Feb 13 2015 15:16:39 by doxygen 1.8.9.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KPeople

Skip menu "KPeople"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • File List

Class Picker

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