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: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7*/
8
9#include <QQmlEngine>
10#include <QQmlExtensionPlugin>
11
12#include "formats.h"
13#include "kuserproxy.h"
14#include <KAboutData>
15#include <KFormat>
16
17class KCoreAddonsPlugin : public QQmlExtensionPlugin
18{
19 Q_OBJECT
20 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
21
22public:
23 void registerTypes(const char *uri) override
24 {
25 qmlRegisterSingletonType<Formats>(uri, versionMajor: 1, versionMinor: 0, typeName: "Format", callback: [](QQmlEngine *, QJSEngine *) {
26 return new Formats();
27 });
28 qRegisterMetaType<QLocale::FormatType>();
29 qmlRegisterUncreatableMetaObject(staticMetaObject: KFormat::staticMetaObject, uri, versionMajor: 1, versionMinor: 0, qmlName: "FormatTypes", reason: QString());
30 qmlRegisterType<KUserProxy>(uri, versionMajor: 1, versionMinor: 0, qmlName: "KUser");
31 qmlRegisterSingletonType(uri, versionMajor: 1, versionMinor: 0, typeName: "AboutData", callback: [](QQmlEngine *engine, QJSEngine *) -> QJSValue {
32 return engine->toScriptValue(value: KAboutData::applicationData());
33 });
34 }
35};
36
37#include "kcoreaddonsplugin.moc"
38

source code of kcoreaddons/src/qml/kcoreaddonsplugin.cpp