qtmobility/src/contacts/requests/qcontactsaverequest.cpp
changeset 14 6fbed849b4f4
parent 11 06b8e2af4411
child 15 1f895d8a5b2b
equal deleted inserted replaced
11:06b8e2af4411 14:6fbed849b4f4
    52   For a QContactSaveRequest, the resultsAvailable() signal will be emitted when
    52   For a QContactSaveRequest, the resultsAvailable() signal will be emitted when
    53   either the individual item errors (which may be retrieved by calling errorMap()), or the resultant
    53   either the individual item errors (which may be retrieved by calling errorMap()), or the resultant
    54   contacts (which may be retrieved by calling contacts()), are updated, as well as if
    54   contacts (which may be retrieved by calling contacts()), are updated, as well as if
    55   the overall operation error (which may be retrieved by calling error()) is updated.
    55   the overall operation error (which may be retrieved by calling error()) is updated.
    56 
    56 
       
    57   Please see the class documentation of QContactAbstractRequest for more information about
       
    58   the usage of request classes and ownership semantics.
       
    59 
    57   \ingroup contacts-requests
    60   \ingroup contacts-requests
    58  */
    61  */
    59 
    62 
    60 /*! Constructs a new contact save request whose parent is the specified \a parent */
    63 /*! Constructs a new contact save request whose parent is the specified \a parent */
    61 QContactSaveRequest::QContactSaveRequest(QObject* parent)
    64 QContactSaveRequest::QContactSaveRequest(QObject* parent)
    71   \endcode
    74   \endcode
    72  */
    75  */
    73 void QContactSaveRequest::setContact(const QContact& contact)
    76 void QContactSaveRequest::setContact(const QContact& contact)
    74 {
    77 {
    75     Q_D(QContactSaveRequest);
    78     Q_D(QContactSaveRequest);
       
    79     QMutexLocker ml(&d->m_mutex);
    76     d->m_contacts.clear();
    80     d->m_contacts.clear();
    77     d->m_contacts.append(contact);
    81     d->m_contacts.append(contact);
    78 }
    82 }
    79 
    83 
    80 /*! Sets the list of contacts to be saved to \a contacts */
    84 /*! Sets the list of contacts to be saved to \a contacts */
    81 void QContactSaveRequest::setContacts(const QList<QContact>& contacts)
    85 void QContactSaveRequest::setContacts(const QList<QContact>& contacts)
    82 {
    86 {
    83     Q_D(QContactSaveRequest);
    87     Q_D(QContactSaveRequest);
       
    88     QMutexLocker ml(&d->m_mutex);
    84     d->m_contacts = contacts;
    89     d->m_contacts = contacts;
    85 }
    90 }
    86 
    91 
    87 /*! Returns the list of contacts which will be saved if called prior to calling \c start(),
    92 /*! Returns the list of contacts which will be saved if called prior to calling \c start(),
    88     otherwise returns the list of contacts as they were saved in the contacts store */
    93     otherwise returns the list of contacts as they were saved in the contacts store */
    89 QList<QContact> QContactSaveRequest::contacts() const
    94 QList<QContact> QContactSaveRequest::contacts() const
    90 {
    95 {
    91     Q_D(const QContactSaveRequest);
    96     Q_D(const QContactSaveRequest);
       
    97     QMutexLocker ml(&d->m_mutex);
    92     return d->m_contacts;
    98     return d->m_contacts;
    93 }
    99 }
    94 
   100 
    95 /*! Returns the map of input definition list indices to errors which occurred */
   101 /*! Returns the map of input definition list indices to errors which occurred */
    96 QMap<int, QContactManager::Error> QContactSaveRequest::errorMap() const
   102 QMap<int, QContactManager::Error> QContactSaveRequest::errorMap() const
    97 {
   103 {
    98     Q_D(const QContactSaveRequest);
   104     Q_D(const QContactSaveRequest);
       
   105     QMutexLocker ml(&d->m_mutex);
    99     return d->m_errors;
   106     return d->m_errors;
   100 }
   107 }
   101 
   108 
   102 #include "moc_qcontactsaverequest.cpp"
   109 #include "moc_qcontactsaverequest.cpp"
   103 
   110