| 1 | /* |
| 2 | * This file is part of libOnlineAccounts |
| 3 | * |
| 4 | * Copyright (C) 2016 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 "service.h" |
| 22 | |
| 23 | #include <QVariantMap> |
| 24 | #include <LomiriOnlineAccountsDaemon/dbus_constants.h> |
| 25 | |
| 26 | using namespace OnlineAccounts; |
| 27 | |
| 28 | Service::ServiceData::ServiceData(const QVariantMap &map): |
| 29 | m_id(map.value(ONLINE_ACCOUNTS_INFO_KEY_SERVICE_ID).toString()), |
| 30 | m_displayName(map.value(ONLINE_ACCOUNTS_INFO_KEY_DISPLAY_NAME).toString()), |
| 31 | m_iconSource(map.value(ONLINE_ACCOUNTS_INFO_KEY_ICON_SOURCE).toString()) |
| 32 | { |
| 33 | } |
| 34 | |
| 35 | Service::Service(): |
| 36 | d(new ServiceData(QVariantMap())) |
| 37 | { |
| 38 | } |
| 39 | |
| 40 | Service::Service(const QVariantMap &map): |
| 41 | d(new ServiceData(map)) |
| 42 | { |
| 43 | } |
| 44 | |
| 45 | #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) |
| 46 | QVariantMap Service::toMap() const |
| 47 | { |
| 48 | return QVariantMap { |
| 49 | { "serviceId", id() }, |
| 50 | { "displayName", displayName() }, |
| 51 | { "iconSource", iconSource() }, |
| 52 | }; |
| 53 | } |
| 54 | #endif |