10 New, 4 Modified patches for 1.3.5
[webos-internals: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,77 @@
17         handleCommand: function(event) {
18                 if (event.type == Mojo.Event.command) {
19                         switch (event.command) {
20 +                               case 'advanced':
21 +                                       SystemManagerService.showQuickLaunch(false);
22 +                                       this.controller.serviceRequest('palm://com.palm.connectionmanager', {
23 +                                               method: 'getnovacommode',
24 +                                               parameters: {},
25 +                                               onSuccess: function(response){
26 +                                                       var choices = [
27 +                                                               {label:"Toggle DevMode", value:'devmode'}, 
28 +                                                               {label:"Rescan Fileindexer", value:'fileindexer'},
29 +                                                               {label:"Rescan Applications", value:'rescanapps'},
30 +                                                               {label:"Cancel", value:'cancel', type:'secondary'}
31 +                                                       ];
32 +                                                       this.inDevMode = response.isEnabled;
33 +                                                       if(this.inDevMode) {
34 +                                                               choices[0].label = "Turn off DevMode";
35 +                                                       } else {
36 +                                                               choices[0].label = "Turn on DevMode";
37 +                                                       }
38 +                                                       this.controller.showAlertDialog({
39 +                                                               onChoose: function(value) {
40 +                                                                       if(value=='devmode') {
41 +                                                                               this.controller.showAlertDialog({
42 +                                                                                       onChoose: function(value){
43 +                                                                                               if(value=='reset') {
44 +                                                                                                       this.controller.serviceRequest('palm://com.palm.connectionmanager', {
45 +                                                                                                               method: 'setnovacommode',
46 +                                                                                                               parameters: {
47 +                                                                                                                       isEnabled:!this.inDevMode
48 +                                                                                                               },
49 +                                                                                                               onSuccess: function() {
50 +                                                                                                                       this.controller.serviceRequest('palm://com.palm.power/shutdown', {
51 +                                                                                                                               method: 'machineReboot',
52 +                                                                                                                               parameters: {
53 +                                                                                                                                       reason:"User initiated/DevMode status change"
54 +                                                                                                                               }
55 +                                                                                                                       });
56 +                                                                                                               }.bind(this)
57 +                                                                                                       });
58 +                                                                                               }
59 +                                                                                               SystemManagerService.showQuickLaunch(true);
60 +                                                                                       }.bind(this), 
61 +                                                                                       title: "Restart Device?",
62 +                                                                                       message: "Your device needs to restart for this action to happen.",
63 +                                                                                       choices: [
64 +                                                                                               {label:"Continue and reset", value:'reset', type:'negative'},
65 +                                                                                               {label:"Cancel", value:'cancel'}
66 +                                                                                       ]
67 +                                                                               });
68 +                                                                       } else if(value=='fileindexer') {
69 +                                                                               this.controller.serviceRequest('palm://ca.canucksoftware.filemgr', {
70 +                                                                                       method: 'rescanFileindexer',
71 +                                                                                       parameters: {}
72 +                                                                               });
73 +                                                                               SystemManagerService.showQuickLaunch(true);
74 +                                                                       } else if(value=='rescanapps') {
75 +                                                                               this.controller.serviceRequest('com.palm.applicationManager', {
76 +                                                                                       method: 'rescan',
77 +                                                                                       parameters: {}
78 +                                                                               });
79 +                                                                               SystemManagerService.showQuickLaunch(true);
80 +                                                                       } else {
81 +                                                                               SystemManagerService.showQuickLaunch(true);
82 +                                                                       }
83 +                                                               }.bind(this),
84 +                                                               title: "Advanced Options",
85 +                                                               message: "",
86 +                                                               choices: choices
87 +                                                       });
88 +                                               }.bind(this)
89 +                                       });
90 +                                       break;
91                                 case Mojo.Menu.helpCmd:
92                                         ApplicationService.launch(this.helpInfo.id, this.helpInfo.params);
93                                         break;