=== AlarmSnoozeApplet.lua ================================================================== --- AlarmSnoozeApplet.lua (revision 39045) +++ AlarmSnoozeApplet.lua (local) @@ -94,7 +94,7 @@ -- this timer is for debug purposes only, to log state information every second for tracking purposes -- very useful when needed... - -- self.statusPoller:start() + --self.statusPoller:start() if startTimer then self:_startTimer() @@ -248,6 +248,22 @@ end +function notify_playerPower(self, player, power) + if player ~= self.player then + return + end + log:debug("notify_playerPower(): ", power) + + -- turning power off while alarm is in progress always means alarm should be cancelled + if not power then + if self.alarmInProgress then + log:warn('Power turned off while alarm in progress. By design, turn the alarm off') + self:_alarmOff(true) + end + end +end + + function notify_playerCurrent(self, player) log:info("notify_playerCurrent(", player, ")") if player == self.localPlayer then @@ -481,6 +497,12 @@ return EVENT_CONSUME end + local pauseAction = function() + window:playSound("WINDOWHIDE") + self:_alarmOff(true) + return EVENT_UNUSED + end + local consumeAction = function() log:warn('Consuming this action') Framework:playSound("BUMP") @@ -501,6 +523,7 @@ menu:addActionListener("back", self, cancelAction) menu:addActionListener("power", self, offAction) menu:addActionListener("mute", self, snoozeAction) + menu:addActionListener("pause", self, pauseAction) window:ignoreAllInputExcept( --these actions are not ignored