Warning: That file was not part of the compilation database. It may have many parsing errors.

1/****************************************************************************
2**
3** Copyright (C) 2015 The Qt Company Ltd.
4** Contact: http://www.qt.io/licensing/
5**
6** This file is part of the QtContacts module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL21$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see http://www.qt.io/terms-conditions. For further
15** information use the contact form at http://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 2.1 or version 3 as published by the Free
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the
22** following information to ensure the GNU Lesser General Public License
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25**
26** As a special exception, The Qt Company gives you certain additional
27** rights. These rights are described in The Qt Company LGPL Exception
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29**
30** $QT_END_LICENSE$
31**
32****************************************************************************/
33
34#ifndef QCONTACT_H
35#define QCONTACT_H
36
37#include <QtCore/qlist.h>
38#include <QtCore/qmap.h>
39#include <QtCore/qshareddata.h>
40#include <QtCore/qstring.h>
41
42#include <QtContacts/qcontactdetail.h>
43#include <QtContacts/qcontactrelationship.h>
44#include <QtContacts/qcontacttype.h>
45
46QT_BEGIN_NAMESPACE_CONTACTS
47
48class QContactActionDescriptor;
49class QContactId;
50class QContactManager;
51class QContactCollectionId;
52
53class QContactData;
54class Q_CONTACTS_EXPORT QContact
55{
56public:
57 QContact();
58
59 ~QContact();
60
61 QContact(const QContact& other);
62 QContact& operator=(const QContact& other);
63
64 bool operator==(const QContact &other) const;
65 bool operator!=(const QContact &other) const {return !(other == *this);}
66
67 /* Unique ID */
68 QContactId id() const;
69 void setId(const QContactId& id);
70
71 /* Type - contact, group, metacontact, ... */
72 QContactType::TypeValues type() const;
73 void setType(const QContactType::TypeValues& type);
74
75 QStringList tags() const;
76 void clearTags();
77 void addTag(const QString& tag);
78 void setTags(const QStringList& tags);
79
80 /* Is this an empty contact? */
81 bool isEmpty() const;
82 void clearDetails();
83
84 /* Access details of particular type */
85 QContactDetail detail(QContactDetail::DetailType type) const;
86 QList<QContactDetail> details(QContactDetail::DetailType type = QContactDetail::TypeUndefined) const;
87 bool appendDetail(const QContactDetail &detail);
88 /* Templated (type-specific) detail retrieval */
89 template<typename T> QList<T> details() const
90 {
91 QList<QContactDetail> props = details(T::Type);
92 QList<T> ret;
93 for (int i=0; i<props.count(); i++)
94 ret.append(T(props.at(i)));
95 return ret;
96 }
97
98 template<typename T> T detail() const
99 {
100 return T(detail(T::Type));
101 }
102
103 /* generic detail addition/removal functions */
104 bool saveDetail(QContactDetail* detail);
105 bool removeDetail(QContactDetail* detail);
106
107 /* Relationships that this contact was involved in when it was retrieved from the manager */
108 QList<QContactRelationship> relationships(const QString& relationshipType = QString()) const;
109 QList<QContactId> relatedContacts(const QString& relationshipType = QString(), QContactRelationship::Role role = QContactRelationship::Either) const;
110
111 QContactCollectionId collectionId() const;
112 void setCollectionId(const QContactCollectionId &collectionId);
113
114 /* Actions available to be performed on this contact */
115 QList<QContactActionDescriptor> availableActions(const QString& serviceName = QString()) const;
116
117 /* Preferences (eg, set a particular detail preferred for the SMS action) - subject to change! */
118 bool setPreferredDetail(const QString& actionName, const QContactDetail& preferredDetail);
119 bool isPreferredDetail(const QString& actionName, const QContactDetail& detail) const;
120 QContactDetail preferredDetail(const QString& actionName) const;
121 QMap<QString, QContactDetail> preferredDetails() const;
122
123private:
124 friend class QContactData;
125 friend class QContactManager;
126 friend class QContactManagerData;
127 friend class QContactManagerEngine;
128 Q_CONTACTS_EXPORT friend QDataStream& operator<<(QDataStream& out, const QContact& contact);
129 Q_CONTACTS_EXPORT friend QDataStream& operator>>(QDataStream& in, QContact& contact);
130
131 QSharedDataPointer<QContactData> d;
132};
133
134Q_CONTACTS_EXPORT uint qHash(const QContact& key);
135#ifndef QT_NO_DEBUG_STREAM
136Q_CONTACTS_EXPORT QDebug operator<<(QDebug dbg, const QContact& contact);
137#endif
138#ifndef QT_NO_DATASTREAM
139Q_CONTACTS_EXPORT QDataStream& operator<<(QDataStream& out, const QContact& contact);
140Q_CONTACTS_EXPORT QDataStream& operator>>(QDataStream& in, QContact& contact);
141#endif
142
143QT_END_NAMESPACE_CONTACTS
144
145QT_BEGIN_NAMESPACE
146Q_DECLARE_TYPEINFO(QTCONTACTS_PREPEND_NAMESPACE(QContact), Q_MOVABLE_TYPE);
147QT_END_NAMESPACE
148
149#endif // QCONTACT_H
150

Warning: That file was not part of the compilation database. It may have many parsing errors.

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

source code of qtpim/src/contacts/qcontact.h