summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Adams <chris.adams@jollamobile.com>2015-07-20 15:37:31 +1000
committerLiang Qi <liang.qi@theqtcompany.com>2015-10-12 13:04:27 +0000
commit3eb142029c2513d1ddd5266bf56df544ed98732a (patch)
tree4bedc67ffbc50343ee48dc89d652180bd9e4179a
parent3ff8c2c5d803100251aa41befff0d59f540021f9 (diff)
Improve QContactDetail performance and memory usage
This commit improves the performance of QContactDetail by avoiding use of QMap<int, QVariant> to store data, as the memory footprint of this storage container is prohibitively large. Instead, all details' fields are now backed by specific data members and the QMap is only used in fallback or extension cases. According to the tests/benchmarks/contacts/detailsbenchmark results, this commit reduces memory usage by about 35% and reduces runtime by about 35% also. Change-Id: Ie73d124563ebf4b46d35810116110322af2208c4 Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
-rw-r--r--src/contacts/details/qcontactaddress.h28
-rw-r--r--src/contacts/details/qcontactanniversary.h20
-rw-r--r--src/contacts/details/qcontactavatar.h8
-rw-r--r--src/contacts/details/qcontactbirthday.h12
-rw-r--r--src/contacts/details/qcontactdetails.cpp1329
-rw-r--r--src/contacts/details/qcontactdisplaylabel.h4
-rw-r--r--src/contacts/details/qcontactemailaddress.h4
-rw-r--r--src/contacts/details/qcontactextendeddetail.h22
-rw-r--r--src/contacts/details/qcontactfamily.h8
-rw-r--r--src/contacts/details/qcontactfavorite.h8
-rw-r--r--src/contacts/details/qcontactgender.h4
-rw-r--r--src/contacts/details/qcontactgeolocation.h36
-rw-r--r--src/contacts/details/qcontactglobalpresence.h24
-rw-r--r--src/contacts/details/qcontactguid.h4
-rw-r--r--src/contacts/details/qcontacthobby.h4
-rw-r--r--src/contacts/details/qcontactname.h20
-rw-r--r--src/contacts/details/qcontactnickname.h4
-rw-r--r--src/contacts/details/qcontactnote.h4
-rw-r--r--src/contacts/details/qcontactonlineaccount.h20
-rw-r--r--src/contacts/details/qcontactorganization.h28
-rw-r--r--src/contacts/details/qcontactphonenumber.h10
-rw-r--r--src/contacts/details/qcontactpresence.h24
-rw-r--r--src/contacts/details/qcontactringtone.h18
-rw-r--r--src/contacts/details/qcontactsynctarget.h4
-rw-r--r--src/contacts/details/qcontacttag.h4
-rw-r--r--src/contacts/details/qcontacttimestamp.h8
-rw-r--r--src/contacts/details/qcontacttype.h4
-rw-r--r--src/contacts/details/qcontacturl.h10
-rw-r--r--src/contacts/details/qcontactversion.h15
-rw-r--r--src/contacts/qcontact.cpp22
-rw-r--r--src/contacts/qcontactdetail.cpp158
-rw-r--r--src/contacts/qcontactdetail.h51
-rw-r--r--src/contacts/qcontactdetail_p.h439
-rw-r--r--tests/auto/contacts/qcontact/tst_qcontact.cpp4
-rw-r--r--tests/auto/contacts/qcontactdetails/tst_qcontactdetails.cpp102
35 files changed, 2062 insertions, 402 deletions
diff --git a/src/contacts/details/qcontactaddress.h b/src/contacts/details/qcontactaddress.h
index 06f3bc208..cc3993b9f 100644
--- a/src/contacts/details/qcontactaddress.h
+++ b/src/contacts/details/qcontactaddress.h
@@ -67,21 +67,21 @@ public:
SubTypeInternational
};
- void setStreet(const QString& _street) {setValue(FieldStreet, _street);}
- QString street() const {return value(FieldStreet).toString();}
- void setLocality(const QString& _locality) {setValue(FieldLocality, _locality);}
- QString locality() const {return value(FieldLocality).toString();}
- void setRegion(const QString& _region) {setValue(FieldRegion, _region);}
- QString region() const {return value(FieldRegion).toString();}
- void setPostcode(const QString& _postcode) {setValue(FieldPostcode, _postcode);}
- QString postcode() const {return value(FieldPostcode).toString();}
- void setCountry(const QString& _country) {setValue(FieldCountry, _country);}
- QString country() const {return value(FieldCountry).toString();}
- void setPostOfficeBox(const QString& _postOfficeBox) {setValue(FieldPostOfficeBox, _postOfficeBox);}
- QString postOfficeBox() const {return value(FieldPostOfficeBox).toString();}
+ void setStreet(const QString& _street);
+ QString street() const;
+ void setLocality(const QString& _locality);
+ QString locality() const;
+ void setRegion(const QString& _region);
+ QString region() const;
+ void setPostcode(const QString& _postcode);
+ QString postcode() const;
+ void setCountry(const QString& _country);
+ QString country() const;
+ void setPostOfficeBox(const QString& _postOfficeBox);
+ QString postOfficeBox() const;
- void setSubTypes(const QList<int> &_subTypes) {setValue(FieldSubTypes, QVariant::fromValue(_subTypes));}
- QList<int> subTypes() const {return value< QList<int> >(FieldSubTypes);}
+ void setSubTypes(const QList<int> &_subTypes);
+ QList<int> subTypes() const;
// Convenience filter
static QContactFilter match(const QString& subString);
diff --git a/src/contacts/details/qcontactanniversary.h b/src/contacts/details/qcontactanniversary.h
index dfecb11ea..38a0e219a 100644
--- a/src/contacts/details/qcontactanniversary.h
+++ b/src/contacts/details/qcontactanniversary.h
@@ -65,18 +65,18 @@ public:
SubTypeMemorial
};
- void setOriginalDate(const QDate& date) {setValue(FieldOriginalDate, date);}
- QDate originalDate() const {return value<QDate>(FieldOriginalDate);}
- void setOriginalDateTime(const QDateTime& dateTime) {setValue(FieldOriginalDate, dateTime);}
- QDateTime originalDateTime() const {return value<QDateTime>(FieldOriginalDate);}
+ void setOriginalDate(const QDate& date);
+ QDate originalDate() const;
+ void setOriginalDateTime(const QDateTime& dateTime);
+ QDateTime originalDateTime() const;
- void setCalendarId(const QString& _calendarId) {setValue(FieldCalendarId, _calendarId);}
- QString calendarId() const {return value(FieldCalendarId).toString();}
- void setEvent(const QString& _event) {setValue(FieldEvent, _event);}
- QString event() const {return value(FieldEvent).toString();}
+ void setCalendarId(const QString& _calendarId);
+ QString calendarId() const;
+ void setEvent(const QString& _event);
+ QString event() const;
- void setSubType(const QContactAnniversary::SubType &_subType) {setValue(FieldSubType, static_cast<int>(_subType));}
- QContactAnniversary::SubType subType() const {return static_cast<QContactAnniversary::SubType>(value<int>(FieldSubType));}
+ void setSubType(QContactAnniversary::SubType _subType);
+ QContactAnniversary::SubType subType() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontactavatar.h b/src/contacts/details/qcontactavatar.h
index 66de69f70..583e3f5a0 100644
--- a/src/contacts/details/qcontactavatar.h
+++ b/src/contacts/details/qcontactavatar.h
@@ -55,11 +55,11 @@ public:
FieldVideoUrl
};
- void setImageUrl(const QUrl& _imageUrl) {setValue(FieldImageUrl, _imageUrl);}
- QUrl imageUrl() const {return value<QUrl>(FieldImageUrl);}
+ void setImageUrl(const QUrl& _imageUrl);
+ QUrl imageUrl() const;
- void setVideoUrl(const QUrl& _videoUrl) {setValue(FieldVideoUrl, _videoUrl);}
- QUrl videoUrl() const {return value<QUrl>(FieldVideoUrl);}
+ void setVideoUrl(const QUrl& _videoUrl);
+ QUrl videoUrl() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontactbirthday.h b/src/contacts/details/qcontactbirthday.h
index 6e9e62fb0..217133205 100644
--- a/src/contacts/details/qcontactbirthday.h
+++ b/src/contacts/details/qcontactbirthday.h
@@ -55,12 +55,12 @@ public:
FieldCalendarId
};
- void setDate(const QDate& _date) {setValue(FieldBirthday, _date);}
- QDate date() const {return value<QDate>(FieldBirthday);}
- void setDateTime(const QDateTime& _dateTime) {setValue(FieldBirthday, _dateTime);}
- QDateTime dateTime() const {return value<QDateTime>(FieldBirthday);}
- void setCalendarId(const QString& _calendarId) {setValue(FieldCalendarId, _calendarId);}
- QString calendarId() const {return value(FieldCalendarId).toString();}
+ void setDate(const QDate& _date);
+ QDate date() const;
+ void setDateTime(const QDateTime& _dateTime);
+ QDateTime dateTime() const;
+ void setCalendarId(const QString& _calendarId);
+ QString calendarId() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontactdetails.cpp b/src/contacts/details/qcontactdetails.cpp
index b51adb390..17fd9206e 100644
--- a/src/contacts/details/qcontactdetails.cpp
+++ b/src/contacts/details/qcontactdetails.cpp
@@ -38,6 +38,7 @@
#include "qcontactmanager.h"
#include "qcontactfilter.h"
#include "qcontacts.h"
+#include "qcontactdetail_p.h"
/*
When these conditions are satisfied, QStringLiteral is implemented by
@@ -54,6 +55,19 @@
QT_BEGIN_NAMESPACE_CONTACTS
+/* We use offsetof to determine the offset to member fields
+ * in each builtin detail type private class.
+ * This is technically undefined behavior according to the
+ * CPP98 spec, as the classes in question are non-POD.
+ * However, they do not have any virtual functions, nor any
+ * private or protected non-static data, nor do they use
+ * multiple inheritance or virtual inheritance otherwise.
+ * As such, all modern compilers do implement the class
+ * layouts as if they were POD, and the offsetof macro
+ * does indeed work in our case. */
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_GCC("-Winvalid-offsetof")
+
/* template docs:
@@ -87,6 +101,21 @@ QT_BEGIN_NAMESPACE_CONTACTS
\ingroup contacts-details
*/
+class QContactSyncTargetPrivate : public QContactDetailBuiltinPrivate<QContactSyncTargetPrivate>
+{
+public:
+ QString m_syncTarget;
+
+ enum { FieldCount = 1 };
+
+ QContactSyncTargetPrivate() : QContactDetailBuiltinPrivate<QContactSyncTargetPrivate>(QContactSyncTarget::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactSyncTargetPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactSyncTargetPrivate, m_syncTarget) },
+};
+
/*!
\variable QContactSyncTarget::Type
The enum constant for the type identifier of QContactSyncTarget details.
@@ -106,6 +135,10 @@ const QContactDetail::DetailType QContactSyncTarget::Type(QContactDetail::TypeSy
Returns the identifier of the backend store to which the contact
containing this detail should be synchronized.
*/
+QString QContactSyncTarget::syncTarget() const
+{
+ return reinterpret_cast<const QContactSyncTargetPrivate*>(d.constData())->memberValue<QString>(QContactSyncTarget::FieldSyncTarget);
+}
/*!
\fn QContactSyncTarget::setSyncTarget(const QString& syncTarget)
@@ -113,6 +146,10 @@ const QContactDetail::DetailType QContactSyncTarget::Type(QContactDetail::TypeSy
Sets the identifier of the backend store to which the contact
containing this detail should be synchronized to \a syncTarget.
*/
+void QContactSyncTarget::setSyncTarget(const QString &_value)
+{
+ reinterpret_cast<QContactSyncTargetPrivate*>(d.data())->setMemberValue<QString>(QContactSyncTarget::FieldSyncTarget, _value);
+}
/* ==================== QContactEmailAddress ======================= */
@@ -126,6 +163,21 @@ const QContactDetail::DetailType QContactSyncTarget::Type(QContactDetail::TypeSy
\inmodule QtContacts
*/
+class QContactEmailAddressPrivate : public QContactDetailBuiltinPrivate<QContactEmailAddressPrivate>
+{
+public:
+ QString m_emailAddress;
+
+ enum { FieldCount = 1 };
+
+ QContactEmailAddressPrivate() : QContactDetailBuiltinPrivate<QContactEmailAddressPrivate>(QContactEmailAddress::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactEmailAddressPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactEmailAddressPrivate, m_emailAddress) },
+};
+
/*!
\variable QContactEmailAddress::Type
The enum constant for the type identifier of QContactEmailAddress details.
@@ -144,11 +196,19 @@ const QContactDetail::DetailType QContactEmailAddress::Type(QContactDetail::Type
\fn QContactEmailAddress::emailAddress() const
Returns the email address of the contact which is stored in this detail.
*/
+QString QContactEmailAddress::emailAddress() const
+{
+ return reinterpret_cast<const QContactEmailAddressPrivate*>(d.constData())->memberValue<QString>(QContactEmailAddress::FieldEmailAddress);
+}
/*!
\fn QContactEmailAddress::setEmailAddress(const QString& emailAddress)
Sets the email address of the contact which is stored in this detail to \a emailAddress.
*/
+void QContactEmailAddress::setEmailAddress(const QString& _value)
+{
+ reinterpret_cast<QContactEmailAddressPrivate*>(d.data())->setMemberValue<QString>(QContactEmailAddress::FieldEmailAddress, _value);
+}
/* ==================== QContactFamily ======================= */
/*!
@@ -159,6 +219,23 @@ const QContactDetail::DetailType QContactEmailAddress::Type(QContactDetail::Type
\inmodule QtContacts
*/
+class QContactFamilyPrivate : public QContactDetailBuiltinPrivate<QContactFamilyPrivate>
+{
+public:
+ QString m_spouse;
+ QStringList m_children;
+
+ enum { FieldCount = 2 };
+
+ QContactFamilyPrivate() : QContactDetailBuiltinPrivate<QContactFamilyPrivate>(QContactFamily::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactFamilyPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactFamilyPrivate, m_spouse) },
+ { QContactDetailBuiltinPrivateBase::StringList, offsetof(QContactFamilyPrivate, m_children) },
+};
+
/*!
\variable QContactFamily::Type
The enum constant for the type identifier of QContactFamily details.
@@ -179,21 +256,37 @@ const QContactDetail::DetailType QContactFamily::Type(QContactDetail::TypeFamily
\fn QContactFamily::spouse() const
Returns the name of the spouse of the contact which is stored in this detail.
*/
+QString QContactFamily::spouse() const
+{
+ return reinterpret_cast<const QContactFamilyPrivate*>(d.constData())->memberValue<QString>(QContactFamily::FieldSpouse);
+}
/*!
\fn QContactFamily::setSpouse(const QString& spouseName)
Sets the name of the spouse of the contact which is stored in this detail to \a spouseName.
*/
+void QContactFamily::setSpouse(const QString& _value)
+{
+ reinterpret_cast<QContactFamilyPrivate*>(d.data())->setMemberValue<QString>(QContactFamily::FieldSpouse, _value);
+}
/*!
\fn QContactFamily::children() const
Returns the names of the children of the contact which is stored in this detail.
*/
+QStringList QContactFamily::children() const
+{
+ return reinterpret_cast<const QContactFamilyPrivate*>(d.constData())->memberValue<QStringList>(QContactFamily::FieldChildren);
+}
/*!
\fn QContactFamily::setChildren(const QStringList& childrenNames)
Sets the names of the children of the contact which is stored in this detail to \a childrenNames.
*/
+void QContactFamily::setChildren(const QStringList &_value)
+{
+ reinterpret_cast<QContactFamilyPrivate*>(d.data())->setMemberValue<QStringList>(QContactFamily::FieldChildren, _value);
+}
/* ==================== QContactFavorite ======================= */
/*!
@@ -204,6 +297,23 @@ const QContactDetail::DetailType QContactFamily::Type(QContactDetail::TypeFamily
\inmodule QtContacts
*/
+class QContactFavoritePrivate : public QContactDetailBuiltinPrivate<QContactFavoritePrivate>
+{
+public:
+ bool m_favorite;
+ int m_index;
+
+ enum { FieldCount = 2 };
+
+ QContactFavoritePrivate() : QContactDetailBuiltinPrivate<QContactFavoritePrivate>(QContactFavorite::Type), m_favorite(false), m_index(0) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactFavoritePrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::Bool, offsetof(QContactFavoritePrivate, m_favorite) },
+ { QContactDetailBuiltinPrivateBase::Int, offsetof(QContactFavoritePrivate, m_index) },
+};
+
/*!
\variable QContactFavorite::Type
The enum constant for the type identifier of QContactFavorite details.
@@ -225,21 +335,36 @@ const QContactDetail::DetailType QContactFavorite::Type(QContactDetail::TypeFavo
\fn bool QContactFavorite::isFavorite() const
Returns true if the contact is a favorite, false otherwise.
*/
-
+bool QContactFavorite::isFavorite() const
+{
+ return reinterpret_cast<const QContactFavoritePrivate*>(d.constData())->memberValue<bool>(QContactFavorite::FieldFavorite);
+}
/*!
\fn QContactFavorite::setFavorite(bool isFavorite)
If \a isFavorite is true, marks the contact as a favorite. Otherwise, marks the contact as not a favorite.
*/
+void QContactFavorite::setFavorite(bool _value)
+{
+ reinterpret_cast<QContactFavoritePrivate*>(d.data())->setMemberValue<bool>(QContactFavorite::FieldFavorite, _value);
+}
/*!
\fn int QContactFavorite::index() const
Returns the index of the favorite contact.
*/
+int QContactFavorite::index() const
+{
+ return reinterpret_cast<const QContactFavoritePrivate*>(d.constData())->memberValue<int>(QContactFavorite::FieldIndex);
+}
/*!
\fn QContactFavorite::setIndex(int index)
Sets the index of the favorite contact to \a index.
*/
+void QContactFavorite::setIndex(int _value)
+{
+ reinterpret_cast<QContactFavoritePrivate*>(d.data())->setMemberValue<int>(QContactFavorite::FieldIndex, _value);
+}
/*!
Returns a filter suitable for finding contacts which are marked
@@ -264,6 +389,27 @@ QContactFilter QContactFavorite::match()
\inmodule QtContacts
*/
+class QContactAnniversaryPrivate : public QContactDetailBuiltinPrivate<QContactAnniversaryPrivate>
+{
+public:
+ QString m_calendarId;
+ QDateTime m_originalDate;
+ QString m_event;
+ int m_subType;
+
+ enum { FieldCount = 4 };
+
+ QContactAnniversaryPrivate() : QContactDetailBuiltinPrivate<QContactAnniversaryPrivate>(QContactAnniversary::Type), m_subType(0) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactAnniversaryPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactAnniversaryPrivate, m_calendarId) },
+ { QContactDetailBuiltinPrivateBase::DateTime, offsetof(QContactAnniversaryPrivate, m_originalDate) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactAnniversaryPrivate, m_event) },
+ { QContactDetailBuiltinPrivateBase::Int, offsetof(QContactAnniversaryPrivate, m_subType) },
+};
+
/*!
\variable QContactAnniversary::Type
The enum constant for the type identifier of QContactAnniversary details.
@@ -305,11 +451,19 @@ const QContactDetail::DetailType QContactAnniversary::Type(QContactDetail::TypeA
Returns the original date of the event stored in this detail.
If the original event occurrence stored is a QDateTime, this returns the date portion.
*/
+QDate QContactAnniversary::originalDate() const
+{
+ return (reinterpret_cast<const QContactAnniversaryPrivate*>(d.constData()))->memberValue<QDateTime>(QContactAnniversary::FieldOriginalDate).date();
+}
/*!
\fn QContactAnniversary::setOriginalDate(const QDate& date)
Sets the original date of the event stored in this detail to \a date.
*/
+void QContactAnniversary::setOriginalDate(const QDate& _value)
+{
+ reinterpret_cast<QContactAnniversaryPrivate*>(d.data())->setMemberValue<QDateTime>(QContactAnniversary::FieldOriginalDate, QDateTime(_value));
+}
/*!
\fn QContactAnniversary::originalDateTime() const
@@ -317,41 +471,73 @@ const QContactDetail::DetailType QContactAnniversary::Type(QContactDetail::TypeA
If the original event occurrence stored is a QDate, this returns a QDateTime with the
time set to midnight.
*/
+QDateTime QContactAnniversary::originalDateTime() const
+{
+ return reinterpret_cast<const QContactAnniversaryPrivate*>(d.constData())->memberValue<QDateTime>(QContactAnniversary::FieldOriginalDate);
+}
/*!
\fn QContactAnniversary::setOriginalDateTime(const QDateTime& dateTime)
Sets the original date and time of the event stored in this detail to \a dateTime.
*/
+void QContactAnniversary::setOriginalDateTime(const QDateTime& _value)
+{
+ reinterpret_cast<QContactAnniversaryPrivate*>(d.data())->setMemberValue<QDateTime>(QContactAnniversary::FieldOriginalDate, _value);
+}
/*!
\fn QContactAnniversary::calendarId() const
* Returns the identifier of the calendar entry associated with this anniversary.
*/
+QString QContactAnniversary::calendarId() const
+{
+ return reinterpret_cast<const QContactAnniversaryPrivate*>(d.constData())->memberValue<QString>(QContactAnniversary::FieldCalendarId);
+}
/*!
\fn QContactAnniversary::setCalendarId(const QString& calendarId)
Sets the identifier of the calendar entry associated with this anniversary to \a calendarId.
*/
+void QContactAnniversary::setCalendarId(const QString& _value)
+{
+ reinterpret_cast<QContactAnniversaryPrivate*>(d.data())->setMemberValue<QString>(QContactAnniversary::FieldCalendarId, _value);
+}
/*!
\fn QContactAnniversary::event() const
Returns the name of the event for which this detail contains information.
*/
+QString QContactAnniversary::event() const
+{
+ return reinterpret_cast<const QContactAnniversaryPrivate*>(d.constData())->memberValue<QString>(QContactAnniversary::FieldEvent);
+}
/*!
\fn QContactAnniversary::setEvent(const QString& event)
Sets the name of the event for which this detail contains information to \a event.
*/
+void QContactAnniversary::setEvent(const QString& _value)
+{
+ reinterpret_cast<QContactAnniversaryPrivate*>(d.data())->setMemberValue<QString>(QContactAnniversary::FieldEvent, _value);
+}
/*!
\fn QContactAnniversary::setSubType(const QContactAnniversary::SubType &subType)
Sets the subtype which this detail implements to be the given \a subType.
*/
+void QContactAnniversary::setSubType(QContactAnniversary::SubType _value)
+{
+ reinterpret_cast<QContactAnniversaryPrivate*>(d.data())->setMemberValue<int>(QContactAnniversary::FieldSubType, static_cast<int>(_value));
+}
/*!
\fn QContactAnniversary::subType() const
Returns the subtype that this detail implements, if defined.
*/
+QContactAnniversary::SubType QContactAnniversary::subType() const
+{
+ return static_cast<QContactAnniversary::SubType>(reinterpret_cast<const QContactAnniversaryPrivate*>(d.constData())->memberValue<int>(QContactAnniversary::FieldSubType));
+}
/* ==================== QContactAvatar ======================= */
@@ -372,9 +558,25 @@ const QContactDetail::DetailType QContactAnniversary::Type(QContactDetail::TypeA
resource whose content may dynamically change. The content of a resource
identified by a URL specified in a QContactAvatar detail is set by whoever
owns the resource which the URL identifies.
-
*/
+class QContactAvatarPrivate : public QContactDetailBuiltinPrivate<QContactAvatarPrivate>
+{
+public:
+ QUrl m_imageUrl;
+ QUrl m_videoUrl;
+
+ enum { FieldCount = 2 };
+
+ QContactAvatarPrivate() : QContactDetailBuiltinPrivate<QContactAvatarPrivate>(QContactAvatar::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactAvatarPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::Url, offsetof(QContactAvatarPrivate, m_imageUrl) },
+ { QContactDetailBuiltinPrivateBase::Url, offsetof(QContactAvatarPrivate, m_videoUrl) },
+};
+
/*!
\variable QContactAvatar::Type
The enum constant for the type identifier of QContactAvatar details.
@@ -395,21 +597,37 @@ const QContactDetail::DetailType QContactAvatar::Type(QContactDetail::TypeAvatar
\fn QContactAvatar::imageUrl() const
Returns the url of an avatar image associated with the contact
*/
+QUrl QContactAvatar::imageUrl() const
+{
+ return reinterpret_cast<const QContactAvatarPrivate*>(d.constData())->memberValue<QUrl>(QContactAvatar::FieldImageUrl);
+}
/*!
\fn QContactAvatar::setImageUrl(const QUrl& imageUrl)
Sets the url of an avatar image associated with the contact to \a imageUrl
*/
+void QContactAvatar::setImageUrl(const QUrl& _value)
+{
+ reinterpret_cast<QContactAvatarPrivate*>(d.data())->setMemberValue<QUrl>(QContactAvatar::FieldImageUrl, _value);
+}
/*!
\fn QContactAvatar::videoUrl() const
Returns the url of an avatar video associated with the contact
*/
+QUrl QContactAvatar::videoUrl() const
+{
+ return reinterpret_cast<const QContactAvatarPrivate*>(d.constData())->memberValue<QUrl>(QContactAvatar::FieldVideoUrl);
+}
/*!
\fn QContactAvatar::setVideoUrl(const QUrl& videoUrl)
Sets the url of an avatar video associated with the contact to \a videoUrl
*/
+void QContactAvatar::setVideoUrl(const QUrl& _value)
+{
+ reinterpret_cast<QContactAvatarPrivate*>(d.data())->setMemberValue<QUrl>(QContactAvatar::FieldVideoUrl, _value);
+}
/* ==================== QContactAddress ======================= */
@@ -425,6 +643,33 @@ const QContactDetail::DetailType QContactAvatar::Type(QContactDetail::TypeAvatar
Versit \reg is a trademark of the Internet Mail Consortium.
*/
+class QContactAddressPrivate : public QContactDetailBuiltinPrivate<QContactAddressPrivate>
+{
+public:
+ QString m_street;
+ QString m_locality;
+ QString m_region;
+ QString m_postcode;
+ QString m_country;
+ QList<int> m_subTypes;
+ QString m_pobox;
+
+ enum { FieldCount = 7 };
+
+ QContactAddressPrivate() : QContactDetailBuiltinPrivate<QContactAddressPrivate>(QContactAddress::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactAddressPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactAddressPrivate, m_street) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactAddressPrivate, m_locality) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactAddressPrivate, m_region) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactAddressPrivate, m_postcode) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactAddressPrivate, m_country) },
+ { QContactDetailBuiltinPrivateBase::IntList, offsetof(QContactAddressPrivate, m_subTypes) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactAddressPrivate, m_pobox) },
+};
+
/*!
\variable QContactAddress::Type
The enum constant for the type identifier of QContactAddress details.
@@ -471,71 +716,128 @@ const QContactDetail::DetailType QContactAddress::Type(QContactDetail::TypeAddre
\fn QContactAddress::postOfficeBox() const
Returns the post office box segment of the address stored in this detail.
*/
+QString QContactAddress::postOfficeBox() const
+{
+ return reinterpret_cast<const QContactAddressPrivate*>(d.constData())->memberValue<QString>(QContactAddress::FieldPostOfficeBox);
+}
/*!
\fn QContactAddress::setPostOfficeBox(const QString& postOfficeBox)
Sets the post office box segment of the address stored in this detail to \a postOfficeBox.
*/
+void QContactAddress::setPostOfficeBox(const QString& _value)
+{
+ reinterpret_cast<QContactAddressPrivate*>(d.data())->setMemberValue(QContactAddress::FieldPostOfficeBox, _value);
+}
/*!
\fn QContactAddress::street() const
Returns the street segment of the address stored in this detail.
*/
+QString QContactAddress::street() const
+{
+ return reinterpret_cast<const QContactAddressPrivate*>(d.constData())->memberValue<QString>(QContactAddress::FieldStreet);
+}
/*!
\fn QContactAddress::setStreet(const QString& street)
Sets the street segment of the address stored in this detail to \a street.
*/
+void QContactAddress::setStreet(const QString& _value)
+{
+ reinterpret_cast<QContactAddressPrivate*>(d.data())->setMemberValue(QContactAddress::FieldStreet, _value);
+}
/*!
\fn QContactAddress::locality() const
Returns the locality segment of the address stored in this detail.
*/
+QString QContactAddress::locality() const
+{
+ return reinterpret_cast<const QContactAddressPrivate*>(d.constData())->memberValue<QString>(QContactAddress::FieldLocality);
+}
/*!
\fn QContactAddress::setLocality(const QString& locality)
Sets the locality segment of the address stored in this detail to \a locality.
*/
+void QContactAddress::setLocality(const QString& _value)
+{
+ reinterpret_cast<QContactAddressPrivate*>(d.data())->setMemberValue(QContactAddress::FieldLocality, _value);
+}
/*!
\fn QContactAddress::region() const
Returns the region segment of the address stored in this detail.
*/
+QString QContactAddress::region() const
+{
+ return reinterpret_cast<const QContactAddressPrivate*>(d.constData())->memberValue<QString>(QContactAddress::FieldRegion);
+}
/*!
\fn QContactAddress::setRegion(const QString& region)
Sets the region segment of the address stored in this detail to \a region.
*/
+void QContactAddress::setRegion(const QString& _value)
+{
+ reinterpret_cast<QContactAddressPrivate*>(d.data())->setMemberValue(QContactAddress::FieldRegion, _value);
+}
/*!
\fn QContactAddress::postcode() const
Returns the postcode segment of the address stored in this detail.
*/
+QString QContactAddress::postcode() const
+{
+ return reinterpret_cast<const QContactAddressPrivate*>(d.constData())->memberValue<QString>(QContactAddress::FieldPostcode);
+}
/*!
\fn QContactAddress::setPostcode(const QString& postcode)
Sets the postcode segment of the address stored in this detail to \a postcode.
*/
+void QContactAddress::setPostcode(const QString& _value)
+{
+ reinterpret_cast<QContactAddressPrivate*>(d.data())->setMemberValue(QContactAddress::FieldPostcode, _value);
+}
/*!
\fn QContactAddress::country() const
Returns the country segment of the address stored in this detail.
*/
+QString QContactAddress::country() const
+{
+ return reinterpret_cast<const QContactAddressPrivate*>(d.constData())->memberValue<QString>(QContactAddress::FieldCountry);
+}
/*!
\fn QContactAddress::setCountry(const QString& country)
Sets the country segment of the address stored in this detail to \a country.
*/
+void QContactAddress::setCountry(const QString& _value)
+{
+ reinterpret_cast<QContactAddressPrivate*>(d.data())->setMemberValue(QContactAddress::FieldCountry, _value);
+}
/*!
\fn QContactAddress::setSubTypes(const QList<int> &subTypes)
Sets the subtypes which this detail implements to be those contained in the list of given \a subTypes.
*/
+void QContactAddress::setSubTypes(const QList<int>& _value)
+{
+ reinterpret_cast<QContactAddressPrivate*>(d.data())->setMemberValue(QContactAddress::FieldSubTypes, _value);
+}
/*!
\fn QContactAddress::subTypes() const
Returns the list of subtypes that this detail implements.
*/
+QList<int> QContactAddress::subTypes() const
+{
+ return reinterpret_cast<const QContactAddressPrivate*>(d.constData())->memberValue<QList<int> >(QContactAddress::FieldSubTypes);
+}
+
/*!
Returns a filter suitable for finding contacts with an address which
@@ -586,6 +888,23 @@ QContactFilter QContactAddress::match(const QString &subString)
\inmodule QtContacts
*/
+class QContactUrlPrivate : public QContactDetailBuiltinPrivate<QContactUrlPrivate>
+{
+public:
+ QString m_url;
+ int m_subType;
+
+ enum { FieldCount = 2 };
+
+ QContactUrlPrivate() : QContactDetailBuiltinPrivate<QContactUrlPrivate>(QContactUrl::Type), m_subType(0) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactUrlPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactUrlPrivate, m_url) },
+ { QContactDetailBuiltinPrivateBase::Int, offsetof(QContactUrlPrivate, m_subType) },
+};
+
/*!
\variable QContactUrl::Type
The enum constant for the type identifier of QContactUrl details.
@@ -614,30 +933,50 @@ const QContactDetail::DetailType QContactUrl::Type(QContactDetail::TypeUrl);
*/
/*!
+ \fn QContactUrl::setUrl(const QUrl& url)
+ Sets the url stored in this detail to the string representation
+ of the given \a url.
+ */
+void QContactUrl::setUrl(const QUrl& _value)
+{
+ reinterpret_cast<QContactUrlPrivate*>(d.data())->setMemberValue<QString>(QContactUrl::FieldUrl, _value.toString());
+}
+
+/*!
\fn QContactUrl::url() const
Returns the url stored in this detail.
*/
+QString QContactUrl::url() const
+{
+ return reinterpret_cast<const QContactUrlPrivate*>(d.constData())->memberValue<QString>(QContactUrl::FieldUrl);
+}
/*!
\fn QContactUrl::setUrl(const QString& url)
Sets the url stored in this detail to \a url.
*/
-
-/*!
- \fn QContactUrl::setUrl(const QUrl& url)
- Sets the url stored in this detail to the string representation
- of the given \a url.
- */
+void QContactUrl::setUrl(const QString& _value)
+{
+ reinterpret_cast<QContactUrlPrivate*>(d.data())->setMemberValue<QString>(QContactUrl::FieldUrl, _value);
+}
/*!
\fn QContactUrl::setSubType(const QContactUrl::SubType& subType)
Sets the subtype which this detail implements to be the given \a subType.
*/
+void QContactUrl::setSubType(QContactUrl::SubType _value)
+{
+ reinterpret_cast<QContactUrlPrivate*>(d.data())->setMemberValue<int>(QContactUrl::FieldSubType, static_cast<int>(_value));
+}
/*!
\fn QContactUrl::subType() const
Returns the subtype that this detail implements, if defined.
*/
+QContactUrl::SubType QContactUrl::subType() const
+{
+ return static_cast<QContactUrl::SubType>(reinterpret_cast<const QContactUrlPrivate*>(d.constData())->memberValue<int>(QContactUrl::FieldSubType));
+}
/* ==================== QContactPhonenumber ======================= */
@@ -649,6 +988,23 @@ const QContactDetail::DetailType QContactUrl::Type(QContactDetail::TypeUrl);
\inmodule QtContacts
*/
+class QContactPhoneNumberPrivate : public QContactDetailBuiltinPrivate<QContactPhoneNumberPrivate>
+{
+public:
+ QString m_number;
+ QList<int> m_subTypes;
+
+ enum { FieldCount = 2 };
+
+ QContactPhoneNumberPrivate() : QContactDetailBuiltinPrivate<QContactPhoneNumberPrivate>(QContactPhoneNumber::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactPhoneNumberPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactPhoneNumberPrivate, m_number) },
+ { QContactDetailBuiltinPrivateBase::IntList, offsetof(QContactPhoneNumberPrivate, m_subTypes) },
+};
+
/*!
\variable QContactPhoneNumber::Type
@@ -690,21 +1046,37 @@ const QContactDetail::DetailType QContactPhoneNumber::Type(QContactDetail::TypeP
\fn QContactPhoneNumber::number() const
Returns the phone number stored in this detail.
*/
+QString QContactPhoneNumber::number() const
+{
+ return reinterpret_cast<const QContactPhoneNumberPrivate*>(d.constData())->memberValue<QString>(QContactPhoneNumber::FieldNumber);
+}
/*!
\fn QContactPhoneNumber::setNumber(const QString& number)
Sets the phone number stored in this detail to \a number.
*/
+void QContactPhoneNumber::setNumber(const QString& _value)
+{
+ reinterpret_cast<QContactPhoneNumberPrivate*>(d.data())->setMemberValue<QString>(QContactPhoneNumber::FieldNumber, _value);
+}
/*!
\fn QContactPhoneNumber::setSubTypes(const QList<int>& subTypes)
Sets the subtypes which this detail implements to be those contained in the list of given \a subTypes
*/
+void QContactPhoneNumber::setSubTypes(const QList<int>& _value)
+{
+ reinterpret_cast<QContactPhoneNumberPrivate*>(d.data())->setMemberValue<QList<int> >(QContactPhoneNumber::FieldSubTypes, _value);
+}
/*!
\fn QContactPhoneNumber::subTypes() const
Returns the list of subtypes that this detail implements.
*/
+QList<int> QContactPhoneNumber::subTypes() const
+{
+ return reinterpret_cast<const QContactPhoneNumberPrivate*>(d.constData())->memberValue<QList<int> >(QContactPhoneNumber::FieldSubTypes);
+}
/* ==================== QContactBirthday ======================= */
@@ -715,6 +1087,23 @@ const QContactDetail::DetailType QContactPhoneNumber::Type(QContactDetail::TypeP
\inmodule QtContacts
*/
+class QContactBirthdayPrivate : public QContactDetailBuiltinPrivate<QContactBirthdayPrivate>
+{
+public:
+ QDateTime m_birthday;
+ QString m_calendarId;
+
+ enum { FieldCount = 2 };
+
+ QContactBirthdayPrivate() : QContactDetailBuiltinPrivate<QContactBirthdayPrivate>(QContactBirthday::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactBirthdayPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::DateTime, offsetof(QContactBirthdayPrivate, m_birthday) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactBirthdayPrivate, m_calendarId) },
+};
+
/*!
\variable QContactBirthday::Type
The enum constant for the type identifier of QContactBirthday details.
@@ -739,11 +1128,19 @@ const QContactDetail::DetailType QContactBirthday::Type(QContactDetail::TypeBirt
Returns the date of the birthday which is stored in this detail.
If the birthday stored is a QDateTime, this returns the date portion.
*/
+QDate QContactBirthday::date() const
+{
+ return reinterpret_cast<const QContactBirthdayPrivate*>(d.constData())->memberValue<QDateTime>(QContactBirthday::FieldBirthday).date();
+}
/*!
\fn QContactBirthday::setDate(const QDate& date)
Sets the date of the birthday which is stored in this detail to \a date.
*/
+void QContactBirthday::setDate(const QDate& _value)
+{
+ reinterpret_cast<QContactBirthdayPrivate*>(d.data())->setMemberValue<QDateTime>(QContactBirthday::FieldBirthday, QDateTime(_value));
+}
/*!
\fn QContactBirthday::dateTime() const
@@ -751,22 +1148,38 @@ const QContactDetail::DetailType QContactBirthday::Type(QContactDetail::TypeBirt
If the birthday stored is a QDate, this returns a QDateTime with the
time set to midnight.
*/
+QDateTime QContactBirthday::dateTime() const
+{
+ return reinterpret_cast<const QContactBirthdayPrivate*>(d.constData())->memberValue<QDateTime>(QContactBirthday::FieldBirthday);
+}
/*!
\fn QContactBirthday::setDateTime(const QDateTime& dateTime)
Sets the date and time of the birthday which is stored in this detail to \a dateTime.
*/
+void QContactBirthday::setDateTime(const QDateTime& _value)
+{
+ reinterpret_cast<QContactBirthdayPrivate*>(d.data())->setMemberValue<QDateTime>(QContactBirthday::FieldBirthday, _value);
+}
/*!
\fn QContactBirthday::calendarId() const
* Returns the identifier of the calendar entry associated with this birthday.
*/
+QString QContactBirthday::calendarId() const
+{
+ return reinterpret_cast<const QContactBirthdayPrivate*>(d.constData())->memberValue<QString>(QContactBirthday::FieldCalendarId);
+}
/*!
\fn QContactBirthday::setCalendarId(const QString& calendarId)
Sets the identifier of the calendar entry associated with this birthday to \a calendarId.
*/
+void QContactBirthday::setCalendarId(const QString& _value)
+{
+ reinterpret_cast<QContactBirthdayPrivate*>(d.data())->setMemberValue<QString>(QContactBirthday::FieldCalendarId, _value);
+}
/* ==================== QContactDisplayLabel ======================= */
@@ -777,6 +1190,21 @@ const QContactDetail::DetailType QContactBirthday::Type(QContactDetail::TypeBirt
\inmodule QtContacts
*/
+class QContactDisplayLabelPrivate : public QContactDetailBuiltinPrivate<QContactDisplayLabelPrivate>
+{
+public:
+ QString m_label;
+
+ enum { FieldCount = 1 };
+
+ QContactDisplayLabelPrivate() : QContactDetailBuiltinPrivate<QContactDisplayLabelPrivate>(QContactDisplayLabel::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactDisplayLabelPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactDisplayLabelPrivate, m_label) },
+};
+
/*!
\variable QContactDisplayLabel::Type
The enum constant for the type identifier of QContactDisplayLabel details.
@@ -795,11 +1223,19 @@ const QContactDetail::DetailType QContactDisplayLabel::Type(QContactType::TypeDi
Sets the displayLabel of the contact which is stored in this detail to \a displayLabel.
displayLabel can be for example the first name of a contact.
*/
+void QContactDisplayLabel::setLabel(const QString& _value)
+{
+ reinterpret_cast<QContactDisplayLabelPrivate*>(d.data())->setMemberValue<QString>(QContactDisplayLabel::FieldLabel, _value);
+}
/*!
\fn QContactDisplayLabel::label() const
Returns the displayLabel of the contact which is stored in this detail.
*/
+QString QContactDisplayLabel::label() const
+{
+ return reinterpret_cast<const QContactDisplayLabelPrivate*>(d.constData())->memberValue<QString>(QContactDisplayLabel::FieldLabel);
+}
/* ==================== QContactGender ======================= */
@@ -811,6 +1247,21 @@ const QContactDetail::DetailType QContactDisplayLabel::Type(QContactType::TypeDi
\inmodule QtContacts
*/
+class QContactGenderPrivate : public QContactDetailBuiltinPrivate<QContactGenderPrivate>
+{
+public:
+ int m_gender;
+
+ enum { FieldCount = 1 };
+
+ QContactGenderPrivate() : QContactDetailBuiltinPrivate<QContactGenderPrivate>(QContactGender::Type), m_gender(0) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactGenderPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::Int, offsetof(QContactGenderPrivate, m_gender) },
+};
+
/*!
\variable QContactGender::Type
The enum constant for the type identifier of QContactGender details.
@@ -834,6 +1285,10 @@ const QContactDetail::DetailType QContactGender::Type(QContactDetail::TypeGender
possible values for the value stored are "Male", "Female" and
"Unspecified".
*/
+QContactGender::GenderField QContactGender::gender() const
+{
+ return static_cast<QContactGender::GenderField>(reinterpret_cast<const QContactGenderPrivate*>(d.constData())->memberValue<int>(QContactGender::FieldGender));
+}
/*!
\fn QContactGender::setGender(const GenderField gender)
@@ -842,6 +1297,10 @@ const QContactDetail::DetailType QContactGender::Type(QContactDetail::TypeGender
gender, if \a gender is either GenderMale or GenderFemale, otherwise sets
it to GenderUnspecified.
*/
+void QContactGender::setGender(QContactGender::GenderField _value)
+{
+ reinterpret_cast<QContactGenderPrivate*>(d.data())->setMemberValue<int>(QContactGender::FieldGender, static_cast<int>(_value));
+}
/* ==================== QContactGeolocation ======================= */
@@ -853,6 +1312,38 @@ const QContactDetail::DetailType QContactGender::Type(QContactDetail::TypeGender
\inmodule QtContacts
*/
+class QContactGeoLocationPrivate : public QContactDetailBuiltinPrivate<QContactGeoLocationPrivate>
+{
+public:
+ QString m_label;
+ double m_latitude;
+ double m_longitude;
+ double m_accuracy;
+ double m_altitude;
+ double m_altitudeAccuracy;
+ double m_heading;
+ double m_speed;
+ QDateTime m_timestamp;
+
+ enum { FieldCount = 9 };
+
+ QContactGeoLocationPrivate() : QContactDetailBuiltinPrivate<QContactGeoLocationPrivate>(QContactGeoLocation::Type),
+ m_latitude(0.0), m_longitude(0.0), m_accuracy(0.0), m_altitude(0.0), m_altitudeAccuracy(0.0), m_heading(0.0), m_speed(0.0) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactGeoLocationPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactGeoLocationPrivate, m_label) },
+ { QContactDetailBuiltinPrivateBase::Double, offsetof(QContactGeoLocationPrivate, m_latitude) },
+ { QContactDetailBuiltinPrivateBase::Double, offsetof(QContactGeoLocationPrivate, m_longitude) },
+ { QContactDetailBuiltinPrivateBase::Double, offsetof(QContactGeoLocationPrivate, m_accuracy) },
+ { QContactDetailBuiltinPrivateBase::Double, offsetof(QContactGeoLocationPrivate, m_altitude) },
+ { QContactDetailBuiltinPrivateBase::Double, offsetof(QContactGeoLocationPrivate, m_altitudeAccuracy) },
+ { QContactDetailBuiltinPrivateBase::Double, offsetof(QContactGeoLocationPrivate, m_heading) },
+ { QContactDetailBuiltinPrivateBase::Double, offsetof(QContactGeoLocationPrivate, m_speed) },
+ { QContactDetailBuiltinPrivateBase::DateTime, offsetof(QContactGeoLocationPrivate, m_timestamp) },
+};
+
/*!
\variable QContactGeoLocation::Type
The enum constant for the type identifier of QContactGeoLocation details.
@@ -886,11 +1377,19 @@ const QContactDetail::DetailType QContactGeoLocation::Type(QContactDetail::TypeG
\fn QContactGeoLocation::setLabel(const QString& label)
Sets the label of the location stored in the detail to \a label.
*/
+void QContactGeoLocation::setLabel(const QString& _value)
+{
+ reinterpret_cast<QContactGeoLocationPrivate*>(d.data())->setMemberValue<QString>(QContactGeoLocation::FieldLabel, _value);
+}
/*!
\fn QContactGeoLocation::label() const
Returns the label of the location stored in the detail.
*/
+QString QContactGeoLocation::label() const
+{
+ return reinterpret_cast<const QContactGeoLocationPrivate*>(d.constData())->memberValue<QString>(QContactGeoLocation::FieldLabel);
+}
/*!
\fn QContactGeoLocation::setLatitude(double latitude)
@@ -898,6 +1397,10 @@ const QContactDetail::DetailType QContactGeoLocation::Type(QContactDetail::TypeG
Sets the latitude portion of the coordinate (in decimal degrees) of
the location stored in the detail to \a latitude.
*/
+void QContactGeoLocation::setLatitude(double _value)
+{
+ reinterpret_cast<QContactGeoLocationPrivate*>(d.data())->setMemberValue<double>(QContactGeoLocation::FieldLatitude, _value);
+}
/*!
\fn QContactGeoLocation::latitude() const
@@ -905,6 +1408,10 @@ const QContactDetail::DetailType QContactGeoLocation::Type(QContactDetail::TypeG
Returns the latitude portion of the coordinate (specified in
decimal degrees) of the location stored in the detail.
*/
+double QContactGeoLocation::latitude() const
+{
+ return reinterpret_cast<const QContactGeoLocationPrivate*>(d.constData())->memberValue<double>(QContactGeoLocation::FieldLatitude);
+}
/*!
\fn QContactGeoLocation::setLongitude(double longitude)
@@ -912,6 +1419,10 @@ const QContactDetail::DetailType QContactGeoLocation::Type(QContactDetail::TypeG
Sets the longitude portion of the coordinate (in decimal degrees)
of the location stored in the detail to \a longitude.
*/
+void QContactGeoLocation::setLongitude(double _value)
+{
+ reinterpret_cast<QContactGeoLocationPrivate*>(d.data())->setMemberValue<double>(QContactGeoLocation::FieldLongitude, _value);
+}
/*!
\fn QContactGeoLocation::longitude() const
@@ -919,6 +1430,10 @@ const QContactDetail::DetailType QContactGeoLocation::Type(QContactDetail::TypeG
Returns the longitude portion of the coordinate (specified in
decimal degrees) of the location stored in the detail.
*/
+double QContactGeoLocation::longitude() const
+{
+ return reinterpret_cast<const QContactGeoLocationPrivate*>(d.constData())->memberValue<double>(QContactGeoLocation::FieldLongitude);
+}
/*!
\fn QContactGeoLocation::setAccuracy(double accuracy)
@@ -926,6 +1441,10 @@ const QContactDetail::DetailType QContactGeoLocation::Type(QContactDetail::TypeG
Specifies that the latitude and longitude portions of the location
stored in the detail are accurate to within \a accuracy metres.
*/
+void QContactGeoLocation::setAccuracy(double _value)
+{
+ reinterpret_cast<QContactGeoLocationPrivate*>(d.data())->setMemberValue<double>(QContactGeoLocation::FieldAccuracy, _value);
+}
/*!
\fn QContactGeoLocation::accuracy() const
@@ -933,6 +1452,10 @@ const QContactDetail::DetailType QContactGeoLocation::Type(QContactDetail::TypeG
Returns the accuracy (in metres) of the latitude and longitude of
the location stored in the detail.
*/
+double QContactGeoLocation::accuracy() const
+{
+ return reinterpret_cast<const QContactGeoLocationPrivate*>(d.constData())->memberValue<double>(QContactGeoLocation::FieldAccuracy);
+}
/*!
\fn QContactGeoLocation::setAltitude(double altitude)
@@ -940,11 +1463,19 @@ const QContactDetail::DetailType QContactGeoLocation::Type(QContactDetail::TypeG
Sets the altitude portion of the coordinate (in metres above the
ellipsoid) of the location stored in the detail to \a altitude.
*/
+void QContactGeoLocation::setAltitude(double _value)
+{
+ reinterpret_cast<QContactGeoLocationPrivate*>(d.data())->setMemberValue<double>(QContactGeoLocation::FieldAltitude, _value);
+}
/*!
\fn QContactGeoLocation::altitude() const
Returns the altitude (in metres) of the location stored in the detail.
*/
+double QContactGeoLocation::altitude() const
+{
+ return reinterpret_cast<const QContactGeoLocationPrivate*>(d.constData())->memberValue<double>(QContactGeoLocation::FieldAltitude);
+}
/*!
\fn QContactGeoLocation::setAltitudeAccuracy(double altitudeAccuracy)
@@ -952,6 +1483,10 @@ const QContactDetail::DetailType QContactGeoLocation::Type(QContactDetail::TypeG
Sets the altitude-accuracy portion of the coordinate (in metres) of
the location stored in the detail to \a altitudeAccuracy.
*/
+void QContactGeoLocation::setAltitudeAccuracy(double _value)
+{
+ reinterpret_cast<QContactGeoLocationPrivate*>(d.data())->setMemberValue<double>(QContactGeoLocation::FieldAltitudeAccuracy, _value);
+}
/*!
\fn QContactGeoLocation::altitudeAccuracy() const
@@ -959,6 +1494,10 @@ const QContactDetail::DetailType QContactGeoLocation::Type(QContactDetail::TypeG
Returns the accuracy of the altitude portion of the location stored
in the detail.
*/
+double QContactGeoLocation::altitudeAccuracy() const
+{
+ return reinterpret_cast<const QContactGeoLocationPrivate*>(d.constData())->memberValue<double>(QContactGeoLocation::FieldAltitudeAccuracy);
+}
/*!
\fn QContactGeoLocation::setHeading(double heading)
@@ -967,6 +1506,10 @@ const QContactDetail::DetailType QContactGeoLocation::Type(QContactDetail::TypeG
clockwise relative to true north) of the location-aware device at
the time of measurement to \a heading.
*/
+void QContactGeoLocation::setHeading(double _value)
+{
+ reinterpret_cast<QContactGeoLocationPrivate*>(d.data())->setMemberValue<double>(QContactGeoLocation::FieldHeading, _value);
+}
/*!
\fn QContactGeoLocation::heading() const
@@ -975,6 +1518,10 @@ const QContactDetail::DetailType QContactGeoLocation::Type(QContactDetail::TypeG
location-aware device that recorded (or was provided) the
measurement.
*/
+double QContactGeoLocation::heading() const
+{
+ return reinterpret_cast<const QContactGeoLocationPrivate*>(d.constData())->memberValue<double>(QContactGeoLocation::FieldHeading);
+}
/*!
\fn QContactGeoLocation::setSpeed(double speed)
@@ -982,6 +1529,10 @@ const QContactDetail::DetailType QContactGeoLocation::Type(QContactDetail::TypeG
Sets the speed portion of the coordinate (in metres per second) of
the location-aware device at the time of measurement to \a speed.
*/
+void QContactGeoLocation::setSpeed(double _value)
+{
+ reinterpret_cast<QContactGeoLocationPrivate*>(d.data())->setMemberValue<double>(QContactGeoLocation::FieldSpeed, _value);
+}
/*!
\fn QContactGeoLocation::speed() const
@@ -990,6 +1541,10 @@ const QContactDetail::DetailType QContactGeoLocation::Type(QContactDetail::TypeG
location-aware device that recorded (or was provided) the
measurement.
*/
+double QContactGeoLocation::speed() const
+{
+ return reinterpret_cast<const QContactGeoLocationPrivate*>(d.constData())->memberValue<double>(QContactGeoLocation::FieldSpeed);
+}
/*!
\fn QContactGeoLocation::setTimestamp(const QDateTime& timestamp)
@@ -997,6 +1552,10 @@ const QContactDetail::DetailType QContactGeoLocation::Type(QContactDetail::TypeG
Sets the creation (or first-valid) timestamp of the location
information to \a timestamp.
*/
+void QContactGeoLocation::setTimestamp(const QDateTime& _value)
+{
+ reinterpret_cast<QContactGeoLocationPrivate*>(d.data())->setMemberValue<QDateTime>(QContactGeoLocation::FieldTimestamp, _value);
+}
/*!
\fn QContactGeoLocation::timestamp() const
@@ -1004,6 +1563,10 @@ const QContactDetail::DetailType QContactGeoLocation::Type(QContactDetail::TypeG
Returns the timestamp associated with the location stored in the
detail.
*/
+QDateTime QContactGeoLocation::timestamp() const
+{
+ return reinterpret_cast<const QContactGeoLocationPrivate*>(d.constData())->memberValue<QDateTime>(QContactGeoLocation::FieldTimestamp);
+}
/* ==================== QContactGuid ======================= */
@@ -1015,6 +1578,21 @@ const QContactDetail::DetailType QContactGeoLocation::Type(QContactDetail::TypeG
\inmodule QtContacts
*/
+class QContactGuidPrivate : public QContactDetailBuiltinPrivate<QContactGuidPrivate>
+{
+public:
+ QString m_guid;
+
+ enum { FieldCount = 1 };
+
+ QContactGuidPrivate() : QContactDetailBuiltinPrivate<QContactGuidPrivate>(QContactGuid::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactGuidPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactGuidPrivate, m_guid) },
+};
+
/*!
\variable QContactGuid::Type
The enum constant for the type identifier of QContactGuid details.
@@ -1034,11 +1612,19 @@ const QContactDetail::DetailType QContactGuid::Type(QContactDetail::TypeGuid);
Returns the globally unique identifier which is stored in this
detail.
*/
+QString QContactGuid::guid() const
+{
+ return reinterpret_cast<const QContactGuidPrivate*>(d.constData())->memberValue<QString>(QContactGuid::FieldGuid);
+}
/*!
\fn QContactGuid::setGuid(const QString& guid)
Sets the globally unique identifier which is stored in this detail to \a guid.
*/
+void QContactGuid::setGuid(const QString& _value)
+{
+ reinterpret_cast<QContactGuidPrivate*>(d.data())->setMemberValue<QString>(QContactGuid::FieldGuid, _value);
+}
/* ==================== QContactHobby ======================= */
@@ -1052,6 +1638,21 @@ const QContactDetail::DetailType QContactGuid::Type(QContactDetail::TypeGuid);
detail contains information about a single hobby of the contact.
*/
+class QContactHobbyPrivate : public QContactDetailBuiltinPrivate<QContactHobbyPrivate>
+{
+public:
+ QString m_hobby;
+
+ enum { FieldCount = 1 };
+
+ QContactHobbyPrivate() : QContactDetailBuiltinPrivate<QContactHobbyPrivate>(QContactHobby::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactHobbyPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactHobbyPrivate, m_hobby) },
+};
+
/*!
\variable QContactHobby::Type
The enum constant for the type identifier of QContactHobby details.
@@ -1069,11 +1670,19 @@ const QContactDetail::DetailType QContactHobby::Type(QContactDetail::TypeHobby);
\fn QContactHobby::setHobby(const QString& hobby)
Sets the hobby associated with a contact which is stored in this detail to \a hobby.
*/
+void QContactHobby::setHobby(const QString& _value)
+{
+ reinterpret_cast<QContactHobbyPrivate*>(d.data())->setMemberValue<QString>(QContactHobby::FieldHobby, _value);
+}
/*!
\fn QContactHobby::hobby() const
Returns the hobby associated with a contact which is stored in this detail.
*/
+QString QContactHobby::hobby() const
+{
+ return reinterpret_cast<const QContactHobbyPrivate*>(d.constData())->memberValue<QString>(QContactHobby::FieldHobby);
+}
/* ==================== QContactName ======================= */
@@ -1085,6 +1694,29 @@ const QContactDetail::DetailType QContactHobby::Type(QContactDetail::TypeHobby);
\inmodule QtContacts
*/
+class QContactNamePrivate : public QContactDetailBuiltinPrivate<QContactNamePrivate>
+{
+public:
+ QString m_prefix;
+ QString m_firstName;
+ QString m_middleName;
+ QString m_lastName;
+ QString m_suffix;
+
+ enum { FieldCount = 5 };
+
+ QContactNamePrivate() : QContactDetailBuiltinPrivate<QContactNamePrivate>(QContactName::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactNamePrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactNamePrivate, m_prefix) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactNamePrivate, m_firstName) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactNamePrivate, m_middleName) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactNamePrivate, m_lastName) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactNamePrivate, m_suffix) },
+};
+
/*!
\variable QContactName::Type
The enum constant for the type identifier of QContactName details.
@@ -1110,21 +1742,37 @@ const QContactDetail::DetailType QContactName::Type(QContactDetail::TypeName);
\fn QContactName::prefix() const
Returns the prefix segment of the name stored in this detail.
*/
+QString QContactName::prefix() const
+{
+ return reinterpret_cast<const QContactNamePrivate*>(d.constData())->memberValue<QString>(QContactName::FieldPrefix);
+}
/*!
\fn QContactName::setPrefix(const QString& prefix)
Sets the prefix segment of the name stored in this detail to \a prefix.
*/
+void QContactName::setPrefix(const QString& _value)
+{
+ reinterpret_cast<QContactNamePrivate*>(d.data())->setMemberValue<QString>(QContactName::FieldPrefix, _value);
+}
/*!
\fn QContactName::firstName() const
Returns the first (given) name segment of the name stored in this detail.
*/
+QString QContactName::firstName() const
+{
+ return reinterpret_cast<const QContactNamePrivate*>(d.constData())->memberValue<QString>(QContactName::FieldFirstName);
+}
/*!
\fn QContactName::setFirstName(const QString& firstName)
Sets the first name segment of the name stored in this detail to \a firstName.
*/
+void QContactName::setFirstName(const QString& _value)
+{
+ reinterpret_cast<QContactNamePrivate*>(d.data())->setMemberValue<QString>(QContactName::FieldFirstName, _value);
+}
/*!
\fn QContactName::middleName() const
@@ -1132,11 +1780,19 @@ const QContactDetail::DetailType QContactName::Type(QContactDetail::TypeName);
Returns the middle (additional, or other) name segment of the name
stored in this detail.
*/
+QString QContactName::middleName() const
+{
+ return reinterpret_cast<const QContactNamePrivate*>(d.constData())->memberValue<QString>(QContactName::FieldMiddleName);
+}
/*!
\fn QContactName::setMiddleName(const QString& middleName)
Sets the middle name segment of the name stored in this detail to \a middleName.
*/
+void QContactName::setMiddleName(const QString& _value)
+{
+ reinterpret_cast<QContactNamePrivate*>(d.data())->setMemberValue<QString>(QContactName::FieldMiddleName, _value);
+}
/*!
\fn QContactName::lastName() const
@@ -1144,21 +1800,37 @@ const QContactDetail::DetailType QContactName::Type(QContactDetail::TypeName);
Returns the last (family, or surname) name segment of the name
stored in this detail.
*/
+QString QContactName::lastName() const
+{
+ return reinterpret_cast<const QContactNamePrivate*>(d.constData())->memberValue<QString>(QContactName::FieldLastName);
+}
/*!
\fn QContactName::setLastName(const QString& lastName)
Sets the last name segment of the name stored in this detail to \a lastName.
*/
+void QContactName::setLastName(const QString& _value)
+{
+ reinterpret_cast<QContactNamePrivate*>(d.data())->setMemberValue<QString>(QContactName::FieldLastName, _value);
+}
/*!
\fn QContactName::suffix() const
Returns the suffix segment of the name stored in this detail.
*/
+QString QContactName::suffix() const
+{
+ return reinterpret_cast<const QContactNamePrivate*>(d.constData())->memberValue<QString>(QContactName::FieldSuffix);
+}
/*!
\fn QContactName::setSuffix(const QString& suffix)
Sets the suffix segment of the name stored in this detail to \a suffix.
*/
+void QContactName::setSuffix(const QString& _value)
+{
+ reinterpret_cast<QContactNamePrivate*>(d.data())->setMemberValue<QString>(QContactName::FieldSuffix, _value);
+}
/* ==================== QContactNickname ======================= */
@@ -1169,6 +1841,21 @@ const QContactDetail::DetailType QContactName::Type(QContactDetail::TypeName);
\inmodule QtContacts
*/
+class QContactNicknamePrivate : public QContactDetailBuiltinPrivate<QContactNicknamePrivate>
+{
+public:
+ QString m_nickname;
+
+ enum { FieldCount = 1 };
+
+ QContactNicknamePrivate() : QContactDetailBuiltinPrivate<QContactNicknamePrivate>(QContactNickname::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactNicknamePrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactNicknamePrivate, m_nickname) },
+};
+
/*!
\variable QContactNickname::Type
The enum constant for the type identifier of QContactNickname details.
@@ -1186,11 +1873,19 @@ const QContactDetail::DetailType QContactNickname::Type(QContactType::TypeNickna
\fn QContactNickname::setNickname(const QString& nickname)
Sets the nickname of the contact which is stored in this detail to \a nickname.
*/
+void QContactNickname::setNickname(const QString& _value)
+{
+ reinterpret_cast<QContactNicknamePrivate*>(d.data())->setMemberValue<QString>(QContactNickname::FieldNickname, _value);
+}
/*!
\fn QContactNickname::nickname() const
Returns the nickname of the contact which is stored in this detail.
*/
+QString QContactNickname::nickname() const
+{
+ return reinterpret_cast<const QContactNicknamePrivate*>(d.constData())->memberValue<QString>(QContactNickname::FieldNickname);
+}
/* ==================== QContactNote ======================= */
@@ -1202,6 +1897,21 @@ const QContactDetail::DetailType QContactNickname::Type(QContactType::TypeNickna
\inmodule QtContacts
*/
+class QContactNotePrivate : public QContactDetailBuiltinPrivate<QContactNotePrivate>
+{
+public:
+ QString m_note;
+
+ enum { FieldCount = 1 };
+
+ QContactNotePrivate() : QContactDetailBuiltinPrivate<QContactNotePrivate>(QContactNote::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactNotePrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactNotePrivate, m_note) },
+};
+
/*!
\variable QContactNote::Type
The enum constant for the type identifier of QContactNote details.
@@ -1219,11 +1929,19 @@ const QContactDetail::DetailType QContactNote::Type(QContactDetail::TypeNote);
\fn QContactNote::setNote(const QString& note)
Sets a note associated with a contact to \a note.
*/
+void QContactNote::setNote(const QString& _value)
+{
+ reinterpret_cast<QContactNotePrivate*>(d.data())->setMemberValue<QString>(QContactNote::FieldNote, _value);
+}
/*!
\fn QContactNote::note() const
Returns a string for a note associated with a contact.
*/
+QString QContactNote::note() const
+{
+ return reinterpret_cast<const QContactNotePrivate*>(d.constData())->memberValue<QString>(QContactNote::FieldNote);
+}
/* ==================== QContactTag ======================= */
@@ -1245,6 +1963,21 @@ const QContactDetail::DetailType QContactNote::Type(QContactDetail::TypeNote);
\snippet qtcontactsdocsample/qtcontactsdocsample.cpp Checking for a specific tag
*/
+class QContactTagPrivate : public QContactDetailBuiltinPrivate<QContactTagPrivate>
+{
+public:
+ QString m_tag;
+
+ enum { FieldCount = 1 };
+
+ QContactTagPrivate() : QContactDetailBuiltinPrivate<QContactTagPrivate>(QContactTag::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactTagPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactTagPrivate, m_tag) },
+};
+
/*!
\variable QContactTag::Type
The enum constant for the type identifier of QContactTag details.
@@ -1262,11 +1995,19 @@ const QContactDetail::DetailType QContactTag::Type(QContactDetail::TypeTag);
\fn QContactTag::setTag(const QString& tag)
Sets the tag associated with a contact which is stored in this detail to \a tag.
*/
+void QContactTag::setTag(const QString& _value)
+{
+ reinterpret_cast<QContactTagPrivate*>(d.data())->setMemberValue<QString>(QContactTag::FieldTag, _value);
+}
/*!
\fn QContactTag::tag() const
Returns the tag associated with a contact which is stored in this detail.
*/
+QString QContactTag::tag() const
+{
+ return reinterpret_cast<const QContactTagPrivate*>(d.constData())->memberValue<QString>(QContactTag::FieldTag);
+}
/*!
Returns a filter suitable for finding contacts which have a tag which
@@ -1292,6 +2033,23 @@ QContactFilter QContactTag::match(const QString &subString)
\inmodule QtContacts
*/
+class QContactTimestampPrivate : public QContactDetailBuiltinPrivate<QContactTimestampPrivate>
+{
+public:
+ QDateTime m_modificationTimestamp;
+ QDateTime m_creationTimestamp;
+
+ enum { FieldCount = 2 };
+
+ QContactTimestampPrivate() : QContactDetailBuiltinPrivate<QContactTimestampPrivate>(QContactTimestamp::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactTimestampPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::DateTime, offsetof(QContactTimestampPrivate, m_modificationTimestamp) },
+ { QContactDetailBuiltinPrivateBase::DateTime, offsetof(QContactTimestampPrivate, m_creationTimestamp) },
+};
+
/*!
\variable QContactTimestamp::Type
The enum constant for the type identifier of QContactTimestamp details.
@@ -1308,24 +2066,41 @@ const QContactDetail::DetailType QContactTimestamp::Type(QContactDetail::TypeTim
*/
/*!
- \fn QContactTimestamp::created() const
- Returns the creation timestamp saved in this detail.
+ \fn QContactTimestamp::setCreated(const QDateTime& dateTime)
+ Sets the creation timestamp saved in this detail to \a dateTime.
*/
+void QContactTimestamp::setCreated(const QDateTime& _value)
+{
+ reinterpret_cast<QContactTimestampPrivate*>(d.data())->setMemberValue<QDateTime>(QContactTimestamp::FieldCreationTimestamp, _value);
+}
/*!
- \fn QContactTimestamp::lastModified() const
- Returns the last-modified timestamp saved in this detail.
+ \fn QContactTimestamp::created() const
+ Returns the creation timestamp saved in this detail.
*/
+QDateTime QContactTimestamp::created() const
+{
+ return reinterpret_cast<const QContactTimestampPrivate*>(d.constData())->memberValue<QDateTime>(QContactTimestamp::FieldCreationTimestamp);
+}
/*!
- \fn QContactTimestamp::setCreated(const QDateTime& dateTime)
- Sets the creation timestamp saved in this detail to \a dateTime.
+ \fn QContactTimestamp::setLastModified(const QDateTime& dateTime)
+ Sets the last-modified timestamp saved in this detail to \a dateTime.
*/
+void QContactTimestamp::setLastModified(const QDateTime& _value)
+{
+ reinterpret_cast<QContactTimestampPrivate*>(d.data())->setMemberValue<QDateTime>(QContactTimestamp::FieldModificationTimestamp, _value);
+}
/*!
- \fn QContactTimestamp::setLastModified(const QDateTime& dateTime)
- Sets the last-modified timestamp saved in this detail to \a dateTime.
+ \fn QContactTimestamp::lastModified() const
+ Returns the last-modified timestamp saved in this detail.
*/
+QDateTime QContactTimestamp::lastModified() const
+{
+ return reinterpret_cast<const QContactTimestampPrivate*>(d.constData())->memberValue<QDateTime>(QContactTimestamp::FieldModificationTimestamp);
+}
+
/* ==================== QContactType ======================= */
@@ -1336,6 +2111,21 @@ const QContactDetail::DetailType QContactTimestamp::Type(QContactDetail::TypeTim
\inmodule QtContacts
*/
+class QContactTypePrivate : public QContactDetailBuiltinPrivate<QContactTypePrivate>
+{
+public:
+ int m_contactType;
+
+ enum { FieldCount = 1 };
+
+ QContactTypePrivate() : QContactDetailBuiltinPrivate<QContactTypePrivate>(QContactType::Type), m_contactType(0) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactTypePrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::Int, offsetof(QContactTypePrivate, m_contactType) },
+};
+
/*!
\variable QContactType::Type
The enum constant for the type identifier of QContactType details.
@@ -1387,12 +2177,19 @@ const QContactDetail::DetailType QContactType::Type(QContactDetail::TypeType);
\fn QContactType::type() const
Returns the contact type value stored in this detail.
*/
+QContactType::TypeValues QContactType::type() const
+{
+ return static_cast<QContactType::TypeValues>(reinterpret_cast<const QContactTypePrivate*>(d.constData())->memberValue<int>(QContactType::FieldType));
+}
/*!
- \fn QContactType::setType(const TypeValues type)
+ \fn QContactType::setType(TypeValues type)
Sets the type of the contact to be the give \a type.
*/
-
+void QContactType::setType(QContactType::TypeValues _value)
+{
+ reinterpret_cast<QContactTypePrivate*>(d.data())->setMemberValue<int>(QContactType::FieldType, static_cast<int>(_value));
+}
/* ==================== QContactOnlineAccount ======================= */
@@ -1418,6 +2215,29 @@ const QContactDetail::DetailType QContactType::Type(QContactDetail::TypeType);
\ingroup contacts-details
*/
+class QContactOnlineAccountPrivate : public QContactDetailBuiltinPrivate<QContactOnlineAccountPrivate>
+{
+public:
+ QString m_accountUri;
+ QString m_serviceProvider;
+ int m_protocol;
+ QStringList m_capabilities;
+ QList<int> m_subTypes;
+
+ enum { FieldCount = 5 };
+
+ QContactOnlineAccountPrivate() : QContactDetailBuiltinPrivate<QContactOnlineAccountPrivate>(QContactOnlineAccount::Type), m_protocol(0) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactOnlineAccountPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactOnlineAccountPrivate, m_accountUri) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactOnlineAccountPrivate, m_serviceProvider) },
+ { QContactDetailBuiltinPrivateBase::Int, offsetof(QContactOnlineAccountPrivate, m_protocol) },
+ { QContactDetailBuiltinPrivateBase::StringList, offsetof(QContactOnlineAccountPrivate, m_capabilities) },
+ { QContactDetailBuiltinPrivateBase::IntList, offsetof(QContactOnlineAccountPrivate, m_subTypes) },
+};
+
/*!
\variable QContactOnlineAccount::Type
The enum constant for the type identifier of QContactOnlineAccount details.
@@ -1474,6 +2294,10 @@ const QContactDetail::DetailType QContactOnlineAccount::Type(QContactDetail::Typ
Sets the universal resource identifier of the contact's online
account to \a accountUri.
*/
+void QContactOnlineAccount::setAccountUri(const QString& _value)
+{
+ reinterpret_cast<QContactOnlineAccountPrivate*>(d.data())->setMemberValue<QString>(QContactOnlineAccount::FieldAccountUri, _value);
+}
/*!
\fn QContactOnlineAccount::accountUri() const
@@ -1481,6 +2305,10 @@ const QContactDetail::DetailType QContactOnlineAccount::Type(QContactDetail::Typ
Returns the universal resource identifier of the online account of
the contact.
*/
+QString QContactOnlineAccount::accountUri() const
+{
+ return reinterpret_cast<const QContactOnlineAccountPrivate*>(d.constData())->memberValue<QString>(QContactOnlineAccount::FieldAccountUri);
+}
/*!
\fn QContactOnlineAccount::setServiceProvider(const QString& serviceProvider)
@@ -1488,21 +2316,37 @@ const QContactDetail::DetailType QContactOnlineAccount::Type(QContactDetail::Typ
Sets the service provider of the contact's online account to \a
serviceProvider.
*/
+void QContactOnlineAccount::setServiceProvider(const QString& _value)
+{
+ reinterpret_cast<QContactOnlineAccountPrivate*>(d.data())->setMemberValue<QString>(QContactOnlineAccount::FieldServiceProvider, _value);
+}
/*!
\fn QContactOnlineAccount::serviceProvider() const
Returns the service provider of the online account of the contact.
*/
+QString QContactOnlineAccount::serviceProvider() const
+{
+ return reinterpret_cast<const QContactOnlineAccountPrivate*>(d.constData())->memberValue<QString>(QContactOnlineAccount::FieldServiceProvider);
+}
/*!
\fn QContactOnlineAccount::protocol() const
Returns the protocol value.
*/
+QContactOnlineAccount::Protocol QContactOnlineAccount::protocol() const
+{
+ return static_cast<QContactOnlineAccount::Protocol>(reinterpret_cast<const QContactOnlineAccountPrivate*>(d.constData())->memberValue<int>(QContactOnlineAccount::FieldProtocol));
+}
/*!
\fn QContactOnlineAccount::setProtocol(Protocol protocol)
Set the protocol to \a protocol.
*/
+void QContactOnlineAccount::setProtocol(QContactOnlineAccount::Protocol _value)
+{
+ reinterpret_cast<QContactOnlineAccountPrivate*>(d.data())->setMemberValue<int>(QContactOnlineAccount::FieldProtocol, static_cast<int>(_value));
+}
/*!
\fn QContactOnlineAccount::setSubTypes(const QList<int>& subTypes)
@@ -1510,11 +2354,19 @@ const QContactDetail::DetailType QContactOnlineAccount::Type(QContactDetail::Typ
Sets the subtypes which this detail implements to be those
contained in the list of given \a subTypes.
*/
+void QContactOnlineAccount::setSubTypes(const QList<int>& _value)
+{
+ reinterpret_cast<QContactOnlineAccountPrivate*>(d.data())->setMemberValue<QList<int> >(QContactOnlineAccount::FieldSubTypes, _value);
+}
/*!
\fn QContactOnlineAccount::subTypes() const
Returns the list of subtypes that this detail implements.
*/
+QList<int> QContactOnlineAccount::subTypes() const
+{
+ return reinterpret_cast<const QContactOnlineAccountPrivate*>(d.constData())->memberValue<QList<int> >(QContactOnlineAccount::FieldSubTypes);
+}
/*!
\fn QContactOnlineAccount::setCapabilities(const QStringList& capabilities)
@@ -1524,6 +2376,10 @@ const QContactDetail::DetailType QContactOnlineAccount::Type(QContactDetail::Typ
list of service-provider specified strings which together identify the
types of communication which may be possible.
*/
+void QContactOnlineAccount::setCapabilities(const QStringList& _value)
+{
+ reinterpret_cast<QContactOnlineAccountPrivate*>(d.data())->setMemberValue<QStringList>(QContactOnlineAccount::FieldCapabilities, _value);
+}
/*!
\fn QContactOnlineAccount::capabilities() const
@@ -1531,6 +2387,10 @@ const QContactDetail::DetailType QContactOnlineAccount::Type(QContactDetail::Typ
Returns the capabilities of the online account about which this detail stores
presence information.
*/
+QStringList QContactOnlineAccount::capabilities() const
+{
+ return reinterpret_cast<const QContactOnlineAccountPrivate*>(d.constData())->memberValue<QStringList>(QContactOnlineAccount::FieldCapabilities);
+}
/* ==================== QContactOrganization ======================= */
@@ -1542,6 +2402,33 @@ const QContactDetail::DetailType QContactOnlineAccount::Type(QContactDetail::Typ
\inmodule QtContacts
*/
+class QContactOrganizationPrivate : public QContactDetailBuiltinPrivate<QContactOrganizationPrivate>
+{
+public:
+ QString m_name;
+ QUrl m_logoUrl;
+ QStringList m_department;
+ QString m_location;
+ QString m_role;
+ QString m_title;
+ QString m_assistantName;
+
+ enum { FieldCount = 7 };
+
+ QContactOrganizationPrivate() : QContactDetailBuiltinPrivate<QContactOrganizationPrivate>(QContactOrganization::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactOrganizationPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactOrganizationPrivate, m_name) },
+ { QContactDetailBuiltinPrivateBase::Url, offsetof(QContactOrganizationPrivate, m_logoUrl) },
+ { QContactDetailBuiltinPrivateBase::StringList, offsetof(QContactOrganizationPrivate, m_department) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactOrganizationPrivate, m_location) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactOrganizationPrivate, m_role) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactOrganizationPrivate, m_title) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactOrganizationPrivate, m_assistantName) },
+};
+
/*!
\variable QContactOrganization::Type
The enum constant for the type identifier of QContactOrganization details.
@@ -1572,21 +2459,37 @@ const QContactDetail::DetailType QContactOrganization::Type(QContactDetail::Type
\fn QContactOrganization::setName(const QString& name)
Sets the name of the organization stored in this detail to \a name.
*/
+void QContactOrganization::setName(const QString& _value)
+{
+ reinterpret_cast<QContactOrganizationPrivate*>(d.data())->setMemberValue<QString>(QContactOrganization::FieldName, _value);
+}
/*!
\fn QContactOrganization::name() const
Returns the name of the organization stored in this detail.
*/
+QString QContactOrganization::name() const
+{
+ return reinterpret_cast<const QContactOrganizationPrivate*>(d.constData())->memberValue<QString>(QContactOrganization::FieldName);
+}
/*!
\fn QContactOrganization::setLogoUrl(const QUrl& logo)
Sets the url of the logo of the organization stored in this detail to \a logo.
*/
+void QContactOrganization::setLogoUrl(const QUrl& _value)
+{
+ reinterpret_cast<QContactOrganizationPrivate*>(d.data())->setMemberValue<QUrl>(QContactOrganization::FieldLogoUrl, _value);
+}
/*!
\fn QContactOrganization::logoUrl() const
Returns the url of the logo of the organization stored in this detail.
*/
+QUrl QContactOrganization::logoUrl() const
+{
+ return reinterpret_cast<const QContactOrganizationPrivate*>(d.constData())->memberValue<QUrl>(QContactOrganization::FieldLogoUrl);
+}
/*!
@@ -1596,12 +2499,19 @@ const QContactDetail::DetailType QContactOrganization::Type(QContactDetail::Type
detail to \a department. The department is a list of progressively
finer-grained information.
*/
+void QContactOrganization::setDepartment(const QStringList& _value)
+{
+ reinterpret_cast<QContactOrganizationPrivate*>(d.data())->setMemberValue<QStringList>(QContactOrganization::FieldDepartment, _value);
+}
/*!
\fn QContactOrganization::department() const
Returns the contact's department stored in this detail.
*/
-
+QStringList QContactOrganization::department() const
+{
+ return reinterpret_cast<const QContactOrganizationPrivate*>(d.constData())->memberValue<QStringList>(QContactOrganization::FieldDepartment);
+}
/*!
\fn QContactOrganization::setLocation(const QString& location)
@@ -1609,33 +2519,56 @@ const QContactDetail::DetailType QContactOrganization::Type(QContactDetail::Type
Sets the location (e.g. city or suburb) of the organization stored
in this detail to \a location.
*/
+void QContactOrganization::setLocation(const QString& _value)
+{
+ reinterpret_cast<QContactOrganizationPrivate*>(d.data())->setMemberValue<QString>(QContactOrganization::FieldLocation, _value);
+}
/*!
\fn QContactOrganization::location() const
Returns the location of the organization stored in this detail.
*/
+QString QContactOrganization::location() const
+{
+ return reinterpret_cast<const QContactOrganizationPrivate*>(d.constData())->memberValue<QString>(QContactOrganization::FieldLocation);
+}
/*!
\fn QContactOrganization::setRole(const QString& role)
Sets the contact's role within the organization stored in this detail to \a role.
*/
+void QContactOrganization::setRole(const QString& _value)
+{
+ reinterpret_cast<QContactOrganizationPrivate*>(d.data())->setMemberValue<QString>(QContactOrganization::FieldRole, _value);
+}
/*!
\fn QContactOrganization::role() const
Returns the contact's role within the organization stored in this detail.
*/
-
+QString QContactOrganization::role() const
+{
+ return reinterpret_cast<const QContactOrganizationPrivate*>(d.constData())->memberValue<QString>(QContactOrganization::FieldRole);
+}
/*!
\fn QContactOrganization::setTitle(const QString& title)
Sets the contact's title within the organization stored in this detail to \a title.
*/
+void QContactOrganization::setTitle(const QString& _value)
+{
+ reinterpret_cast<QContactOrganizationPrivate*>(d.data())->setMemberValue<QString>(QContactOrganization::FieldTitle, _value);
+}
/*!
\fn QContactOrganization::title() const
Returns the contact's title within the organization stored in this detail.
*/
+QString QContactOrganization::title() const
+{
+ return reinterpret_cast<const QContactOrganizationPrivate*>(d.constData())->memberValue<QString>(QContactOrganization::FieldTitle);
+}
/*!
\fn QContactOrganization::setAssistantName(const QString& assistantName)
@@ -1643,6 +2576,10 @@ const QContactDetail::DetailType QContactOrganization::Type(QContactDetail::Type
Sets the name of the default assistant of contacts belonging to
this organization to \a assistantName.
*/
+void QContactOrganization::setAssistantName(const QString& _value)
+{
+ reinterpret_cast<QContactOrganizationPrivate*>(d.data())->setMemberValue<QString>(QContactOrganization::FieldAssistantName, _value);
+}
/*!
\fn QContactOrganization::assistantName() const
@@ -1650,6 +2587,11 @@ const QContactDetail::DetailType QContactOrganization::Type(QContactDetail::Type
Returns the name of the default assistant of contacts belonging to
this organization.
*/
+QString QContactOrganization::assistantName() const
+{
+ return reinterpret_cast<const QContactOrganizationPrivate*>(d.constData())->memberValue<QString>(QContactOrganization::FieldAssistantName);
+}
+
/* ==================== QContactRingtone ======================= */
@@ -1661,6 +2603,25 @@ const QContactDetail::DetailType QContactOrganization::Type(QContactDetail::Type
\inmodule QtContacts
*/
+class QContactRingtonePrivate : public QContactDetailBuiltinPrivate<QContactRingtonePrivate>
+{
+public:
+ QUrl m_audioRingtoneUrl;
+ QUrl m_videoRingtoneUrl;
+ QUrl m_vibrationRingtoneUrl;
+
+ enum { FieldCount = 3 };
+
+ QContactRingtonePrivate() : QContactDetailBuiltinPrivate<QContactRingtonePrivate>(QContactRingtone::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactRingtonePrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::Url, offsetof(QContactRingtonePrivate, m_audioRingtoneUrl) },
+ { QContactDetailBuiltinPrivateBase::Url, offsetof(QContactRingtonePrivate, m_videoRingtoneUrl) },
+ { QContactDetailBuiltinPrivateBase::Url, offsetof(QContactRingtonePrivate, m_vibrationRingtoneUrl) },
+};
+
/*!
\variable QContactRingtone::Type
The enum constant for the type identifier of QContactRingtone details.
@@ -1682,6 +2643,10 @@ const QContactDetail::DetailType QContactRingtone::Type(QContactDetail::TypeRing
Returns the uri of the audio ringtone stored in the ringtone detail.
*/
+QUrl QContactRingtone::audioRingtoneUrl() const
+{
+ return reinterpret_cast<const QContactRingtonePrivate*>(d.constData())->memberValue<QUrl>(QContactRingtone::FieldAudioRingtoneUrl);
+}
/*!
\fn QContactRingtone::setAudioRingtoneUrl(const QUrl& audioRingtoneUrl)
@@ -1689,12 +2654,20 @@ const QContactDetail::DetailType QContactRingtone::Type(QContactDetail::TypeRing
Sets the uri of the audio ringtone stored in the ringtone detail
to \a audioRingtoneUrl.
*/
+void QContactRingtone::setAudioRingtoneUrl(const QUrl& _value)
+{
+ reinterpret_cast<QContactRingtonePrivate*>(d.data())->setMemberValue<QUrl>(QContactRingtone::FieldAudioRingtoneUrl, _value);
+}
/*!
\fn QContactRingtone::videoRingtoneUrl() const
Returns the uri of the video ringtone stored in the ringtone detail.
*/
+QUrl QContactRingtone::videoRingtoneUrl() const
+{
+ return reinterpret_cast<const QContactRingtonePrivate*>(d.constData())->memberValue<QUrl>(QContactRingtone::FieldVideoRingtoneUrl);
+}
/*!
\fn QContactRingtone::setVideoRingtoneUrl(const QUrl& videoRingtoneUrl)
@@ -1702,21 +2675,31 @@ const QContactDetail::DetailType QContactRingtone::Type(QContactDetail::TypeRing
Sets the uri of the video ringtone stored in the ringtone detail
to \a videoRingtoneUrl.
*/
+void QContactRingtone::setVideoRingtoneUrl(const QUrl& _value)
+{
+ reinterpret_cast<QContactRingtonePrivate*>(d.data())->setMemberValue<QUrl>(QContactRingtone::FieldVideoRingtoneUrl, _value);
+}
/*!
\fn QContactRingtone::vibrationRingtoneUrl() const
- \internal
Returns the uri of the vibration ringtone stored in the ringtone detail.
*/
+QUrl QContactRingtone::vibrationRingtoneUrl() const
+{
+ return reinterpret_cast<const QContactRingtonePrivate*>(d.constData())->memberValue<QUrl>(QContactRingtone::FieldVibrationRingtoneUrl);
+}
/*!
\fn QContactRingtone::setVibrationRingtoneUrl(const QUrl& vibrationRingtoneUrl)
- \internal
Sets the uri of the vibration ringtone stored in the ringtone detail
to \a vibrationRingtoneUrl.
*/
+void QContactRingtone::setVibrationRingtoneUrl(const QUrl& _value)
+{
+ reinterpret_cast<QContactRingtonePrivate*>(d.data())->setMemberValue<QUrl>(QContactRingtone::FieldVibrationRingtoneUrl, _value);
+}
/* ==================== QContactPresence ======================= */
@@ -1741,6 +2724,31 @@ const QContactDetail::DetailType QContactRingtone::Type(QContactDetail::TypeRing
\ingroup contacts-details
*/
+class QContactPresencePrivate : public QContactDetailBuiltinPrivate<QContactPresencePrivate>
+{
+public:
+ QDateTime m_timestamp;
+ QString m_nickname;
+ int m_presenceState;
+ QString m_presenceStateText;
+ QUrl m_presenceStateImageUrl;
+ QString m_customMessage;
+
+ enum { FieldCount = 6 };
+
+ QContactPresencePrivate() : QContactDetailBuiltinPrivate<QContactPresencePrivate>(QContactPresence::Type), m_presenceState(0) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactPresencePrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::DateTime, offsetof(QContactPresencePrivate, m_timestamp) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactPresencePrivate, m_nickname) },
+ { QContactDetailBuiltinPrivateBase::Int, offsetof(QContactPresencePrivate, m_presenceState) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactPresencePrivate, m_presenceStateText) },
+ { QContactDetailBuiltinPrivateBase::Url, offsetof(QContactPresencePrivate, m_presenceStateImageUrl) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactPresencePrivate, m_customMessage) },
+};
+
/*!
\variable QContactPresence::Type
The enum constant for the type identifier of QContactPresence details.
@@ -1770,12 +2778,20 @@ const QContactDetail::DetailType QContactPresence::Type(QContactDetail::TypePres
Sets the timestamp for the last update of the presence detail to be
\a updateTimestamp.
*/
+void QContactPresence::setTimestamp(const QDateTime& _value)
+{
+ reinterpret_cast<QContactPresencePrivate*>(d.data())->setMemberValue<QDateTime>(QContactPresence::FieldTimestamp, _value);
+}
/*!
\fn QContactPresence::timestamp() const
Returns the timestamp at which the data in the presence detail was valid.
*/
+QDateTime QContactPresence::timestamp() const
+{
+ return reinterpret_cast<const QContactPresencePrivate*>(d.constData())->memberValue<QDateTime>(QContactPresence::FieldTimestamp);
+}
/*!
\fn QContactPresence::setNickname(const QString& nickname)
@@ -1784,6 +2800,10 @@ const QContactDetail::DetailType QContactPresence::Type(QContactDetail::TypePres
communications via the online account about which this detail
stores presence information to \a nickname.
*/
+void QContactPresence::setNickname(const QString& _value)
+{
+ reinterpret_cast<QContactPresencePrivate*>(d.data())->setMemberValue<QString>(QContactPresence::FieldNickname, _value);
+}
/*!
\fn QContactPresence::nickname() const
@@ -1791,6 +2811,10 @@ const QContactDetail::DetailType QContactPresence::Type(QContactDetail::TypePres
Returns the last-known nickname used by the contact during
communications via the online account.
*/
+QString QContactPresence::nickname() const
+{
+ return reinterpret_cast<const QContactPresencePrivate*>(d.constData())->memberValue<QString>(QContactPresence::FieldNickname);
+}
/*!
\enum QContactPresence::PresenceState
@@ -1806,13 +2830,16 @@ const QContactDetail::DetailType QContactPresence::Type(QContactDetail::TypePres
\value PresenceExtendedAway Signifies that the contact is away for an extended period of time
\value PresenceOffline Signifies that the contact is offline
*/
-
/*!
\fn QContactPresence::setPresenceState(QContactPresence::PresenceState presenceState)
Sets the presence state of the online account according to the presence
information provider to the given \a presenceState.
*/
+void QContactPresence::setPresenceState(QContactPresence::PresenceState _value)
+{
+ reinterpret_cast<QContactPresencePrivate*>(d.data())->setMemberValue<int>(QContactPresence::FieldPresenceState, static_cast<int>(_value));
+}
/*!
\fn QContactPresence::presenceState() const
@@ -1820,6 +2847,10 @@ const QContactDetail::DetailType QContactPresence::Type(QContactDetail::TypePres
Returns the presence state of the online account according to the
presence provider.
*/
+QContactPresence::PresenceState QContactPresence::presenceState() const
+{
+ return static_cast<QContactPresence::PresenceState>(reinterpret_cast<const QContactPresencePrivate*>(d.constData())->memberValue<int>(QContactPresence::FieldPresenceState));
+}
/*!
\fn QContactPresence::setPresenceStateText(const QString& presenceStateText)
@@ -1829,12 +2860,20 @@ const QContactDetail::DetailType QContactPresence::Type(QContactDetail::TypePres
naming of states, or to allow finer grained state reporting than is
provided by the presence state API.
*/
+void QContactPresence::setPresenceStateText(const QString& _value)
+{
+ reinterpret_cast<QContactPresencePrivate*>(d.data())->setMemberValue<QString>(QContactPresence::FieldPresenceStateText, _value);
+}
/*!
\fn QContactPresence::presenceStateText() const
Returns the text corresponding to the current presence state.
*/
+QString QContactPresence::presenceStateText() const
+{
+ return reinterpret_cast<const QContactPresencePrivate*>(d.constData())->memberValue<QString>(QContactPresence::FieldPresenceStateText);
+}
/*!
\fn QContactPresence::setCustomMessage(const QString& customMessage)
@@ -1844,6 +2883,10 @@ const QContactDetail::DetailType QContactPresence::Type(QContactDetail::TypePres
This custom message would have been set by the contact,
and does not necessarily correspond to a particular presence state.
*/
+void QContactPresence::setCustomMessage(const QString& _value)
+{
+ reinterpret_cast<QContactPresencePrivate*>(d.data())->setMemberValue<QString>(QContactPresence::FieldCustomMessage, _value);
+}
/*!
\fn QContactPresence::customMessage() const
@@ -1851,6 +2894,10 @@ const QContactDetail::DetailType QContactPresence::Type(QContactDetail::TypePres
Returns the custom status message from the contact for the online account
about which this detail stores presence information.
*/
+QString QContactPresence::customMessage() const
+{
+ return reinterpret_cast<const QContactPresencePrivate*>(d.constData())->memberValue<QString>(QContactPresence::FieldCustomMessage);
+}
/*!
\fn QContactPresence::setPresenceStateImageUrl(const QUrl& presenceStateImageUrl)
@@ -1858,6 +2905,10 @@ const QContactDetail::DetailType QContactPresence::Type(QContactDetail::TypePres
Sets the last-known status image url of the contact for the online account
about which this detail stores presence information, to \a presenceStateImageUrl.
*/
+void QContactPresence::setPresenceStateImageUrl(const QUrl& _value)
+{
+ reinterpret_cast<QContactPresencePrivate*>(d.data())->setMemberValue<QUrl>(QContactPresence::FieldPresenceStateImageUrl, _value);
+}
/*!
\fn QContactPresence::presenceStateImageUrl() const
@@ -1865,6 +2916,10 @@ const QContactDetail::DetailType QContactPresence::Type(QContactDetail::TypePres
Returns the last-known status image url of the contact for the online account
about which this detail stores presence information.
*/
+QUrl QContactPresence::presenceStateImageUrl() const
+{
+ return reinterpret_cast<const QContactPresencePrivate*>(d.constData())->memberValue<QUrl>(QContactPresence::FieldPresenceStateImageUrl);
+}
/* ==================== QContactGlobalPresence ======================= */
@@ -1876,6 +2931,31 @@ const QContactDetail::DetailType QContactPresence::Type(QContactDetail::TypePres
\inmodule QtContacts
*/
+class QContactGlobalPresencePrivate : public QContactDetailBuiltinPrivate<QContactGlobalPresencePrivate>
+{
+public:
+ QDateTime m_timestamp;
+ QString m_nickname;
+ int m_presenceState;
+ QString m_presenceStateText;
+ QUrl m_presenceStateImageUrl;
+ QString m_customMessage;
+
+ enum { FieldCount = 6 };
+
+ QContactGlobalPresencePrivate() : QContactDetailBuiltinPrivate<QContactGlobalPresencePrivate>(QContactGlobalPresence::Type), m_presenceState(0) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactGlobalPresencePrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::DateTime, offsetof(QContactGlobalPresencePrivate, m_timestamp) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactGlobalPresencePrivate, m_nickname) },
+ { QContactDetailBuiltinPrivateBase::Int, offsetof(QContactGlobalPresencePrivate, m_presenceState) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactGlobalPresencePrivate, m_presenceStateText) },
+ { QContactDetailBuiltinPrivateBase::Url, offsetof(QContactGlobalPresencePrivate, m_presenceStateImageUrl) },
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactGlobalPresencePrivate, m_customMessage) },
+};
+
/*!
\variable QContactGlobalPresence::Type
The enum constant for the type identifier of QContactGlobalPresence details.
@@ -1905,12 +2985,20 @@ const QContactDetail::DetailType QContactGlobalPresence::Type(QContactDetail::Ty
Sets the update timestamp of the global presence detail to be
\a updateTimestamp.
*/
+void QContactGlobalPresence::setTimestamp(const QDateTime& _value)
+{
+ reinterpret_cast<QContactGlobalPresencePrivate*>(d.data())->setMemberValue<QDateTime>(QContactGlobalPresence::FieldTimestamp, _value);
+}
/*!
\fn QContactGlobalPresence::timestamp() const
Returns the timestamp at which the data in the global presence detail was valid.
*/
+QDateTime QContactGlobalPresence::timestamp() const
+{
+ return reinterpret_cast<const QContactGlobalPresencePrivate*>(d.constData())->memberValue<QDateTime>(QContactGlobalPresence::FieldTimestamp);
+}
/*!
\fn QContactGlobalPresence::setNickname(const QString& nickname)
@@ -1919,6 +3007,10 @@ const QContactDetail::DetailType QContactGlobalPresence::Type(QContactDetail::Ty
communications via any online account about which this detail
aggregates presence information to \a nickname.
*/
+void QContactGlobalPresence::setNickname(const QString& _value)
+{
+ reinterpret_cast<QContactGlobalPresencePrivate*>(d.data())->setMemberValue<QString>(QContactGlobalPresence::FieldNickname, _value);
+}
/*!
\fn QContactGlobalPresence::nickname() const
@@ -1927,6 +3019,10 @@ const QContactDetail::DetailType QContactGlobalPresence::Type(QContactDetail::Ty
communications via any online account about which this detail
aggregates presence information.
*/
+QString QContactGlobalPresence::nickname() const
+{
+ return reinterpret_cast<const QContactGlobalPresencePrivate*>(d.constData())->memberValue<QString>(QContactGlobalPresence::FieldNickname);
+}
/*!
\fn QContactGlobalPresence::setPresenceState(QContactPresence::PresenceState presenceState)
@@ -1935,6 +3031,10 @@ const QContactDetail::DetailType QContactGlobalPresence::Type(QContactDetail::Ty
information available from the presence providers which this detail aggregates
to the given \a presenceState.
*/
+void QContactGlobalPresence::setPresenceState(QContactPresence::PresenceState _value)
+{
+ reinterpret_cast<QContactGlobalPresencePrivate*>(d.data())->setMemberValue<int>(QContactGlobalPresence::FieldPresenceState, static_cast<int>(_value));
+}
/*!
\fn QContactGlobalPresence::presenceState() const
@@ -1942,6 +3042,10 @@ const QContactDetail::DetailType QContactGlobalPresence::Type(QContactDetail::Ty
Returns the aggregate presence state of any online accounts about which this detail
aggregates presence information.
*/
+QContactPresence::PresenceState QContactGlobalPresence::presenceState() const
+{
+ return static_cast<QContactPresence::PresenceState>(reinterpret_cast<const QContactGlobalPresencePrivate*>(d.constData())->memberValue<int>(QContactGlobalPresence::FieldPresenceState));
+}
/*!
\fn QContactGlobalPresence::setPresenceStateText(const QString& presenceStateText)
@@ -1951,12 +3055,20 @@ const QContactDetail::DetailType QContactGlobalPresence::Type(QContactDetail::Ty
naming of states, or to allow finer grained state reporting than is
provided by the presence state API.
*/
+void QContactGlobalPresence::setPresenceStateText(const QString& _value)
+{
+ reinterpret_cast<QContactGlobalPresencePrivate*>(d.data())->setMemberValue<QString>(QContactGlobalPresence::FieldPresenceStateText, _value);
+}
/*!
\fn QContactGlobalPresence::presenceStateText() const
Returns the text corresponding to the current presence state.
*/
+QString QContactGlobalPresence::presenceStateText() const
+{
+ return reinterpret_cast<const QContactGlobalPresencePrivate*>(d.constData())->memberValue<QString>(QContactGlobalPresence::FieldPresenceStateText);
+}
/*!
\fn QContactGlobalPresence::setCustomMessage(const QString& customMessage)
@@ -1964,6 +3076,11 @@ const QContactDetail::DetailType QContactGlobalPresence::Type(QContactDetail::Ty
Sets the custom status message from the contact for the aggregate presence
detail, to \a customMessage.
*/
+void QContactGlobalPresence::setCustomMessage(const QString& _value)
+{
+ reinterpret_cast<QContactGlobalPresencePrivate*>(d.data())->setMemberValue<QString>(QContactGlobalPresence::FieldCustomMessage, _value);
+}
+
/*!
\fn QContactGlobalPresence::customMessage() const
@@ -1971,18 +3088,30 @@ const QContactDetail::DetailType QContactGlobalPresence::Type(QContactDetail::Ty
Returns the custom status message from the contact for the aggregate presence
detail.
*/
+QString QContactGlobalPresence::customMessage() const
+{
+ return reinterpret_cast<const QContactGlobalPresencePrivate*>(d.constData())->memberValue<QString>(QContactGlobalPresence::FieldCustomMessage);
+}
/*!
\fn QContactGlobalPresence::setPresenceStateImageUrl(const QUrl& presenceStateImageUrl)
Sets the last-known status image url of the contact to \a presenceStateImageUrl.
*/
+void QContactGlobalPresence::setPresenceStateImageUrl(const QUrl& _value)
+{
+ reinterpret_cast<QContactGlobalPresencePrivate*>(d.data())->setMemberValue<QUrl>(QContactGlobalPresence::FieldPresenceStateImageUrl, _value);
+}
/*!
\fn QContactGlobalPresence::presenceStateImageUrl() const
Returns the last-known status image url of the contact.
*/
+QUrl QContactGlobalPresence::presenceStateImageUrl() const
+{
+ return reinterpret_cast<const QContactGlobalPresencePrivate*>(d.constData())->memberValue<QUrl>(QContactGlobalPresence::FieldPresenceStateImageUrl);
+}
/*!
Returns a filter which matches any contact whose global presence state
@@ -2011,6 +3140,23 @@ QContactFilter QContactGlobalPresence::match(QContactPresence::PresenceState sta
the data to another type that the engine supports.
*/
+class QContactExtendedDetailPrivate : public QContactDetailBuiltinPrivate<QContactExtendedDetailPrivate>
+{
+public:
+ QString m_name;
+ QVariant m_data;
+
+ enum { FieldCount = 2 };
+
+ QContactExtendedDetailPrivate() : QContactDetailBuiltinPrivate<QContactExtendedDetailPrivate>(QContactExtendedDetail::Type) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactExtendedDetailPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::String, offsetof(QContactExtendedDetailPrivate, m_name) },
+ { QContactDetailBuiltinPrivateBase::Variant, offsetof(QContactExtendedDetailPrivate, m_data) },
+};
+
/*!
\variable QContactExtendedDetail::Type
@@ -2030,24 +3176,41 @@ const QContactDetail::DetailType QContactExtendedDetail::Type(QContactDetail::Ty
Sets the \a name of this extended detail.
*/
+void QContactExtendedDetail::setName(const QString& _value)
+{
+ reinterpret_cast<QContactExtendedDetailPrivate*>(d.data())->setMemberValue<QString>(QContactExtendedDetail::FieldName, _value);
+}
/*!
\fn QString QContactExtendedDetail::name() const
Gets the name of this extended detail.
*/
+QString QContactExtendedDetail::name() const
+{
+ return reinterpret_cast<const QContactExtendedDetailPrivate*>(d.constData())->memberValue<QString>(QContactExtendedDetail::FieldName);
+}
/*!
\fn void QContactExtendedDetail::setData(const QVariant &data)
Sets the \a data of the extended detail.
*/
+void QContactExtendedDetail::setData(const QVariant& _value)
+{
+ reinterpret_cast<QContactExtendedDetailPrivate*>(d.data())->setMemberValue(QContactExtendedDetail::FieldData, _value);
+}
/*!
\fn QVariant QContactExtendedDetail::data() const
Gets the data of this extended detail.
*/
+QVariant QContactExtendedDetail::data() const
+{
+ return reinterpret_cast<const QContactExtendedDetailPrivate*>(d.constData())->memberValue<QVariant>(QContactExtendedDetail::FieldData);
+}
+
/* ==================== QContactVersion ======================= */
/*!
@@ -2057,6 +3220,23 @@ const QContactDetail::DetailType QContactExtendedDetail::Type(QContactDetail::Ty
\ingroup contacts-details
*/
+class QContactVersionPrivate : public QContactDetailBuiltinPrivate<QContactVersionPrivate>
+{
+public:
+ int m_sequenceNumber;
+ QByteArray m_extendedVersion;
+
+ enum { FieldCount = 2 };
+
+ QContactVersionPrivate() : QContactDetailBuiltinPrivate<QContactVersionPrivate>(QContactVersion::Type), m_sequenceNumber(0) {}
+};
+
+template<>
+const QContactDetailBuiltinPrivateBase::Member QContactDetailBuiltinPrivate<QContactVersionPrivate>::s_members[] = {
+ { QContactDetailBuiltinPrivateBase::Int, offsetof(QContactVersionPrivate, m_sequenceNumber) },
+ { QContactDetailBuiltinPrivateBase::ByteArray, offsetof(QContactVersionPrivate, m_extendedVersion) },
+};
+
/*!
\variable QContactVersion::Type
@@ -2077,24 +3257,41 @@ const QContactDetail::DetailType QContactVersion::Type(QContactDetail::TypeVersi
Sets the integer \a sequenceNumber.
*/
+void QContactVersion::setSequenceNumber(int _value)
+{
+ reinterpret_cast<QContactVersionPrivate*>(d.data())->setMemberValue<int>(QContactVersion::FieldSequenceNumber, _value);
+}
/*!
\fn int QContactVersion::sequenceNumber() const
Gets the integer sequenceNumber.
*/
+int QContactVersion::sequenceNumber() const
+{
+ return reinterpret_cast<const QContactVersionPrivate*>(d.constData())->memberValue<int>(QContactVersion::FieldSequenceNumber);
+}
/*!
\fn void QContactVersion::setExtendedVersion(const QByteArray &extendedVersion)
Sets the \a extendedVersion.
*/
+void QContactVersion::setExtendedVersion(const QByteArray& _value)
+{
+ reinterpret_cast<QContactVersionPrivate*>(d.data())->setMemberValue<QByteArray>(QContactVersion::FieldExtendedVersion, _value);
+}
/*!
\fn QByteArray QContactVersion::extendedVersion() const
Gets the extendedVersion.
*/
+QByteArray QContactVersion::extendedVersion() const
+{
+ return reinterpret_cast<const QContactVersionPrivate*>(d.constData())->memberValue<QByteArray>(QContactVersion::FieldExtendedVersion);
+}
+
/* ==================== Convenience Filters ======================= */
@@ -2209,5 +3406,91 @@ QContactFilter QContactPhoneNumber::match(const QString &number)
return l;
}
+/*
+ Adding a new builtin-detail-type requires extending this function!
+*/
+QContactDetailPrivate *QContactDetailPrivate::construct(QContactDetail::DetailType detailType)
+{
+ switch (detailType) {
+ case QContactDetail::TypeAddress: return new QContactAddressPrivate;
+ case QContactDetail::TypeAnniversary: return new QContactAnniversaryPrivate;
+ case QContactDetail::TypeAvatar: return new QContactAvatarPrivate;
+ case QContactDetail::TypeBirthday: return new QContactBirthdayPrivate;
+ case QContactDetail::TypeDisplayLabel: return new QContactDisplayLabelPrivate;
+ case QContactDetail::TypeEmailAddress: return new QContactEmailAddressPrivate;
+ case QContactDetail::TypeExtendedDetail:return new QContactExtendedDetailPrivate;
+ case QContactDetail::TypeFamily: return new QContactFamilyPrivate;
+ case QContactDetail::TypeFavorite: return new QContactFavoritePrivate;
+ case QContactDetail::TypeGender: return new QContactGenderPrivate;
+ case QContactDetail::TypeGeoLocation: return new QContactGeoLocationPrivate;
+ case QContactDetail::TypeGlobalPresence:return new QContactGlobalPresencePrivate;
+ case QContactDetail::TypeGuid: return new QContactGuidPrivate;
+ case QContactDetail::TypeHobby: return new QContactHobbyPrivate;
+ case QContactDetail::TypeName: return new QContactNamePrivate;
+ case QContactDetail::TypeNickname: return new QContactNicknamePrivate;
+ case QContactDetail::TypeNote: return new QContactNotePrivate;
+ case QContactDetail::TypeOnlineAccount: return new QContactOnlineAccountPrivate;
+ case QContactDetail::TypeOrganization: return new QContactOrganizationPrivate;
+ case QContactDetail::TypePhoneNumber: return new QContactPhoneNumberPrivate;
+ case QContactDetail::TypePresence: return new QContactPresencePrivate;
+ case QContactDetail::TypeRingtone: return new QContactRingtonePrivate;
+ case QContactDetail::TypeSyncTarget: return new QContactSyncTargetPrivate;
+ case QContactDetail::TypeTag: return new QContactTagPrivate;
+ case QContactDetail::TypeTimestamp: return new QContactTimestampPrivate;
+ case QContactDetail::TypeType: return new QContactTypePrivate;
+ case QContactDetail::TypeUrl: return new QContactUrlPrivate;
+ case QContactDetail::TypeVersion: return new QContactVersionPrivate;
+ default: return new QContactDetailPrivate(detailType);
+ }
+}
+
+
+/*!
+ \fn QContactDetail::QContactDetail(QContactDetail::DetailType type)
+ Constructs a new, empty detail of the type identified by \a type.
+ */
+QContactDetail::QContactDetail(QContactDetail::DetailType type)
+ : d(QContactDetailPrivate::construct(type))
+{
+}
+
+/*!
+ \internal
+ \fn QContactDetail::QContactDetail(const QContactDetail& other, DetailType expectedType)
+
+ Constructs a detail that is a copy of \a other if \a other is of the expected type
+ identified by \a expectedType, else constructs a new, empty detail of the
+ type identified by the \a expectedType
+*/
+QContactDetail::QContactDetail(const QContactDetail& other, DetailType expectedType)
+{
+ if (other.d.constData()->m_type == expectedType) {
+ d = other.d;
+ } else {
+ d = QContactDetailPrivate::construct(expectedType);
+ }
+}
+
+/*!
+ \internal
+ \fn QContactDetail& QContactDetail::assign(const QContactDetail& other, DetailType expectedType)
+
+ Assigns this detail to \a other if the type of \a other is that identified
+ by the given \a expectedType, else assigns this detail to be a new, empty
+ detail of the type identified by the given \a expectedType
+*/
+QContactDetail& QContactDetail::assign(const QContactDetail& other, DetailType expectedType)
+{
+ if (this != &other) {
+ if (other.d.constData()->m_type == expectedType) {
+ d = other.d;
+ } else {
+ d = QContactDetailPrivate::construct(expectedType);
+ }
+ }
+ return *this;
+}
+
+QT_WARNING_POP /* -Winvalid-offsetof */
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontactdisplaylabel.h b/src/contacts/details/qcontactdisplaylabel.h
index b0c8e1ed7..cf0c32f38 100644
--- a/src/contacts/details/qcontactdisplaylabel.h
+++ b/src/contacts/details/qcontactdisplaylabel.h
@@ -54,8 +54,8 @@ public:
FieldLabel = 0
};
- void setLabel(const QString& displayLabel) {setValue(FieldLabel, displayLabel);}
- QString label() const {return value(FieldLabel).toString();}
+ void setLabel(const QString& displayLabel);
+ QString label() const;
static QContactFilter match(const QString& label);
};
diff --git a/src/contacts/details/qcontactemailaddress.h b/src/contacts/details/qcontactemailaddress.h
index e1e517713..a07f80b34 100644
--- a/src/contacts/details/qcontactemailaddress.h
+++ b/src/contacts/details/qcontactemailaddress.h
@@ -54,8 +54,8 @@ public:
FieldEmailAddress = 0
};
- void setEmailAddress(const QString& _emailAddress) {setValue(FieldEmailAddress, _emailAddress);}
- QString emailAddress() const {return value(FieldEmailAddress).toString();}
+ void setEmailAddress(const QString& _emailAddress);
+ QString emailAddress() const;
// Convenience filter
static QContactFilter match(const QString& emailAddress);
diff --git a/src/contacts/details/qcontactextendeddetail.h b/src/contacts/details/qcontactextendeddetail.h
index 9fabf20bb..e085bac67 100644
--- a/src/contacts/details/qcontactextendeddetail.h
+++ b/src/contacts/details/qcontactextendeddetail.h
@@ -53,25 +53,11 @@ public:
FieldData
};
- void setName(const QString &_name)
- {
- setValue(FieldName, _name);
- }
+ void setName(const QString &_name);
+ QString name() const;
- QString name() const
- {
- return value(FieldName).toString();
- }
-
- void setData(const QVariant &_data)
- {
- setValue(FieldData, _data);
- }
-
- QVariant data() const
- {
- return value(FieldData);
- }
+ void setData(const QVariant &_data);
+ QVariant data() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontactfamily.h b/src/contacts/details/qcontactfamily.h
index 5852221c5..960f05787 100644
--- a/src/contacts/details/qcontactfamily.h
+++ b/src/contacts/details/qcontactfamily.h
@@ -53,10 +53,10 @@ public:
FieldChildren
};
- void setSpouse(const QString& spouseName) {setValue(FieldSpouse, spouseName);}
- QString spouse() const {return value(FieldSpouse).toString();}
- void setChildren(const QStringList& childrenNames) {setValue(FieldChildren, childrenNames);}
- QStringList children() const {return value<QStringList>(FieldChildren);}
+ void setSpouse(const QString& spouseName);
+ QString spouse() const;
+ void setChildren(const QStringList& childrenNames);
+ QStringList children() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontactfavorite.h b/src/contacts/details/qcontactfavorite.h
index 6c4960c72..291c87fcf 100644
--- a/src/contacts/details/qcontactfavorite.h
+++ b/src/contacts/details/qcontactfavorite.h
@@ -55,10 +55,10 @@ public:
FieldIndex
};
- void setFavorite(bool _isFavorite) {setValue(FieldFavorite, _isFavorite);}
- bool isFavorite() const {return value(FieldFavorite).toBool();}
- void setIndex(int _index) {setValue(FieldIndex, _index);}
- int index() const {return value(FieldIndex).toInt();}
+ void setFavorite(bool _isFavorite);
+ bool isFavorite() const;
+ void setIndex(int _index);
+ int index() const;
// Convenience filter
static QContactFilter match();
diff --git a/src/contacts/details/qcontactgender.h b/src/contacts/details/qcontactgender.h
index 8760d8edf..d1bf07813 100644
--- a/src/contacts/details/qcontactgender.h
+++ b/src/contacts/details/qcontactgender.h
@@ -55,8 +55,8 @@ public:
GenderUnspecified
};
- void setGender(const GenderField _gender) {setValue(FieldGender, static_cast<int>(_gender));}
- GenderField gender() const {return static_cast<GenderField>(value<int>(FieldGender));}
+ void setGender(const GenderField _gender);
+ GenderField gender() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontactgeolocation.h b/src/contacts/details/qcontactgeolocation.h
index d47667727..adf56e6ab 100644
--- a/src/contacts/details/qcontactgeolocation.h
+++ b/src/contacts/details/qcontactgeolocation.h
@@ -63,24 +63,24 @@ public:
FieldTimestamp
};
- void setLabel(const QString& _label) {setValue(FieldLabel, _label);}
- QString label() const {return value(FieldLabel).toString();}
- void setLatitude(double _latitude) {setValue(FieldLatitude, _latitude);}
- double latitude() const {return value(FieldLatitude).toDouble();}
- void setLongitude(double _longitude) {setValue(FieldLongitude, _longitude);}
- double longitude() const {return value(FieldLongitude).toDouble();}
- void setAccuracy(double _accuracy) {setValue(FieldAccuracy, _accuracy);}
- double accuracy() const {return value(FieldAccuracy).toDouble();}
- void setAltitude(double _altitude) {setValue(FieldAltitude, _altitude);}
- double altitude() const {return value(FieldAltitude).toDouble();}
- void setAltitudeAccuracy(double _altitudeAccuracy) {setValue(FieldAltitudeAccuracy, _altitudeAccuracy);}
- double altitudeAccuracy() const {return value(FieldAltitudeAccuracy).toDouble();}
- void setHeading(double _heading) {setValue(FieldHeading, _heading);}
- double heading() const {return value(FieldHeading).toDouble();}
- void setSpeed(double _speed) {setValue(FieldSpeed, _speed);}
- double speed() const {return value(FieldSpeed).toDouble();}
- void setTimestamp(const QDateTime& _timestamp) {setValue(FieldTimestamp, _timestamp);}
- QDateTime timestamp() const {return value(FieldTimestamp).toDateTime();}
+ void setLabel(const QString& _label);
+ QString label() const;
+ void setLatitude(double _latitude);
+ double latitude() const;
+ void setLongitude(double _longitude);
+ double longitude() const;
+ void setAccuracy(double _accuracy);
+ double accuracy() const;
+ void setAltitude(double _altitude);
+ double altitude() const;
+ void setAltitudeAccuracy(double _altitudeAccuracy);
+ double altitudeAccuracy() const;
+ void setHeading(double _heading);
+ double heading() const;
+ void setSpeed(double _speed);
+ double speed() const;
+ void setTimestamp(const QDateTime& _timestamp);
+ QDateTime timestamp() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontactglobalpresence.h b/src/contacts/details/qcontactglobalpresence.h
index 2821556c0..2bd519703 100644
--- a/src/contacts/details/qcontactglobalpresence.h
+++ b/src/contacts/details/qcontactglobalpresence.h
@@ -63,18 +63,18 @@ public:
FieldCustomMessage
};
- void setTimestamp(const QDateTime& _timestamp) {setValue(FieldTimestamp, _timestamp);}
- QDateTime timestamp() const {return value<QDateTime>(FieldTimestamp);}
- void setNickname(const QString& _nickname) {setValue(FieldNickname, _nickname);}
- QString nickname() const {return value(FieldNickname).toString();}
- void setPresenceState(QContactPresence::PresenceState _presenceState) {setValue(FieldPresenceState, static_cast<int>(_presenceState));}
- QContactPresence::PresenceState presenceState() const {return static_cast<QContactPresence::PresenceState>(value<int>(FieldPresenceState));}
- void setPresenceStateText(const QString& _presenceStateText) {setValue(FieldPresenceStateText, _presenceStateText);}
- QString presenceStateText() const {return value(FieldPresenceStateText).toString();}
- void setPresenceStateImageUrl(const QUrl& _presenceStateImageUrl) {setValue(FieldPresenceStateImageUrl, _presenceStateImageUrl);}
- QUrl presenceStateImageUrl() const {return value<QUrl>(FieldPresenceStateImageUrl);}
- void setCustomMessage(const QString& _customMessage) {setValue(FieldCustomMessage, _customMessage);}
- QString customMessage() const {return value(FieldCustomMessage).toString();}
+ void setTimestamp(const QDateTime& _timestamp);
+ QDateTime timestamp() const;
+ void setNickname(const QString& _nickname);
+ QString nickname() const;
+ void setPresenceState(QContactPresence::PresenceState _presenceState);
+ QContactPresence::PresenceState presenceState() const;
+ void setPresenceStateText(const QString& _presenceStateText);
+ QString presenceStateText() const;
+ void setPresenceStateImageUrl(const QUrl& _presenceStateImageUrl);
+ QUrl presenceStateImageUrl() const;
+ void setCustomMessage(const QString& _customMessage);
+ QString customMessage() const;
// convenience filtering functions
static QContactFilter match(QContactPresence::PresenceState state);
diff --git a/src/contacts/details/qcontactguid.h b/src/contacts/details/qcontactguid.h
index 414df9f3b..ce040af7b 100644
--- a/src/contacts/details/qcontactguid.h
+++ b/src/contacts/details/qcontactguid.h
@@ -52,8 +52,8 @@ public:
FieldGuid = 0
};
- void setGuid(const QString& _guid) {setValue(FieldGuid, _guid);}
- QString guid() const {return value(FieldGuid).toString();}
+ void setGuid(const QString& _guid);
+ QString guid() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontacthobby.h b/src/contacts/details/qcontacthobby.h
index 73dd47b34..5733c7463 100644
--- a/src/contacts/details/qcontacthobby.h
+++ b/src/contacts/details/qcontacthobby.h
@@ -52,8 +52,8 @@ public:
FieldHobby = 0
};
- void setHobby(const QString& _hobby) {setValue(FieldHobby, _hobby);}
- QString hobby() const {return value(FieldHobby).toString();}
+ void setHobby(const QString& _hobby);
+ QString hobby() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontactname.h b/src/contacts/details/qcontactname.h
index a1d56601e..0aa3cf288 100644
--- a/src/contacts/details/qcontactname.h
+++ b/src/contacts/details/qcontactname.h
@@ -58,17 +58,17 @@ public:
FieldSuffix
};
- QString prefix() const {return value(FieldPrefix).toString();}
- QString firstName() const {return value(FieldFirstName).toString();}
- QString middleName() const {return value(FieldMiddleName).toString();}
- QString lastName() const {return value(FieldLastName).toString();}
- QString suffix() const {return value(FieldSuffix).toString();}
+ QString prefix() const;
+ QString firstName() const;
+ QString middleName() const;
+ QString lastName() const;
+ QString suffix() const;
- void setPrefix(const QString& _prefix) {setValue(FieldPrefix, _prefix);}
- void setFirstName(const QString& _firstName) {setValue(FieldFirstName, _firstName);}
- void setMiddleName(const QString& _middleName) {setValue(FieldMiddleName, _middleName);}
- void setLastName(const QString& _lastName) {setValue(FieldLastName, _lastName);}
- void setSuffix(const QString& _suffix) {setValue(FieldSuffix, _suffix);}
+ void setPrefix(const QString& _prefix);
+ void setFirstName(const QString& _firstName);
+ void setMiddleName(const QString& _middleName);
+ void setLastName(const QString& _lastName);
+ void setSuffix(const QString& _suffix);
// Convenience filter
static QContactFilter match(const QString& name);
diff --git a/src/contacts/details/qcontactnickname.h b/src/contacts/details/qcontactnickname.h
index f784fcccc..a9fccc004 100644
--- a/src/contacts/details/qcontactnickname.h
+++ b/src/contacts/details/qcontactnickname.h
@@ -52,8 +52,8 @@ public:
FieldNickname = 0
};
- void setNickname(const QString& _nickname) {setValue(FieldNickname, _nickname);}
- QString nickname() const {return value(FieldNickname).toString();}
+ void setNickname(const QString& _nickname);
+ QString nickname() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontactnote.h b/src/contacts/details/qcontactnote.h
index 7bd31e790..8462f6820 100644
--- a/src/contacts/details/qcontactnote.h
+++ b/src/contacts/details/qcontactnote.h
@@ -52,8 +52,8 @@ public:
FieldNote = 0
};
- void setNote(const QString& _note) {setValue(FieldNote, _note);}
- QString note() const {return value(FieldNote).toString();}
+ void setNote(const QString& _note);
+ QString note() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontactonlineaccount.h b/src/contacts/details/qcontactonlineaccount.h
index 731071187..70b4d9896 100644
--- a/src/contacts/details/qcontactonlineaccount.h
+++ b/src/contacts/details/qcontactonlineaccount.h
@@ -75,20 +75,20 @@ public:
ProtocolYahoo
};
- void setAccountUri(const QString& _accountUri) {setValue(FieldAccountUri, _accountUri);}
- QString accountUri() const {return value(FieldAccountUri).toString();}
+ void setAccountUri(const QString& _accountUri);
+ QString accountUri() const;
- void setServiceProvider(const QString& _serviceProvider) {setValue(FieldServiceProvider, _serviceProvider);}
- QString serviceProvider() const {return value(FieldServiceProvider).toString();}
+ void setServiceProvider(const QString& _serviceProvider);
+ QString serviceProvider() const;
- void setProtocol(Protocol _protocol) {setValue(FieldProtocol, _protocol);}
- Protocol protocol() const {return Protocol(value(FieldProtocol).toInt());}
+ void setProtocol(Protocol _protocol);
+ Protocol protocol() const;
- void setCapabilities(const QStringList& _capabilities) {setValue(FieldCapabilities, _capabilities);}
- QStringList capabilities() const {return value<QStringList>(FieldCapabilities);}
+ void setCapabilities(const QStringList& _capabilities);
+ QStringList capabilities() const;
- void setSubTypes(const QList<int> &_subTypes) {setValue(FieldSubTypes, QVariant::fromValue(_subTypes));}
- QList<int> subTypes() const {return value< QList<int> >(FieldSubTypes);}
+ void setSubTypes(const QList<int> &_subTypes);
+ QList<int> subTypes() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontactorganization.h b/src/contacts/details/qcontactorganization.h
index 667e7badc..5626d3ce5 100644
--- a/src/contacts/details/qcontactorganization.h
+++ b/src/contacts/details/qcontactorganization.h
@@ -60,20 +60,20 @@ public:
FieldAssistantName
};
- void setName(const QString& _name) {setValue(FieldName, _name);}
- QString name() const {return value(FieldName).toString();}
- void setLogoUrl(const QUrl& logo) {setValue(FieldLogoUrl, logo);}
- QUrl logoUrl() const {return value<QUrl>(FieldLogoUrl);}
- void setDepartment(const QStringList& _department) {setValue(FieldDepartment, _department);}
- QStringList department() const {return value<QStringList>(FieldDepartment);}
- void setLocation(const QString& _location) {setValue(FieldLocation, _location);}
- QString location() const {return value(FieldLocation).toString();}
- void setRole(const QString& _role) {setValue(FieldRole, _role);}
- QString role() const {return value(FieldRole).toString();}
- void setTitle(const QString& _title) {setValue(FieldTitle, _title);}
- QString title() const {return value(FieldTitle).toString();}
- void setAssistantName(const QString& _assistantName) {setValue(FieldAssistantName, _assistantName);}
- QString assistantName() const {return value(FieldAssistantName).toString();}
+ void setName(const QString& _name);
+ QString name() const;
+ void setLogoUrl(const QUrl& logo);
+ QUrl logoUrl() const;
+ void setDepartment(const QStringList& _department);
+ QStringList department() const;
+ void setLocation(const QString& _location);
+ QString location() const;
+ void setRole(const QString& _role);
+ QString role() const;
+ void setTitle(const QString& _title);
+ QString title() const;
+ void setAssistantName(const QString& _assistantName);
+ QString assistantName() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontactphonenumber.h b/src/contacts/details/qcontactphonenumber.h
index 3d6336913..728bb1844 100644
--- a/src/contacts/details/qcontactphonenumber.h
+++ b/src/contacts/details/qcontactphonenumber.h
@@ -72,14 +72,14 @@ public:
SubTypeIsdn
};
- void setNumber(const QString& _number) {setValue(FieldNumber, _number);}
- QString number() const {return value(FieldNumber).toString();}
+ void setNumber(const QString &_number);
+ QString number() const;
- void setSubTypes(const QList<int> &_subTypes) {setValue(FieldSubTypes, QVariant::fromValue(_subTypes));}
- QList<int> subTypes() const {return value< QList<int> >(FieldSubTypes);}
+ void setSubTypes(const QList<int> &_subTypes);
+ QList<int> subTypes() const;
// Convenience filter
- static QContactFilter match(const QString& number);
+ static QContactFilter match(const QString& _number);
};
//! [0]
diff --git a/src/contacts/details/qcontactpresence.h b/src/contacts/details/qcontactpresence.h
index 8b7a90c36..d22f0500d 100644
--- a/src/contacts/details/qcontactpresence.h
+++ b/src/contacts/details/qcontactpresence.h
@@ -70,18 +70,18 @@ public:
PresenceOffline
};
- void setTimestamp(const QDateTime& _timestamp) {setValue(FieldTimestamp, _timestamp);}
- QDateTime timestamp() const {return value<QDateTime>(FieldTimestamp);}
- void setNickname(const QString& _nickname) {setValue(FieldNickname, _nickname);}
- QString nickname() const {return value(FieldNickname).toString();}
- void setPresenceState(PresenceState presence) {setValue(FieldPresenceState, static_cast<int>(presence));}
- PresenceState presenceState() const {return static_cast<PresenceState>(value<int>(FieldPresenceState));}
- void setPresenceStateText(const QString& _presenceStateText) {setValue(FieldPresenceStateText, _presenceStateText);}
- QString presenceStateText() const {return value(FieldPresenceStateText).toString();}
- void setPresenceStateImageUrl(const QUrl& _presenceStateImageUrl) {setValue(FieldPresenceStateImageUrl, _presenceStateImageUrl);}
- QUrl presenceStateImageUrl() const {return value<QUrl>(FieldPresenceStateImageUrl);}
- void setCustomMessage(const QString& _customMessage) {setValue(FieldCustomMessage, _customMessage);}
- QString customMessage() const {return value(FieldCustomMessage).toString();}
+ void setTimestamp(const QDateTime& _timestamp);
+ QDateTime timestamp() const;
+ void setNickname(const QString& _nickname);
+ QString nickname() const;
+ void setPresenceState(PresenceState presence);
+ PresenceState presenceState() const;
+ void setPresenceStateText(const QString& _presenceStateText);
+ QString presenceStateText() const;
+ void setPresenceStateImageUrl(const QUrl& _presenceStateImageUrl);
+ QUrl presenceStateImageUrl() const;
+ void setCustomMessage(const QString& _customMessage);
+ QString customMessage() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontactringtone.h b/src/contacts/details/qcontactringtone.h
index 47b475662..f0b463f69 100644
--- a/src/contacts/details/qcontactringtone.h
+++ b/src/contacts/details/qcontactringtone.h
@@ -51,19 +51,19 @@ public:
#endif
enum RingtoneField {
- FieldAudioRingtoneUrl = 0,
- FieldVideoRingtoneUrl,
- FieldVibrationRingtoneUrl
+ FieldAudioRingtoneUrl = 0,
+ FieldVideoRingtoneUrl,
+ FieldVibrationRingtoneUrl
};
- void setAudioRingtoneUrl(const QUrl& _audioRingtoneUrl) {setValue(FieldAudioRingtoneUrl, _audioRingtoneUrl);}
- QUrl audioRingtoneUrl() const {return value<QUrl>(FieldAudioRingtoneUrl);}
+ void setAudioRingtoneUrl(const QUrl& _audioRingtoneUrl);
+ QUrl audioRingtoneUrl() const;
- void setVideoRingtoneUrl(const QUrl& _videoRingtoneUrl) {setValue(FieldVideoRingtoneUrl, _videoRingtoneUrl);}
- QUrl videoRingtoneUrl() const {return value<QUrl>(FieldVideoRingtoneUrl);}
+ void setVideoRingtoneUrl(const QUrl& _videoRingtoneUrl);
+ QUrl videoRingtoneUrl() const;
- void setVibrationRingtoneUrl(const QUrl& _vibrationRingtoneUrl) {setValue(FieldVibrationRingtoneUrl, _vibrationRingtoneUrl);}
- QUrl vibrationRingtoneUrl() const {return value<QUrl>(FieldVibrationRingtoneUrl);}
+ void setVibrationRingtoneUrl(const QUrl& _vibrationRingtoneUrl);
+ QUrl vibrationRingtoneUrl() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontactsynctarget.h b/src/contacts/details/qcontactsynctarget.h
index c99016e2e..99620741e 100644
--- a/src/contacts/details/qcontactsynctarget.h
+++ b/src/contacts/details/qcontactsynctarget.h
@@ -52,8 +52,8 @@ public:
FieldSyncTarget = 0
};
- void setSyncTarget(const QString& _syncTarget) {setValue(FieldSyncTarget, _syncTarget);}
- QString syncTarget() const {return value(FieldSyncTarget).toString();}
+ void setSyncTarget(const QString& _syncTarget);
+ QString syncTarget() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontacttag.h b/src/contacts/details/qcontacttag.h
index 5e4c1a8b0..d710b4e8a 100644
--- a/src/contacts/details/qcontacttag.h
+++ b/src/contacts/details/qcontacttag.h
@@ -54,8 +54,8 @@ public:
FieldTag = 0
};
- void setTag(const QString& _tag) {setValue(FieldTag, _tag);}
- QString tag() const {return value(FieldTag).toString();}
+ void setTag(const QString& _tag);
+ QString tag() const;
// Convenience filter
static QContactFilter match(const QString& subString);
diff --git a/src/contacts/details/qcontacttimestamp.h b/src/contacts/details/qcontacttimestamp.h
index e6f460274..ac5221992 100644
--- a/src/contacts/details/qcontacttimestamp.h
+++ b/src/contacts/details/qcontacttimestamp.h
@@ -55,10 +55,10 @@ public:
FieldCreationTimestamp
};
- void setLastModified(const QDateTime& timestamp) {setValue(FieldModificationTimestamp, timestamp);}
- QDateTime lastModified() const {return value<QDateTime>(FieldModificationTimestamp);}
- void setCreated(const QDateTime& timestamp) {setValue(FieldCreationTimestamp, timestamp);}
- QDateTime created() const {return value<QDateTime>(FieldCreationTimestamp);}
+ void setLastModified(const QDateTime& timestamp);
+ QDateTime lastModified() const;
+ void setCreated(const QDateTime& timestamp);
+ QDateTime created() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontacttype.h b/src/contacts/details/qcontacttype.h
index 597e0fe68..d9ada7a9b 100644
--- a/src/contacts/details/qcontacttype.h
+++ b/src/contacts/details/qcontacttype.h
@@ -57,8 +57,8 @@ public:
TypeFacet
};
- void setType(const TypeValues newType) {setValue(FieldType, newType);}
- TypeValues type() const {return static_cast<TypeValues>(value<int>(FieldType));}
+ void setType(TypeValues newType);
+ TypeValues type() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontacturl.h b/src/contacts/details/qcontacturl.h
index 224c551f5..3d8a9a9ee 100644
--- a/src/contacts/details/qcontacturl.h
+++ b/src/contacts/details/qcontacturl.h
@@ -60,12 +60,12 @@ public:
SubTypeFavourite
};
- void setUrl(const QString& _url) {setValue(FieldUrl, _url);}
- void setUrl(const QUrl& _url) {setValue(FieldUrl, _url.toString());}
- QString url() const {return value(FieldUrl).toString();}
+ void setUrl(const QUrl& _url);
+ void setUrl(const QString& _url);
+ QString url() const;
- void setSubType(const QContactUrl::SubType &_subType) {setValue(FieldSubType, static_cast<int>(_subType));}
- QContactUrl::SubType subType() const {return static_cast<QContactUrl::SubType>(value<int>(FieldSubType));}
+ void setSubType(QContactUrl::SubType _subType);
+ QContactUrl::SubType subType() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/details/qcontactversion.h b/src/contacts/details/qcontactversion.h
index 41c9d0d13..723323353 100644
--- a/src/contacts/details/qcontactversion.h
+++ b/src/contacts/details/qcontactversion.h
@@ -53,18 +53,11 @@ public:
FieldExtendedVersion
};
- void setSequenceNumber(int _sequenceNumber) {setValue(FieldSequenceNumber, _sequenceNumber);};
- int sequenceNumber() const {return value(FieldSequenceNumber).toInt();};
+ void setSequenceNumber(int _sequenceNumber);
+ int sequenceNumber() const;
- void setExtendedVersion(const QByteArray &_extendedVersion)
- {
- setValue(FieldExtendedVersion, _extendedVersion);
- };
-
- QByteArray extendedVersion() const
- {
- return value(FieldExtendedVersion).toByteArray();
- };
+ void setExtendedVersion(const QByteArray& _extendedVersion);
+ QByteArray extendedVersion() const;
};
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/qcontact.cpp b/src/contacts/qcontact.cpp
index 8d92b9a20..b806cc975 100644
--- a/src/contacts/qcontact.cpp
+++ b/src/contacts/qcontact.cpp
@@ -309,7 +309,7 @@ QContactDetail QContact::detail(QContactDetail::DetailType type) const
// build the sub-list of matching details.
for (int i = 0; i < d.constData()->m_details.size(); i++) {
const QContactDetail& existing = d.constData()->m_details.at(i);
- if (QContactDetailPrivate::detailPrivate(existing)->m_type == type) {
+ if (existing.d->m_type == type) {
return existing;
}
}
@@ -342,7 +342,7 @@ QList<QContactDetail> QContact::details(QContactDetail::DetailType type) const
} else {
for (int i = 0; i < d->m_details.size(); i++) {
const QContactDetail& existing = d.constData()->m_details.at(i);
- if (QContactDetailPrivate::detailPrivate(existing)->m_type == type) {
+ if (existing.d->m_type == type) {
sublist.append(existing);
}
}
@@ -376,7 +376,7 @@ bool QContact::appendDetail(const QContactDetail &detail)
return false;
/* Also handle contact type specially - only one of them. */
- if (QContactDetailPrivate::detailPrivate(detail)->m_type == QContactType::Type) {
+ if (detail.d->m_type == QContactType::Type) {
d->m_details[0] = detail;
d->m_details[0].d->m_access |= QContactDetail::Irremovable;
return true;
@@ -422,7 +422,7 @@ bool QContact::saveDetail(QContactDetail* detail)
return false;
/* Also handle contact type specially - only one of them. */
- if (QContactDetailPrivate::detailPrivate(*detail)->m_type == QContactType::Type) {
+ if (detail->d->m_type == QContactType::Type) {
detail->d->m_access |= QContactDetail::Irremovable;
d->m_details[0] = *detail;
return true;
@@ -432,8 +432,8 @@ bool QContact::saveDetail(QContactDetail* detail)
// ie, the one with the same type and id, but different value or attributes.
for (int i = 0; i < d.constData()->m_details.size(); i++) {
const QContactDetail& curr = d.constData()->m_details.at(i);
- if (detail->d.constData()->m_type == curr.d.constData()->m_type &&
- detail->d.constData()->m_id == curr.d.constData()->m_id) {
+ if (detail->d->m_type == curr.d->m_type &&
+ detail->d->m_detailId == curr.d->m_detailId) {
// update the detail constraints of the supplied detail
detail->d->m_access = curr.accessConstraints();
// Found the old version. Replace it with this one.
@@ -496,7 +496,7 @@ bool QContact::removeDetail(QContactDetail* detail)
QStringList keys = d.constData()->m_preferences.keys();
for (int i = 0; i < keys.size(); i++) {
QString prefKey = keys.at(i);
- if (d.constData()->m_preferences.value(prefKey) == detail->d.constData()->m_id) {
+ if (d.constData()->m_preferences.value(prefKey) == detail->d->m_detailId) {
d->m_preferences.remove(prefKey);
}
}
@@ -716,7 +716,7 @@ bool QContact::setPreferredDetail(const QString& actionName, const QContactDetai
return false;
// otherwise, save the preference.
- d->m_preferences.insert(actionName, preferredDetail.d.constData()->m_id);
+ d->m_preferences.insert(actionName, preferredDetail.d->m_detailId);
return true;
}
@@ -732,10 +732,10 @@ bool QContact::isPreferredDetail(const QString& actionName, const QContactDetail
return false;
if (actionName.isEmpty())
- return d.constData()->m_preferences.values().contains(detail.d.constData()->m_id);
+ return d.constData()->m_preferences.values().contains(detail.d->m_detailId);
QMap<QString, int>::const_iterator it = d.constData()->m_preferences.find(actionName);
- if (it != d.constData()->m_preferences.end() && it.value() == detail.d.constData()->m_id)
+ if (it != d.constData()->m_preferences.end() && it.value() == detail.d->m_detailId)
return true;
return false;
@@ -762,7 +762,7 @@ QContactDetail QContact::preferredDetail(const QString& actionName) const
int detId = d.constData()->m_preferences.value(actionName);
for (int i = 0; i < d.constData()->m_details.size(); i++) {
QContactDetail det = d.constData()->m_details.at(i);
- if (det.d.constData()->m_id == detId) {
+ if (det.d->m_detailId == detId) {
// found it.
retn = det;
break;
diff --git a/src/contacts/qcontactdetail.cpp b/src/contacts/qcontactdetail.cpp
index 8708dc0db..4eab92751 100644
--- a/src/contacts/qcontactdetail.cpp
+++ b/src/contacts/qcontactdetail.cpp
@@ -33,6 +33,7 @@
#include "qcontactdetail.h"
#include "qcontactdetail_p.h"
+#include "qcontactdetails.h"
#ifndef QT_NO_DATASTREAM
#include <QtCore/qdatastream.h>
@@ -153,13 +154,39 @@ QAtomicInt QContactDetailPrivate::lastDetailKey(1);
you should use this macro when declaring your class to ensure that
it interoperates with other contact functionality.
- Here is an example of a class (\l QContactPhoneNumber) using this macro.
+ Here is an example of a custom extension class using this macro.
Note that the class provides some predefined constants
and some convenience methods that return values associated with schema
fields.
- \snippet qcontactphonenumber.h 0
- */
+ \code
+ #include <QContactDetail>
+ class ContactVehicle : public QContactDetail
+ {
+ public:
+ Q_DECLARE_CUSTOM_CONTACT_DETAIL(ContactVehicle)
+
+ enum VehicleField {
+ FieldRegistration = 0,
+ FieldMake,
+ FieldModel,
+ FieldColor
+ };
+
+ QString registration() const { return value(FieldRegistration).toString(); }
+ void setRegistration(const QString& _registration) { setValue(FieldRegistration, _registration);
+
+ QString make() const { return value(FieldMake).toString(); }
+ void setMake(const QString& _make) { setValue(FieldMake, _make); }
+
+ QString model() const { return value(FieldModel).toString(); }
+ void setModel(const QString& _model) { setValue(FieldModel, _model); }
+
+ QString color() const { return value(FieldColor).toString(); }
+ void setColor(const QString &_color) { setValue(FieldColor, _color); }
+ };
+ \endcode
+*/
/*!
\enum QContactDetail::DetailType
@@ -209,43 +236,18 @@ QAtomicInt QContactDetailPrivate::lastDetailKey(1);
QContactDetail::QContactDetail()
: d(new QContactDetailPrivate)
{
- d->m_type = QContactDetail::TypeUndefined;
-}
-
-/*!
- Constructs a new, empty detail of the type identified by \a type.
- */
-QContactDetail::QContactDetail(QContactDetail::DetailType type)
- : d(new QContactDetailPrivate)
-{
- d->m_type = type;
}
/*! Constructs a detail that is a copy of \a other
-*/
+ */
QContactDetail::QContactDetail(const QContactDetail& other)
: d(other.d)
{
}
/*!
- \internal
-
- Constructs a detail that is a copy of \a other if \a other is of the expected type
- identified by \a expectedType, else constructs a new, empty detail of the
- type identified by the \a expectedType
-*/
-QContactDetail::QContactDetail(const QContactDetail& other, DetailType expectedType)
-{
- if (other.d.constData()->m_type == expectedType) {
- d = other.d;
- } else {
- d = new QContactDetailPrivate;
- d->m_type = expectedType;
- }
-}
-
-/*! Assigns this detail to \a other */
+ * Assigns this detail to \a other
+ */
QContactDetail& QContactDetail::operator=(const QContactDetail& other)
{
if (this != &other)
@@ -253,26 +255,6 @@ QContactDetail& QContactDetail::operator=(const QContactDetail& other)
return *this;
}
-/*!
- \internal
-
- Assigns this detail to \a other if the type of \a other is that identified
- by the given \a expectedType, else assigns this detail to be a new, empty
- detail of the type identified by the given \a expectedType
-*/
-QContactDetail& QContactDetail::assign(const QContactDetail& other, DetailType expectedType)
-{
- if (this != &other) {
- if (other.d.constData()->m_type == expectedType) {
- d = other.d;
- } else {
- d = new QContactDetailPrivate;
- d->m_type = expectedType;
- }
- }
- return *this;
-}
-
/*! Frees the memory used by this detail */
QContactDetail::~QContactDetail()
{
@@ -283,7 +265,7 @@ QContactDetail::~QContactDetail()
*/
QContactDetail::DetailType QContactDetail::type() const
{
- return d.constData()->m_type;
+ return static_cast<QContactDetail::DetailType>(d.constData()->m_type);
}
/*!
@@ -299,14 +281,21 @@ bool QContactDetail::operator==(const QContactDetail& other) const
if (d.constData()->m_access != other.d.constData()->m_access)
return false;
- if (d.constData()->m_values.size() != other.d.constData()->m_values.size())
+ QMap<int, QVariant> thisValues = values(), otherValues = other.values();
+ if (thisValues.size() != otherValues.size())
return false;
- foreach (const QVariant &value, d.constData()->m_values.values()) {
- if (value.canConvert< QList<int> >()) {
- if (other.d.constData()->m_values.value(d.constData()->m_values.key(value)).value< QList<int> >() != value.value< QList<int> >()) {
- return false;
- }
- } else if (!other.d.constData()->m_values.values().contains(value)) {
+
+ QMap<int, QVariant>::const_iterator it = thisValues.constBegin(), end = thisValues.constEnd();
+ for ( ; it != end; ++it) {
+ if (!otherValues.contains(it.key())) {
+ return false;
+ }
+ const QVariant &otherV(otherValues.value(it.key()));
+ if (it.value().canConvert<QList<int> >()) {
+ if (otherV.value<QList<int> >() != it.value().value<QList<int> >()) {
+ return false;
+ }
+ } else if (it.value() != otherV) {
return false;
}
}
@@ -317,14 +306,13 @@ bool QContactDetail::operator==(const QContactDetail& other) const
*/
uint qHash(const QContactDetail &key)
{
- const QContactDetailPrivate* dptr= QContactDetailPrivate::detailPrivate(key);
- uint hash = qHash(QString().setNum(dptr->m_type))
- + QT_PREPEND_NAMESPACE(qHash)(dptr->m_access);
- QMap<int, QVariant>::const_iterator it = dptr->m_values.constBegin();
- while(it != dptr->m_values.constEnd()) {
+ uint hash = qHash(QString().setNum(key.type()))
+ + QT_PREPEND_NAMESPACE(qHash)(key.accessConstraints());
+ QMap<int, QVariant> values = key.values();
+ QMap<int, QVariant>::const_iterator it = values.constBegin(), end = values.constEnd();
+ for ( ; it != end; ++it) {
hash += QT_PREPEND_NAMESPACE(qHash)(it.key())
- + QT_PREPEND_NAMESPACE(qHash)(it.value().toString());
- ++it;
+ + QT_PREPEND_NAMESPACE(qHash)(it.value().toString());
}
return hash;
}
@@ -395,7 +383,7 @@ QDataStream& operator>>(QDataStream& in, QContactDetail& detail)
*/
bool QContactDetail::isEmpty() const
{
- return d.constData()->m_values.isEmpty();
+ return d->isEmpty();
}
/*!
@@ -410,26 +398,28 @@ bool QContactDetail::isEmpty() const
*/
int QContactDetail::key() const
{
- return d.constData()->m_id;
+ return d.constData()->m_detailId;
}
-/*! Causes the implicitly-shared detail to be detached from any other copies, and generates a new key for it.
+/*!
+ * Generates a new key (detail id) for the detail.
* This ensures that calling QContact::saveDetail() will result in a new detail being saved, rather than
* another detail being updated.
*/
void QContactDetail::resetKey()
{
- d->m_id = QContactDetailPrivate::lastDetailKey.fetchAndAddOrdered(1);
+ d->m_detailId = QContactDetailPrivate::lastDetailKey.fetchAndAddOrdered(1);
}
-
/*!
* Returns the value stored in this detail for the given \a field. An invalid QVariant is returned if
* the value of \a field is not set.
*/
QVariant QContactDetail::value(int field) const
{
- return d.constData()->m_values.value(field);
+ if (!hasValue(field))
+ return QVariant();
+ return d->value(field);
}
/*!
@@ -437,23 +427,28 @@ QVariant QContactDetail::value(int field) const
*/
bool QContactDetail::hasValue(int field) const
{
- return d.constData()->m_values.contains(field);
+ return d->hasValue(field);
}
-
/*!
Inserts \a value into the detail for the given \a field if \a value is valid. If \a value is invalid,
removes the field with the given \a field from the detail. Returns true if the given \a value was set
for the \a field (if the \a value was valid), or if the given \a field was removed from detail (if the
\a value was invalid), and returns false if the field could not be removed (and the \a value was invalid)
*/
-bool QContactDetail::setValue(int field, const QVariant& value)
+bool QContactDetail::setValue(int field, const QVariant& _value)
{
- if (!value.isValid())
+ if (!_value.isValid())
return removeValue(field);
+ return d->setValue(field, _value);
+}
- d->m_values.insert(field, value);
- return true;
+void QContactDetail::setValues(const QMap<int, QVariant> &newValues)
+{
+ QMap<int, QVariant>::const_iterator it = newValues.constBegin(), end = newValues.constEnd();
+ for ( ; it != end; ++it) {
+ setValue(it.key(), it.value());
+ }
}
/*!
@@ -462,9 +457,7 @@ bool QContactDetail::setValue(int field, const QVariant& value)
*/
bool QContactDetail::removeValue(int field)
{
- if (d->m_values.remove(field))
- return true;
- return false;
+ return d->removeValue(field);
}
/*!
@@ -472,7 +465,7 @@ bool QContactDetail::removeValue(int field)
*/
QMap<int, QVariant> QContactDetail::values() const
{
- return d.constData()->m_values;
+ return d->values();
}
/*!
@@ -632,4 +625,5 @@ QContactDetail::AccessConstraints QContactDetail::accessConstraints() const
\sa value()
*/
+
QT_END_NAMESPACE_CONTACTS
diff --git a/src/contacts/qcontactdetail.h b/src/contacts/qcontactdetail.h
index ab4d61c85..9724733bd 100644
--- a/src/contacts/qcontactdetail.h
+++ b/src/contacts/qcontactdetail.h
@@ -45,7 +45,6 @@ QT_BEGIN_NAMESPACE_CONTACTS
class QContact;
class QContactActionDescriptor;
-
class QContactDetailPrivate;
class Q_CONTACTS_EXPORT QContactDetail
{
@@ -82,22 +81,6 @@ public:
TypeVersion
};
- QContactDetail();
- explicit QContactDetail(DetailType type);
- ~QContactDetail();
-
- QContactDetail(const QContactDetail& other);
- QContactDetail& operator=(const QContactDetail& other);
-
- enum AccessConstraint {
- NoConstraint = 0,
- ReadOnly = 0x01,
- Irremovable = 0x02
- };
- Q_DECLARE_FLAGS(AccessConstraints, AccessConstraint)
-
- AccessConstraints accessConstraints() const;
-
enum DetailContext {
ContextHome = 0,
ContextWork,
@@ -107,26 +90,46 @@ public:
enum DetailField {
FieldContext = 5000, //to avoid clashing with other detail field values from leaf classes
FieldDetailUri,
- FieldLinkedDetailUris
+ FieldLinkedDetailUris,
+ FieldMaximumUserVisible = 10000 // keys above this will not be reported to clients via values() etc accessors.
+ };
+
+ enum AccessConstraint {
+ NoConstraint = 0,
+ ReadOnly = 0x01,
+ Irremovable = 0x02
};
+ Q_DECLARE_FLAGS(AccessConstraints, AccessConstraint)
+
+protected:
+ QSharedDataPointer<QContactDetailPrivate> d;
+
+public:
+ QContactDetail();
+ explicit QContactDetail(DetailType _type);
+ QContactDetail(const QContactDetail &other);
+ ~QContactDetail();
+ QContactDetail& operator=(const QContactDetail& other);
bool operator==(const QContactDetail& other) const;
- bool operator!=(const QContactDetail& other) const {return !(other == *this);}
+ bool operator!=(const QContactDetail& other) const { return !(other == *this); }
DetailType type() const;
- bool isEmpty() const;
int key() const;
void resetKey();
+ AccessConstraints accessConstraints() const;
+
+ bool isEmpty() const;
bool setValue(int field, const QVariant& value);
bool removeValue(int field);
bool hasValue(int field) const;
+ void setValues(const QMap<int, QVariant> &newValues);
QMap<int, QVariant> values() const;
QVariant value(int field) const;
- template <typename T> T value(int field) const
- {
+ template <typename T> T value(int field) const {
return value(field).value<T>();
}
@@ -177,12 +180,12 @@ protected:
QContactDetail& assign(const QContactDetail &other, DetailType expectedType);
private:
- friend class QContact;
friend class QContactDetailPrivate;
+ friend class QContact;
+ friend class QContactManagerEngine;
#ifndef QT_NO_DATASTREAM
Q_CONTACTS_EXPORT friend QDataStream& operator>>(QDataStream& in, QContactDetail& detail);
#endif
- QSharedDataPointer<QContactDetailPrivate> d;
};
Q_CONTACTS_EXPORT uint qHash(const QContactDetail& key);
diff --git a/src/contacts/qcontactdetail_p.h b/src/contacts/qcontactdetail_p.h
index 57483e6cd..c9dd189b2 100644
--- a/src/contacts/qcontactdetail_p.h
+++ b/src/contacts/qcontactdetail_p.h
@@ -45,55 +45,448 @@
// We mean it.
//
-#include <QtCore/qmap.h>
-#include <QtCore/qshareddata.h>
-#include <QtCore/qvariant.h>
+#include <QMap>
+#include <QList>
+#include <QString>
+#include <QVariant>
+#include <QDateTime>
+#include <QAtomicInt>
+#include <QSharedData>
+#include <QStringList>
-#include <QtContacts/qcontactdetail.h>
+#include "qcontactdetail.h"
QT_BEGIN_NAMESPACE_CONTACTS
class QContactDetailPrivate : public QSharedData
{
public:
+ static QAtomicInt lastDetailKey;
+
+ // all details have these fields
+ QList<int> m_contexts;
+
+ // detail metadata
+ QContactDetail::DetailType m_type;
+ QContactDetail::AccessConstraints m_access;
+ int m_detailId;
+ int m_hasValueBitfield; // subclass types must set the hasValue bit for any field value which isn't stored in m_extraData.
+
+ // extra field data
+ QMap<int, QVariant> m_extraData;
+
QContactDetailPrivate()
- : QSharedData(),
- m_id(lastDetailKey.fetchAndAddOrdered(1)),
- m_access(QContactDetail::NoConstraint)
+ : m_type(QContactDetail::TypeUndefined)
+ , m_access(QContactDetail::NoConstraint)
+ , m_detailId(lastDetailKey.fetchAndAddOrdered(1))
+ , m_hasValueBitfield(0) {}
+ QContactDetailPrivate(QContactDetail::DetailType detailType)
+ : m_type(detailType)
+ , m_access(QContactDetail::NoConstraint)
+ , m_detailId(lastDetailKey.fetchAndAddOrdered(1))
+ , m_hasValueBitfield(0) {}
+ QContactDetailPrivate(const QContactDetailPrivate& other)
+ : QSharedData(other)
+ , m_contexts(other.m_contexts)
+ , m_type(other.m_type)
+ , m_access(other.m_access)
+ , m_detailId(other.m_detailId)
+ , m_hasValueBitfield(other.m_hasValueBitfield)
+ , m_extraData(other.m_extraData) {}
+ virtual ~QContactDetailPrivate() {}
+
+ virtual QContactDetailPrivate *clone() {
+ // NOTE: this one must be called for extension (non-built-in) types ONLY
+ // otherwise slicing will occur on detach, leading to crashes!
+ Q_ASSERT(this->m_type == QContactDetail::TypeUndefined || this->m_type > QContactDetail::TypeVersion); // TypeVersion is the builtin type with largest type value.
+ return new QContactDetailPrivate(*this);
+ }
+
+ virtual bool operator==(const QContactDetailPrivate& other) const { // doesn't check detailId
+ if (m_type != other.m_type
+ || m_hasValueBitfield != other.m_hasValueBitfield
+ || m_contexts != other.m_contexts
+ || m_access != other.m_access
+ || m_extraData.size() != other.m_extraData.size()) {
+ return false;
+ }
+ QMap<int, QVariant>::const_iterator it = m_extraData.constBegin(), end = m_extraData.constEnd();
+ for ( ; it != end; ++it) {
+ if (it.value().canConvert<QList<int> >()) {
+ // QList<int> values must be compared as QList<int> not as QVariant<QList<int> >...
+ if (other.m_extraData.value(it.key()).value< QList<int> >() != it.value().value< QList<int> >()) {
+ return false;
+ }
+ } else {
+ // Everything else can be compared directly by value.
+ if (it.value() != other.m_extraData.value(it.key())) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+ bool operator!=(const QContactDetailPrivate& other) const {return !(other == *this);}
+
+ static void setAccessConstraints(QContactDetail *d, QContactDetail::AccessConstraints constraint)
{
+ d->d->m_access = constraint;
}
- QContactDetailPrivate(const QContactDetailPrivate& other)
- : QSharedData(other),
- m_id(other.m_id),
- m_type(other.m_type),
- m_values(other.m_values),
- m_access(other.m_access)
+ static const QContactDetailPrivate* detailPrivate(const QContactDetail& detail)
{
+ return detail.d.constData();
+ }
+
+ // built-in fields hasValue bitfield bit
+ enum BuiltinFieldBitfieldBits {
+ FieldContextBit = 0,
+ FieldDetailUriBit,
+ FieldLinkedDetailUrisBit,
+ FieldProvenanceBit
+ };
+ // custom types can define more (for fields which are a complicated view of Field>FieldMaximumUserVisible data)
+ inline bool hasValueBitfieldBitSet(unsigned int whichBit) const {
+ unsigned int mask = 1 << whichBit;
+ return m_hasValueBitfield & mask;
+ }
+ inline void setHasValueBitfieldBit(bool _value, unsigned int whichBit) {
+ unsigned int mask = 1 << whichBit;
+ if (_value) {
+ m_hasValueBitfield |= mask; // set
+ } else {
+ m_hasValueBitfield &= ~mask; // clear
+ }
+ }
+
+ virtual bool setValue(int field, const QVariant &_value) {
+ switch (field) {
+ case QContactDetail::FieldContext: {
+ if (_value.userType() == QMetaType::Int || _value.userType() == QMetaType::UInt) {
+ m_contexts = QList<int>() << _value.toInt();
+ } else {
+ m_contexts = _value.value<QList<int> >();
+ }
+ setHasValueBitfieldBit(true, FieldContextBit);
+ return true;
+ }
+ default: {
+ // add the data as an extraData field
+ m_extraData.insert(field, _value);
+ // don't need to set hasValueBitfield bit for fields stored in extra data.
+ return true;
+ }
+ }
+ }
+
+ virtual bool removeValue(int field) {
+ switch (field) {
+ case QContactDetail::FieldContext: {
+ m_contexts = QList<int>();
+ setHasValueBitfieldBit(false, FieldContextBit);
+ return true;
+ }
+ default: {
+ return m_extraData.remove(field);
+ // don't need to clear hasValueBitfield bit for fields stored in extra data.
+ }
+ }
+ }
+
+ virtual bool hasValue(int field) const {
+ switch (field) {
+ case QContactDetail::FieldContext: return hasValueBitfieldBitSet(FieldContextBit);
+ default: return m_extraData.contains(field);
+ }
+ }
+
+ virtual bool isEmpty() const {
+ return m_hasValueBitfield == 0 && m_extraData.isEmpty();
+ }
+
+ virtual QMap<int, QVariant> values() const {
+ QMap<int, QVariant> retn;
+ if (hasValueBitfieldBitSet(FieldContextBit)) {
+ retn.insert(QContactDetail::FieldContext, QVariant::fromValue<QList<int> >(m_contexts));
+ }
+ QMap<int, QVariant>::const_iterator it = m_extraData.constBegin(), end = m_extraData.constEnd();
+ for ( ; it != end; ++it) {
+ if (it.key() <= QContactDetail::FieldMaximumUserVisible) {
+ retn.insert(it.key(), it.value());
+ }
+ }
+ return retn;
}
- ~QContactDetailPrivate()
+ virtual QVariant value(int field) const {
+ switch (field) {
+ case QContactDetail::FieldContext: return QVariant::fromValue<QList<int> >(m_contexts);
+ default: return m_extraData.value(field);
+ }
+ }
+
+ static QContactDetailPrivate *construct(QContactDetail::DetailType detailType);
+};
+
+class QContactDetailBuiltinPrivateBase : public QContactDetailPrivate
+{
+public:
+ enum MemberType {
+ Bool,
+ Double,
+ Int,
+ IntList,
+ String,
+ StringList,
+ Date,
+ DateTime,
+ Url,
+ ByteArray,
+ Variant,
+ };
+
+ struct Member {
+ MemberType type;
+ size_t offset;
+ };
+
+ enum { BaseFieldOffset = 4 };
+
+ QContactDetailBuiltinPrivateBase(QContactDetail::DetailType type)
+ : QContactDetailPrivate(type)
+ {
+ }
+ QContactDetailBuiltinPrivateBase(const QContactDetailBuiltinPrivateBase& other)
+ : QContactDetailPrivate(other)
{
}
- int m_id; // internal, unique id.
- QContactDetail::DetailType m_type;
- QMap<int, QVariant> m_values;
- QContactDetail::AccessConstraints m_access;
+ template<typename Subclass>
+ static const void* memberAddress(const Subclass *base, size_t offset)
+ {
+ return reinterpret_cast<const void*>(reinterpret_cast<const char *>(base) + offset);
+ }
+ template<typename Subclass>
+ static void* memberAddress(Subclass *base, size_t offset)
+ {
+ return reinterpret_cast<void*>(reinterpret_cast<char *>(base) + offset);
+ }
- static QAtomicInt lastDetailKey;
+ template<typename T, typename Subclass>
+ static const T* memberVariable(const Subclass *base, size_t offset)
+ {
+ return reinterpret_cast<const T*>(memberAddress(base, offset));
+ }
+ template<typename T, typename Subclass>
+ static T* memberVariable(Subclass *base, size_t offset)
+ {
+ return reinterpret_cast<T*>(memberAddress(base, offset));
+ }
- static void setAccessConstraints(QContactDetail *d, QContactDetail::AccessConstraints constraint)
+ template<typename Subclass>
+ void reinitialize(Subclass* us, const Member& member)
{
- d->d->m_access = constraint;
+ switch (member.type) {
+ case Bool: *memberVariable<bool>(us, member.offset) = false; return;
+ case Double: *memberVariable<double>(us, member.offset) = 0.0; return;
+ case Int: *memberVariable<int>(us, member.offset) = 0; return;
+ case IntList: reinitialize<QList<int> >(us, member); return;
+ case String: reinitialize<QString>(us, member); return;
+ case StringList: reinitialize<QStringList>(us, member); return;
+ case Date: reinitialize<QDate>(us, member); return;
+ case DateTime: reinitialize<QDateTime>(us, member); return;
+ case Url: reinitialize<QUrl>(us, member); return;
+ case ByteArray: reinitialize<QByteArray>(us, member); return;
+ case Variant: reinitialize<QVariant>(us, member); return;
+ default: qFatal("Unsupported field type");
+ }
}
- static const QContactDetailPrivate* detailPrivate(const QContactDetail& detail)
+ template<typename Subclass>
+ static void setValueFromVariant(Subclass* us, const QVariant& value, const Member& member)
{
- return detail.d.constData();
+ switch (member.type) {
+ case Bool: setValueFromVariant<bool>(us, value, member); return;
+ case Double: setValueFromVariant<double>(us, value, member); return;
+ case Int: setValueFromVariant<int>(us, value, member); return;
+ case IntList: setValueFromVariant<QList<int> >(us, value, member); return;
+ case String: setValueFromVariant<QString>(us, value, member); return;
+ case StringList: setValueFromVariant<QStringList>(us, value, member); return;
+ case Date: *memberVariable<QDate>(us, member.offset) = value.userType() == QMetaType::QDateTime ? value.value<QDateTime>().date() : value.value<QDate>(); return;
+ case DateTime: setValueFromVariant<QDateTime>(us, value, member); return;
+ case Url: setValueFromVariant<QUrl>(us, value, member); return;
+ case ByteArray: *memberVariable<QByteArray>(us, member.offset) = value.userType() == QMetaType::QString ? value.value<QString>().toUtf8() : value.value<QByteArray>(); return;
+ case Variant: *memberVariable<QVariant>(us, member.offset) = value; return;
+ default: qFatal("Unsupported field type");
+ }
+ }
+
+ template<typename Subclass>
+ static bool equal(const Subclass* us, const Subclass* them, const Member& member)
+ {
+ switch (member.type) {
+ case Bool: return equal<bool>(us, them, member);
+ case Double: return equal<double>(us, them, member);
+ case Int: return equal<int>(us, them, member);
+ case IntList: return equal<QList<int> >(us, them, member);
+ case String: return equal<QString>(us, them, member);
+ case StringList: return equal<QStringList>(us, them, member);
+ case Date: return equal<QDate>(us, them, member);
+ case DateTime: return equal<QDateTime>(us, them, member);
+ case Url: return equal<QUrl>(us, them, member);
+ case ByteArray: return equal<QByteArray>(us, them, member);
+ case Variant: return equal<QVariant>(us, them, member);
+ default: qFatal("Unsupported field type");
+ }
+ }
+
+ template<typename Subclass>
+ static QVariant toVariant(const Subclass* us, const Member& member)
+ {
+ switch (member.type) {
+ case Bool: return QVariant(*memberVariable<bool>(us, member.offset));
+ case Double: return QVariant(*memberVariable<double>(us, member.offset));
+ case Int: return QVariant(*memberVariable<int>(us, member.offset));
+ case IntList: return QVariant::fromValue(*memberVariable<QList<int> >(us, member.offset));
+ case String: return QVariant(*memberVariable<QString>(us, member.offset));
+ case StringList: return QVariant::fromValue(*memberVariable<QStringList>(us, member.offset));
+ case Date: return QVariant(*memberVariable<QDate>(us, member.offset));
+ case DateTime: { // if the value was likely set as a QDate, then return it as a QDate.
+ const QDateTime &dt(*memberVariable<QDateTime>(us, member.offset));
+ return (dt.timeSpec() == Qt::LocalTime && dt.time() == QTime(0,0,0,0))
+ ? QVariant(dt.date())
+ : QVariant(dt);
+ }
+ case Url: return QVariant(*memberVariable<QUrl>(us, member.offset));
+ case ByteArray: return QVariant(*memberVariable<QByteArray>(us, member.offset));
+ case Variant: return *memberVariable<QVariant>(us, member.offset);
+ default: qFatal("Unsupported field type");
+ }
+ }
+
+private:
+ template<typename T, typename Subclass>
+ void reinitialize(Subclass* us, const Member& member)
+ {
+ *memberVariable<T>(us, member.offset) = T();
+ }
+
+ template<typename T, typename Subclass>
+ static void setValueFromVariant(Subclass* us, const QVariant& value, const Member& member)
+ {
+ *memberVariable<T>(us, member.offset) = value.value<T>();
+ }
+
+ template<typename T, typename Subclass>
+ static bool equal(const Subclass* us, const Subclass* them, const Member& member)
+ {
+ return *memberVariable<T>(us, member.offset) == *memberVariable<int>(them, member.offset);
+ }
+};
+
+template <typename Subclass>
+class QContactDetailBuiltinPrivate : public QContactDetailBuiltinPrivateBase
+{
+public:
+ static const Member s_members[];
+
+ QContactDetailBuiltinPrivate(QContactDetail::DetailType type)
+ : QContactDetailBuiltinPrivateBase(type)
+ {
+ }
+
+ const Subclass *subclass() const
+ {
+ return static_cast<const Subclass *>(this);
+ }
+ Subclass *subclass()
+ {
+ return static_cast<Subclass *>(this);
+ }
+
+ QContactDetailPrivate *clone() {
+ return new Subclass(*subclass());
+ }
+
+ bool operator==(const QContactDetailBuiltinPrivate& other) const
+ {
+ Subclass *us(subclass());
+ const Subclass *them(other.subclass());
+ for (int i = 0; i < Subclass::FieldCount; ++i) {
+ if (!equal(us, them, s_members[i])) {
+ return false;
+ }
+ }
+ return QContactDetailPrivate::operator==(other);
+ }
+
+ template<typename T>
+ const T& memberValue(int field) const
+ {
+ return *memberVariable<T>(subclass(), s_members[field].offset);
+ }
+
+ template<typename T>
+ void setMemberValue(int field, const T& value)
+ {
+ *memberVariable<T>(subclass(), s_members[field].offset) = value;
+ setHasValueBitfieldBit(true, field + BaseFieldOffset);
+ }
+
+ bool setValue(int field, const QVariant &value)
+ {
+ if (field < Subclass::FieldCount) {
+ setValueFromVariant(subclass(), value, s_members[field]);
+ setHasValueBitfieldBit(true, field + BaseFieldOffset);
+ return true;
+ }
+ return QContactDetailPrivate::setValue(field, value);
+ }
+
+ bool removeValue(int field)
+ {
+ if (field < Subclass::FieldCount) {
+ reinitialize(subclass(), s_members[field]);
+ setHasValueBitfieldBit(false, field + BaseFieldOffset);
+ return true;
+ }
+ return QContactDetailPrivate::removeValue(field);
+ }
+
+ bool hasValue(int field) const
+ {
+ if (field < Subclass::FieldCount) {
+ return hasValueBitfieldBitSet(field + BaseFieldOffset);
+ }
+ return QContactDetailPrivate::hasValue(field);
+ }
+
+ QMap<int, QVariant> values() const
+ {
+ QMap<int, QVariant> retn = QContactDetailPrivate::values();
+ for (int i = 0; i < Subclass::FieldCount; ++i) {
+ if (hasValueBitfieldBitSet(i + BaseFieldOffset)) {
+ retn.insert(i, value(i));
+ }
+ }
+ return retn;
+ }
+
+ QVariant value(int field) const
+ {
+ if (field < Subclass::FieldCount) {
+ return toVariant(subclass(), s_members[field]);
+ }
+ return QContactDetailPrivate::value(field);
}
};
QT_END_NAMESPACE_CONTACTS
+// allow shared data / detach for specific detail types
+template <> inline QTCONTACTS_PREPEND_NAMESPACE(QContactDetailPrivate) *QSharedDataPointer<QTCONTACTS_PREPEND_NAMESPACE(QContactDetailPrivate)>::clone()
+{
+ return d->clone();
+}
+
#endif // QCONTACTDETAIL_P_H
diff --git a/tests/auto/contacts/qcontact/tst_qcontact.cpp b/tests/auto/contacts/qcontact/tst_qcontact.cpp
index 87354dc23..ce7f1db1d 100644
--- a/tests/auto/contacts/qcontact/tst_qcontact.cpp
+++ b/tests/auto/contacts/qcontact/tst_qcontact.cpp
@@ -609,7 +609,7 @@ void tst_QContact::hash()
QContact contact1;
contact1.setId(id);
QContactDetail detail1(QContactDetail::TypeExtendedDetail);
- detail1.setValue(QContactDetail::FieldContext, "value");
+ detail1.setValue(QContactExtendedDetail::FieldData, "value");
contact1.saveDetail(&detail1);
QContact contact2;
contact2.setId(id);
@@ -617,7 +617,7 @@ void tst_QContact::hash()
QContact contact3;
contact3.setId(id);
QContactDetail detail3(QContactDetail::TypeExtendedDetail);
- detail3.setValue(QContactDetail::FieldContext, "another value");
+ detail3.setValue(QContactExtendedDetail::FieldData, "another value");
contact3.saveDetail(&detail3);
QContact contact4; // no details
contact4.setId(id);
diff --git a/tests/auto/contacts/qcontactdetails/tst_qcontactdetails.cpp b/tests/auto/contacts/qcontactdetails/tst_qcontactdetails.cpp
index 23740abf8..bae8bdbb6 100644
--- a/tests/auto/contacts/qcontactdetails/tst_qcontactdetails.cpp
+++ b/tests/auto/contacts/qcontactdetails/tst_qcontactdetails.cpp
@@ -137,7 +137,7 @@ void tst_QContactDetails::address()
QCOMPARE(c.details(QContactAddress::Type).count(), 2);
// test property update
- a1.setValue(QContactAddress::FieldContext, "label1");
+ a1.setValue(QContactAddress::FieldContext, QContactDetail::ContextWork);
a1.setStreet("12345");
QVERIFY(c.saveDetail(&a1));
@@ -219,10 +219,10 @@ void tst_QContactDetails::anniversary()
QCOMPARE(QContactAnniversary(c.details(QContactAnniversary::Type).value(0)).event(), a1.event());
// test property update
- a1.setValue(QContactAnniversary::FieldContext, "label1");
+ a1.setValue(QContactAnniversary::FieldContext, QContactDetail::ContextWork);
a1.setCalendarId("12345");
QVERIFY(c.saveDetail(&a1));
- QCOMPARE(c.details(QContactAnniversary::Type).value(0).value(QContactAnniversary::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactAnniversary::Type).value(0).value(QContactAnniversary::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactAnniversary::Type).value(0).value(QContactAnniversary::FieldCalendarId).toString(), QString("12345"));
// test property remove
@@ -258,10 +258,10 @@ void tst_QContactDetails::avatar()
QCOMPARE(QContactAvatar(c.details(QContactAvatar::Type).value(0)).imageUrl(), a1.imageUrl());
// test property update
- a1.setValue(QContactAvatar::FieldContext, "label1");
+ a1.setValue(QContactAvatar::FieldContext, QContactDetail::ContextWork);
a1.setImageUrl(QUrl("12345"));
QVERIFY(c.saveDetail(&a1));
- QCOMPARE(c.details(QContactAvatar::Type).value(0).value(QContactAvatar::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactAvatar::Type).value(0).value(QContactAvatar::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactAvatar::Type).value(0).value<QUrl>(QContactAvatar::FieldImageUrl), QUrl("12345"));
// test property remove
@@ -278,7 +278,7 @@ void tst_QContactDetails::avatar()
void tst_QContactDetails::birthday()
{
QContact c;
- QContactBirthday b1, b2;
+ QContactBirthday b1, b2, b3;
QDateTime currDateTime = QDateTime::currentDateTime();
QDate currDate = currDateTime.date();
QDateTime snippedDateTime = QDateTime(currDate);
@@ -300,17 +300,25 @@ void tst_QContactDetails::birthday()
QCOMPARE(b1.calendarId(), QString("1234"));
QCOMPARE(b1.value(QContactBirthday::FieldCalendarId).toString(), QString("1234"));
+ b3.setDate(currDate);
+ QCOMPARE(QContactDetail(b3).value(QContactBirthday::FieldBirthday), QVariant(currDate));
+ b3.setDateTime(currDateTime);
+ QCOMPARE(QContactDetail(b3).value(QContactBirthday::FieldBirthday), QVariant(currDateTime));
+ b3.setDateTime(QDateTime(currDate, QTime(0,0,0,0)));
+ QCOMPARE(QContactDetail(b3).value(QContactBirthday::FieldBirthday).type(), QVariant::Date); // unfortunate but unavoidable with current impl.
+ QCOMPARE(QContactDetail(b3).value<QDateTime>(QContactBirthday::FieldBirthday), b3.dateTime());
+
// test property add
QVERIFY(c.saveDetail(&b1));
QCOMPARE(c.details(QContactBirthday::Type).count(), 1);
QCOMPARE(QContactBirthday(c.details(QContactBirthday::Type).value(0)).date(), b1.date());
// test property update
- b1.setValue(QContactBirthday::FieldContext, "label1");
+ b1.setValue(QContactBirthday::FieldContext, QContactDetail::ContextWork);
b1.setDate(currDate.addDays(3));
b1.setCalendarId("12345");
QVERIFY(c.saveDetail(&b1));
- QCOMPARE(c.details(QContactBirthday::Type).value(0).value(QContactBirthday::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactBirthday::Type).value(0).value(QContactBirthday::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactBirthday::Type).value(0).value<QDate>(QContactBirthday::FieldBirthday), currDate.addDays(3));
QCOMPARE(c.details(QContactBirthday::Type).value(0).value(QContactBirthday::FieldCalendarId).toString(), QString("12345"));
@@ -341,10 +349,10 @@ void tst_QContactDetails::displayLabel()
QCOMPARE(QContactDisplayLabel(c.details(QContactDisplayLabel::Type).value(0)).label(), d1.label());
// test property update
- d1.setValue(QContactDisplayLabel::FieldContext, "label1");
+ d1.setValue(QContactDisplayLabel::FieldContext, QContactDetail::ContextWork);
d1.setLabel("12345");
QVERIFY(c.saveDetail(&d1));
- QCOMPARE(c.details(QContactDisplayLabel::Type).value(0).value(QContactDisplayLabel::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactDisplayLabel::Type).value(0).value(QContactDisplayLabel::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactDisplayLabel::Type).value(0).value(QContactDisplayLabel::FieldLabel).toString(), QString("12345"));
// test property remove
@@ -374,10 +382,10 @@ void tst_QContactDetails::emailAddress()
QCOMPARE(QContactEmailAddress(c.details(QContactEmailAddress::Type).value(0)).emailAddress(), e1.emailAddress());
// test property update
- e1.setValue(QContactEmailAddress::FieldContext, "label1");
+ e1.setValue(QContactEmailAddress::FieldContext, QContactDetail::ContextWork);
e1.setEmailAddress("12345");
QVERIFY(c.saveDetail(&e1));
- QCOMPARE(c.details(QContactEmailAddress::Type).value(0).value(QContactEmailAddress::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactEmailAddress::Type).value(0).value(QContactEmailAddress::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactEmailAddress::Type).value(0).value(QContactEmailAddress::FieldEmailAddress).toString(), QString("12345"));
// test property remove
@@ -410,11 +418,11 @@ void tst_QContactDetails::extendedDetail()
QCOMPARE(QContactExtendedDetail(c.details(QContactExtendedDetail::Type).value(0)).name(), extD1.name());
// test property update
- extD1.setValue(QContactExtendedDetail::FieldContext, "label1");
+ extD1.setValue(QContactExtendedDetail::FieldContext, QContactDetail::ContextWork);
extD1.setName("newDetail1");
extD1.setData(v1);
QVERIFY(c.saveDetail(&extD1));
- QCOMPARE(c.details(QContactExtendedDetail::Type).value(0).value(QContactExtendedDetail::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactExtendedDetail::Type).value(0).value(QContactExtendedDetail::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactExtendedDetail::Type).value(0).value(QContactExtendedDetail::FieldData).toInt(), v1.toInt());
QCOMPARE(c.details(QContactExtendedDetail::Type).value(0).value(QContactExtendedDetail::FieldName).toString(), QString("newDetail1"));
@@ -447,11 +455,11 @@ void tst_QContactDetails::family()
QCOMPARE(QContactFamily(c.details(QContactFamily::Type).value(0)).spouse(), f1.spouse());
// test property update
- f1.setValue(QContactFamily::FieldContext, "label1");
+ f1.setValue(QContactFamily::FieldContext, QContactDetail::ContextWork);
f1.setSpouse("12345");
f1.setChildren(QStringList("54321"));
QVERIFY(c.saveDetail(&f1));
- QCOMPARE(c.details(QContactFamily::Type).value(0).value(QContactFamily::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactFamily::Type).value(0).value(QContactFamily::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactFamily::Type).value(0).value(QContactFamily::FieldSpouse).toString(), QString("12345"));
QCOMPARE(c.details(QContactFamily::Type).value(0).value<QStringList>(QContactFamily::FieldChildren), QStringList("54321"));
@@ -488,11 +496,11 @@ void tst_QContactDetails::favorite()
QCOMPARE(QContactFavorite(c.details(QContactFavorite::Type).value(0)).isFavorite(), f1.isFavorite());
// test property update
- f1.setValue(QContactFavorite::FieldContext, "label1");
+ f1.setValue(QContactFavorite::FieldContext, QContactDetail::ContextWork);
f1.setFavorite(false);
f1.setIndex(5);
QVERIFY(c.saveDetail(&f1));
- QCOMPARE(c.details(QContactFavorite::Type).value(0).value(QContactFavorite::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactFavorite::Type).value(0).value(QContactFavorite::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactFavorite::Type).value(0).value<bool>(QContactFavorite::FieldFavorite), false);
QCOMPARE(c.details(QContactFavorite::Type).value(0).value<int>(QContactFavorite::FieldIndex), 5);
QCOMPARE(c.details<QContactFavorite>().value(0).index(), 5);
@@ -524,10 +532,10 @@ void tst_QContactDetails::gender()
QCOMPARE(QContactGender(c.details(QContactGender::Type).value(0)).gender(), g1.gender());
// test property update
- g1.setValue(QContactGender::FieldContext, "label1");
+ g1.setValue(QContactGender::FieldContext, QContactDetail::ContextWork);
g1.setGender(QContactGender::GenderMale);
QVERIFY(c.saveDetail(&g1));
- QCOMPARE(c.details(QContactGender::Type).value(0).value(QContactGender::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactGender::Type).value(0).value(QContactGender::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactGender::Type).value(0).value(QContactGender::FieldGender).toInt(), (int)QContactGender::GenderMale);
// test property remove
@@ -629,10 +637,10 @@ void tst_QContactDetails::globalPresence()
QCOMPARE(QContactGlobalPresence(c.details(QContactGlobalPresence::Type).value(0)).presenceStateText(), p1.presenceStateText());
// test property update
- p1.setValue(QContactGlobalPresence::FieldContext, "label1");
+ p1.setValue(QContactGlobalPresence::FieldContext, QContactDetail::ContextWork);
p1.setPresenceStateText("12345");
QVERIFY(c.saveDetail(&p1));
- QCOMPARE(c.details(QContactGlobalPresence::Type).value(0).value(QContactGlobalPresence::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactGlobalPresence::Type).value(0).value(QContactGlobalPresence::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactGlobalPresence::Type).value(0).value(QContactGlobalPresence::FieldPresenceStateText).toString(), QString("12345"));
p2.setTimestamp(ts);
@@ -677,10 +685,10 @@ void tst_QContactDetails::guid()
QCOMPARE(QContactGuid(c.details(QContactGuid::Type).value(0)).guid(), g1.guid());
// test property update
- g1.setValue(QContactGuid::FieldContext, "label1");
+ g1.setValue(QContactGuid::FieldContext, QContactDetail::ContextWork);
g1.setGuid("12345");
QVERIFY(c.saveDetail(&g1));
- QCOMPARE(c.details(QContactGuid::Type).value(0).value(QContactGuid::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactGuid::Type).value(0).value(QContactGuid::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactGuid::Type).value(0).value(QContactGuid::FieldGuid).toString(), QString("12345"));
// test property remove
@@ -710,10 +718,10 @@ void tst_QContactDetails::hobby()
QCOMPARE(QContactHobby(c.details(QContactHobby::Type).value(0)).hobby(), h1.hobby());
// test property update
- h1.setValue(QContactHobby::FieldContext, "label1");
+ h1.setValue(QContactHobby::FieldContext, QContactDetail::ContextWork);
h1.setHobby("12345");
QVERIFY(c.saveDetail(&h1));
- QCOMPARE(c.details(QContactHobby::Type).value(0).value(QContactHobby::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactHobby::Type).value(0).value(QContactHobby::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactHobby::Type).value(0).value(QContactHobby::FieldHobby).toString(), QString("12345"));
// test property remove
@@ -764,7 +772,7 @@ void tst_QContactDetails::name()
QCOMPARE(c.details(QContactName::Type).count(), 2);
// test property update
- n1.setValue(QContactName::FieldContext, "label1");
+ n1.setValue(QContactName::FieldContext, QContactDetail::ContextWork);
QVERIFY(c.saveDetail(&n1));
// test property remove
@@ -795,10 +803,10 @@ void tst_QContactDetails::nickname()
QCOMPARE(QContactNickname(c.details(QContactNickname::Type).value(0)).nickname(), n1.nickname());
// test property update
- n1.setValue(QContactNickname::FieldContext, "label1");
+ n1.setValue(QContactNickname::FieldContext, QContactDetail::ContextWork);
n1.setNickname("12345");
QVERIFY(c.saveDetail(&n1));
- QCOMPARE(c.details(QContactNickname::Type).value(0).value(QContactNickname::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactNickname::Type).value(0).value(QContactNickname::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactNickname::Type).value(0).value(QContactNickname::FieldNickname).toString(), QString("12345"));
// test property remove
@@ -828,10 +836,10 @@ void tst_QContactDetails::note()
QCOMPARE(QContactNote(c.details(QContactNote::Type).value(0)).note(), n1.note());
// test property update
- n1.setValue(QContactNote::FieldContext, "label1");
+ n1.setValue(QContactNote::FieldContext, QContactDetail::ContextWork);
n1.setNote("orange gypsum");
QVERIFY(c.saveDetail(&n1));
- QCOMPARE(c.details(QContactNote::Type).value(0).value(QContactNote::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactNote::Type).value(0).value(QContactNote::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactNote::Type).value(0).value(QContactNote::FieldNote).toString(), QString("orange gypsum"));
// test property remove
@@ -878,12 +886,12 @@ void tst_QContactDetails::onlineAccount()
// test property update
QStringList caps;
caps << "cap1" << "cap3" << "cap4";
- o1.setValue(QContactOnlineAccount::FieldContext, "label1");
+ o1.setValue(QContactOnlineAccount::FieldContext, QContactDetail::ContextWork);
o1.setAccountUri("test2@nokia.com");
o1.setServiceProvider("some provider");
o1.setCapabilities(caps);
QVERIFY(c.saveDetail(&o1));
- QCOMPARE(c.details(QContactOnlineAccount::Type).value(0).value(QContactOnlineAccount::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactOnlineAccount::Type).value(0).value(QContactOnlineAccount::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactOnlineAccount::Type).value(0).value(QContactOnlineAccount::FieldAccountUri).toString(), QString("test2@nokia.com"));
QCOMPARE(c.details(QContactOnlineAccount::Type).value(0).value<QStringList>(QContactOnlineAccount::FieldCapabilities), caps);
QCOMPARE(c.details<QContactOnlineAccount>().value(0).capabilities(), caps);
@@ -990,10 +998,10 @@ void tst_QContactDetails::phoneNumber()
QCOMPARE(QContactPhoneNumber(c.details(QContactPhoneNumber::Type).value(0)).number(), p1.number());
// test property update
- p1.setValue(QContactPhoneNumber::FieldContext, "label1");
+ p1.setValue(QContactPhoneNumber::FieldContext, QContactDetail::ContextWork);
p1.setNumber("12345");
QVERIFY(c.saveDetail(&p1));
- QCOMPARE(c.details(QContactPhoneNumber::Type).value(0).value(QContactPhoneNumber::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactPhoneNumber::Type).value(0).value(QContactPhoneNumber::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactPhoneNumber::Type).value(0).value(QContactPhoneNumber::FieldNumber).toString(), QString("12345"));
p1.setSubTypes(QList<int>() << QContactPhoneNumber::SubTypeDtmfMenu);
@@ -1047,10 +1055,10 @@ void tst_QContactDetails::presence()
QCOMPARE(QContactPresence(c.details(QContactPresence::Type).value(0)).presenceStateText(), p1.presenceStateText());
// test property update
- p1.setValue(QContactPresence::FieldContext, "label1");
+ p1.setValue(QContactPresence::FieldContext, QContactDetail::ContextWork);
p1.setPresenceStateText("12345");
QVERIFY(c.saveDetail(&p1));
- QCOMPARE(c.details(QContactPresence::Type).value(0).value(QContactPresence::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactPresence::Type).value(0).value(QContactPresence::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactPresence::Type).value(0).value(QContactPresence::FieldPresenceStateText).toString(), QString("12345"));
p2.setTimestamp(ts);
@@ -1095,10 +1103,10 @@ void tst_QContactDetails::ringtone()
QCOMPARE(QContactRingtone(c.details(QContactRingtone::Type).value(0)).audioRingtoneUrl(), r1.audioRingtoneUrl());
// test property update
- r1.setValue(QContactRingtone::FieldContext, "label1");
+ r1.setValue(QContactRingtone::FieldContext, QContactDetail::ContextWork);
r1.setAudioRingtoneUrl(QUrl("audioUrl2"));
QVERIFY(c.saveDetail(&r1));
- QCOMPARE(c.details(QContactRingtone::Type).value(0).value(QContactRingtone::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactRingtone::Type).value(0).value(QContactRingtone::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactRingtone::Type).value(0).value<QUrl>(QContactRingtone::FieldAudioRingtoneUrl), QUrl("audioUrl2"));
// test property remove
@@ -1128,10 +1136,10 @@ void tst_QContactDetails::syncTarget()
QCOMPARE(QContactSyncTarget(c.details(QContactSyncTarget::Type).value(0)).syncTarget(), s1.syncTarget());
// test property update
- s1.setValue(QContactSyncTarget::FieldContext, "label1");
+ s1.setValue(QContactSyncTarget::FieldContext, QContactDetail::ContextWork);
s1.setSyncTarget("12345");
QVERIFY(c.saveDetail(&s1));
- QCOMPARE(c.details(QContactSyncTarget::Type).value(0).value(QContactSyncTarget::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactSyncTarget::Type).value(0).value(QContactSyncTarget::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactSyncTarget::Type).value(0).value(QContactSyncTarget::FieldSyncTarget).toString(), QString("12345"));
// test property remove
@@ -1163,10 +1171,10 @@ void tst_QContactDetails::tag()
QCOMPARE(c.details(QContactTag::Type).count(), 2);
// test property update
- t1.setValue(QContactTag::FieldContext, "label1");
+ t1.setValue(QContactTag::FieldContext, QContactDetail::ContextWork);
t1.setTag("green");
QVERIFY(c.saveDetail(&t1));
- QCOMPARE(c.details(QContactTag::Type).value(0).value(QContactTag::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactTag::Type).value(0).value(QContactTag::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactTag::Type).value(0).value(QContactTag::FieldTag).toString(), QString("green"));
// test property remove
@@ -1196,10 +1204,10 @@ void tst_QContactDetails::timestamp()
QCOMPARE(QContactTimestamp(c.details(QContactTimestamp::Type).value(0)).created(), t1.created());
// test property update
- t1.setValue(QContactTimestamp::FieldContext, "label1");
+ t1.setValue(QContactTimestamp::FieldContext, QContactDetail::ContextWork);
t1.setLastModified(modified);
QVERIFY(c.saveDetail(&t1));
- QCOMPARE(c.details(QContactTimestamp::Type).value(0).value(QContactTimestamp::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactTimestamp::Type).value(0).value(QContactTimestamp::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactTimestamp::Type).value(0).value(QContactTimestamp::FieldCreationTimestamp).toDateTime(), created);
QCOMPARE(c.details(QContactTimestamp::Type).value(0).value(QContactTimestamp::FieldModificationTimestamp).toDateTime(), modified);
@@ -1267,10 +1275,10 @@ void tst_QContactDetails::url()
QCOMPARE(QContactUrl(c.details(QContactUrl::Type).value(0)).url(), u1.url());
// test property update
- u1.setValue(QContactUrl::FieldContext, "label1");
+ u1.setValue(QContactUrl::FieldContext, QContactDetail::ContextWork);
u1.setUrl("12345");
QVERIFY(c.saveDetail(&u1));
- QCOMPARE(c.details(QContactUrl::Type).value(0).value(QContactUrl::FieldContext).toString(), QString("label1"));
+ QCOMPARE(c.details(QContactUrl::Type).value(0).value(QContactUrl::FieldContext).value<QList<int> >(), QList<int>() << QContactDetail::ContextWork);
QCOMPARE(c.details(QContactUrl::Type).value(0).value(QContactUrl::FieldUrl).toString(), QString("12345"));
// now as above, but with the QUrl setter.