| 1 | /* |
| 2 | * This file is part of OnlineAccountsModule |
| 3 | * |
| 4 | * Copyright (C) 2015 Canonical Ltd. |
| 5 | * |
| 6 | * Contact: Alberto Mardegan <[email protected]> |
| 7 | * |
| 8 | * This program is free software: you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU Lesser General Public License version 3, as |
| 10 | * published by the Free Software Foundation. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranties of |
| 14 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 15 | * PURPOSE. See the GNU Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public License |
| 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include "plugin.h" |
| 22 | |
| 23 | #include "account.h" |
| 24 | #include "account_model.h" |
| 25 | |
| 26 | #include <QDebug> |
| 27 | #include <QQmlComponent> |
| 28 | #ifdef LOMIRI_ONLINEACCOUNTS_UBUNTU_COMPAT |
| 29 | #include <QLoggingCategory> |
| 30 | |
| 31 | Q_LOGGING_CATEGORY(ldCategory, "lomiri.deprecations", QtWarningMsg) |
| 32 | #endif |
| 33 | |
| 34 | using namespace OnlineAccountsModule; |
| 35 | |
| 36 | void Plugin::registerTypes(const char* uri) |
| 37 | { |
| 38 | qDebug() << Q_FUNC_INFO << uri; |
| 39 | |
| 40 | qmlRegisterType<AccountModel>(uri, 2, 0, "AccountModel"); |
| 41 | qmlRegisterUncreatableType<Account>(uri, 2, 0, "Account", |
| 42 | "Cannot be created from QML"); |
| 43 | qmlRegisterUncreatableType<OnlineAccounts::Service>(uri, 2, 0, "Service", |
| 44 | "Cannot be created from QML"); |
| 45 | |
| 46 | #ifdef LOMIRI_ONLINEACCOUNTS_UBUNTU_COMPAT |
| 47 | if (uri == QLatin1String("Ubuntu.OnlineAccounts")) { |
| 48 | qCDebug(ldCategory, "Use of the Ubuntu.OnlineAccounts namespace is " |
| 49 | "deprecated, please consider updating your " |
| 50 | "applications to import Lomiri.OnlineAccounts " |
| 51 | "instead."); |
| 52 | } |
| 53 | #endif |
| 54 | } |