~mterry/unity8/power-button-on-lock

« back to all changes in this revision

Viewing changes to qml/Panel/Indicators/MenuItemFactory.qml

  • Committer: Michael Terry
  • Date: 2014-11-24 15:25:42 UTC
  • mfrom: (1368.1.82 unity8)
  • Revision ID: michael.terry@canonical.com-20141124152542-5cysva8ds3qfula6
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
290
290
            checked: serverChecked
291
291
            highlightWhenPressed: false
292
292
 
293
 
            onServerCheckedChanged: {
294
 
                // value can be changed by menu, so a binding won't work.
295
 
                checked = serverChecked;
296
 
            }
 
293
            onServerCheckedChanged: updateFromServer()
297
294
            onTriggered: {
298
295
                menuModel.activate(menuIndex);
 
296
                resyncTimer.restart();
 
297
            }
 
298
 
 
299
            // value can be changed by menu, so a binding won't work.
 
300
            function updateFromServer() {
 
301
                resyncTimer.stop();
 
302
                if (checked != serverChecked) {
 
303
                    checked = serverChecked;
 
304
                }
 
305
            }
 
306
 
 
307
            // Server value is not guaranteed to change to what we expect from an activation.
 
308
            // In this case, we need to re-assert that we are presenting the UI with the set backend value.
 
309
            Timer {
 
310
                id: resyncTimer
 
311
                interval: 1500
 
312
                onTriggered: updateFromServer()
299
313
            }
300
314
        }
301
315
    }
315
329
            checked: serverChecked
316
330
            highlightWhenPressed: false
317
331
 
318
 
            onServerCheckedChanged: {
319
 
                // value can be changed by menu, so a binding won't work.
320
 
                checked = serverChecked;
321
 
            }
 
332
            onServerCheckedChanged: updateFromServer()
322
333
            onTriggered: {
323
334
                menuModel.activate(menuIndex);
 
335
                resyncTimer.restart();
 
336
            }
 
337
 
 
338
            // value can be changed by menu, so a binding won't work.
 
339
            function updateFromServer() {
 
340
                resyncTimer.stop();
 
341
                if (checked != serverChecked) {
 
342
                    checked = serverChecked;
 
343
                }
 
344
            }
 
345
 
 
346
            // Server value is not guaranteed to change to what we expect from an activation.
 
347
            // In this case, we need to re-assert that we are presenting the UI with the set backend value.
 
348
            Timer {
 
349
                id: resyncTimer
 
350
                interval: 1500
 
351
                onTriggered: updateFromServer()
324
352
            }
325
353
        }
326
354
    }