File indexing completed on 2024-04-28 16:13:34

0001 /*
0002  * This file is part of the KDE project
0003  *
0004  * Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Library General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Library General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Library General Public License
0017  * along with this library; see the file COPYING.LIB.  If not, write to
0018  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0019  * Boston, MA 02110-1301, USA.
0020  *
0021  */
0022 
0023 #include "CalligraComponentsPlugin.h"
0024 
0025 #include "Document.h"
0026 #include "View.h"
0027 #include "Global.h"
0028 #include "ViewController.h"
0029 #include "Enums.h"
0030 #include "ImageDataItem.h"
0031 #include "models/ContentsModel.h"
0032 #include "LinkArea.h"
0033 
0034 using namespace Calligra::Components;
0035 
0036 QObject* singletonFactory(QQmlEngine*, QJSEngine*)
0037 {
0038     return new Calligra::Components::Global{};
0039 }
0040 
0041 void CalligraComponentsPlugin::registerTypes(const char* uri)
0042 {
0043     Q_ASSERT(uri == QLatin1Literal{"org.kde.calligra"});
0044 
0045     qmlRegisterType<Calligra::Components::Document>(uri, 1, 0, "Document");
0046     qmlRegisterType<Calligra::Components::View>(uri, 1, 0, "View");
0047     qmlRegisterType<Calligra::Components::ViewController>(uri, 1, 0, "ViewController");
0048     qmlRegisterType<Calligra::Components::ContentsModel>(uri, 1, 0, "ContentsModel");
0049     qmlRegisterType<Calligra::Components::ImageDataItem>(uri, 1, 0, "ImageDataItem");
0050     qmlRegisterType<Calligra::Components::LinkArea>(uri, 1, 0, "LinkArea");
0051 
0052     qmlRegisterUncreatableType<Calligra::Components::DocumentType>(uri, 1, 0, "DocumentType", "Provides the DocumentType enum");
0053     qmlRegisterUncreatableType<Calligra::Components::DocumentStatus>(uri, 1, 0, "DocumentStatus", "Provides the DocumentStatus enum");
0054 
0055     qmlRegisterSingletonType<Calligra::Components::Global>(uri, 1, 0, "Global", &singletonFactory);
0056 }