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),
37 m_quickList(new QuickListModel(this))
39 QuickListEntry nameAction;
40 nameAction.setActionId("launch_item");
41 nameAction.setText(m_name);
42 m_quickList->appendAction(nameAction);
43 QuickListEntry pinningAction;
44 pinningAction.setActionId("pin_item");
45 pinningAction.setText(gettext("Pin shortcut"));
46 m_quickList->appendAction(pinningAction);
49QString LauncherItem::appId() const
54QString LauncherItem::name() const
59void LauncherItem::setName(const QString &name)
64 entry.setActionId("launch_item");
65 entry.setText(m_name);
66 m_quickList->updateAction(entry);
67 Q_EMIT nameChanged(name);
71QString LauncherItem::icon() const
76void LauncherItem::setIcon(const QString &icon)
80 Q_EMIT iconChanged(icon);
84bool LauncherItem::pinned() const
89void LauncherItem::setPinned(bool pinned)
91 if (m_pinned != pinned) {
93 Q_EMIT pinnedChanged(pinned);
96 // Even if pinned status didn't change, we want to update text in case
97 // the locale has changed since we last set pinned status.
99 entry.setActionId("pin_item");
100 entry.setText(pinned ? gettext("Unpin shortcut") : gettext("Pin shortcut"));
101 m_quickList->updateAction(entry);
104bool LauncherItem::running() const
109void LauncherItem::setRunning(bool running)
111 if (m_running != running) {
113 Q_EMIT runningChanged(running);
117bool LauncherItem::recent() const
122void LauncherItem::setRecent(bool recent)
124 if (m_recent != recent) {
126 Q_EMIT recentChanged(recent);
130int LauncherItem::progress() const
135void LauncherItem::setProgress(int progress)
137 if (m_progress != progress) {
138 m_progress = progress;
139 Q_EMIT progressChanged(progress);
143int LauncherItem::count() const
148void LauncherItem::setCount(int count)
150 if (m_count != count) {
152 Q_EMIT countChanged(count);
156bool LauncherItem::countVisible() const
158 return m_countVisible;
161void LauncherItem::setCountVisible(bool countVisible)
163 if (m_countVisible != countVisible) {
164 m_countVisible = countVisible;
165 Q_EMIT countVisibleChanged(countVisible);
169bool LauncherItem::focused() const
174void LauncherItem::setFocused(bool focused)
176 if (m_focused != focused) {
178 Q_EMIT focusedChanged(focused);
182unity::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