Renamed patch from previous commit.
[webos-internals:shivaramv-modifications.git] / phone / phone-close-slide-to-end-call.patch
1 Index: /usr/palm/applications/com.palm.app.phone/app/controllers/activecall-assistant.js
2 ===================================================================
3 --- .orig/usr/palm/applications/com.palm.app.phone/app/controllers/activecall-assistant.js
4 +++ /usr/palm/applications/com.palm.app.phone/app/controllers/activecall-assistant.js
5 @@ -20,6 +20,19 @@ var ActivecallAssistant = Class.create({
6         },
7         
8         initialize: function(params){
9 +
10 +//BEGIN Slider Patch block 1 of 3
11 +               var request = new Mojo.Service.Request('palm://com.palm.keys/switches', {
12 +                method: 'status',
13 +                parameters: {"get" : "slider"},
14 +                               onFailure: function() {
15 +                                               QDLogger.log("Slider: Failed to get slider status");
16 +                                       },
17 +                               onSuccess: this.getSliderPos.bind(this)
18 +                       });
19 +               this.sliderSubscriptionx = TelephonyCommands.sliderSubscribe(this.onSliderEventDuringCall.bind(this));
20 +//END Slider Patch block 1 of 3
21 +               
22             this.appAssistant = Mojo.Controller.getAppController().assistant;
23                 this.eventListener = this.appAssistant.telephonyEventListener;
24                 this.announcer = this.appAssistant.announcer;
25 @@ -139,7 +152,44 @@ var ActivecallAssistant = Class.create({
26                 this.controller.setupWidget(Mojo.Menu.appMenu, {omitDefaultItems: false}, appMenuModel);
27                 
28      },
29 -
30 +    
31 +//BEGIN Slider Patch block 2 of 3
32 +    getSliderPos:  function(response) {
33 +               QDLogger.log("****getting slider position****");
34 +               if (response.key === "slider") {
35 +                       this.sliderPos = response.state;
36 +                       QDLogger.log("Slider Position:", response.state);
37 +               }
38 +    },
39 +       onSliderEventDuringCall: function(response) {
40 +               if (response && response.key && response.state) {
41 +                       QDLogger.log( "ActivecallAssistant#onSliderEvent", response.key  , response.state);
42 +               } else {
43 +                       return;
44 +               }
45 +               if (response.key == "slider") {
46 +                       QDLogger.log( "log: ", this.sliderPos, response.state);
47 +                       if (this.sliderPos=='up'&&response.state == "down") {
48 +                               QDLogger.log( "**********UP DOWN************");
49 +                               //First, "tap" each Disconnect Button.
50 +                               for (i = 0; i < 3; i++) {
51 +                                       if (this.controller.get("disc_button_" + i)) {
52 +                                               QDLogger.log( "**** disconnecting line:" + i + "****");
53 +                                               Mojo.Event.send(this.controller.get("disc_button_" + i), Mojo.Event.tap);
54 +                                       }
55 +                               }
56 +                               QDLogger.log( "******** end loop **********");
57 +                               //In case the Disconnect Buttons don't work, or there are calls not disconnected, just call the function to disconnect all calls.
58 +                               //The reason we don't just do this one function is that the screen redraw is not pretty.
59 +                               QDLogger.log( "********disconnecting all calls********");
60 +                               this.eventListener.disconnectAllCalls();
61 +                               QDLogger.log( "********finished routine********");
62 +                       }
63 +                       this.sliderPos = response.state;
64 +               } 
65 +       },
66 +//END Slider Patch block 2 of 3
67 +       
68         handleCommand: function(event) {
69                 if (event.type == Mojo.Event.command) {
70                         switch (event.command) {
71 @@ -1230,6 +1280,10 @@ break;
72          this.controller.document.removeEventListener('keydown', this.boundStartDTMFHardKey);
73          this.controller.document.removeEventListener('keyup', this.boundEndDTMFHardKey);
74                 
75 +//BEGIN Slider Patch block 3 of 3
76 +               this.sliderSubscriptionx.cancel();      //remove slider listener
77 +//END Slider Patch block 3 of 3
78 +
79                 // drop puck subscription
80                 this.puckSubscription.cancel();
81                 delete this.puckSubscription;
82