Updated system menus patches
[webos-internals:modifications.git] / top-bar / top-bar-system-menu-initial-framework.patch
1 --- .orig/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
2 +++ /usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
3 @@ -12,6 +12,7 @@
4                 this.isInitialQuery = false;
5                 this.airplaneModeInitialQueryDone = false;
6                 this.carrierText = "Palm";
7 +               this.statusText = null;
8                 this.airplaneModeTriggered = false;
9                 this.show3GForEvdo = false;
10                 this.carrierTextEnglish = "Palm";
11 @@ -30,6 +31,7 @@
12                 $('tty').hide();
13                 $('hac').hide();
14                 $('callforward').hide();
15 +               $('appmenu').hide();
16                 
17                 this.getBuildName();
18                                                 
19 @@ -87,14 +89,17 @@
20                 this.initOnServerStart("com.palm.pubsubservice", this.pubsubServiceInit.bind(this));
21                                 
22                 Mojo.Event.listen($('appmenu'),'mojo-tap', this.appMenuHandleTap.bindAsEventListener(this));
23 +               
24 +               Mojo.Event.listen($('statusmenu'),'mojo-tap', this.statusMenuHandleTap.bindAsEventListener(this));
25 +               Mojo.Event.listen($('todaymenu'),'mojo-tap', this.todayMenuHandleTap.bindAsEventListener(this));
26                 Mojo.Event.listen($('devicemenu'),'mojo-tap', this.deviceMenuHandleTap.bindAsEventListener(this));
27                                                 
28                 this.registerForeGroundApp();
29                 this.registerStatusSettings();          
30                 
31 -               //Create the Device Menu Window. But do not do this if this is a frist use run.
32 +               //Create the System Menu Windows. But do not do this if this is a frist use run.
33                 if(!PalmSystem.isMinimal)
34 -                       this.showDeviceMenu();
35 +                       this.showSystemMenus();
36                 
37                 this.setStageControllerActiveToFalse.bind(this).delay(5);       
38                 
39 @@ -277,7 +282,7 @@
40         //If it is First Use, Do not change the App Name.
41         if(PalmSystem.isMinimal) {
42                 this.foregroundAppID = payload.id;
43 -               $('appname').hide();
44 +               $('appmenu').hide();
45                 $('carrier').show();
46                 return;
47         }
48 @@ -308,11 +313,11 @@
49                 }
50                 else 
51                         $('appname').innerHTML = payload.appmenu || payload.title;
52 -               $('appname').show();
53 +               $('appmenu').show();
54                 this.foregroundAppID = payload.id;
55         }
56         else{
57 -               $('appname').hide();
58 +               $('appmenu').hide();
59                 $('carrier').show();
60                 this.foregroundAppID=null;
61         }
62 @@ -400,11 +405,11 @@
63                 }
64                 if (payload.locked || this.foregroundAppID == null) {
65                         $('carrier').show();
66 -                       $('appname').hide();
67 +                       $('appmenu').hide();
68                 }
69                 else {
70                         $('carrier').hide();
71 -                       $('appname').show();
72 +                       $('appmenu').show();
73                 }
74         }       
75         
76 @@ -449,6 +454,126 @@
77         }       
78  },
79  
80 +// System menus
81 +
82 +showSystemMenus: function() {
83 +       this.showStatusMenu();
84 +       this.showTodayMenu();
85 +       this.showDeviceMenu();
86 +},
87 +
88 +hideSystemMenus: function(menu) {
89 +       if(menu != "status") {
90 +               var modeStageController = Mojo.Controller.getAppController().getStageProxy("StatusMenu");
91 +               
92 +               if (modeStageController) {
93 +                       modeStageController.delegateToSceneAssistant("close");
94 +               }
95 +       }
96 +       
97 +       if(menu != "today") {
98 +               var modeStageController = Mojo.Controller.getAppController().getStageProxy("TodayMenu");
99 +               
100 +               if (modeStageController) {
101 +                       modeStageController.delegateToSceneAssistant("close");
102 +               }
103 +       }
104 +
105 +       if(menu != "device") {
106 +               var deviceStageController = Mojo.Controller.getAppController().getStageProxy("DeviceMenu");
107 +               
108 +               if (deviceStageController) {
109 +                       deviceStageController.delegateToSceneAssistant("close");
110 +               }
111 +       }       
112 +},
113 +
114 +// Status menu
115 +
116 +statusMenuHandleTap: function(event) { //show/hide statusmenu
117 +
118 +       //Ignore the notification if it's in First Use.
119 +        if(PalmSystem.isMinimal)
120 +               return;
121 +
122 +       var target = event.target;
123 +       var i=0;
124 +       var level = 2; //up to 2 level, for hour, minute
125 +       while (target.getAttribute('id') != 'statusmenu' && i<level) {
126 +       target = target.up();
127 +               i++;
128 +    }   
129 +    if (target) {
130 +               if(target.getAttribute('id') == 'statusmenu'){ //show/hide statusMenu
131 +                       if((event.up) && (event.up.altKey || event.up.metaKey))
132 +                               this.showStatusMenu(true);
133 +                       else
134 +                               this.showStatusMenu(false);
135 +               }                       
136 +    }
137 +},
138 +
139 +showStatusMenu: function(edit) {
140 +
141 +//     var stageController = Mojo.Controller.getAppController().getStageProxy("StatusMenu");
142 +//     if (stageController) {
143 +//             this.hideSystemMenus("status");
144 +//             stageController.delegateToSceneAssistant("toggleStatusMenu", edit);                     
145 +//     } else {
146 +//             this.statusMenuCreatedHandler = this.statusMenuCreated.bind(this);
147 +//             Mojo.Controller.getAppController().createStageWithCallback({name:"StatusMenu",lightweight: true}, 
148 +//                     this.statusMenuCreatedHandler, "menu");
149 +//     }
150 +},
151 +
152 +statusMenuCreated: function(stageController) {
153 +//     stageController.pushScene('statusmenu',this);
154 +},
155 +
156 +// Today menu
157 +
158 +todayMenuHandleTap: function(event) { //show/hide todaymenu
159 +
160 +       //Ignore the notification if it's in First Use.
161 +        if(PalmSystem.isMinimal)
162 +               return;
163 +
164 +       var target = event.target;
165 +       var i=0;
166 +       var level = 2; //up to 2 level, for hour, minute
167 +       while (target.getAttribute('id') != 'todaymenu' && i<level) {
168 +       target = target.up();
169 +               i++;
170 +    }   
171 +    if (target) {
172 +               if(target.getAttribute('id') == 'todaymenu'){ //show/hide todayMenu
173 +                       if((event.up) && (event.up.altKey || event.up.metaKey))
174 +                               this.showTodayMenu(true);
175 +                       else
176 +                               this.showTodayMenu(false);
177 +               }                       
178 +    }
179 +},
180 +
181 +showTodayMenu: function(edit) {
182 +
183 +//     var stageController = Mojo.Controller.getAppController().getStageProxy("TodayMenu");
184 +//     if (stageController) {
185 +//             this.hideSystemMenus("today");
186 +//             stageController.delegateToSceneAssistant("toggleTodayMenu", edit);                      
187 +//     } else {
188 +//             this.todayMenuCreatedHandler = this.todayMenuCreated.bind(this);
189 +//             Mojo.Controller.getAppController().createStageWithCallback({name:"TodayMenu",lightweight: true}, 
190 +//                     this.todayMenuCreatedHandler, "menu");
191 +//     }
192 +},
193 +
194 +todayMenuCreated: function(stageController) {
195 +//     stageController.pushScene('todaymenu',this);
196 +},
197 +
198 +// Device menu
199 +
200  deviceMenuHandleTap: function(event){//show/hide devicemenu
201         
202         //Ignore the notification if it's in First Use.
203 @@ -466,17 +591,21 @@
204                 i++;
205      }   
206      if (target) {
207 -               if(target.getAttribute('id') == 'devicemenu'){//show/hide deviceMenu
208 -                       this.showDeviceMenu();                                                                                          
209 +               if(target.getAttribute('id') == 'devicemenu'){ //show/hide deviceMenu
210 +                       if((event.up) && (event.up.altKey || event.up.metaKey))
211 +                               this.showDeviceMenu(true);
212 +                       else
213 +                               this.showDeviceMenu(false);
214                 }                       
215      }          
216  },
217  
218 -showDeviceMenu: function() {                   
219 +showDeviceMenu: function(edit) {                       
220                 
221                 var stageController = Mojo.Controller.getAppController().getStageProxy("DeviceMenu");
222                 if (stageController) {
223 -                       stageController.delegateToSceneAssistant("toggleDeviceMenu");                   
224 +                       this.hideSystemMenus("device");
225 +                       stageController.delegateToSceneAssistant("toggleDeviceMenu", edit);                     
226                 } else {
227                         this.deviceMenuCreatedHandler = this.deviceMenuCreated.bind(this);
228                         Mojo.Controller.getAppController().createStageWithCallback({name:"DeviceMenu",lightweight: true}, 
229 @@ -616,7 +745,10 @@
230                                 this.carrierTextEnglish = payload.extended.networkName.escapeHTML();
231                         } 
232                                 
233 -                       $('carrier').innerHTML = this.carrierText;              
234 +                       if(this.statusText != null)
235 +                               $('carrier').innerHTML = this.statusText;
236 +                       else
237 +                               $('carrier').innerHTML = this.carrierText;       
238                         if(payload.extended.registration == 'home') {                   
239                                 $('roaming').hide();
240                         }                                                               
241 @@ -682,9 +814,11 @@
242                         $('rssi').className = "bars-0";
243                         break;
244                 default:
245 -                       this.carrierText = this.$L('No service');
246 -                       this.carrierTextEnglish = "No service";
247 -                       $('carrier').innerHTML = this.carrierText;
248 +                       if(!this.airplaneMode) {
249 +                               this.carrierTextEnglish = "No service";
250 +                               this.carrierText = $L('No service');
251 +                               $('carrier').innerHTML = this.carrierText;
252 +                       }
253                         $('roaming').hide();
254                         break;                  
255         }
256 @@ -1020,7 +1154,11 @@
257                                         this.carrierTextEnglish = networkMsg.networkName.escapeHTML();
258                                 }       
259                                         
260 -                               $('carrier').innerHTML = this.carrierText;
261 +                               if(this.statusText != null)
262 +                                       $('carrier').innerHTML = this.statusText;
263 +                               else
264 +                                       $('carrier').innerHTML = this.carrierText;
265 +
266                                 this.simlocked = false;
267                                 
268                                 if(networkMsg.registration == 'home') {                                 
269 @@ -2822,6 +2960,14 @@
270                 });     
271  },
272  
273 +getAirplaneModeInProgress: function() {
274 +       return this.apModeInProgress;
275 +},
276 +
277 +setAirplaneModeInProgress: function(inprogress) {
278 +       this.apModeInProgress = inprogress;
279 +},
280 +
281  //Disable Airplane Mode by turning on Phone and other radios.
282  disableFlightMode: function() {
283         Mojo.Log.info("System UI - Disabling Airplane Mode");
284 --- .orig/usr/lib/luna/system/luna-systemui/app/views/bar/bar-scene.html
285 +++ /usr/lib/luna/system/luna-systemui/app/views/bar/bar-scene.html
286 @@ -6,16 +6,10 @@
287                         <span id='today'></span> 
288                 </div>
289         </div>
290 -       <div id="appmenu">               
291 -               <div id="carrier" class="carrier-wrapper truncating-text">
292 -               </div>                          
293 -               <div class="appname-container">
294 -                       <div id="appname" class="appname-wrapper truncating-text">
295 -                               <!-- Insert name here -->                  
296 -                       </div>  
297 -               </div>
298 -       </div>                   
299 -       
300 +
301 +       <div id="carrier" class="carrier-wrapper truncating-text">
302 +       </div>                          
303 +
304         <div id="devicemenu">
305                 <div id="power">
306                 </div>
307 @@ -36,4 +30,18 @@
308                 <div id="hac">
309                 </div>                  
310         </div>
311 +
312 +       <div id="statusmenu">               
313 +       </div>
314 +
315 +       <div id="todaymenu">               
316 +       </div>
317 +
318 +       <div id="appmenu">
319 +               <div class="appname-container">
320 +                       <div id="appname" class="appname-wrapper truncating-text">
321 +                               <!-- Insert name here -->                  
322 +                       </div>  
323 +               </div>
324 +       </div>                   
325  </div>
326 --- .orig/usr/palm/frameworks/mojo/submissions/347/stylesheets/global-menus.css
327 +++ /usr/palm/frameworks/mojo/submissions/347/stylesheets/global-menus.css
328 @@ -626,9 +626,11 @@
329    padding-top: 28px;
330  }
331  
332 -/* Application and Device Menus */
333 +/* Status, Today, Device and Application Menus */
334  
335  #palm-app-menu.palm-popup-container,
336 +#palm-status-menu.palm-popup-container,
337 +#palm-today-menu.palm-popup-container,
338  #palm-device-menu.palm-popup-container {
339    font-family: "Prelude" !important;
340    text-align: left !important;
341 @@ -648,6 +650,8 @@
342  }
343  
344  #palm-app-menu.palm-popup-container.palm-touch-rows-7,
345 +#palm-status-menu.palm-popup-container.palm-touch-rows-7,
346 +#palm-today-menu.palm-popup-container.palm-touch-rows-7,
347  #palm-device-menu.palm-popup-container.palm-touch-rows-7 {
348    -webkit-border-image: url(../images/system-menu-background-solid.png) 30 28 35 28 repeat repeat;
349  }
350 @@ -655,24 +659,48 @@
351  #palm-app-menu.palm-popup-container {
352    top: -2px;
353    left: -6px;
354 -  min-width: 278px;
355 +  min-width: 306px;
356 +  max-width: 306px;
357 +  max-height: 413px;
358 +}
359 +
360 +#palm-status-menu.palm-popup-container {
361 +  top: -2px;
362 +  left: -6px;
363 +  min-width: 306px;
364 +  max-width: 306px;
365 +  max-height: 413px;
366 +}
367 +
368 +#palm-today-menu.palm-popup-container {
369 +  top: -2px;
370 +  left: 8px;
371 +  min-width: 306px;
372 +  max-width: 306px;
373    max-height: 413px;
374  }
375  
376  #palm-device-menu.palm-popup-container {
377    top: -2px;
378    right: -6px;
379 -  min-width: 278px;
380 +  min-width: 306px;
381 +  max-width: 306px;
382    max-height: 413px;
383  }
384  
385  #palm-app-menu > .palm-popup-wrapper,
386 +#palm-status-menu > .palm-popup-wrapper,
387 +#palm-today-menu > .palm-popup-wrapper,
388  #palm-device-menu > .palm-popup-wrapper {
389    margin: -58px -21px -48px -52px;
390  }
391  
392  #palm-app-menu .palm-popup-fade-top,
393  #palm-app-menu .palm-popup-fade-bottom,
394 +#palm-status-menu .palm-popup-fade-top,
395 +#palm-status-menu .palm-popup-fade-bottom,
396 +#palm-today-menu .palm-popup-fade-top,
397 +#palm-today-menu .palm-popup-fade-bottom,
398  #palm-device-menu .palm-popup-fade-top,
399  #palm-device-menu .palm-popup-fade-bottom {
400    margin-right: 9px;
401 @@ -687,6 +715,25 @@
402    left: -32px;
403    bottom: -24px;
404  }
405 +
406 +#palm-status-menu .palm-popup-fade-top {
407 +  left: -32px;
408 +  top: -27px;
409 +}
410 +#palm-status-menu .palm-popup-fade-bottom {
411 +  left: -32px;
412 +  bottom: -24px;
413 +}
414 +
415 +#palm-today-menu .palm-popup-fade-top {
416 +  left: -32px;
417 +  top: -27px;
418 +}
419 +#palm-today-menu .palm-popup-fade-bottom {
420 +  left: -32px;
421 +  bottom: -24px;
422 +}
423 +
424  #palm-device-menu .palm-popup-fade-top {
425    left: -33px;
426    top: -27px;
427 @@ -698,50 +745,72 @@
428  
429  
430  #palm-app-menu .palm-popup-fade-top > .fade-background,
431 +#palm-status-menu .palm-popup-fade-top > .fade-background,
432 +#palm-today-menu .palm-popup-fade-top > .fade-background,
433  #palm-device-menu .palm-popup-fade-top > .fade-background {
434    -webkit-border-image: url(../images/system-menu-fade-top.png) 0 24 0 24 repeat repeat;
435  }
436  #palm-app-menu .palm-popup-fade-top > .fade-arrow,
437 +#palm-status-menu .palm-popup-fade-top > .fade-arrow,
438 +#palm-today-menu .palm-popup-fade-top > .fade-arrow,
439  #palm-device-menu .palm-popup-fade-top > .fade-arrow {
440    background: url(../images/palm-popup-fade-arrow-up-dark.png) center center no-repeat;
441  }
442  #palm-app-menu .palm-popup-fade-bottom > .fade-background,
443 +#palm-status-menu .palm-popup-fade-bottom > .fade-background,
444 +#palm-today-menu .palm-popup-fade-bottom > .fade-background,
445  #palm-device-menu .palm-popup-fade-bottom > .fade-background {
446    -webkit-border-image: url(../images/system-menu-fade-bottom.png) 0 24 0 24 repeat repeat;
447  }
448  #palm-app-menu .palm-popup-fade-bottom > .fade-arrow,
449 +#palm-status-menu .palm-popup-fade-bottom > .fade-arrow,
450 +#palm-today-menu .palm-popup-fade-bottom > .fade-arrow,
451  #palm-device-menu .palm-popup-fade-bottom > .fade-arrow {
452    background: url(../images/palm-popup-fade-arrow-down-dark.png) center center no-repeat;
453  }
454  
455  #palm-app-menu.palm-touch-rows-7 .palm-popup-fade-top > .fade-background,
456 +#palm-status-menu.palm-touch-rows-7 .palm-popup-fade-top > .fade-background,
457 +#palm-today-menu.palm-touch-rows-7 .palm-popup-fade-top > .fade-background,
458  #palm-device-menu.palm-touch-rows-7 .palm-popup-fade-top > .fade-background {
459    -webkit-border-image: url(../images/system-menu-fade-top-solid.png) 0 24 0 24 repeat repeat;
460  }
461  #palm-app-menu.palm-touch-rows-7 .palm-popup-fade-bottom > .fade-background,
462 +#palm-status-menu.palm-touch-rows-7 .palm-popup-fade-bottom > .fade-background,
463 +#palm-today-menu.palm-touch-rows-7 .palm-popup-fade-bottom > .fade-background,
464  #palm-device-menu.palm-touch-rows-7 .palm-popup-fade-bottom > .fade-background {
465    -webkit-border-image: url(../images/system-menu-fade-bottom-solid.png) 0 24 0 24 repeat repeat;
466  }
467  
468  #palm-app-menu .palm-popup-content,
469 +#palm-status-menu .palm-popup-content,
470 +#palm-today-menu .palm-popup-content,
471  #palm-device-menu .palm-popup-content {
472    margin: 31px 0 26px 31px;
473  }
474  
475  #palm-app-menu .palm-row,
476 +#palm-status-menu .palm-row,
477 +#palm-today-menu .palm-row,
478  #palm-device-menu .palm-row {
479    background: url(../images/list-separator-dark-taper.png) bottom left no-repeat;
480  }
481  
482  #palm-app-menu .palm-row.single,
483 +#palm-status-menu .palm-row.single,
484 +#palm-today-menu .palm-row.single,
485  #palm-device-menu .palm-row.single,
486  #palm-app-menu .palm-row.last,
487 +#palm-status-menu .palm-row.last,
488 +#palm-today-menu .palm-row.last,
489  #palm-device-menu .palm-row.last {
490    background: none;
491    -webkit-border-image: none;
492  }
493  
494  #palm-app-menu .label,
495 +#palm-status-menu .label,
496 +#palm-today-menu .label,
497  #palm-device-menu .label {
498    color: #AAA;
499    text-shadow: #333 0 -1px 0;
500 @@ -760,14 +829,20 @@
501  }
502  
503  #palm-app-menu .palm-row.selected,
504 +#palm-status-menu .palm-row.selected,
505 +#palm-today-menu .palm-row.selected,
506  #palm-device-menu .palm-row.selected,
507  #palm-app-menu .palm-row.selected.submenu-group,
508 +#palm-status-menu .palm-row.selected.submenu-group,
509 +#palm-today-menu .palm-row.selected.submenu-group,
510  #palm-device-menu .palm-row.selected.submenu-group {
511    background: none;
512    -webkit-border-image: url(../images/system-menu-selection-gradient-default.png) 24 20 24 20 repeat repeat;
513  }
514  
515  #palm-app-menu .palm-popup-content > .palm-list > .menu-start.selected,
516 +#palm-status-menu .palm-popup-content > .palm-list > .menu-start.selected,
517 +#palm-today-menu .palm-popup-content > .palm-list > .menu-start.selected,
518  #palm-device-menu .palm-popup-content > .palm-list > .menu-start.selected,
519  #palm-app-menu .palm-row.first.selected.submenu-group {
520    background: none;
521 @@ -775,18 +850,24 @@
522  }
523  
524  #palm-app-menu .palm-popup-content > .palm-list > .menu-end.selected,
525 +#palm-status-menu .palm-popup-content > .palm-list > .menu-end.selected,
526 +#palm-today-menu .palm-popup-content > .palm-list > .menu-end.selected,
527  #palm-device-menu .palm-popup-content > .palm-list > .menu-end.selected {
528    background: none;
529    -webkit-border-image: url(../images/system-menu-selection-gradient-last.png) 24 20 24 20 repeat repeat;
530  }
531  
532  #palm-app-menu .palm-row.submenu-group,
533 +#palm-status-menu .palm-row.submenu-group,
534 +#palm-today-menu .palm-row.submenu-group,
535  #palm-device-menu .palm-row.submenu-group {
536    -webkit-border-image: none;
537    background: url(../images/system-menu-section-divider.png) bottom left no-repeat;
538  }
539  
540  #palm-app-menu .palm-drawer-container,
541 +#palm-status-menu .palm-drawer-container,
542 +#palm-today-menu .palm-drawer-container,
543  #palm-device-menu .palm-drawer-container {
544    position: relative;
545    top: 0px;
546 @@ -797,6 +878,8 @@
547  }
548  
549  #palm-app-menu .palm-drawer-contents,
550 +#palm-status-menu .palm-drawer-contents,
551 +#palm-today-menu .palm-drawer-contents,
552  #palm-device-menu .palm-drawer-contents {
553    margin: 0;
554    position: relative;
555 @@ -804,16 +887,22 @@
556  }
557  
558  #palm-app-menu .palm-drawer-contents .palm-row .title,
559 +#palm-status-menu .palm-drawer-contents .palm-row .title,
560 +#palm-today-menu .palm-drawer-contents .palm-row .title,
561  #palm-device-menu .palm-drawer-contents .palm-row .title {
562    margin-left: 14px;
563  }
564  
565  #palm-app-menu .palm-row .title.dim,
566 +#palm-status-menu .palm-row .title.dim,
567 +#palm-today-menu .palm-row .title.dim,
568  #palm-device-menu .palm-row .title.dim {
569    color: #BBB;
570  }
571  
572  #palm-app-menu .palm-drawer-contents .palm-row .label,
573 +#palm-status-menu .palm-drawer-contents .palm-row .label,
574 +#palm-today-menu .palm-drawer-contents .palm-row .label,
575  #palm-device-menu .palm-drawer-contents .palm-row .label {
576    margin-right: 24px;
577  }
578 --- .orig/usr/lib/luna/system/luna-systemui/stylesheets/systemui.css
579 +++ /usr/lib/luna/system/luna-systemui/stylesheets/systemui.css
580 @@ -393,3 +393,27 @@
581                 height: 480px;
582                 background-color: black;
583  }
584 +
585 +#statusmenu {
586 +               color: #fff;
587 +               position: fixed;
588 +               margin: 0;
589 +               top: 0;
590 +               left: 0;
591 +               height: 28px;
592 +               width: 110px;
593 +               padding: 0;
594 +}
595 +
596 +#todaymenu {
597 +               color: #fff;
598 +               position: fixed;
599 +               margin: 0;
600 +               top: 0;
601 +               left: 110px;
602 +               right: 110px;
603 +               height: 28px;
604 +               width: 100px;
605 +               padding: 0;
606 +}
607 +
608 --- .orig/etc/palm/persistentWindows.conf
609 +++ /etc/palm/persistentWindows.conf
610 @@ -1,5 +1,7 @@
611  {
612                 "com.palm.systemui": [
613 +                       "StatusMenu",
614 +                       "TodayMenu",
615                         "DeviceMenu"
616                 ],
617