| 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 | #include "qcontactrelationshipremoverequest.h" |
| 35 | |
| 36 | #include "qcontactrequests_p.h" |
| 37 | |
| 38 | QT_BEGIN_NAMESPACE_CONTACTS |
| 39 | |
| 40 | /*! |
| 41 | \class QContactRelationshipRemoveRequest |
| 42 | |
| 43 | \brief The QContactRelationshipRemoveRequest class allows a client |
| 44 | to asynchronously request that certain relationships be removed from |
| 45 | a contacts store. |
| 46 | |
| 47 | For a QContactRelationshipRemoveRequest, the resultsUpdated() signal will be emitted when |
| 48 | the individual item errors (which may be retrieved by calling errorMap()) are updated, or if the overall |
| 49 | operation error (which may be retrieved by calling error()) is updated. |
| 50 | |
| 51 | Please see the class documentation of QContactAbstractRequest for more information about |
| 52 | the usage of request classes and ownership semantics. |
| 53 | |
| 54 | |
| 55 | \inmodule QtContacts |
| 56 | |
| 57 | \ingroup contacts-requests |
| 58 | */ |
| 59 | |
| 60 | /*! Constructs a new relationship remove request whose parent is the specified \a parent */ |
| 61 | QContactRelationshipRemoveRequest::QContactRelationshipRemoveRequest(QObject* parent) |
| 62 | : QContactAbstractRequest(new QContactRelationshipRemoveRequestPrivate, parent) |
| 63 | { |
| 64 | } |
| 65 | |
| 66 | |
| 67 | /*! Frees any memory used by this request */ |
| 68 | QContactRelationshipRemoveRequest::~QContactRelationshipRemoveRequest() |
| 69 | { |
| 70 | } |
| 71 | |
| 72 | /*! |
| 73 | Sets the relationship which will be removed to \a relationship. |
| 74 | Equivalent to calling: |
| 75 | \code |
| 76 | setRelationships(QList<QContactRelationship>() << relationship); |
| 77 | \endcode |
| 78 | */ |
| 79 | void QContactRelationshipRemoveRequest::setRelationship(const QContactRelationship& relationship) |
| 80 | { |
| 81 | Q_D(QContactRelationshipRemoveRequest); |
| 82 | QMutexLocker ml(&d->m_mutex); |
| 83 | d->m_relationships.clear(); |
| 84 | d->m_relationships.append(t: relationship); |
| 85 | } |
| 86 | |
| 87 | /*! Sets the list of relationships which will be removed to \a relationships |
| 88 | */ |
| 89 | void QContactRelationshipRemoveRequest::setRelationships(const QList<QContactRelationship>& relationships) |
| 90 | { |
| 91 | Q_D(QContactRelationshipRemoveRequest); |
| 92 | QMutexLocker ml(&d->m_mutex); |
| 93 | d->m_relationships = relationships; |
| 94 | } |
| 95 | |
| 96 | /*! Returns the list of relationships which will be removed |
| 97 | */ |
| 98 | QList<QContactRelationship> QContactRelationshipRemoveRequest::relationships() const |
| 99 | { |
| 100 | Q_D(const QContactRelationshipRemoveRequest); |
| 101 | QMutexLocker ml(&d->m_mutex); |
| 102 | return d->m_relationships; |
| 103 | } |
| 104 | |
| 105 | /*! Returns the map of input contact list indices to errors which occurred |
| 106 | */ |
| 107 | QMap<int, QContactManager::Error> QContactRelationshipRemoveRequest::errorMap() const |
| 108 | { |
| 109 | Q_D(const QContactRelationshipRemoveRequest); |
| 110 | QMutexLocker ml(&d->m_mutex); |
| 111 | return d->m_errors; |
| 112 | } |
| 113 | |
| 114 | #include "moc_qcontactrelationshipremoverequest.cpp" |
| 115 | |
| 116 | QT_END_NAMESPACE_CONTACTS |
| 117 | |