Make use of existing function
commit5e3edac8cdf8a93b71747c4a3b879f09fc232cf5
authorDaniel d'Andrada <daniel.dandrada@canonical.com>
dateMon 2 Feb 2015, 15:20 (12 years ago)
parentba68d27
qml/Stages/TabletStage.qml+4−11
@@ -82,17 +82,10 @@ Rectangle {
8282 }
8383
8484 function updateSpreadDelegateFocus() {
85− var appIndex = 0;
86− var found = false;
87− while (!found && appIndex < ApplicationManager.count) {
88− if (ApplicationManager.get(appIndex).appId === priv.focusedAppId) {
89− spreadRepeater.itemAt(appIndex).focus = true;
90− found = true;
91− } else {
92− ++appIndex;
93− }
94− }
95− if (!found) {
85+ var focusedAppIndex = priv.indexOf(priv.focusedAppId);
86+ if (focusedAppIndex !== -1) {
87+ spreadRepeater.itemAt(focusedAppIndex).focus = true;
88+ } else {
9689 console.warn("TabletStage: Failed to find the SpreadDelegate for appID=" + priv.focusedAppId);
9790 }
9891 }