/*
 * Copyright (C) 2013 Canonical Ltd.
 *
 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
 *
 * This file is part of OnlineAccountsClient.
 *
 * OnlineAccountsClient is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * OnlineAccountsClient is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with OnlineAccountsClient.  If not, see
 * <http://www.gnu.org/licenses/>.
 */

#include "plugin.h"
#include <LomiriOnlineAccountsClient/Setup>
#include <QDebug>
#include <QQmlComponent>

#ifdef LOMIRI_ONLINEACCOUNTS_UBUNTU_COMPAT
#include <QLoggingCategory>

Q_LOGGING_CATEGORY(ldCategory, "lomiri.deprecations", QtWarningMsg)
#endif

using namespace OnlineAccountsClient;

void Plugin::registerTypes(const char *uri)
{
    qDebug() << Q_FUNC_INFO << uri;
    qmlRegisterType<Setup>(uri, 0, 1, "Setup");
    qmlRegisterType<Setup,2>(uri, 0, 2, "Setup");

#ifdef LOMIRI_ONLINEACCOUNTS_UBUNTU_COMPAT
    if (uri == QLatin1String("Ubuntu.OnlineAccounts.Client")) {
        qCDebug(ldCategory, "Use of the Ubuntu.OnlineAccounts.Client namespace "
                            "is deprecated, please consider updating your "
                            "applications to import "
                            "Lomiri.OnlineAccounts.Client instead.");
    }
#endif
}
