@@ -41,8 +41,8 @@ LauncherBackend::~LauncherBackend()
4141
4242void LauncherBackend::clearItems()
4343{
44− for (int i = 0; i < m_storedApps.size(); i++) {
45− delete m_storedApps[i].settings;
44+ for (LauncherBackendItem &app: m_storedApps) {
45+ delete app.settings;
4646 }
4747 m_storedApps.clear();
4848}
@@ -50,8 +50,8 @@ void LauncherBackend::clearItems()
5050QStringList LauncherBackend::storedApplications() const
5151{
5252 auto files = QStringList();
53− for (int i = 0; i < m_storedApps.size(); i++) {
54− files << m_storedApps[i].settings->fileName();
53+ for (const LauncherBackendItem &app: m_storedApps) {
54+ files << app.settings->fileName();
5555 }
5656 return files;
5757}
@@ -61,12 +61,12 @@ void LauncherBackend::setStoredApplications(const QStringList &appIds)
6161 // Are we dropping any pinned apps?
6262 auto needToSync = false;
6363 auto pinnedItems = QStringList();
64− for (int i = 0; i < m_storedApps.size(); i++) {
65− if (m_storedApps[i].pinned) {
64+ for (LauncherBackendItem &app: m_storedApps) {
65+ if (app.pinned) {
6666 auto found = false;
67− for (int j = 0; j < appIds.size(); j++) {
68− auto fullAppId = desktopFile(appIds[j]);
69− if (m_storedApps[i].settings->fileName() == fullAppId) {
67+ for (const QString &appId: appIds) {
68+ auto fullAppId = desktopFile(appId);
69+ if (app.settings->fileName() == fullAppId) {
7070 found = true;
7171 break;
7272 }
@@ -74,13 +74,14 @@ void LauncherBackend::setStoredApplications(const QStringList &appIds)
7474 if (!found) {
7575 needToSync = true;
7676 }
77− pinnedItems.append(m_storedApps[i].settings->fileName());
77+ pinnedItems.append(app.settings->fileName());
7878 }
7979 }
8080
8181 clearItems();
8282
83− for (auto appId: appIds) {
83+
84+ for (const QString &appId: appIds) {
8485 loadDesktopFile(appId, pinnedItems.contains(desktopFile(appId)));
8586 }
8687
@@ -203,17 +204,17 @@ void LauncherBackend::syncFromAccounts()
203204 setStoredApplications(appIds);
204205
205206 // Mark all apps as pinned (since we just refreshed the set)
206− for (int i = 0; i < m_storedApps.size(); i++) {
207− m_storedApps[i].pinned = true;
207+ for (LauncherBackendItem &app: m_storedApps) {
208+ app.pinned = true;
208209 }
209210}
210211
211212void LauncherBackend::syncToAccounts()
212213{
213214 auto pinnedItems = QStringList();
214− for (int i = 0; i < m_storedApps.size(); i++) {
215− if (m_storedApps[i].pinned) {
216− pinnedItems.append(m_storedApps[i].settings->fileName());
215+ for (LauncherBackendItem &app: m_storedApps) {
216+ if (app.pinned) {
217+ pinnedItems.append(app.settings->fileName());
217218 }
218219 }
219220
@@ -240,7 +241,7 @@ bool LauncherBackend::loadDesktopFile(const QString &appId, bool isPinned)
240241int LauncherBackend::findItem(const QString &appId) const
241242{
242243 auto fullAppId = desktopFile(appId);
243− for (int i = 0; i < m_storedApps.size(); i++) {
244+ for (int i = 0; i < m_storedApps.size(); ++i) {
244245 if (m_storedApps[i].settings->fileName() == fullAppId) {
245246 return i;
246247 }