File indexing completed on 2024-05-12 03:55:02

0001 /*
0002     SPDX-FileCopyrightText: 2014 Bhushan Shah <bhush94@gmail.com>
0003     SPDX-FileCopyrightText: 2014 David Edmundson <davidedmundson@kde.org>
0004     SPDX-FileCopyrightText: 2023 Alexander Lohnau <alexander.lohnau@gmx.de>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #include <QQmlEngine>
0010 #include <QQmlExtensionPlugin>
0011 
0012 #include "formats.h"
0013 #include "kuserproxy.h"
0014 #include <KAboutData>
0015 #include <KFormat>
0016 
0017 class KCoreAddonsPlugin : public QQmlExtensionPlugin
0018 {
0019     Q_OBJECT
0020     Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
0021 
0022 public:
0023     void registerTypes(const char *uri) override
0024     {
0025         qmlRegisterSingletonType<Formats>(uri, 1, 0, "Format", [](QQmlEngine *, QJSEngine *) {
0026             return new Formats();
0027         });
0028         qRegisterMetaType<QLocale::FormatType>();
0029         qmlRegisterUncreatableMetaObject(KFormat::staticMetaObject, uri, 1, 0, "FormatTypes", QString());
0030         qmlRegisterType<KUserProxy>(uri, 1, 0, "KUser");
0031         qmlRegisterSingletonType(uri, 1, 0, "AboutData", [](QQmlEngine *engine, QJSEngine *) -> QJSValue {
0032             return engine->toScriptValue(KAboutData::applicationData());
0033         });
0034     }
0035 };
0036 
0037 #include "kcoreaddonsplugin.moc"