| 1 | /* |
| 2 | * Copyright (C) 2014 Canonical Ltd. |
| 3 | * |
| 4 | * Contact: Alberto Mardegan <[email protected]> |
| 5 | * |
| 6 | * This file is part of lomiri-online-accounts-ui |
| 7 | * |
| 8 | * This program is free software: you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License version 3, as published |
| 10 | * 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 General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along |
| 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include "application-manager-mock.h" |
| 22 | |
| 23 | #include <QDebug> |
| 24 | |
| 25 | using namespace OnlineAccountsUi; |
| 26 | |
| 27 | ApplicationManager *ApplicationManager::m_instance = 0; |
| 28 | |
| 29 | ApplicationManagerPrivate::ApplicationManagerPrivate(ApplicationManager *q): |
| 30 | QObject(q), |
| 31 | q_ptr(q) |
| 32 | { |
| 33 | } |
| 34 | |
| 35 | ApplicationManagerPrivate::~ApplicationManagerPrivate() |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | ApplicationManager::ApplicationManager(QObject *parent): |
| 40 | QObject(parent), |
| 41 | d_ptr(new ApplicationManagerPrivate(this)) |
| 42 | { |
| 43 | m_instance = this; |
| 44 | } |
| 45 | |
| 46 | ApplicationManager::~ApplicationManager() |
| 47 | { |
| 48 | m_instance = 0; |
| 49 | } |
| 50 | |
| 51 | ApplicationManager *ApplicationManager::instance() |
| 52 | { |
| 53 | if (!m_instance) { |
| 54 | new ApplicationManager; |
| 55 | } |
| 56 | return m_instance; |
| 57 | } |
| 58 | |
| 59 | QVariantMap ApplicationManager::applicationInfo(const QString &applicationId, |
| 60 | const QString &profile) |
| 61 | { |
| 62 | Q_D(ApplicationManager); |
| 63 | Q_EMIT d->applicationInfoCalled(applicationId, profile); |
| 64 | return d->m_applicationInfo[applicationId]; |
| 65 | } |
| 66 | |
| 67 | QVariantMap ApplicationManager::providerInfo(const QString &providerId) const |
| 68 | { |
| 69 | Q_D(const ApplicationManager); |
| 70 | return d->m_providerInfo[providerId]; |
| 71 | } |