new patch
[webos-internals:skurriers-modifications.git] / messaging / messaging-character-counter---vzw.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 29204c4..3b6df6d 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 @@ -568,7 +568,12 @@ var ChatviewAssistant = Class.create({
6                                 segmentCountContainer: this.controller.get('segmentCounterContainer'),
7                                 segmentCountElement: this.controller.get('segmentCounter'),
8                                 setTextFieldValueFn: this.setTextFieldValue.bind(this)
9 -                       }
10 +                       },
11 +                       charCounter: {
12 +                               charCountContainer: this.controller.get('charCounterContainer'),
13 +                               charCountElement: this.controller.get('charCounter'),
14 +                               setTextFieldValueFn: this.setTextFieldValue.bind(this)
15 +                       }
16                 };
17  
18                 this.characterCounter = new CharacterCounter(this.controller, this.Messaging.platformType, this.Messaging.carrier, this.messageTextElement, charCounterParams);
19 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
20 index 57dfb0f..35b9b71 100644
21 --- a/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js
22 +++ b/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js
23 @@ -217,7 +217,12 @@ var ComposeAssistant = Class.create({
24                                 segmentCountContainer: this.controller.get('segmentCounterContainer'),
25                                 segmentCountElement: this.controller.get('segmentCounter'),
26                                 setTextFieldValueFn: this.setTextFieldValue.bind(this)
27 -                       }
28 +                       },
29 +                       charCounter: {
30 +                               charCountContainer: this.controller.get('charCounterContainer'),
31 +                               charCountElement: this.controller.get('charCounter'),
32 +                               setTextFieldValueFn: this.setTextFieldValue.bind(this)
33 +                       }
34                 };
35  
36                 this.characterCounter = new CharacterCounter(this.controller,this.Messaging.platformType,this.Messaging.carrier,this.messageTextElement,charCounterParams);
37 diff --git a/usr/palm/applications/com.palm.app.messaging/app/utilities/CharacterCounter.js b/usr/palm/applications/com.palm.app.messaging/app/utilities/CharacterCounter.js
38 index 96decfe..f4c9ff9 100644
39 --- a/usr/palm/applications/com.palm.app.messaging/app/utilities/CharacterCounter.js
40 +++ b/usr/palm/applications/com.palm.app.messaging/app/utilities/CharacterCounter.js
41 @@ -54,7 +54,10 @@ var CharacterCounter = Class.create({
42                                 containerElement: null,
43                                 valueElement: null
44                         };
45 -                       
46 +                       var charCounterUI = {
47 +                               containerElement: null,
48 +                               valueElement: null
49 +                       };
50                                                 
51                         // TODO: eventually we might want to implement some cleverness that counts
52                         // bytes so we can accurately limit text that includes UTF-8 characters.
53 @@ -414,6 +417,20 @@ var CharacterCounter = Class.create({
54                                 }
55                         };
56                         
57 +                       var setCurrentCharCount = function(newCharCount) {
58 +                               if(charCounterUI.valueElement)
59 +                                       charCounterUI.valueElement.update(newCharCount);
60 +                               if(charCounterUI.containerElement) {
61 +                                       if (newCharCount == 0) {
62 +                                               if (charCounterUI.containerElement.visible())
63 +                                                       charCounterUI.containerElement.hide();
64 +                                       } else {
65 +                                               if (!charCounterUI.containerElement.visible())
66 +                                                       charCounterUI.containerElement.show();
67 +                                       }
68 +                               }
69 +                       };
70 +               
71                         return {
72                                 
73                                 init: function(controller,platform,carrier,textElement,params) {
74 @@ -522,6 +539,13 @@ var CharacterCounter = Class.create({
75                                                                 setTextFieldValueFn = params.segmentCounter.setTextFieldValueFn;
76                                                         }                                               
77                                                 }
78 +                                               if(params.charCounter) {
79 +                                                       charCounterUI.containerElement = params.charCounter.charCountContainer;
80 +                                                       charCounterUI.valueElement = params.charCounter.charCountElement;
81 +                                                       if(params.charCounter.setTextFieldValueFn) {
82 +                                                               setTextFieldValueFn = params.charCounter.setTextFieldValueFn;
83 +                                                       }                                               
84 +                                               }
85  
86                                         }                                       
87                                 },
88 @@ -582,7 +606,7 @@ var CharacterCounter = Class.create({
89                                         this.resetTimer = undefined;
90  
91                                         var rawCharacterData = getRawCharacterData();
92 -                                       
93 +                                       setCurrentCharCount(rawCharacterData.count);
94  //                                     if (rawCharacterData.count > 69){
95  //                                             recheckAllTextForNonGsm = true;
96  //                                             Mojo.Log.info("text changed, looking for char size");
97 diff --git a/usr/palm/applications/com.palm.app.messaging/app/views/chatview/chatview-scene.html b/usr/palm/applications/com.palm.app.messaging/app/views/chatview/chatview-scene.html
98 index e1f7235..e293b25 100644
99 --- a/usr/palm/applications/com.palm.app.messaging/app/views/chatview/chatview-scene.html
100 +++ b/usr/palm/applications/com.palm.app.messaging/app/views/chatview/chatview-scene.html
101 @@ -25,6 +25,10 @@
102                         <div id="messageContainer" class="palm-row view-#{availabilityClass}">
103                                 <div class="palm-row-wrapper textfield-group focused">
104                                         <div class="title">
105 +                                               <div id="charCounterContainer" style="display: none;">
106 +                                                       <div id="charCounter">
107 +                                                       </div>
108 +                                               </div>
109                                                 <div id="attachmentContainer" style="display: none;">
110                                                         <div id="cancelAttachment">
111                                                         </div>
112 diff --git a/usr/palm/applications/com.palm.app.messaging/app/views/compose/compose-scene.html b/usr/palm/applications/com.palm.app.messaging/app/views/compose/compose-scene.html
113 index 79fca4a..8be374b 100644
114 --- a/usr/palm/applications/com.palm.app.messaging/app/views/compose/compose-scene.html
115 +++ b/usr/palm/applications/com.palm.app.messaging/app/views/compose/compose-scene.html
116 @@ -10,6 +10,10 @@
117                 <div id="messageContainer" class='palm-row'>
118                         <div class="palm-row-wrapper textfield-group focused">
119                                 <div class="title">
120 +                                       <div id="charCounterContainer" style="display: none;">
121 +                                               <div id="charCounter">
122 +                                               </div>
123 +                                       </div>
124                                         <div id="attachmentContainer" style="display: none;">
125                                                 <div id="cancelAttachment">
126                                                 </div>
127 diff --git a/usr/palm/applications/com.palm.app.messaging/resources/es/views/chatview/chatview-scene.html b/usr/palm/applications/com.palm.app.messaging/resources/es/views/chatview/chatview-scene.html
128 index 3bff455..94a41f4 100644
129 --- a/usr/palm/applications/com.palm.app.messaging/resources/es/views/chatview/chatview-scene.html
130 +++ b/usr/palm/applications/com.palm.app.messaging/resources/es/views/chatview/chatview-scene.html
131 @@ -25,6 +25,10 @@
132                         <div id="messageContainer" class="palm-row view-#{availabilityClass}">
133                                 <div class="palm-row-wrapper textfield-group focused">
134                                         <div class="title">
135 +                                               <div id="charCounterContainer" style="display: none;">
136 +                                                       <div id="charCounter">
137 +                                                       </div>
138 +                                               </div>
139                                                 <div id="attachmentContainer" style="display: none;">
140                                                         <div id="cancelAttachment">
141                                                         </div>
142 diff --git a/usr/palm/applications/com.palm.app.messaging/stylesheets/messaging.css b/usr/palm/applications/com.palm.app.messaging/stylesheets/messaging.css
143 index 59607ca..d9bfda2 100644
144 --- a/usr/palm/applications/com.palm.app.messaging/stylesheets/messaging.css
145 +++ b/usr/palm/applications/com.palm.app.messaging/stylesheets/messaging.css
146 @@ -993,6 +993,25 @@
147                 height: 61px;
148  }
149  
150 +#messageContainer #charCounterContainer {
151 +       line-height: 20px;
152 +       display:block;
153 +       height: 20px;
154 +       border-width: 0px 10px 0px 9px;
155 +       -webkit-border-image: url(../images/message-segment-badge.png) 0 10 0 9 stretch stretch;
156 +       position: absolute;
157 +       z-index: 3;
158 +       top: 2px;
159 +       left: 2px;
160 +}
161 +
162 +#messageContainer #charCounterContainer #charCounter {
163 +       font-size: 12px;
164 +       font-weight: bold;
165 +       color: #679BC2;
166 +       margin: 0px -4px 3px -3px;
167 +}
168 +
169  #messageContainer #attachmentContainer {
170                 position: relative;
171                 margin-top: 10px;