Renamed more-icons-per-row-5x4-flare576
[webos-internals:adamrmcd-modifications.git] / contacts / contacttone.patch
1 Adds a message tone selector
2 Adds a message tone selector
3 Index: /usr/palm/applications/com.palm.app.contacts/app/controllers/edit-assistant.js
4 ===================================================================
5 --- .orig/usr/palm/applications/com.palm.app.contacts/app/controllers/edit-assistant.js
6 +++ /usr/palm/applications/com.palm.app.contacts/app/controllers/edit-assistant.js
7 @@ -63,6 +63,17 @@ EditAssistant = Class.create({
8                         template: "edit/ringtones"
9                 }));
10                 
11 +               if(this.person.messagingRingtoneName){
12 +                       this.person.MsgtoneDisplay = this.person.messagingRingtoneName;
13 +                       this.person.MsgtoneSet = "msgtone-set";
14 +               } else {
15 +                       this.person.MsgtoneDisplay = $L("Set a message tone");
16 +                       this.person.MsgtoneSet = "";
17 +               }
18 +               this.controller.get("MsgtoneBox").update(Mojo.View.render({
19 +                       object: this.person,
20 +                       template: "edit/msgtones"
21 +               }));            
22                 
23                 var that = this;
24                 
25 @@ -264,6 +275,11 @@ EditAssistant = Class.create({
26                                         object: {ringtoneDisplay:ringtoneName},
27                                         template: "edit/ringtones"
28                                 }));
29 +                               var messagingRingtoneName = this.person.messagingRingtoneName || $L("Set a message tone");
30 +                               this.controller.get("MsgtoneBox").update(Mojo.View.render({
31 +                                       object: {MsgtoneDisplay:messagingRingtoneName},
32 +                                       template: "edit/msgtones"
33 +                               }));
34                                 
35                         }
36                 }
37 @@ -521,6 +537,7 @@ EditAssistant = Class.create({
38                 this.controller.listen("NameSyncPickerWrapper", Mojo.Event.tap, this.popupContactChooser.bind(this));
39                 this.controller.get("edit-photo").observe(Mojo.Event.tap, this.attachFilePicker.bind(this));
40                 this.controller.get("RingtoneBox").observe(Mojo.Event.tap, this.attachRingtonePicker.bind(this));
41 +               this.controller.get("MsgtoneBox").observe(Mojo.Event.tap, this.attachMsgtonePicker.bind(this));
42                 this.renderLabels();
43                 this.setupContact();
44                 if (this.contact.readOnly) {
45 Index: /usr/palm/applications/com.palm.app.contacts/app/controllers/filepicker-behaviors.js
46 ===================================================================
47 --- .orig/usr/palm/applications/com.palm.app.contacts/app/controllers/filepicker-behaviors.js
48 +++ /usr/palm/applications/com.palm.app.contacts/app/controllers/filepicker-behaviors.js
49 @@ -56,6 +56,55 @@ var FilepickerBehaviors = {
50                         Mojo.FilePicker.pickFile(params, this.controller.stageController);
51  
52         },
53 +
54 +       attachMsgtonePicker: function(event){
55 +               if(this.person.messagingRingtoneLoc){
56 +                       this.controller.popupSubmenu( {
57 +                               onChoose:function(c){
58 +                                       if(c == "CHANGE"){
59 +                                               this.pushMsgtonePicker();
60 +                                       } else if(c == "DELETE"){
61 +                                               this.clearMsgtone();
62 +                                       }
63 +                               }.bind(this),
64 +                               placeNear:event.target,
65 +                               items:[
66 +                                       {label:$L("Change Msgtone"), command:'CHANGE'},
67 +                                       {label:$L("Delete Msgtone"), command:'DELETE'}
68 +                               ]
69 +                       })                      
70 +               } else {
71 +                       this.pushMsgtonePicker();
72 +               }
73 +               
74 +       },
75 +       
76 +       clearMsgtone:function(){
77 +               this.person.messagingRingtoneLoc = "";
78 +               this.person.messagingRingtoneName = "";
79 +               this.person.MsgtoneDisplay = $L("Set a message tone");
80 +               this.person.MsgtoneSet = "";
81 +               this.person.dirty = true;
82 +               this.controller.get("MsgtoneBox").update(Mojo.View.render({
83 +                       object:this.person,
84 +                       template:"edit/msgtones"
85 +               }));
86 +       },
87 +       
88 +       pushMsgtonePicker:function(){
89 +                       var params = {
90 +                               actionType: 'attach',
91 +                               kinds: ['ringtone'],
92 +                               defaultKind: 'ringtone',
93 +                               filePath:this.person.messagingRingtoneLoc,
94 +                               onSelect: function(file){
95 +                                       this.attachMsgtone(this.sanitizeSystemPath(file.fullPath), file.name);
96 +                               }.bind(this)
97 +                       };
98 +                       //Mojo.Log.info("ContactMulti Picking a msgtone for " + this.contact.firstName + " " + this.contact.lastName);
99 +                       Mojo.FilePicker.pickFile(params, this.controller.stageController);
100 +
101 +       },
102         
103         attachFilePicker: function(event){
104                 if(this.contact.readOnly){
105 @@ -150,6 +199,20 @@ var FilepickerBehaviors = {
106                         template:"edit/ringtones"
107                       }));
108                 }
109 +       },
110 +       
111 +       attachMsgtone: function(msgtonePath, name){
112 +               if (msgtonePath) {
113 +                       this.person.dirty = true;
114 +                       this.person.messagingRingtoneName = name;
115 +                       this.person.MsgtoneDisplay = name;
116 +                       this.person.MsgtoneSet = "msgtone-set";
117 +                       this.person.messagingRingtoneLoc = msgtonePath;
118 +                       this.controller.get("MsgtoneBox").update(Mojo.View.render({
119 +                       object:this.person,
120 +                       template:"edit/msgtones"
121 +                     }));
122 +               }
123         }
124  }
125  
126 Index: /usr/palm/applications/com.palm.app.contacts/app/views/edit/lists-fake.html
127 ===================================================================
128 --- .orig/usr/palm/applications/com.palm.app.contacts/app/views/edit/lists-fake.html
129 +++ /usr/palm/applications/com.palm.app.contacts/app/views/edit/lists-fake.html
130 @@ -32,6 +32,20 @@
131          </div>
132      </div>
133  </div>
134 +<div>
135 +<div id="MsgtoneBox" class="">
136 +    <div class="palm-group unlabeled">
137 +        <div class="palm-list">
138 +            <div class="palm-row single" id="MsgtoneButton" x-mojo-tap-highlight="momentary">
139 +                <div class="palm-row-wrapper">
140 +                    <div class="title"  x-mojo-loc="">
141 +                        Set a message tone
142 +                    </div>
143 +                </div>
144 +            </div>
145 +        </div>
146 +    </div>
147 +</div>
148  </div>
149  <div>
150  <div id="emailList" name="emailList" class="contactPointList" >
151 Index: /usr/palm/applications/com.palm.app.contacts/app/views/edit/msgtones.html
152 ===================================================================
153 --- /dev/null
154 +++ /usr/palm/applications/com.palm.app.contacts/app/views/edit/msgtones.html
155 @@ -0,0 +1,16 @@
156 +<div class="palm-group unlabeled">
157 +  <div class="palm-list">
158 +    <div class="palm-row single #{MsgtoneSet} msgtone-button" id="MsgtoneButton" x-mojo-tap-highlight="momentary">
159 +      <div class="palm-row-wrapper">
160 +        <div class="label right truncating-text" x-mojo-loc=''>
161 +          Msgtone
162 +        </div>
163 +        <div class="title">
164 +          <div class="truncating-text">
165 +            #{MsgtoneDisplay}
166 +          </div>
167 +        </div>
168 +      </div>
169 +    </div>
170 +  </div>
171 +</div>
172 \ No newline at end of file