Reorganized everything into new structure
[webos-internals:adamrmcd-modifications.git] / phone / phone-no-alert-during-call.patch
1 Index: /usr/palm/applications/com.palm.app.phone/app/models/FormattedCall.js
2 ===================================================================
3 --- .orig/usr/palm/applications/com.palm.app.phone/app/models/FormattedCall.js
4 +++ /usr/palm/applications/com.palm.app.phone/app/models/FormattedCall.js
5 @@ -12,6 +12,22 @@ var FormattedCall =  Class.create({
6                 else
7                         this.formatCall(id, lineState);
8         },
9 +
10 +       getSSStatus: function() {
11 +               this.getSSStatusReq = AudioService.getSystemSoundStatus(this.getSSStatusQuery.bind(this));
12 +       },
13 +       
14 +       getSSStatusQuery: function(payload) {
15 +                if (!(payload === undefined)) {                                                                                                         
16 +                       Mojo.Log.error("SVC Initial Value: %j",payload.volume);                                                            
17 +                        SSVolume = payload.volume;                                                                                        
18 +                       AudioService.setSystemVolume(0,null,null);
19 +                } else {                                                                                                                    
20 +                        Mojo.Log.error("SVC No initial volume.  Setting to 50.");                                                             
21 +                        SSVolume = 50;               
22 +                        AudioService.setSystemVolume(0,null,null);
23 +               }       
24 +       },
25         
26         // given the line number and the service's list of calls
27         // build object whose properties will be Mojo.Rendered into
28 @@ -19,6 +35,10 @@ var FormattedCall =  Class.create({
29         formatConferenceCall: function(lineNumber, callMsg) {
30                 QDLogger.log( "formatConferenceCall");
31                 this.state = this.formatState(callMsg[lineNumber].state);
32 +               if (this.state === "Ended" || this.state === "Ending") {
33 +                       Mojo.Log.error("SVC resetting system volume for conference call");
34 +                       AudioService.setSystemVolume(SSVolume,null,null);
35 +               }
36          this.conferenceLabel = this.formatConferenceLabel();
37                 // TODO: not sure why i didn't have this in the first place
38                 this.contact = this.conferenceLabel;
39 @@ -49,6 +69,24 @@ var FormattedCall =  Class.create({
40                 this.lineNumber = lineNumber;
41                 this.id = callMsg[lineNumber].id;
42                 
43 +               try {
44 +                       SSVolume=SSVolume/1
45 +               } catch(err) {
46 +                       SSVolume = 101;
47 +               }
48 +               if (this.lineNumber == '0' && this.state == "") {
49 +                       if (SSVolume===101) {
50 +                               Mojo.Log.error("SVC setting system volume to 0");
51 +                               this.getSSStatus();
52 +                       }
53 +               }
54 +               if (this.state == "Ended" || this.state == "Ending") {
55 +                       if (SSVolume < 101) {
56 +                               Mojo.Log.error("SVC resetting system volume to %j",SSVolume);
57 +                               AudioService.setSystemVolume(SSVolume,null,null);
58 +                               SSVolume = 101;
59 +                       }
60 +               }
61                 // ensure empty label is displayed as empty
62                 this.displayLabel = (callMsg[lineNumber].contact.labelFormatted ? callMsg[lineNumber].contact.labelFormatted : "");
63                 this.numberCaption = ((callMsg[lineNumber].contact.name !== undefined || callMsg[lineNumber].contact.id !== undefined) ? this.number : " ");
64 Index: /usr/palm/applications/com.palm.app.phone/app/models/audio-luna-service.js
65 ===================================================================
66 --- /dev/null
67 +++ /usr/palm/applications/com.palm.app.phone/app/models/audio-luna-service.js
68 @@ -0,0 +1,35 @@
69 +/* Copyright 2009 Palm, Inc.  All rights reserved. */
70 +
71 +var AudioService = Class.create({ 
72 +       initialize: function() { 
73 +       }
74 +});
75 +    
76 +AudioService.setSystemVolume = function(volume,callback, sceneController) {
77 +       var request = new Mojo.Service.Request(AudioService.system_identifier, {
78 +               method: 'setVolume',
79 +               parameters: {volume:volume },
80 +               onSuccess: function(response) {
81 +               if(callback)
82 +                       callback(response);
83 +               },
84 +               onFailure: function(response) {
85 +               if(callback)
86 +                       callback(response);
87 +               },                      
88 +       });
89 +       return request;
90 +}
91 +
92 +AudioService.getSystemSoundStatus = function(callback) {
93 +   var request = new Mojo.Service.Request(AudioService.system_identifier, {
94 +         method: 'status',
95 +         parameters: {"subscribe": false},
96 +         onSuccess: callback,
97 +         onFailure: callback
98 +   });
99 +   return request;
100 +}
101 +                                       
102 +AudioService.system_identifier = 'palm://com.palm.audio/system';
103 +
104 Index: /usr/palm/applications/com.palm.app.phone/sources.json
105 ===================================================================
106 --- .orig/usr/palm/applications/com.palm.app.phone/sources.json
107 +++ /usr/palm/applications/com.palm.app.phone/sources.json
108 @@ -1,5 +1,8 @@
109  [
110    {
111 +    "source": "app\/models\/audio-luna-service.js"
112 +  },
113 +  {
114      "source": "app\/models\/QDLogger.js"
115    },
116    {