Use a LiveTimer instead of the screen state to detect a new day, so the solution is valid also for the desktop version
commit8c6a0cfcae327fd3ab842c14515b8bacd7ef34ee
authorTomás Tormo <tomas.tormo@gmail.com>
dateTue 25 Oct 2016, 10:14 (10 years ago)
parentfc9f007
qml/Greeter/Infographics.qml+4−10
@@ -59,18 +59,12 @@ Item {
5959 onDataDisappeared: startShowAnimation() // show "no data" label
6060 }
6161
62− Connections {
63− id: screenState
64− target: Powerd
65−
66− onStatusChanged: {
67− if(Powerd.status === Powerd.On){
68− handleScreenOn()
69− }
70− }
62+ LiveTimer {
63+ frequency: LiveTimer.Hour
64+ onTrigger: handleTimerTrigger()
7165 }
7266
73− function handleScreenOn(){
67+ function handleTimerTrigger(){
7468 var today = new Date().getDay()
7569 if(infographic.currentWeekDay !== today){
7670 infographic.currentWeekDay = today
tests/qmltests/Greeter/tst_Infographics.qml+1−1
@@ -150,7 +150,7 @@ Item {
150150 infographic.currentWeekDay = (today - data.currentDayOffset)
151151
152152 //When
153− infographic.handleScreenOn()
153+ infographic.handleTimerTrigger()
154154
155155 //Then
156156 tryCompare(infographic, "currentWeekDay", today)