@@ -92,25 +92,27 @@ void LauncherModel::move(int oldIndex, int newIndex)
92 pin(m_list.at(newIndex)->appId());
92 pin(m_list.at(newIndex)->appId());
95−void LauncherModel::pin(const QString &appId)
95+void LauncherModel::pin(const QString &appId, int index)
97− int index = findApplication(appId);
97+ int currentIndex = findApplication(appId);
102− LauncherItem *item = m_list.at(index);
103− if (!item->pinned()) {
99+ if (currentIndex >= 0) {
100+ if (index == -1 || index == currentIndex) {
101+ m_list.at(currentIndex)->setPinned(true);
102+ QModelIndex modelIndex = this->index(currentIndex);
103+ Q_EMIT dataChanged(modelIndex, modelIndex);
105+ move(currentIndex, index);
108+ beginInsertRows(QModelIndex(), index, index);
109+ LauncherItem *item = new LauncherItem(appId,
110+ m_backend->desktopFile(appId),
111+ m_backend->displayName(appId),
112+ m_backend->icon(appId));
105 item->setPinned(true);
113 item->setPinned(true);
106− item->setRecent(false);
114+ m_list.insert(index, item);
107−
115+ endInsertRows();
108− m_backend->setPinned(item->appId(), true);
110− QModelIndex modelIndex = this->index(index);
111− Q_EMIT dataChanged(modelIndex, modelIndex);
@@ -128,7 +130,7 @@ void LauncherModel::requestRemove(const QString &appId)
128 storeAppList();
130 storeAppList();
131−void LauncherModel::triggerQuickListAction(const QString &appId, int quickListIndex)
133+void LauncherModel::quickListActionInvoked(const QString &appId, int quickListIndex)
133 int index = findApplication(appId);
135 int index = findApplication(appId);
134 if (index < 0) {
136 if (index < 0) {