@@ -22,11 +22,6 @@
2222#include <QDir>
2323#include <QFileInfo>
2424
25−LauncherBackend::LauncherBackendItem::~LauncherBackendItem()
26−{
27− delete settings;
28−}
29−
3025LauncherBackend::LauncherBackend(QObject *parent):
3126 QObject(parent)
3227{
@@ -36,7 +31,15 @@ LauncherBackend::LauncherBackend(QObject *parent):
3631
3732LauncherBackend::~LauncherBackend()
3833{
34+ clearItems();
35+}
3936
37+void LauncherBackend::clearItems()
38+{
39+ for (int i = 0; i < m_storedApps.size(); i++) {
40+ delete m_storedApps[i].settings;
41+ }
42+ m_storedApps.clear();
4043}
4144
4245QStringList LauncherBackend::storedApplications() const
@@ -69,7 +72,8 @@ void LauncherBackend::setStoredApplications(const QStringList &appIds)
6972 }
7073 }
7174
72− m_storedApps.clear();
75+ clearItems();
76+
7377 for (auto appId: appIds) {
7478 loadDesktopFile(appId);
7579 }
@@ -101,7 +105,14 @@ QString LauncherBackend::icon(const QString &appId) const
101105 if (index < 0) {
102106 return "";
103107 } else {
104− return m_storedApps[index].settings->value("Desktop Entry/Icon").toString();
108+ auto iconName = m_storedApps[index].settings->value("Desktop Entry/Icon").toString();
109+ if (!iconName.isEmpty()) {
110+ QFileInfo iconFileInfo(iconName);
111+ if (iconFileInfo.isRelative()) {
112+ iconName = "image://gicon/" + iconName;
113+ }
114+ }
115+ return iconName;
105116 }
106117}
107118
@@ -187,6 +198,11 @@ void LauncherBackend::syncFromAccounts()
187198 }
188199
189200 setStoredApplications(appIds);
201+
202+ // Mark all apps as pinned (since we just refreshed the set)
203+ for (int i = 0; i < m_storedApps.size(); i++) {
204+ m_storedApps[i].pinned = true;
205+ }
190206}
191207
192208void LauncherBackend::syncToAccounts()