updateds
[webos-internals:modifications.git] / phone / phone-close-slider-to-end-regular-phone-calls-only.patch
1 diff --git a/usr/palm/applications/com.palm.app.phone/app/controllers/activecall-assistant.js b/usr/palm/applications/com.palm.app.phone/app/controllers/activecall-assistant.js
2 index 148d8ba..e98daf9 100644
3 --- a/usr/palm/applications/com.palm.app.phone/app/controllers/activecall-assistant.js
4 +++ b/usr/palm/applications/com.palm.app.phone/app/controllers/activecall-assistant.js
5 @@ -24,6 +24,17 @@ var ActivecallAssistant = Class.create({
6         },
7         
8         initialize: function(params){
9 +//BEGIN Slider Patch block 1 of 3
10 +               var request = new Mojo.Service.Request('palm://com.palm.keys/switches', {
11 +                method: 'status',
12 +                parameters: {"get" : "slider"},
13 +                               onFailure: function() {
14 +                                               //QDLogger.log("Slider: Failed to get slider status");
15 +                                       },
16 +                               onSuccess: this.getSliderPos.bind(this)
17 +                       });
18 +               this.sliderSubscriptionx = TelephonyCommands.sliderSubscribe(this.onSliderEventDuringCall.bind(this));
19 +//END Slider Patch block 1 of 3
20             this.appAssistant = Mojo.Controller.getAppController().assistant;
21                 this.eventListener = this.appAssistant.telephonyEventListener;
22                 this.announcer = this.appAssistant.announcer;
23 @@ -462,6 +473,41 @@ break;
24                 }
25  
26      },
27 +
28 +//BEGIN Slider Patch block 2 of 3
29 +    getSliderPos:  function(response) {
30 +               if (response.key === "slider") {
31 +                       this.sliderPos = response.state;
32 +               }
33 +    },
34 +       onSliderEventDuringCall: function(response) {
35 +               if (response && response.key && response.state) {
36 +               } else {
37 +                       return;
38 +               }
39 +               
40 +               var scenarios = this.appAssistant.telephonyEventListener.getAvailableAudioScenarios();
41 +               var frontSpeaker = false;
42 +               
43 +        if(this.audioActiveProfile == "phone_front_speaker") frontSpeaker = true;
44 +        
45 +               if (response.key == "slider"&&frontSpeaker) {
46 +                       if (this.sliderPos=='up'&&response.state == "down") {
47 +                               //First, "tap" each Disconnect Button.
48 +                               for (i = 0; i < 3; i++) {
49 +                                       if (this.controller.get("disc_button_" + i)) {
50 +                                               Mojo.Event.send(this.controller.get("disc_button_" + i), Mojo.Event.tap);
51 +                                       }
52 +                               }
53 +                               //In case the Disconnect Buttons don't work, or there are calls not disconnected, just call the function to disconnect all calls.
54 +                               //The reason we don't just do this one function is that the screen redraw is not pretty.
55 +                               this.eventListener.disconnectAllCalls();
56 +                       }
57 +                       this.sliderPos = response.state;
58 +               } 
59 +       },
60 +//END Slider Patch block 2 of 3
61 +    
62         
63         // sets up pause/wait digit handling 
64         handlePauseWaitDigits: function(callStateMessage) {
65 @@ -1302,6 +1348,9 @@ break;
66                 this.controller.document.removeEventListener("mouseup", this.boundEndContinuousDTMF);
67          this.controller.document.removeEventListener('keydown', this.boundStartDTMFHardKey);
68          this.controller.document.removeEventListener('keyup', this.boundEndDTMFHardKey);
69 +//BEGIN Slider Patch block 3 of 3
70 +               this.sliderSubscriptionx.cancel();      //remove slider listener
71 +//END Slider Patch block 3 of 3
72                 
73                 // drop puck subscription
74                 this.puckSubscription.cancel();