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);
44 QuickListEntry pinningAction;
45 pinningAction.setActionId("pin_item");
46 pinningAction.setText(gettext("Pin shortcut"));
47 m_quickList->appendAction(pinningAction);
49 m_quitAction.setActionId("stop_item");
50 m_quitAction.setIcon("application-exit");
51 m_quitAction.setText(gettext("Quit"));
54QString LauncherItem::appId() const
59QString LauncherItem::name() const
64void LauncherItem::setName(const QString &name)
69 entry.setActionId("launch_item");
70 entry.setText(m_name);
71 m_quickList->updateAction(entry);
72 Q_EMIT nameChanged(name);
76QString LauncherItem::icon() const
81void LauncherItem::setIcon(const QString &icon)
85 Q_EMIT iconChanged(icon);
89bool LauncherItem::pinned() const
94void LauncherItem::setPinned(bool pinned)
96 if (m_pinned != pinned) {
98 Q_EMIT pinnedChanged(pinned);
101 // Even if pinned status didn't change, we want to update text in case
102 // the locale has changed since we last set pinned status.
103 QuickListEntry entry;
104 entry.setActionId("pin_item");
105 entry.setText(pinned ? gettext("Unpin shortcut") : gettext("Pin shortcut"));
106 m_quickList->updateAction(entry);
109bool LauncherItem::running() const
114void LauncherItem::setRunning(bool running)
116 if (m_running != running) {
118 if (m_running) { // add the quit action
119 m_quickList->appendAction(m_quitAction);
120 } else { // remove the quit action
121 m_quickList->removeAction(m_quitAction);
123 Q_EMIT runningChanged(running);
127bool LauncherItem::recent() const
132void LauncherItem::setRecent(bool recent)
134 if (m_recent != recent) {
136 Q_EMIT recentChanged(recent);
140int LauncherItem::progress() const
145void LauncherItem::setProgress(int progress)
147 if (m_progress != progress) {
148 m_progress = progress;
149 Q_EMIT progressChanged(progress);
153int LauncherItem::count() const
158void LauncherItem::setCount(int count)
160 if (m_count != count) {
162 Q_EMIT countChanged(count);
166bool LauncherItem::countVisible() const
168 return m_countVisible;
171void LauncherItem::setCountVisible(bool countVisible)
173 if (m_countVisible != countVisible) {
174 m_countVisible = countVisible;
175 Q_EMIT countVisibleChanged(countVisible);
179bool LauncherItem::focused() const
184void LauncherItem::setFocused(bool focused)
186 if (m_focused != focused) {
188 Q_EMIT focusedChanged(focused);
192unity::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