summaryrefslogtreecommitdiffstats
path: root/src/imports/contacts/details/qdeclarativecontactextendeddetail_p.h
diff options
context:
space:
mode:
authorCristiano di Flora <cristiano.di-flora@nokia.com>2011-10-31 17:02:18 +0200
committerQt by Nokia <qt-info@nokia.com>2011-11-25 20:10:42 +0100
commitade72a2b68618623bc76f0bb0dc2c6c9f48783dc (patch)
treeb3f380d8438c1fe72aa1340bc87d70482e6d4caa /src/imports/contacts/details/qdeclarativecontactextendeddetail_p.h
parent43010ddbb4021dd9fbb83f9c4941bc843490ec64 (diff)
Adding new ExtendedDetail detail.
- consider any unknown detail as extended detail in json2qcontact conversion - JsonDb internal (reserved) keys are skipped properly (i.e., keys starting with "_") - schema handling / detail definition removed - remove documentation of mutable definition mechanism - remove documentation of schema handling mechanisms - remove obsolete code from code snippets - remove qcontactdetaildefinition auto tests - remove detailDefinition tests from several auto tests - add cpp autotests and qml tests - Bool, int, uint, qlonglong, qulonglong, double and QChar supported in extended details - string conversion for date in UTC format for extended details - support for embedded variantlists and maps in extended details Change-Id: I0d9d9c8b3f31376934b64217db3c4be4c9284160 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Cristiano di Flora <cristiano.di-flora@nokia.com>
Diffstat (limited to 'src/imports/contacts/details/qdeclarativecontactextendeddetail_p.h')
-rw-r--r--src/imports/contacts/details/qdeclarativecontactextendeddetail_p.h122
1 files changed, 122 insertions, 0 deletions
diff --git a/src/imports/contacts/details/qdeclarativecontactextendeddetail_p.h b/src/imports/contacts/details/qdeclarativecontactextendeddetail_p.h
new file mode 100644
index 000000000..dc6e3ad9c
--- /dev/null
+++ b/src/imports/contacts/details/qdeclarativecontactextendeddetail_p.h
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QDECLARATIVECONTACTEXTENDEDDETAIL_P_H
+#define QDECLARATIVECONTACTEXTENDEDDETAIL_P_H
+
+#include "qdeclarativecontactdetail_p.h"
+#include "qcontactextendeddetail.h"
+
+QTCONTACTS_BEGIN_NAMESPACE
+
+class QDeclarativeContactExtendedDetail : public QDeclarativeContactDetail
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY valueChanged)
+ Q_PROPERTY(QVariant data READ data WRITE setData NOTIFY valueChanged)
+ Q_ENUMS(FieldType)
+public:
+ enum FieldType {
+ Name = 0,
+ Data
+ };
+
+ QDeclarativeContactExtendedDetail (QObject *parent = 0)
+ :QDeclarativeContactDetail(parent)
+ {
+ setDetail(QContactExtendedDetail());
+ connect(this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
+ }
+
+ ContactDetailType detailType() const
+ {
+ return QDeclarativeContactDetail::ExtendedDetail;
+ }
+
+ void setName(const QString &newDetailName)
+ {
+ if (newDetailName != name() && !readOnly()) {
+ detail().setValue(QContactExtendedDetail::FieldName, newDetailName);
+ emit valueChanged();
+ }
+ }
+
+ QString name() const
+ {
+ return detail().value(QContactExtendedDetail::FieldName);
+ }
+
+ void setData(const QVariant &newData)
+ {
+ if (newData != data() && !readOnly()) {
+ detail().setValue(QContactExtendedDetail::FieldData, newData);
+ emit valueChanged();
+ }
+ }
+
+ QVariant data() const
+ {
+ return detail().variantValue(QContactExtendedDetail::FieldData);
+ }
+
+ static QString fieldNameFromFieldType(int type)
+ {
+ switch (type) {
+ case Name:
+ return QContactExtendedDetail::FieldName;
+ case Data:
+ return QContactExtendedDetail::FieldData;
+ }
+ qmlInfo(0) << tr("invalid field type:") << type;
+ return QString();
+ }
+
+signals:
+ void valueChanged();
+};
+
+QTCONTACTS_END_NAMESPACE
+
+QML_DECLARE_TYPE(QTCONTACTS_PREPEND_NAMESPACE(QDeclarativeContactExtendedDetail))
+
+#endif // QDECLARATIVECONTACTEXTENDEDDETAIL_P_H