1/****************************************************************************
2**
3** Copyright (C) 2015 The Qt Company Ltd.
4** Contact: http://www.qt.io/licensing/
5**
6** This file is part of the QtQml module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL21$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see http://www.qt.io/terms-conditions. For further
15** information use the contact form at http://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 2.1 or version 3 as published by the Free
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the
22** following information to ensure the GNU Lesser General Public License
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25**
26** As a special exception, The Qt Company gives you certain additional
27** rights. These rights are described in The Qt Company LGPL Exception
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29**
30** $QT_END_LICENSE$
31**
32****************************************************************************/
33
34#include <QtQml/qqml.h>
35#include <QtQml/qqmlextensionplugin.h>
36
37#include <QtContacts/qcontactid.h>
38#include <QtContacts/qcontactabstractrequest.h>
39
40#include "qdeclarativecontact_p.h"
41#include "qdeclarativecontactcollection_p.h"
42#include "qdeclarativecontactdetail_p.h"
43#include "qdeclarativecontactfetchhint_p.h"
44#include "qdeclarativecontactfilter_p.h"
45#include "qdeclarativecontactfilters_p.h"
46#include "qdeclarativecontactmodel_p.h"
47#include "qdeclarativecontactrelationship_p.h"
48#include "qdeclarativecontactrelationshipmodel_p.h"
49#include "qdeclarativecontactsortorder_p.h"
50
51QTCONTACTS_USE_NAMESPACE
52
53QT_BEGIN_NAMESPACE
54
55class QContactQmlPlugin : public QQmlExtensionPlugin
56{
57 Q_OBJECT
58 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface" FILE "contacts.json")
59public:
60 void registerTypes(const char *uri)
61 {
62 Q_ASSERT(uri == QStringLiteral("QtContacts"));
63
64 int major = 5;
65 int minor = 0;
66 qRegisterMetaType<QContactAbstractRequest::State>(typeName: "QContactAbstractRequest::State");
67 qRegisterMetaType<QContactId>(typeName: "QContactId");
68 qRegisterMetaType<QList<QContactId> >(typeName: "QList<QContactId>");
69 qRegisterMetaType<QList<QContactCollectionId> >(typeName: "QList<QContactCollectionId>");
70 qmlRegisterType<QDeclarativeContactModel>(uri, versionMajor: major, versionMinor: minor, qmlName: "ContactModel");
71 qmlRegisterType<QDeclarativeContact>(uri, versionMajor: major, versionMinor: minor, qmlName: "Contact");
72 qmlRegisterType<QDeclarativeContactCollection>(uri, versionMajor: major, versionMinor: minor, qmlName: "Collection");
73 qmlRegisterType<QDeclarativeContactFetchHint>(uri, versionMajor: major, versionMinor: minor, qmlName: "FetchHint");
74 qmlRegisterType<QDeclarativeContactRelationshipModel>(uri, versionMajor: major, versionMinor: minor, qmlName: "RelationshipModel");
75 qmlRegisterType<QDeclarativeContactRelationship>(uri, versionMajor: major, versionMinor: minor, qmlName: "Relationship");
76 qmlRegisterType<QDeclarativeContactSortOrder>(uri, versionMajor: major, versionMinor: minor, qmlName: "SortOrder");
77
78 //details
79 qmlRegisterType<QDeclarativeContactDetail>(uri, versionMajor: major, versionMinor: minor, qmlName: "ContactDetail");
80 qmlRegisterType<QDeclarativeContactAddress>(uri, versionMajor: major, versionMinor: minor, qmlName: "Address");
81 qmlRegisterType<QDeclarativeContactAnniversary>(uri, versionMajor: major, versionMinor: minor, qmlName: "Anniversary");
82 qmlRegisterType<QDeclarativeContactAvatar>(uri, versionMajor: major, versionMinor: minor, qmlName: "Avatar");
83 qmlRegisterType<QDeclarativeContactBirthday>(uri, versionMajor: major, versionMinor: minor, qmlName: "Birthday");
84 qmlRegisterType<QDeclarativeContactDisplayLabel>(uri, versionMajor: major, versionMinor: minor, qmlName: "DisplayLabel");
85 qmlRegisterType<QDeclarativeContactEmailAddress>(uri, versionMajor: major, versionMinor: minor, qmlName: "EmailAddress");
86 qmlRegisterType<QDeclarativeContactFamily>(uri, versionMajor: major, versionMinor: minor, qmlName: "Family");
87 qmlRegisterType<QDeclarativeContactFavorite>(uri, versionMajor: major, versionMinor: minor, qmlName: "Favorite");
88 qmlRegisterType<QDeclarativeContactGender>(uri, versionMajor: major, versionMinor: minor, qmlName: "Gender");
89 qmlRegisterType<QDeclarativeContactGeoLocation>(uri, versionMajor: major, versionMinor: minor, qmlName: "Location");
90 qmlRegisterType<QDeclarativeContactGlobalPresence>(uri, versionMajor: major, versionMinor: minor, qmlName: "GlobalPresence");
91 qmlRegisterType<QDeclarativeContactGuid>(uri, versionMajor: major, versionMinor: minor, qmlName: "Guid");
92 qmlRegisterType<QDeclarativeContactName>(uri, versionMajor: major, versionMinor: minor, qmlName: "Name");
93 qmlRegisterType<QDeclarativeContactNickname>(uri, versionMajor: major, versionMinor: minor, qmlName: "Nickname");
94 qmlRegisterType<QDeclarativeContactNote>(uri, versionMajor: major, versionMinor: minor, qmlName: "Note");
95 qmlRegisterType<QDeclarativeContactOnlineAccount>(uri, versionMajor: major, versionMinor: minor, qmlName: "OnlineAccount");
96 qmlRegisterType<QDeclarativeContactOrganization>(uri, versionMajor: major, versionMinor: minor, qmlName: "Organization");
97 qmlRegisterType<QDeclarativeContactPhoneNumber>(uri, versionMajor: major, versionMinor: minor, qmlName: "PhoneNumber");
98 qmlRegisterType<QDeclarativeContactPresence>(uri, versionMajor: major, versionMinor: minor, qmlName: "Presence");
99 qmlRegisterType<QDeclarativeContactRingtone>(uri, versionMajor: major, versionMinor: minor, qmlName: "Ringtone");
100 qmlRegisterType<QDeclarativeContactSyncTarget>(uri, versionMajor: major, versionMinor: minor, qmlName: "SyncTarget");
101 qmlRegisterType<QDeclarativeContactTag>(uri, versionMajor: major, versionMinor: minor, qmlName: "Tag");
102 qmlRegisterType<QDeclarativeContactTimestamp>(uri, versionMajor: major, versionMinor: minor, qmlName: "Timestamp");
103 qmlRegisterType<QDeclarativeContactType>(uri, versionMajor: major, versionMinor: minor, qmlName: "Type");
104 qmlRegisterType<QDeclarativeContactUrl>(uri, versionMajor: major, versionMinor: minor, qmlName: "Url");
105 qmlRegisterType<QDeclarativeContactVersion>(uri, versionMajor: major, versionMinor: minor, qmlName: "Version");
106 qmlRegisterType<QDeclarativeContactHobby>(uri, versionMajor: major, versionMinor: minor, qmlName: "Hobby");
107 qmlRegisterType<QDeclarativeContactExtendedDetail>(uri, versionMajor: major, versionMinor: minor, qmlName: "ExtendedDetail");
108
109 //filters
110 qmlRegisterType<QDeclarativeContactFilter>(uri, versionMajor: major, versionMinor: minor, qmlName: "Filter");
111 qmlRegisterType<QDeclarativeContactActionFilter>(uri, versionMajor: major, versionMinor: minor, qmlName: "ActionFilter");
112 qmlRegisterType<QDeclarativeContactChangeLogFilter>(uri, versionMajor: major, versionMinor: minor, qmlName: "ChangeLogFilter");
113 qmlRegisterType<QDeclarativeContactCollectionFilter>(uri, versionMajor: major, versionMinor: minor, qmlName: "CollectionFilter");
114 qmlRegisterType<QDeclarativeContactDetailFilter>(uri, versionMajor: major, versionMinor: minor, qmlName: "DetailFilter");
115 qmlRegisterType<QDeclarativeContactDetailRangeFilter>(uri, versionMajor: major, versionMinor: minor, qmlName: "DetailRangeFilter");
116 qmlRegisterType<QDeclarativeContactIdFilter>(uri, versionMajor: major, versionMinor: minor, qmlName: "IdFilter");
117 qmlRegisterType<QDeclarativeContactRelationshipFilter>(uri, versionMajor: major, versionMinor: minor, qmlName: "RelationshipFilter");
118 qmlRegisterType<QDeclarativeContactIntersectionFilter>(uri, versionMajor: major, versionMinor: minor, qmlName: "IntersectionFilter");
119 qmlRegisterType<QDeclarativeContactUnionFilter>(uri, versionMajor: major, versionMinor: minor, qmlName: "UnionFilter");
120 qmlRegisterType<QDeclarativeContactInvalidFilter>(uri, versionMajor: major, versionMinor: minor, qmlName: "InvalidFilter");
121 qmlRegisterType<QDeclarativeContactCompoundFilter>();
122
123 }
124
125 void initializeEngine(QQmlEngine *engine, const char *uri)
126 {
127 Q_UNUSED(engine)
128 Q_UNUSED(uri)
129 }
130};
131
132#include "plugin.moc"
133
134QT_END_NAMESPACE
135

source code of qtpim/src/imports/contacts/plugin.cpp