2 * Copyright 2013 Canonical Ltd.
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.
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.
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/>.
17 * Renato Araujo Oliveira Filho <renato@canonical.com>
24Indicator::Indicator(QObject *parent)
30Indicator::~Indicator()
34void Indicator::init(const QString& busName, const QSettings& settings)
36 // Save all keys we care about from the QSettings object. It's annoying
37 // that we can't just copy the object.
39 Q_FOREACH(const QString& key, settings.allKeys()) {
40 if (key.endsWith(QLatin1String("/Position")) || key.endsWith(QLatin1String("/ObjectPath"))) {
41 m_settings.insert(key, settings.value(key));
45 setId(settings.value(QStringLiteral("Indicator Service/Name")).toString());
47 const QString actionObjectPath = settings.value(QStringLiteral("Indicator Service/ObjectPath")).toString();
49 QVariantMap properties;
50 properties.insert(QStringLiteral("busType"), 1);
51 properties.insert(QStringLiteral("busName"), busName);
52 properties.insert(QStringLiteral("actionsObjectPath"), actionObjectPath);
53 setIndicatorProperties(properties);
56QString Indicator::identifier() const
61void Indicator::setId(const QString &identifier)
63 if (identifier != m_identifier) {
64 m_identifier = identifier;
65 Q_EMIT identifierChanged(m_identifier);
69int Indicator::position() const
74void Indicator::setPosition(int position)
76 if (position != m_position) {
77 m_position = position;
78 Q_EMIT positionChanged(m_position);
82void Indicator::setProfile(const QString& profile)
84 QVariant pos = m_settings.value(profile + "/Position");
86 pos = m_settings.value(QStringLiteral("Indicator Service/Position"), QVariant::fromValue(0));
87 setPosition(pos.toInt());
89 const QString menuObjectPath = m_settings.value(profile + "/ObjectPath").toString();
90 QVariantMap map = m_properties.toMap();
91 map.insert(QStringLiteral("menuObjectPath"), menuObjectPath);
92 setIndicatorProperties(map);
95QVariant Indicator::indicatorProperties() const
100void Indicator::setIndicatorProperties(const QVariant &properties)
102 if (m_properties != properties)
104 m_properties = properties;
105 Q_EMIT indicatorPropertiesChanged(m_properties);
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list