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 * Michael Zanetti <michael.zanetti@canonical.com>
20#include "launcheritem.h"
21#include "quicklistmodel.h"
26LauncherItem::LauncherItem(const QString &appId, const QString &name, const QString &icon, QObject *parent) :
27 LauncherItemInterface(parent),
36 m_countVisible(false),
39 m_quickList(new QuickListModel(this))
41 QuickListEntry nameAction;
42 nameAction.setActionId("launch_item");
43 nameAction.setText(m_name);
44 m_quickList->appendAction(nameAction);
45 QuickListEntry pinningAction;
46 pinningAction.setActionId("pin_item");
47 pinningAction.setText(gettext("Pin shortcut"));
48 m_quickList->appendAction(pinningAction);
51QString LauncherItem::appId() const
56QString LauncherItem::name() const
61void LauncherItem::setName(const QString &name)
66 entry.setActionId("launch_item");
67 entry.setText(m_name);
68 m_quickList->updateAction(entry);
69 Q_EMIT nameChanged(name);
73QString LauncherItem::icon() const
78void LauncherItem::setIcon(const QString &icon)
82 Q_EMIT iconChanged(icon);
86bool LauncherItem::pinned() const
91void LauncherItem::setPinned(bool pinned)
93 if (m_pinned != pinned) {
95 Q_EMIT pinnedChanged(pinned);
98 // Even if pinned status didn't change, we want to update text in case
99 // the locale has changed since we last set pinned status.
100 QuickListEntry entry;
101 entry.setActionId("pin_item");
102 entry.setText(pinned ? gettext("Unpin shortcut") : gettext("Pin shortcut"));
103 m_quickList->updateAction(entry);
106bool LauncherItem::running() const
111void LauncherItem::setRunning(bool running)
113 if (m_running != running) {
115 Q_EMIT runningChanged(running);
119bool LauncherItem::recent() const
124void LauncherItem::setRecent(bool recent)
126 if (m_recent != recent) {
128 Q_EMIT recentChanged(recent);
132int LauncherItem::progress() const
137void LauncherItem::setProgress(int progress)
139 if (m_progress != progress) {
140 m_progress = progress;
141 Q_EMIT progressChanged(progress);
145int LauncherItem::count() const
150void LauncherItem::setCount(int count)
152 if (m_count != count) {
154 Q_EMIT countChanged(count);
158bool LauncherItem::countVisible() const
160 return m_countVisible;
163void LauncherItem::setCountVisible(bool countVisible)
165 if (m_countVisible != countVisible) {
166 m_countVisible = countVisible;
167 Q_EMIT countVisibleChanged(countVisible);
171bool LauncherItem::focused() const
176void LauncherItem::setFocused(bool focused)
178 if (m_focused != focused) {
183 Q_EMIT focusedChanged(focused);
187bool LauncherItem::alerting() const
192void LauncherItem::setAlerting(bool alerting)
194 std::cout << "LauncherItem::setAlerting()" << std::endl;
195 if (m_alerting != alerting) {
196 m_alerting = alerting;
197 Q_EMIT alertingChanged(alerting);
201unity::shell::launcher::QuickListModelInterface *LauncherItem::quickList() const
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