@@ -41,8 +41,8 @@ LauncherBackend::~LauncherBackend()
42void LauncherBackend::clearItems()
42void LauncherBackend::clearItems()
44− for (int i = 0; i < m_storedApps.size(); i++) {
44+ for (LauncherBackendItem &app: m_storedApps) {
45− delete m_storedApps[i].settings;
45+ delete app.settings;
47 m_storedApps.clear();
47 m_storedApps.clear();
@@ -50,8 +50,8 @@ void LauncherBackend::clearItems()
50QStringList LauncherBackend::storedApplications() const
50QStringList LauncherBackend::storedApplications() const
52 auto files = QStringList();
52 auto files = QStringList();
53− for (int i = 0; i < m_storedApps.size(); i++) {
53+ for (const LauncherBackendItem &app: m_storedApps) {
54− files << m_storedApps[i].settings->fileName();
54+ files << app.settings->fileName();
56 return files;
56 return files;
@@ -61,12 +61,12 @@ void LauncherBackend::setStoredApplications(const QStringList &appIds)
61 // Are we dropping any pinned apps?
61 // Are we dropping any pinned apps?
62 auto needToSync = false;
62 auto needToSync = false;
63 auto pinnedItems = QStringList();
63 auto pinnedItems = QStringList();
64− for (int i = 0; i < m_storedApps.size(); i++) {
64+ for (LauncherBackendItem &app: m_storedApps) {
65− if (m_storedApps[i].pinned) {
65+ if (app.pinned) {
66 auto found = false;
66 auto found = false;
67− for (int j = 0; j < appIds.size(); j++) {
67+ for (const QString &appId: appIds) {
68− auto fullAppId = desktopFile(appIds[j]);
68+ auto fullAppId = desktopFile(appId);
69− if (m_storedApps[i].settings->fileName() == fullAppId) {
69+ if (app.settings->fileName() == fullAppId) {
70 found = true;
70 found = true;
@@ -74,13 +74,14 @@ void LauncherBackend::setStoredApplications(const QStringList &appIds)
74 if (!found) {
74 if (!found) {
75 needToSync = true;
75 needToSync = true;
77− pinnedItems.append(m_storedApps[i].settings->fileName());
77+ pinnedItems.append(app.settings->fileName());
81 clearItems();
81 clearItems();
83− for (auto appId: appIds) {
84+ for (const QString &appId: appIds) {
84 loadDesktopFile(appId, pinnedItems.contains(desktopFile(appId)));
85 loadDesktopFile(appId, pinnedItems.contains(desktopFile(appId)));
@@ -203,17 +204,17 @@ void LauncherBackend::syncFromAccounts()
203 setStoredApplications(appIds);
204 setStoredApplications(appIds);
205 // Mark all apps as pinned (since we just refreshed the set)
206 // Mark all apps as pinned (since we just refreshed the set)
206− for (int i = 0; i < m_storedApps.size(); i++) {
207+ for (LauncherBackendItem &app: m_storedApps) {
207− m_storedApps[i].pinned = true;
208+ app.pinned = true;
211void LauncherBackend::syncToAccounts()
212void LauncherBackend::syncToAccounts()
213 auto pinnedItems = QStringList();
214 auto pinnedItems = QStringList();
214− for (int i = 0; i < m_storedApps.size(); i++) {
215+ for (LauncherBackendItem &app: m_storedApps) {
215− if (m_storedApps[i].pinned) {
216+ if (app.pinned) {
216− pinnedItems.append(m_storedApps[i].settings->fileName());
217+ pinnedItems.append(app.settings->fileName());
@@ -240,7 +241,7 @@ bool LauncherBackend::loadDesktopFile(const QString &appId, bool isPinned)
240int LauncherBackend::findItem(const QString &appId) const
241int LauncherBackend::findItem(const QString &appId) const
242 auto fullAppId = desktopFile(appId);
243 auto fullAppId = desktopFile(appId);
243− for (int i = 0; i < m_storedApps.size(); i++) {
244+ for (int i = 0; i < m_storedApps.size(); ++i) {
244 if (m_storedApps[i].settings->fileName() == fullAppId) {
245 if (m_storedApps[i].settings->fileName() == fullAppId) {
245 return i;
246 return i;