Patches.
[webos-internals:modifications.git] / messaging / messaging-message-signature.patch
1 diff --git a/usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js b/usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js
2 index 484cd45..f8d1f47 100644
3 --- a/usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js
4 +++ b/usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js
5 @@ -41,6 +41,7 @@ var ChatviewAssistant = Class.create({
6                 this.selectedTransport = {};
7                 this.IMAddressSubscriptions = [];
8                 this.attachment;
9 +               this.msgSignature = "";
10                 this.messageTextElement;
11                 this.hasLoadedChatList = false;
12                 this.attemptedToFixChatWithBadPersonId = false;
13 @@ -2486,10 +2487,19 @@ var ChatviewAssistant = Class.create({
14                         }
15                 }
16                 
17 +               this.cookie = new Mojo.Model.Cookie("com.palm.app.messaging.messagesignature");
18 +               if (this.cookie) {
19 +                       var cookie = this.cookie.get();
20 +                       if (cookie) {                   
21 +                               if(cookie.messageSignature) {
22 +                                       this.msgSignature = cookie.messageSignature;
23 +                               }
24 +                       }
25 +               }
26                 var params = {
27                         chatThreadId: this.chatThreadId,
28                         recipient: recipient,
29 -                       messageText: message
30 +                       messageText: message + this.msgSignature
31                 };
32                 if (this.selectedTransport.contactPointId) 
33                         params.contactPointId = this.selectedTransport.contactPointId;
34 diff --git a/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js b/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js
35 index 3183de4..e665681 100644
36 --- a/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js
37 +++ b/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js
38 @@ -5,6 +5,7 @@ var ComposeAssistant = Class.create({
39                 this.appController = Mojo.Controller.getAppController();
40                 this.Messaging = this.appController.Messaging;
41                 this.attachment;
42 +               this.msgSignature = "";
43                 this.messageTextElement;
44                 this.prePopulatedRecipients = [];
45                 this.sendMessageCount = 0;      // keep a count of how many times we call send so we know when the last callback is hit
46 @@ -273,9 +274,18 @@ var ComposeAssistant = Class.create({
47                 if(!this.handleSentMessageResponse) {
48                         this.handleSentMessageResponse = this._handleSentMessageResponse.bind(this);
49                 }
50 +               this.cookie = new Mojo.Model.Cookie("com.palm.app.messaging.messagesignature");
51 +               if (this.cookie) {
52 +                       var cookie = this.cookie.get();
53 +                       if (cookie) {                   
54 +                               if(cookie.messageSignature) {
55 +                                       this.msgSignature = cookie.messageSignature;
56 +                               }
57 +                       }
58 +               }
59                 var params = {
60                         recipientJSONArray: recipientsArray,
61 -               messageText: message,
62 +               messageText: message + this.msgSignature,
63                 onSuccess: this.handleSentMessageResponse
64                 };
65                 if (this.attachment) { // sending an attachment
66 diff --git a/usr/palm/applications/com.palm.app.messaging/app/controllers/prefsAccountSummary-assistant.js b/usr/palm/applications/com.palm.app.messaging/app/controllers/prefsAccountSummary-assistant.js
67 index 50c8e26..94a3d10 100644
68 --- a/usr/palm/applications/com.palm.app.messaging/app/controllers/prefsAccountSummary-assistant.js
69 +++ b/usr/palm/applications/com.palm.app.messaging/app/controllers/prefsAccountSummary-assistant.js
70 @@ -31,6 +31,17 @@ var PrefsAccountSummaryAssistant = Class.create({
71          this.controller.get('phoneNumber').update(MessagingUtils.formatPhoneNumber(MessagingUtils.handleGetOwnPhoneNumber(data.phoneNumber)));
72        }).bind(this));  
73     
74 +      this.signatureModel = {
75 +        'msgSignature': '',
76 +               'listTitle':$L('Signature')
77 +      };
78 +      this.controller.setupWidget('msgSignature', {
79 +        modelProperty: "msgSignature",
80 +        maxLength: 30
81 +      }, this.signatureModel);
82 +      this.controller.get('msgSignature').observe(Mojo.Event.propertyChanged, this.msgSignatureChanged.bindAsEventListener(this));
83 +         this.currentSignature();
84 +       
85        this.controller.listen('preferences-accounts',Mojo.Event.listTap, this.handleAccountListTap);      
86        this.controller.listen('addAccountButton',Mojo.Event.tap, this.handleAddAccountTap);   
87     
88 @@ -43,6 +54,7 @@ var PrefsAccountSummaryAssistant = Class.create({
89                 if (this.saveSMSPrefs) {
90                         this.controller.stopListening('savePrefs', Mojo.Event.tap, this.saveSMSPrefs);
91                 }
92 +      this.controller.get('msgSignature').stopObserving(Mojo.Event.propertyChanged, this.msgSignatureChanged.bindAsEventListener(this));
93        this.controller.stopListening('notificationToggle',Mojo.Event.propertyChange,this.notificationToggleChanged);
94        this.controller.stopListening('notificationSoundSelector',Mojo.Event.propertyChange,this.notificationSoundToggleChanged);                
95        this.controller.stopListening('autoDownloadToggle',Mojo.Event.propertyChange,this.autoDownloadToggleChanged);
96 @@ -193,6 +205,27 @@ var PrefsAccountSummaryAssistant = Class.create({
97        this.requests.push(MessagingMojoService.getMMSSettings(this.renderEditMMSSettings.bind(this), this.controller)); 
98      },
99      
100 +    msgSignatureChanged: function(event){
101 +               this.msgSignature = event.value;
102 +               this.cookie.put({messageSignature: this.msgSignature});
103 +    },
104 +       
105 +    currentSignature: function() {
106 +               this.cookie = new Mojo.Model.Cookie("com.palm.app.messaging.messagesignature");
107 +               if (this.cookie) {
108 +                       var cookie = this.cookie.get();
109 +                       if (cookie) {                   
110 +                               if(cookie.messageSignature) {
111 +                                       this.msgSignature = cookie.messageSignature;
112 +                               }
113 +                       }
114 +               } else {
115 +                       this.msgSignature = "";
116 +               }
117 +               this.signatureModel.msgSignature = this.msgSignature;
118 +        this.controller.modelChanged(this.signatureModel);            
119 +       },
120 +       
121      prefsNotification: function() {
122        // The notification prefs were loaded on headless app boot
123        var messagingPrefs = this.Messaging.messagingPrefs;
124 diff --git a/usr/palm/applications/com.palm.app.messaging/app/views/prefsAccountSummary/prefsAccountSummary-scene.html b/usr/palm/applications/com.palm.app.messaging/app/views/prefsAccountSummary/prefsAccountSummary-scene.html
125 index 03d2b66..37f3849 100644
126 --- a/usr/palm/applications/com.palm.app.messaging/app/views/prefsAccountSummary/prefsAccountSummary-scene.html
127 +++ b/usr/palm/applications/com.palm.app.messaging/app/views/prefsAccountSummary/prefsAccountSummary-scene.html
128 @@ -6,6 +6,21 @@
129      </div>
130    </div>
131  
132 +    <div class="palm-group">
133 +        <div class="palm-group-title">
134 +            <span x-mojo-loc="">Outgoing signature (30 chars)</span>
135 +        </div>
136 +        <div class="palm-list">
137 +            <div class='palm-row single'>
138 +                <div class="palm-row-wrapper textfield-group" x-mojo-focus-highlight="true">
139 +                    <div class="title">
140 +                        <div id="msgSignature" name="msgSignature" x-mojo-element="TextField">
141 +                        </div>
142 +                    </div>
143 +                </div>
144 +            </div>
145 +        </div>
146 +    </div>
147         <div class="palm-group">
148                 <div class="palm-group-title" x-mojo-loc=''>
149                         New message