File indexing completed on 2024-05-12 12:58:00

0001 /*
0002  * This file is part of the KDE project
0003  *
0004  * SPDX-FileCopyrightText: 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.0-or-later
0007  *
0008  */
0009 
0010 #include "CalligraComponentsPlugin.h"
0011 
0012 #include "Document.h"
0013 #include "View.h"
0014 #include "Global.h"
0015 #include "ViewController.h"
0016 #include "Enums.h"
0017 #include "ImageDataItem.h"
0018 #include "models/ContentsModel.h"
0019 #include "LinkArea.h"
0020 
0021 using namespace Calligra::Components;
0022 
0023 QObject* singletonFactory(QQmlEngine*, QJSEngine*)
0024 {
0025     return new Calligra::Components::Global{};
0026 }
0027 
0028 void CalligraComponentsPlugin::registerTypes(const char* uri)
0029 {
0030     Q_ASSERT(uri == QLatin1String{"org.kde.calligra"});
0031 
0032     qmlRegisterType<Calligra::Components::Document>(uri, 1, 0, "Document");
0033     qmlRegisterType<Calligra::Components::View>(uri, 1, 0, "View");
0034     qmlRegisterType<Calligra::Components::ViewController>(uri, 1, 0, "ViewController");
0035     qmlRegisterType<Calligra::Components::ContentsModel>(uri, 1, 0, "ContentsModel");
0036     qmlRegisterType<Calligra::Components::ImageDataItem>(uri, 1, 0, "ImageDataItem");
0037     qmlRegisterType<Calligra::Components::LinkArea>(uri, 1, 0, "LinkArea");
0038 
0039     qmlRegisterUncreatableType<Calligra::Components::DocumentType>(uri, 1, 0, "DocumentType", "Provides the DocumentType enum");
0040     qmlRegisterUncreatableType<Calligra::Components::DocumentStatus>(uri, 1, 0, "DocumentStatus", "Provides the DocumentStatus enum");
0041 
0042     qmlRegisterSingletonType<Calligra::Components::Global>(uri, 1, 0, "Global", &singletonFactory);
0043 }