10 New, 4 Modified patches for 1.3.5
[webos-internals:modifications.git] / notifications / notifications-reset-options-on-power-button-hold.patch
1 Name: Reset Options On Power Button Hold
2 Version: 1.3.5-3
3 Author: Jason Robitaille
4 Description: On power button hold, it goes straight to the reset options, with airplaine mode added, and skips the swap-battery/shutdown prompt,   (MIT license)
5
6 --- .orig/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
7 +++ /usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
8 @@ -2426,7 +2426,7 @@
9                     var f = function(stageController){
10                       stageController.pushScene('poweroffalert',this);
11                     }.bind(this);
12 -                   var params = {name: 'PowerOffAlert', height: 175,lightweight:true};                     
13 +                   var params = {name: 'PowerOffAlert', height: 230,lightweight:true};
14                     appController.createStageWithCallback(params,f,'popupalert');
15          }
16         //Close the Storage Alert and create a USB dashboard.
17 --- .orig/usr/lib/luna/system/luna-systemui/app/views/poweroffalert/poweroffalert-scene.html
18 +++ /usr/lib/luna/system/luna-systemui/app/views/poweroffalert/poweroffalert-scene.html
19 @@ -1,5 +1,6 @@
20  <div class="system-notification power-off">
21                 <div class="palm-notification-button affirmative" x-mojo-tap-highlight="immediate" id='flightmode' x-mojo-loc=''></div>
22 -               <div class="palm-notification-button negative" x-mojo-tap-highlight="immediate" id='poweroff' x-mojo-loc=''>Power</div>
23 +               <div class="palm-notification-button alternate" x-mojo-tap-highlight="immediate" id='restart' x-mojo-loc=''>Restart</div>
24 +               <div class="palm-notification-button negative" x-mojo-tap-highlight="immediate" id='shutdown' x-mojo-loc=''>Shut Down</div>
25                 <div class="palm-notification-button" x-mojo-tap-highlight="immediate" id='cancel' x-mojo-loc=''>Cancel</div>
26  </div>
27 \ No newline at end of file
28 --- .orig/usr/lib/luna/system/luna-systemui/app/controllers/poweroffalert-assistant.js
29 +++ /usr/lib/luna/system/luna-systemui/app/controllers/poweroffalert-assistant.js
30 @@ -7,7 +7,8 @@
31      
32      setup: function() {                
33                 var flightMode = this.flightMode.bindAsEventListener(this);
34 -               var powerOff = this.powerOff.bindAsEventListener(this);
35 +               var restart = this.restart.bindAsEventListener(this);
36 +               var shutdown = this.shutdown.bindAsEventListener(this);
37                 var cancel = this.cancel.bindAsEventListener(this);
38                 var launchAirplaneModeHelp = this.launchAirplaneModeHelp.bindAsEventListener(this);
39                 this.flightMode = this.barAssistant.getAirplaneMode();
40 @@ -16,7 +17,8 @@
41                 else
42                         this.controller.get('flightmode').innerHTML = "<div class='info-icon' id='airplaneInfo' x-mojo-touch-feedback='immediate'></div>" + $L('Airplane Mode');
43                         
44 -               this.controller.get('poweroff').addEventListener(Mojo.Event.tap, powerOff);
45                 this.controller.get('flightmode').addEventListener(Mojo.Event.tap, flightMode);
46 +               this.controller.get('restart').addEventListener(Mojo.Event.tap, restart);
47 +               this.controller.get('shutdown').addEventListener(Mojo.Event.tap, shutdown);
48                 this.controller.get('cancel').addEventListener(Mojo.Event.tap, cancel);
49                 this.controller.get('airplaneInfo').addEventListener(Mojo.Event.tap, launchAirplaneModeHelp);
50 @@ -46,6 +48,16 @@
51                 this.controller.window.close();
52         },
53         
54 +       restart: function() {
55 +               this.barAssistant.machineReboot("Restart selected by User in PowerOff Dialog");
56 +               this.controller.window.close();
57 +       },
58 +       
59 +       shutdown:function() {
60 +               this.barAssistant.machineOffNow("Shutdown request by User");
61 +               this.controller.window.close();
62 +       },
63 +       
64         flightMode:function(event) {
65                 
66                 var targetId = event.target.id;