1 | /* |
2 | SPDX-FileCopyrightText: 2014 Bhushan Shah <bhush94@gmail.com> |
3 | SPDX-FileCopyrightText: 2014 David Edmundson <davidedmundson@kde.org> |
4 | SPDX-FileCopyrightText: 2023 Alexander Lohnau <alexander.lohnau@gmx.de> |
5 | |
6 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL |
7 | */ |
8 | |
9 | #include <QQmlEngine> |
10 | #include <QQmlExtensionPlugin> |
11 | |
12 | #include "formats.h" |
13 | #include "kuserproxy.h" |
14 | #include <KAboutData> |
15 | #include <KFormat> |
16 | |
17 | class KCoreAddonsPlugin : public QQmlExtensionPlugin |
18 | { |
19 | Q_OBJECT |
20 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface" ) |
21 | |
22 | public: |
23 | void registerTypes(const char *uri) override |
24 | { |
25 | qmlRegisterSingletonType<Formats>(uri, 1, 0, "Format" , [](QQmlEngine *, QJSEngine *) { |
26 | return new Formats(); |
27 | }); |
28 | qRegisterMetaType<QLocale::FormatType>(); |
29 | qmlRegisterUncreatableMetaObject(KFormat::staticMetaObject, uri, 1, 0, "FormatTypes" , QString()); |
30 | qmlRegisterType<KUserProxy>(uri, 1, 0, "KUser" ); |
31 | qmlRegisterSingletonType(uri, 1, 0, "AboutData" , [](QQmlEngine *engine, QJSEngine *) -> QJSValue { |
32 | return engine->toScriptValue(KAboutData::applicationData()); |
33 | }); |
34 | } |
35 | }; |
36 | |
37 | #include "kcoreaddonsplugin.moc" |
38 | |