20 #include "launcheritem.h"
21 #include "quicklistmodel.h"
25 LauncherItem::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);
49 QString LauncherItem::appId()
const
54 QString LauncherItem::name()
const
59 void 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);
71 QString LauncherItem::icon()
const
76 void LauncherItem::setIcon(
const QString &icon)
80 Q_EMIT iconChanged(icon);
84 bool LauncherItem::pinned()
const
89 void LauncherItem::setPinned(
bool pinned)
91 if (m_pinned != pinned) {
93 Q_EMIT pinnedChanged(pinned);
99 entry.setActionId(
"pin_item");
100 entry.setText(pinned ? gettext(
"Unpin shortcut") : gettext(
"Pin shortcut"));
101 m_quickList->updateAction(entry);
104 bool LauncherItem::running()
const
109 void LauncherItem::setRunning(
bool running)
111 if (m_running != running) {
113 Q_EMIT runningChanged(running);
117 bool LauncherItem::recent()
const
122 void LauncherItem::setRecent(
bool recent)
124 if (m_recent != recent) {
126 Q_EMIT recentChanged(recent);
130 int LauncherItem::progress()
const
135 void LauncherItem::setProgress(
int progress)
137 if (m_progress != progress) {
138 m_progress = progress;
139 Q_EMIT progressChanged(progress);
143 int LauncherItem::count()
const
148 void LauncherItem::setCount(
int count)
150 if (m_count != count) {
152 Q_EMIT countChanged(count);
156 bool LauncherItem::countVisible()
const
158 return m_countVisible;
161 void LauncherItem::setCountVisible(
bool countVisible)
163 if (m_countVisible != countVisible) {
164 m_countVisible = countVisible;
165 Q_EMIT countVisibleChanged(countVisible);
169 bool LauncherItem::focused()
const
174 void LauncherItem::setFocused(
bool focused)
176 if (m_focused != focused) {
178 Q_EMIT focusedChanged(focused);
182 unity::shell::launcher::QuickListModelInterface *LauncherItem::quickList()
const