summaryrefslogtreecommitdiffstats
path: root/src/contacts/filters/qcontactdetailfilter_p.h
diff options
context:
space:
mode:
authorCristiano di Flora <cristiano.di-flora@nokia.com>2012-02-16 12:16:30 +0200
committerQt by Nokia <qt-info@nokia.com>2012-02-24 14:58:31 +0100
commit40e822354ac75cb60f782a16f4e9712909475f04 (patch)
tree0ae9561f4e2d64a029a6e8fbea77a2360c720295 /src/contacts/filters/qcontactdetailfilter_p.h
parent3e812b769ea4e5f20381e470017934a899b956c2 (diff)
Use enumerations for detail types and detail fields.
This patch changes the internal representation of detail types and field names within details from a string-based representation to enum constants. Detail definition names are then replaced by the concept of "Detail Type". Enum values are also aligned across C++ Vs QML APIs Authors: - Tommi Anttila <tommi.4.anttila@nokia.com> - Claudio Brunelli <claudio.brunelli@nokia.com> - Cristiano di Flora <cristiano.di-flora@nokia.com> Change-Id: I8b86022d08f9c3baf84b658f07e6600efdc73b8b Reviewed-by: Cristiano di Flora <cristiano.di-flora@nokia.com> Reviewed-by: Claudio Brunelli <claudio.brunelli@nokia.com>
Diffstat (limited to 'src/contacts/filters/qcontactdetailfilter_p.h')
-rw-r--r--src/contacts/filters/qcontactdetailfilter_p.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/contacts/filters/qcontactdetailfilter_p.h b/src/contacts/filters/qcontactdetailfilter_p.h
index 537842376..3e49d9fc0 100644
--- a/src/contacts/filters/qcontactdetailfilter_p.h
+++ b/src/contacts/filters/qcontactdetailfilter_p.h
@@ -55,6 +55,7 @@
#include "qcontactfilter_p.h"
#include "qcontactfilter.h"
+#include "qcontactdetail.h"
#include <QString>
#include <QVariant>
@@ -65,14 +66,16 @@ class QContactDetailFilterPrivate : public QContactFilterPrivate
{
public:
QContactDetailFilterPrivate()
- : QContactFilterPrivate(),
- m_flags(0)
+ : QContactFilterPrivate()
+ , m_type(QContactDetail::TypeUndefined)
+ , m_fieldId(-1)
+ , m_flags(0)
{
}
QContactDetailFilterPrivate(const QContactDetailFilterPrivate& other)
: QContactFilterPrivate(other),
- m_defId(other.m_defId),
+ m_type(other.m_type),
m_fieldId(other.m_fieldId),
m_exactValue(other.m_exactValue),
m_flags(other.m_flags)
@@ -82,7 +85,7 @@ public:
bool compare(const QContactFilterPrivate* other) const
{
const QContactDetailFilterPrivate *od = static_cast<const QContactDetailFilterPrivate*>(other);
- if (m_defId != od->m_defId)
+ if (m_type != od->m_type)
return false;
if (m_fieldId != od->m_fieldId)
return false;
@@ -96,7 +99,7 @@ public:
QDataStream& outputToStream(QDataStream& stream, quint8 formatVersion) const
{
if (formatVersion == 1) {
- stream << m_defId << m_fieldId << m_exactValue << static_cast<quint32>(m_flags);
+ stream << static_cast<quint32>(m_type) << m_fieldId << m_exactValue << static_cast<quint32>(m_flags);
}
return stream;
}
@@ -105,8 +108,10 @@ public:
{
if (formatVersion == 1) {
quint32 flags;
- stream >> m_defId >> m_fieldId >> m_exactValue >> flags;
+ quint32 type;
+ stream >> type >> m_fieldId >> m_exactValue >> flags;
m_flags = QContactFilter::MatchFlags(flags);
+ m_type = QContactDetail::DetailType(type);
}
return stream;
}
@@ -114,7 +119,7 @@ public:
QDebug& debugStreamOut(QDebug& dbg) const
{
dbg.nospace() << "QContactDetailFilter(";
- dbg.nospace() << "detailDefinitionName=" << m_defId << ","
+ dbg.nospace() << "detailType=" << static_cast<quint32>(m_type) << ","
<< "detailFieldName=" << m_fieldId << ","
<< "value=" << m_exactValue << ","
<< "matchFlags=" << static_cast<quint32>(m_flags);
@@ -124,8 +129,8 @@ public:
#endif
Q_IMPLEMENT_CONTACTFILTER_VIRTUALCTORS(QContactDetailFilter, QContactFilter::ContactDetailFilter)
- QString m_defId;
- QString m_fieldId;
+ QContactDetail::DetailType m_type;
+ int m_fieldId;
QVariant m_exactValue;
QContactFilter::MatchFlags m_flags;
};