4 New, 2 updated patches.
[webos-internals:imagineer1981s-modifications.git] / app-launcher / app-launcher-advanced-options-in-launcher.patch
1 Name: Advanced Options in Launcher
2 Version: 1.3.5.1-1
3 Author: Jason Robitaille
4 Description: Adds additional options to the launcher's menu: turn on/off DevMode, rescan fileindexer, and rescan applications  (MIT license)
5
6 --- .orig/usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js
7 +++ /usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js
8 @@ -28,6 +28,7 @@
9                         Mojo.Menu.editItem,
10                         { label: $L('List Apps...'), command: 'listapps' },
11                         { label: $L('Default Applications'), command: 'defaultapps'},
12 +                       { label: $L('Advanced Options'), command: 'advanced'},
13                         Mojo.Menu.helpItem
14                 ]
15      },
16 @@ -115,6 +116,84 @@
17         handleCommand: function(event) {
18                 if (event.type == Mojo.Event.command) {
19                         switch (event.command) {
20 +                               case 'advanced':
21 +                                       this.showQLBar = true;
22 +                                       if(this.kQuickLaunchHeight==0) {
23 +                                               this.showQLBar = false;
24 +                                       } else {
25 +                                               SystemManagerService.showQuickLaunch(false);
26 +                                       }
27 +                                       this.controller.serviceRequest('palm://com.palm.connectionmanager', {
28 +                                               method: 'getnovacommode',
29 +                                               parameters: {},
30 +                                               onSuccess: function(response){
31 +                                                       var choices = [
32 +                                                               {label:"Toggle DevMode", value:'devmode'}, 
33 +                                                               {label:"Rescan Fileindexer", value:'fileindexer'},
34 +                                                               {label:"Rescan Applications", value:'rescanapps'},
35 +                                                               {label:"Cancel", value:'cancel', type:'secondary'}
36 +                                                       ];
37 +                                                       this.inDevMode = response.isEnabled;
38 +                                                       if(this.inDevMode) {
39 +                                                               choices[0].label = "Turn off DevMode";
40 +                                                       } else {
41 +                                                               choices[0].label = "Turn on DevMode";
42 +                                                       }
43 +                                                       this.controller.showAlertDialog({
44 +                                                               onChoose: function(value) {
45 +                                                                       if(value=='devmode') {
46 +                                                                               this.controller.showAlertDialog({
47 +                                                                                       onChoose: function(value){
48 +                                                                                               if(value=='reset') {
49 +                                                                                                       this.controller.serviceRequest('palm://com.palm.connectionmanager', {
50 +                                                                                                               method: 'getnovacommode',
51 +                                                                                                               parameters: {
52 +                                                                                                                       isEnabled:!this.inDevMode
53 +                                                                                                               },
54 +                                                                                                               onSuccess: function() {
55 +                                                                                                                       this.controller.serviceRequest('palm://com.palm.power/shutdown', {
56 +                                                                                                                               method: 'machineReboot',
57 +                                                                                                                               parameters: {
58 +                                                                                                                                       reason:"User initiated/DevMode status change"
59 +                                                                                                                               }
60 +                                                                                                                       });
61 +                                                                                                               }.bind(this)
62 +                                                                                                       });
63 +                                                                                               }
64 +                                                                                               SystemManagerService.showQuickLaunch(this.showQLBar);
65 +                                                                                       }.bind(this), 
66 +                                                                                       title: "Restart Device?",
67 +                                                                                       message: "Your device needs to restart for this action to happen.",
68 +                                                                                       preventCancel: false,
69 +                                                                                       choices: [
70 +                                                                                               {label:"Continue and reset", value:'reset', type:'negative'},
71 +                                                                                               {label:"Cancel", value:'cancel'}
72 +                                                                                       ]
73 +                                                                               });
74 +                                                                       } else if(value=='fileindexer') {
75 +                                                                               this.controller.serviceRequest('palm://ca.canucksoftware.filemgr', {
76 +                                                                                       method: 'rescanFileindexer',
77 +                                                                                       parameters: {}
78 +                                                                               });
79 +                                                                               SystemManagerService.showQuickLaunch(this.showQLBar);
80 +                                                                       } else if(value=='rescanapps') {
81 +                                                                               this.controller.serviceRequest('com.palm.applicationManager', {
82 +                                                                                       method: 'rescan',
83 +                                                                                       parameters: {}
84 +                                                                               });
85 +                                                                               SystemManagerService.showQuickLaunch(this.showQLBar);
86 +                                                                       } else {
87 +                                                                               SystemManagerService.showQuickLaunch(this.showQLBar);
88 +                                                                       }
89 +                                                               }.bind(this),
90 +                                                               title: "Advanced Options",
91 +                                                               message: "",
92 +                                                               preventCancel: false,
93 +                                                               choices: choices
94 +                                                       });
95 +                                               }.bind(this)
96 +                                       });
97 +                                       break;
98                                 case Mojo.Menu.helpCmd:
99                                         ApplicationService.launch(this.helpInfo.id, this.helpInfo.params);
100                                         break;