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"
25LauncherItem::LauncherItem(const QString &appId, const QString &name, const QString &icon, QObject *parent) :
26 LauncherItemInterface(parent),
35 m_countVisible(false),
38 m_quickList(new QuickListModel(this))
40 QuickListEntry nameAction;
41 nameAction.setActionId("launch_item");
42 nameAction.setText(m_name);
43 m_quickList->appendAction(nameAction);
44 QuickListEntry pinningAction;
45 pinningAction.setActionId("pin_item");
46 pinningAction.setText(gettext("Pin shortcut"));
47 m_quickList->appendAction(pinningAction);
50QString LauncherItem::appId() const
55QString LauncherItem::name() const
60void LauncherItem::setName(const QString &name)
65 entry.setActionId("launch_item");
66 entry.setText(m_name);
67 m_quickList->updateAction(entry);
68 Q_EMIT nameChanged(name);
72QString LauncherItem::icon() const
77void LauncherItem::setIcon(const QString &icon)
81 Q_EMIT iconChanged(icon);
85bool LauncherItem::pinned() const
90void LauncherItem::setPinned(bool pinned)
92 if (m_pinned != pinned) {
94 Q_EMIT pinnedChanged(pinned);
97 // Even if pinned status didn't change, we want to update text in case
98 // the locale has changed since we last set pinned status.
100 entry.setActionId("pin_item");
101 entry.setText(pinned ? gettext("Unpin shortcut") : gettext("Pin shortcut"));
102 m_quickList->updateAction(entry);
105bool LauncherItem::running() const
110void LauncherItem::setRunning(bool running)
112 if (m_running != running) {
114 Q_EMIT runningChanged(running);
118bool LauncherItem::recent() const
123void LauncherItem::setRecent(bool recent)
125 if (m_recent != recent) {
127 Q_EMIT recentChanged(recent);
131int LauncherItem::progress() const
136void LauncherItem::setProgress(int progress)
138 if (m_progress != progress) {
139 m_progress = progress;
140 Q_EMIT progressChanged(progress);
144int LauncherItem::count() const
149void LauncherItem::setCount(int count)
151 if (m_count != count) {
153 Q_EMIT countChanged(count);
154 if (m_countVisible) {
160bool LauncherItem::countVisible() const
162 return m_countVisible;
165void LauncherItem::setCountVisible(bool countVisible)
167 if (m_countVisible != countVisible) {
168 m_countVisible = countVisible;
169 Q_EMIT countVisibleChanged(countVisible);
176bool LauncherItem::focused() const
181void LauncherItem::setFocused(bool focused)
183 if (m_focused != focused) {
188 Q_EMIT focusedChanged(focused);
192bool LauncherItem::alerting() const
197void LauncherItem::setAlerting(bool alerting)
199 if (m_alerting != alerting) {
200 m_alerting = alerting;
201 Q_EMIT alertingChanged(alerting);
205unity::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