on 57720af help sign in
88 lines 2.3 kB history raw
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Renato Araujo Oliveira Filho <renato@canonical.com>
18 */
20#include "indicator.h"
22#include <QStringList>
24Indicator::Indicator(QObject *parent)
25 : QObject(parent)
29Indicator::~Indicator()
33void Indicator::init(const QString& busName, const QSettings& settings)
35 setId(settings.value("Indicator Service/Name").toString());
37 QString actionObjectPath = settings.value("Indicator Service/ObjectPath").toString();
39 QVariantMap mapMenuObjectPaths;
40 Q_FOREACH(const QString& childGroup, settings.childGroups())
41 {
42 if (childGroup == "Indicator Service")
43 continue;
45 QString menuPath = childGroup+"/ObjectPath";
46 if (settings.contains(menuPath))
47 {
48 mapMenuObjectPaths[childGroup] = settings.value(menuPath).toString();
49 }
50 }
53 QVariantMap properties;
54 properties.clear();
55 properties.insert("busType", 1);
56 properties.insert("busName", busName);
57 properties.insert("actionsObjectPath", actionObjectPath);
58 properties.insert("menuObjectPaths", mapMenuObjectPaths);
59 setIndicatorProperties(properties);
62QString Indicator::identifier() const
64 return m_identifier;
67void Indicator::setId(const QString &identifier)
69 if (identifier != m_identifier) {
70 m_identifier = identifier;
71 Q_EMIT identifierChanged(m_identifier);
72 }
76QVariant Indicator::indicatorProperties() const
78 return m_properties;
81void Indicator::setIndicatorProperties(const QVariant &properties)
83 if (m_properties != properties)
84 {
85 m_properties = properties;
86 Q_EMIT indicatorPropertiesChanged(m_properties);
87 }