@@ -162,23 +162,7 @@ void LauncherModel::pin(const QString &appId, int index)
163void LauncherModel::requestRemove(const QString &appId)
163void LauncherModel::requestRemove(const QString &appId)
165− int index = findApplication(appId);
165+ unpin(appId);
170− if (m_appManager->findApplication(appId)) {
171− m_list.at(index)->setPinned(false);
172− QModelIndex modelIndex = this->index(index);
173− Q_EMIT dataChanged(modelIndex, modelIndex, QVector<int>() << RolePinned);
178− beginRemoveRows(QModelIndex(), index, index);
179− m_list.takeAt(index)->deleteLater();
182 storeAppList();
166 storeAppList();
@@ -289,6 +273,24 @@ void LauncherModel::storeAppList()
289 m_settings->setStoredApplications(appIds);
273 m_settings->setStoredApplications(appIds);
276+void LauncherModel::unpin(const QString &appId)
278+ int index = findApplication(appId);
283+ if (m_appManager->findApplication(appId)) {
284+ m_list.at(index)->setPinned(false);
285+ QModelIndex modelIndex = this->index(index);
286+ Q_EMIT dataChanged(modelIndex, modelIndex, QVector<int>() << RolePinned);
288+ beginRemoveRows(QModelIndex(), index, index);
289+ m_list.takeAt(index)->deleteLater();
292int LauncherModel::findApplication(const QString &appId)
294int LauncherModel::findApplication(const QString &appId)
294 for (int i = 0; i < m_list.count(); ++i) {
296 for (int i = 0; i < m_list.count(); ++i) {
@@ -370,18 +372,8 @@ void LauncherModel::refresh()
373− // If running, just unpin, otherwise really remove
374 Q_FOREACH (LauncherItem* item, toBeRemoved) {
375 Q_FOREACH (LauncherItem* item, toBeRemoved) {
375− int index = m_list.indexOf(item);
376+ unpin(item->appId());
376− if (m_appManager->findApplication(item->appId())) {
377− item->setPinned(false);
378− QModelIndex modelIndex = this->index(index);
379− Q_EMIT dataChanged(modelIndex, modelIndex, QVector<int>() << RolePinned);
381− beginRemoveRows(QModelIndex(), index, index);
382− m_list.takeAt(index)->deleteLater();
387 // This brings the Launcher into sync with the settings backend again. There's an issue though:
379 // This brings the Launcher into sync with the settings backend again. There's an issue though: