File indexing completed on 2024-11-24 04:50:42

0001 // SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu>
0002 // SPDX-License-Identifier: LGPL-2.0-or-later
0003 
0004 #include "contactplugin.h"
0005 #include "addresseewrapper.h"
0006 #include "contactapplication.h"
0007 #include "contactcollectionmodel.h"
0008 #include "contactconfig.h"
0009 #include "contacteditorbackend.h"
0010 #include "contactgroupeditor.h"
0011 #include "contactgroupwrapper.h"
0012 #include "contactmanager.h"
0013 #include "contactsmodel.h"
0014 #include "emailmodel.h"
0015 
0016 #include <QQmlEngine>
0017 
0018 void CalendarPlugin::registerTypes(const char *uri)
0019 {
0020     Q_ASSERT(uri == QByteArray("org.kde.merkuro.contact"));
0021 
0022     qmlRegisterSingletonType<ContactApplication>("org.kde.merkuro.contact", 1, 0, "ContactApplication", [](QQmlEngine *engine, QJSEngine *scriptEngine) {
0023         Q_UNUSED(engine)
0024         Q_UNUSED(scriptEngine)
0025         return new ContactApplication;
0026     });
0027 
0028     qmlRegisterSingletonType<ContactConfig>("org.kde.merkuro.contact", 1, 0, "Config", [](QQmlEngine *engine, QJSEngine *scriptEngine) {
0029         Q_UNUSED(engine)
0030         Q_UNUSED(scriptEngine)
0031         return new ContactConfig;
0032     });
0033 
0034     qmlRegisterSingletonType<ContactManager>("org.kde.merkuro.contact", 1, 0, "ContactManager", [](QQmlEngine *engine, QJSEngine *scriptEngine) {
0035         Q_UNUSED(engine)
0036         Q_UNUSED(scriptEngine)
0037         return new ContactManager;
0038     });
0039 
0040     qmlRegisterUncreatableType<EmailModel>("org.kde.merkuro.contact", 1, 0, "EmailModel", QStringLiteral("Enum"));
0041     qmlRegisterUncreatableType<PhoneModel>("org.kde.merkuro.contact", 1, 0, "PhoneModel", QStringLiteral("Enum"));
0042     qmlRegisterType<AddresseeWrapper>("org.kde.merkuro.contact", 1, 0, "AddresseeWrapper");
0043     qmlRegisterType<ContactEditorBackend>("org.kde.merkuro.contact", 1, 0, "ContactEditor");
0044     qmlRegisterType<ContactGroupWrapper>("org.kde.merkuro.contact", 1, 0, "ContactGroupWrapper");
0045     qmlRegisterType<ContactGroupEditor>("org.kde.merkuro.contact", 1, 0, "ContactGroupEditor");
0046     qmlRegisterType<ContactsModel>("org.kde.merkuro.contact", 1, 0, "ContactsModel");
0047     qRegisterMetaType<KContacts::Picture>("KContacts::Picture");
0048     qRegisterMetaType<KContacts::PhoneNumber::List>("KContacts::PhoneNumber::List");
0049     qRegisterMetaType<KContacts::PhoneNumber>("KContacts::PhoneNumber");
0050     qRegisterMetaType<QAction *>();
0051 }
0052 
0053 #include "moc_contactplugin.cpp"