|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #include "qcontactrelationshipfetchrequest.h" |
|
43 #include "qcontactrelationship.h" |
|
44 #include "qcontactrelationshipfilter.h" |
|
45 #include "qcontactrequests_p.h" |
|
46 |
|
47 QTM_BEGIN_NAMESPACE |
|
48 |
|
49 /*! |
|
50 \class QContactRelationshipFetchRequest |
|
51 |
|
52 \brief The QContactRelationshipFetchRequest class allows a client to |
|
53 asynchronously request relationships from a contacts store manager. |
|
54 |
|
55 For a QContactRelationshipFetchRequest, the resultsAvailable() signal will be emitted when the resultant |
|
56 relationships (which may be retrieved by calling relationships()), are updated, as well as if |
|
57 the overall operation error (which may be retrieved by calling error()) is updated. |
|
58 |
|
59 Please see the class documentation of QContactAbstractRequest for more information about |
|
60 the usage of request classes and ownership semantics. |
|
61 |
|
62 \ingroup contacts-requests |
|
63 */ |
|
64 |
|
65 /*! Constructs a new relationship fetch request whose parent is the specified \a parent |
|
66 */ |
|
67 QContactRelationshipFetchRequest::QContactRelationshipFetchRequest(QObject* parent) |
|
68 : QContactAbstractRequest(new QContactRelationshipFetchRequestPrivate, parent) |
|
69 { |
|
70 } |
|
71 |
|
72 /*! Frees any memory used by this request */ |
|
73 QContactRelationshipFetchRequest::~QContactRelationshipFetchRequest() |
|
74 { |
|
75 QContactAbstractRequestPrivate::notifyEngine(this); |
|
76 } |
|
77 |
|
78 /*! Sets the source contact criterion of the fetch request to \a firstId. |
|
79 If \a firstId is the default-constructed id, or the first contact id is not set, |
|
80 the request will fetch relationships involving any first contact. |
|
81 */ |
|
82 void QContactRelationshipFetchRequest::setFirst(const QContactId& firstId) |
|
83 { |
|
84 Q_D(QContactRelationshipFetchRequest); |
|
85 QMutexLocker ml(&d->m_mutex); |
|
86 d->m_first = firstId; |
|
87 } |
|
88 |
|
89 /*! Returns the source contact criterion of the fetch request |
|
90 */ |
|
91 QContactId QContactRelationshipFetchRequest::first() const |
|
92 { |
|
93 Q_D(const QContactRelationshipFetchRequest); |
|
94 QMutexLocker ml(&d->m_mutex); |
|
95 return d->m_first; |
|
96 } |
|
97 |
|
98 /*! Sets the relationship type criterion of the fetch request to \a relationshipType. |
|
99 If \a relationshipType is empty, or the relationship type is not set, |
|
100 the request will fetch relationships of any type. |
|
101 */ |
|
102 void QContactRelationshipFetchRequest::setRelationshipType(const QString& relationshipType) |
|
103 { |
|
104 Q_D(QContactRelationshipFetchRequest); |
|
105 QMutexLocker ml(&d->m_mutex); |
|
106 d->m_relationshipType = relationshipType; |
|
107 } |
|
108 |
|
109 /*! Returns the relationship type criterion of the fetch request |
|
110 */ |
|
111 QString QContactRelationshipFetchRequest::relationshipType() const |
|
112 { |
|
113 Q_D(const QContactRelationshipFetchRequest); |
|
114 QMutexLocker ml(&d->m_mutex); |
|
115 return d->m_relationshipType; |
|
116 } |
|
117 |
|
118 /*! Sets the destination contact criterion of the fetch request to \a secondId. |
|
119 If \a secondId is the default-constructed id, or the second contact id is not set, |
|
120 the request will fetch relationships involving any second contact. |
|
121 */ |
|
122 void QContactRelationshipFetchRequest::setSecond(const QContactId& secondId) |
|
123 { |
|
124 Q_D(QContactRelationshipFetchRequest); |
|
125 QMutexLocker ml(&d->m_mutex); |
|
126 d->m_second = secondId; |
|
127 } |
|
128 |
|
129 /*! Returns the destination contact criterion of the fetch request |
|
130 */ |
|
131 QContactId QContactRelationshipFetchRequest::second() const |
|
132 { |
|
133 Q_D(const QContactRelationshipFetchRequest); |
|
134 QMutexLocker ml(&d->m_mutex); |
|
135 return d->m_second; |
|
136 } |
|
137 |
|
138 |
|
139 /*! Returns the list of relationships that was the result of the request |
|
140 */ |
|
141 QList<QContactRelationship> QContactRelationshipFetchRequest::relationships() const |
|
142 { |
|
143 Q_D(const QContactRelationshipFetchRequest); |
|
144 QMutexLocker ml(&d->m_mutex); |
|
145 return d->m_relationships; |
|
146 } |
|
147 |
|
148 #include "moc_qcontactrelationshipfetchrequest.cpp" |
|
149 |
|
150 QTM_END_NAMESPACE |