MauiKit Accounts

accounts_plugin.cpp
1// SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#include <QQmlEngine>
6#include <QResource>
7#include <QQmlContext>
8
9#include "accounts_plugin.h"
10
11#include "mauiaccounts.h"
12
13void AccountsPlugin::registerTypes(const char *uri)
14{
15 #if defined(Q_OS_ANDROID)
16 QResource::registerResource(QStringLiteral("assets:/android_rcc_bundle.rcc"));
17 #endif
18
19 Q_ASSERT(QLatin1String(uri) == QLatin1String("org.mauikit.accounts"));
20
21 qmlRegisterSingletonType<MauiAccounts>(uri, 1, 0, "Accounts", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject * {
22 Q_UNUSED(scriptEngine)
23 auto accounts = MauiAccounts::instance();
25 return accounts;
26 });
27
28 qmlRegisterType(componentUrl(QStringLiteral("AccountsMenuItem.qml")), uri, 1, 0, "AccountsMenuItem");
29 qmlRegisterType(componentUrl(QStringLiteral("AccountsDialog.qml")), uri, 1, 0, "AccountsDialog");
30 qmlRegisterType(componentUrl(QStringLiteral("CredentialsDialog.qml")), uri, 1, 0, "CredentialsDialog");
31}
32
33void AccountsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
34{
35 Q_UNUSED(uri);
36 Q_UNUSED(engine);
37
38}
39
40QUrl AccountsPlugin::componentUrl(const QString &fileName) const
41{
42 return QUrl(resolveFileUrl(fileName));
43}
void setObjectOwnership(QObject *object, ObjectOwnership ownership)
bool registerResource(const QString &rccFileName, const QString &mapRoot)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:56 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.