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

0001 // SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu>
0002 // SPDX-License-Identifier: LGPL-2.0-or-later
0003 
0004 #include "akonadiquickplugin.h"
0005 
0006 #include "agentconfiguration.h"
0007 #include "collection.h"
0008 #include "collectioncomboboxmodel.h"
0009 #include "collectionpickermodel.h"
0010 #include "mimetypes.h"
0011 #include "tagmanager.h"
0012 
0013 #include <Akonadi/Collection>
0014 #include <QQmlEngine>
0015 
0016 void AkonadiQuickPlugin::registerTypes(const char *uri)
0017 {
0018     Q_ASSERT(uri == QByteArray("org.kde.akonadi"));
0019 
0020     qmlRegisterSingletonType<Akonadi::Quick::MimeTypes>("org.kde.akonadi", 1, 0, "MimeTypes", [](QQmlEngine *engine, QJSEngine *scriptEngine) {
0021         Q_UNUSED(engine)
0022         Q_UNUSED(scriptEngine)
0023         return new Akonadi::Quick::MimeTypes;
0024     });
0025 
0026     qmlRegisterSingletonType<TagManager>("org.kde.akonadi", 1, 0, "TagManager", [](QQmlEngine *engine, QJSEngine *scriptEngine) {
0027         Q_UNUSED(engine)
0028         Q_UNUSED(scriptEngine)
0029         return new TagManager;
0030     });
0031 
0032     qmlRegisterType<AgentConfiguration>("org.kde.akonadi", 1, 0, "AgentConfiguration");
0033     qmlRegisterType<Akonadi::Quick::CollectionComboBoxModel>("org.kde.akonadi", 1, 0, "CollectionComboBoxModel");
0034     qmlRegisterType<Akonadi::Quick::CollectionPickerModel>("org.kde.akonadi", 1, 0, "CollectionPickerModel");
0035 
0036     qmlRegisterUncreatableType<Akonadi::Quick::Collection>("org.kde.akonadi", 1, 0, "Collection", QStringLiteral("It's just an enum"));
0037 }
0038 
0039 #include "moc_akonadiquickplugin.cpp"