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)
63 Q_EMIT nameChanged(name);
67 QString LauncherItem::icon()
const
72 void LauncherItem::setIcon(
const QString &icon)
76 Q_EMIT iconChanged(icon);
80 bool LauncherItem::pinned()
const
85 void LauncherItem::setPinned(
bool pinned)
87 if (m_pinned != pinned) {
90 entry.setActionId(
"pin_item");
91 entry.setText(pinned ? gettext(
"Unpin shortcut") : gettext(
"Pin shortcut"));
92 m_quickList->updateAction(entry);
93 Q_EMIT pinnedChanged(pinned);
97 bool LauncherItem::running()
const
102 void LauncherItem::setRunning(
bool running)
104 if (m_running != running) {
106 Q_EMIT runningChanged(running);
110 bool LauncherItem::recent()
const
115 void LauncherItem::setRecent(
bool recent)
117 if (m_recent != recent) {
119 Q_EMIT recentChanged(recent);
123 int LauncherItem::progress()
const
128 void LauncherItem::setProgress(
int progress)
130 if (m_progress != progress) {
131 m_progress = progress;
132 Q_EMIT progressChanged(progress);
136 int LauncherItem::count()
const
141 void LauncherItem::setCount(
int count)
143 if (m_count != count) {
145 Q_EMIT countChanged(count);
149 bool LauncherItem::countVisible()
const
151 return m_countVisible;
154 void LauncherItem::setCountVisible(
bool countVisible)
156 if (m_countVisible != countVisible) {
157 m_countVisible = countVisible;
158 Q_EMIT countVisibleChanged(countVisible);
162 bool LauncherItem::focused()
const
167 void LauncherItem::setFocused(
bool focused)
169 if (m_focused != focused) {
171 Q_EMIT focusedChanged(focused);
175 unity::shell::launcher::QuickListModelInterface *LauncherItem::quickList()
const