Updated system prefs patches
[webos-internals:imagineer1981s-modifications.git] / advanced / advanced-system-prefs-framework-pre.patch
1 --- .orig/usr/palm/applications/com.palm.app.contacts/app/models/AppSettings.js
2 +++ /usr/palm/applications/com.palm.app.contacts/app/models/AppSettings.js
3 @@ -4,7 +4,7 @@
4  /*global Mojo, ContactsUI */
5  
6  var AppSettings = function () {
7 -       this.cookieVersion = 1;
8 +       this.cookieVersion = 2;
9         this.cookieContainer = new Mojo.Model.Cookie("contacts");
10         this.cookie = this.cookieContainer.get();
11         
12 @@ -12,14 +12,28 @@
13                 this.cookie = {
14                         version: this.cookieVersion,
15                         firstUse: true,
16 +                       listViewDisplayMode: "default",
17                         listViewDisplayType: ContactsUI.PersonListWidget.VIEW.PERSON_LIST
18                 };
19                 this.cookieContainer.put(this.cookie);
20         } else if (this.cookie.version && this.cookie.version !== this.cookieVersion) {
21                 // Handle cookie migration here
22 +               this.cookie.version = this.cookieVersion;
23 +               this.cookie.listViewDisplayMode = "default";
24 +
25 +               this.cookieContainer.put(this.cookie);
26         }
27  };
28  
29 +AppSettings.prototype.getListViewDisplayMode = function () {
30 +       return this.cookie.listViewDisplayMode;
31 +};
32 +
33 +AppSettings.prototype.setListViewDisplayMode = function (mode) {
34 +       this.cookie.listViewDisplayMode = mode;
35 +       this.cookieContainer.put(this.cookie);
36 +};
37 +
38  AppSettings.prototype.isFirstLaunch = function () {
39         return this.cookie.firstUse;
40  };
41 --- .orig/usr/palm/applications/com.palm.app.contacts/app/controllers/app-assistant.js
42 +++ /usr/palm/applications/com.palm.app.contacts/app/controllers/app-assistant.js
43 @@ -374,6 +374,10 @@
44                                 } else if (launchType === "editContact") {
45                                         this.pushEditScene.apply(this, pushSceneArgs);
46                                 
47 +                               // [Launch Param: "launchType" === "editUnknown"] - Pushes the prefs scene with unknown contacts view
48 +                               } else if (launchType === "editUnknown") {
49 +                                       this.pushPrefsSceneEditUnknown.apply(this, pushSceneArgs);
50 +                               
51                                 // [Launch Param: "launchType" === "reminder"] - Pushes the detail scene + reminder scene
52                                 } else if (launchType === "reminder") {
53                                         this.pushReminderScene.apply(this, pushSceneArgs);
54 @@ -464,6 +468,21 @@
55                         });
56                 });
57         },
58 +
59 +       pushPrefsSceneEditUnknown: function (stageController, launchParams, shouldFocus, transition) {
60 +               this.popAllScenesAndPushListView(stageController, transition);
61 +               stageController.pushScene({
62 +                       name: "prefs",
63 +                       transition: transition
64 +               }, "unknown_prefs");
65 +               stageController.pushScene({
66 +                       name: "accountlogin",
67 +                       transition: transition
68 +               }, {
69 +                       account: launchParams.account,
70 +                       template: launchParams.template
71 +               });
72 +       },
73         
74         transformContact: function (contact) {
75                 //the old schema needs to be mapped to the new schema
76 --- .orig/usr/palm/applications/com.palm.app.contacts/stylesheets/common.css
77 +++ /usr/palm/applications/com.palm.app.contacts/stylesheets/common.css
78 @@ -65,6 +65,8 @@
79  
80  .palm-menu-icon.favorite { background-image: url(../images/menu-icon-favorites.png); }
81  .palm-menu-icon.new-contact    { background-image: url(../images/menu-icon-new-contact.png); }
82 +.palm-menu-icon.new-favorite   { background-image: url(../images/menu-icon-new-favorite.png); }
83 +.palm-menu-icon.notification { background-image: url(../images/menu-icon-notifications.png); }
84  
85  /* Account Icons */      
86                              
87 --- .orig/usr/palm/applications/com.palm.app.contacts/app/controllers/detail-assistant.js
88 +++ /usr/palm/applications/com.palm.app.contacts/app/controllers/detail-assistant.js
89 @@ -321,6 +321,12 @@
90                 
91         if (person) {
92                 items.push({
93 +                       label: $L('Notifications'),
94 +                       icon: "notification",                   
95 +                       command: "notifications"
96 +               });
97 +
98 +               items.push({
99                         label: $L('Edit'),
100                         command: MenuHandler.editContact,
101                         disabled: enableEditItem ? false : true
102 @@ -764,7 +770,7 @@
103         }
104  };
105  
106 -DetailAssistant.prototype.handleEdit = function () {
107 +DetailAssistant.prototype.handleEdit = function (view) {
108         var detailSceneCallback = this.handleReturnFromEditScene.bind(this);
109  
110         if (this.currentlyLinking) { 
111 @@ -772,6 +778,7 @@
112         }
113  
114         this.controller.stageController.pushScene('edit', {
115 +               editView: view,
116                 person: this.detailWidget.getPerson(),
117                 //updateDetailCallback: updateDetailID,
118                 detailSceneCallback: detailSceneCallback
119 @@ -781,7 +788,7 @@
120  DetailAssistant.prototype.handleReturnFromEditScene = function (response) {
121         Mojo.Log.info("RESPONSE: " + JSON.stringify(response) + "\n\n\n\n");
122  
123 -       this.updateCommandMenu(false);
124 +//     this.updateCommandMenu(false);
125  
126         try {
127                 //this.cmdMenuModel.items = this.commandMenuModel;
128 @@ -1072,6 +1079,8 @@
129                 } else if (event.command === MenuHandler.deleteContact) {
130                         Mojo.Event.stop(event);
131                         this.handleDelete();
132 +               } else if (event.command === "notifications") {
133 +                       this.handleEdit("prefs");
134                 } else if (event.command === "sendbluetooth") {
135                         Mojo.Event.stop(event);
136                         this.sendContactBluetooth();
137 --- .orig/usr/palm/applications/com.palm.app.contacts/app/controllers/edit-assistant.js
138 +++ /usr/palm/applications/com.palm.app.contacts/app/controllers/edit-assistant.js
139 @@ -44,6 +44,8 @@
140  // --------------------------------------------
141  // --NTRP
142  var EditAssistant = function (params) {
143 +       this.editView = params.editView;
144 +
145         // Flag for the activate method below that
146         // indicates whether or not the contactPoints (addresses, url, ims)
147         // need to be setup and drawn to the screne 
148 @@ -162,7 +164,7 @@
149         
150         // Check if the ringtone exists. If it does then display it, otherwise
151         // show the set a ringtone button.
152 -       if (this.person.getRingtone().getName()) {
153 +/*     if (this.person.getRingtone().getName()) {
154                 this.person.ringtoneDisplay = this.person.getRingtone().getName();
155                 this.person.ringtoneSet = "ringtone-set";
156         } else {
157 @@ -174,7 +176,7 @@
158                 object: this.person,
159                 template: "edit/ringtones"
160         });
161 -       
162 +*/     
163         var that = this,
164                 notes = [],
165                 phoneNumbers = [],
166 @@ -947,10 +949,10 @@
167         // pop the edit scene.
168         this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, {
169                 visible: true,
170 -               items: [{
171 +               items: [{}, {
172                         label: $L('Done'),
173                         command: this.finished.bind(this)
174 -               }]
175 +               }, {}]
176         });
177         
178         // I believe this is the spinner that is shown when it takes a long time to 
179 @@ -1125,7 +1127,7 @@
180         // Attach the eventhandlers to the name, photo, and ringtone fields.
181         this.eventListenerManager.addListener(this.controller.get('NameSyncPickerWrapper'), Mojo.Event.tap, this.popupContactChooser.bind(this));
182         this.eventListenerManager.addListener(this.controller.get('edit-photo'), Mojo.Event.tap, this.attachFilePicker.bind(this));
183 -       this.eventListenerManager.addListener(this.controller.get('RingtoneBox'), Mojo.Event.tap, this.attachRingtonePicker.bind(this));
184 +//     this.eventListenerManager.addListener(this.controller.get('RingtoneBox'), Mojo.Event.tap, this.attachRingtonePicker.bind(this));
185         
186         // Sets up the labels for the popup on the entries in the contactPoint lists. (Home, Work, ...)
187         this.renderLabels();
188 @@ -1144,6 +1146,258 @@
189                 this.controller.setInitialFocusedElement(null);
190         }
191         
192 +       // SETUP contact prefs view
193 +       
194 +       var firstName = this.person.getName().getGivenName() || "";
195 +       var lastName = this.person.getName().getFamilyName() || "";
196 +
197 +       this.controller.get("ContactName").innerHTML = firstName + " " + lastName;
198 +
199 +       this.choicesCallAction = [
200 +               {label: $L("Alert Normally"), value: "none"},
201 +               {label: $L("Direct to Voicemail"), value: "direct2vm"},
202 +               {label: $L("Hang Up Automatically"), value: "autohangup"} ];
203 +
204 +       this.modelCallAction = {value: this.person.getCallAction().getAction() || "none"};
205 +
206 +       if((this.modelCallAction.value == "direct2vm") || (this.modelCallAction.value == "autohangup"))
207 +       {
208 +               this.controller.get("PhoneAlertRow").style.display = "none";
209 +               this.controller.get("PhoneRingtoneRow").style.display = "none";
210 +       }
211 +
212 +       this.controller.setupWidget("CallAction", {
213 +               label: $L("Action"),
214 +               labelPlacement: "left",                 
215 +               choices: this.choicesCallAction},
216 +               this.modelCallAction);
217 +
218 +       this.eventListenerManager.addListener(this.controller.get("CallAction"), Mojo.Event.propertyChange, 
219 +               this.saveContactPreferences.bind(this, "call"));
220 +
221 +       this.choicesPhoneAlert = [
222 +               {label: $L("Use Default"), value: "default"},
223 +               {label: $L("Ringtone"), value: "ringtone"},
224 +               {label: $L("Mute"), value: "none"} ];
225 +
226 +       this.modelCallAlert = {value: this.person.getCallAlert().getAlert() || "default"};
227 +
228 +       if(this.modelCallAlert.value != "ringtone")
229 +               this.controller.get("PhoneRingtoneRow").style.display = "none";
230 +
231 +       this.controller.setupWidget("PhoneAlert", {
232 +               label: $L("Alert"),
233 +               labelPlacement: "left",                                                         
234 +               choices: this.choicesPhoneAlert},
235 +               this.modelCallAlert);
236 +
237 +       this.eventListenerManager.addListener(this.controller.get("PhoneAlert"), Mojo.Event.propertyChange, 
238 +               this.saveContactPreferences.bind(this, "call"));
239 +
240 +       this.controller.get("PhoneRingtone").innerHTML = this.person.getRingtone().getName() || "";
241 +
242 +       this.eventListenerManager.addListener(this.controller.get("PhoneRingtoneRow"), Mojo.Event.tap, 
243 +               this.selectRingtone.bind(this, "call"));
244 +
245 +       this.choicesMsgAlert = [
246 +               {label: $L("Use Default"), value: "default"},
247 +               {label: $L("System Sound"), value: "notifications"},
248 +               {label: $L("Ringtone"), value: "ringtone"},
249 +               {label: $L("Vibrate"), value: "vibrate"},
250 +               {label: $L("Mute"), value: "none"} ];
251 +
252 +       this.modelMsgAlert = {value: this.person.getMsgAlert().getAlert() || "default"};
253 +
254 +       if(this.modelMsgAlert.value != "ringtone")
255 +               this.controller.get("MsgRingtoneRow").style.display = "none";
256 +
257 +       this.controller.setupWidget("MsgAlert", {
258 +               label: $L("Alert"),
259 +               labelPlacement: "left",                                                         
260 +               choices: this.choicesMsgAlert},
261 +               this.modelMsgAlert);
262 +
263 +       this.eventListenerManager.addListener(this.controller.get("MsgAlert"), Mojo.Event.propertyChange, 
264 +               this.saveContactPreferences.bind(this, "msg"));
265 +
266 +       this.controller.get("MsgRingtone").innerHTML = this.person.getMsgRingtone().getName() || "";
267 +
268 +       this.eventListenerManager.addListener(this.controller.get("MsgRingtoneRow"), Mojo.Event.tap, 
269 +               this.selectRingtone.bind(this, "msg"));
270 +
271 +       this.choicesIMsgAlert = [
272 +               {label: $L("Use Default"), value: "default"},
273 +               {label: $L("System Sound"), value: "notifications"},
274 +               {label: $L("Ringtone"), value: "ringtone"},
275 +               {label: $L("Vibrate"), value: "vibrate"},
276 +               {label: $L("Mute"), value: "none"} ];
277 +
278 +       this.modelIMsgAlert = {value: this.person.getIMsgAlert().getAlert() || "default"};
279 +
280 +       if(this.modelIMsgAlert.value != "ringtone")
281 +               this.controller.get("IMsgRingtoneRow").style.display = "none";
282 +
283 +       this.controller.setupWidget("IMsgAlert", {
284 +               label: $L("Alert"),
285 +               labelPlacement: "left",                                                         
286 +               choices: this.choicesIMsgAlert},
287 +               this.modelIMsgAlert);
288 +
289 +       this.eventListenerManager.addListener(this.controller.get("IMsgAlert"), Mojo.Event.propertyChange, 
290 +               this.saveContactPreferences.bind(this, "imsg"));
291 +
292 +       this.controller.get("IMsgRingtone").innerHTML = this.person.getIMsgRingtone().getName() || "default";
293 +
294 +       this.eventListenerManager.addListener(this.controller.get("IMsgRingtoneRow"), Mojo.Event.tap, 
295 +               this.selectRingtone.bind(this, "imsg"));
296 +
297 +       // Show correct view
298 +       
299 +       if(this.editView == "prefs") {
300 +               this.controller.get("contact_detail").style.display = "none";
301 +               this.controller.get("contact_prefs").style.display = "block";           
302 +       }
303 +};
304 +
305 +EditAssistant.prototype.saveContactPreferences = function(group) {
306 +       this.person.dirty = true;
307 +
308 +       if(group == "call") {
309 +               if(this.modelCallAction.value != "none") {
310 +                       this.controller.get("CallActionRow").style.className = "single";
311 +                       this.controller.get("PhoneAlertRow").style.display = "none";            
312 +                       this.controller.get("PhoneRingtoneRow").style.display = "none";
313 +
314 +                       this.modelCallAlert.value = "default";
315 +                       this.controller.modelChanged(this.modelCallAlert);
316 +
317 +                       this.controller.get("PhoneRingtone").innerHTML = "";
318 +               }
319 +               else {
320 +                       this.controller.get("CallActionRow").style.className = "first";
321 +                       this.controller.get("PhoneAlertRow").style.display = "block";           
322 +
323 +                       if(this.modelCallAlert.value != "ringtone") {
324 +                               this.controller.get("PhoneRingtoneRow").style.display = "none";
325 +                               this.controller.get("PhoneRingtone").innerHTML = "";
326 +                       }
327 +                       else {
328 +                               this.controller.get("PhoneRingtoneRow").style.display = "block";
329 +                               
330 +                               if((!this.person.getRingtone().getName()) || (this.person.getRingtone().getName() == ""))
331 +                                       this.selectRingtone("call", null);
332 +                               else
333 +                                       this.controller.get("PhoneRingtone").innerHTML = this.person.getRingtone().getName() || "";
334 +                       }
335 +               }
336 +
337 +               this.person.getCallAction().setAction(this.modelCallAction.value);
338 +               this.person.getCallAlert().setAlert(this.modelCallAlert.value);
339 +       } else if(group == "msg") {
340 +               if(this.modelMsgAlert.value != "ringtone") {
341 +                       this.controller.get("MsgRingtoneRow").style.display = "none";
342 +                       this.controller.get("MsgRingtone").innerHTML = "";      
343 +               }
344 +               else {
345 +                       this.controller.get("MsgRingtoneRow").style.display = "block";  
346 +
347 +                       if((!this.person.getMsgRingtone().getName()) || (this.person.getMsgRingtone().getName() == ""))
348 +                               this.selectRingtone("msg", null);
349 +                       else
350 +                               this.controller.get("MsgRingtone").innerHTML = this.person.getMsgRingtone().getName() || "";
351 +               }
352 +               
353 +               this.person.getMsgAlert().setAlert(this.modelMsgAlert.value);
354 +       } else if(group == "imsg") {
355 +               if(this.modelIMsgAlert.value != "ringtone") {
356 +                       this.controller.get("IMsgRingtoneRow").style.display = "none";
357 +                       this.controller.get("IMsgRingtone").innerHTML = "";     
358 +               }
359 +               else {
360 +                       this.controller.get("IMsgRingtoneRow").style.display = "block"; 
361 +
362 +                       if((!this.person.getIMsgRingtone().getName()) || (this.person.getIMsgRingtone().getName() == ""))
363 +                               this.selectRingtone("imsg", null);
364 +                       else
365 +                               this.controller.get("IMsgRingtone").innerHTML = this.person.getIMsgRingtone().getName() || "";          
366 +               }
367 +               
368 +               this.person.getIMsgAlert().setAlert(this.modelIMsgAlert.value);
369 +       }
370 +};
371 +
372 +EditAssistant.prototype.selectRingtone = function(config, event) {
373 +       var ringtone = "";
374 +
375 +       if(config == "call")
376 +               ringtone = this.person.getRingtone().getLocation();
377 +       else if(config == "msg")
378 +               ringtone = this.person.getMsgRingtone().getLocation();
379 +       else if(config == "imsg")
380 +               ringtone = this.person.getIMsgRingtone().getLocation();
381 +
382 +       Mojo.FilePicker.pickFile({actionType: 'attach', kinds: ['ringtone'], defaultKind: 'ringtone',
383 +               filePath: ringtone, onSelect: this.setRingtone.bind(this, config),
384 +               onCancel: this.cancelRingtone.bind(this, config)},
385 +               this.controller.stageController);
386 +};
387 +
388 +EditAssistant.prototype.setRingtone = function(config, file) {
389 +       var ringtonePath = file.fullPath.replace(/^\s*/, '').replace(/\s*$/, '');
390 +       if(ringtonePath.indexOf("file://") == 0) 
391 +               ringtonePath = ringtonePath.substring(7);
392 +
393 +       if(config == "call") {
394 +               this.controller.get("PhoneRingtone").innerHTML = file.name;
395 +               this.person.getRingtone().setName(file.name);
396 +               this.person.getRingtone().setLocation(ringtonePath);
397 +               this.person.dirty = true;
398 +       }
399 +       else if(config == "msg") {
400 +               this.controller.get("MsgRingtone").innerHTML = file.name;
401 +               this.person.getMsgRingtone().setName(file.name);
402 +               this.person.getMsgRingtone().setLocation(ringtonePath);
403 +               this.person.dirty = true;
404 +       }
405 +       else if(config == "imsg") {
406 +               this.controller.get("IMsgRingtone").innerHTML = file.name;
407 +               this.person.getIMsgRingtone().setName(file.name);
408 +               this.person.getIMsgRingtone().setLocation(ringtonePath);
409 +               this.person.dirty = true;
410 +       }
411 +};
412 +
413 +EditAssistant.prototype.cancelRingtone = function(config) {
414 +       if(config == "call") {
415 +               if((!this.person.getRingtone().getLocation()) && (this.person.getRingtone().getLocation() == "")) {
416 +                       this.controller.get("PhoneRingtoneRow").style.display = "none";
417 +
418 +                       this.modelCallAlert.value = "default";
419 +                       this.controller.modelChanged(this.modelCallAlert);
420 +                       
421 +                       this.saveContactPreferences("phone");
422 +               }
423 +       }
424 +       else if(config == "msg") {
425 +               if((!this.person.getMsgRingtone().getLocation()) && (this.person.getMsgRingtone().getLocation() == "")) {
426 +                       this.controller.get("MsgRingtoneRow").style.display = "none";
427 +
428 +                       this.modelMsgAlert.value = "default";
429 +                       this.controller.modelChanged(this.modelMsgAlert);
430 +                       
431 +                       this.saveContactPreferences("msg");
432 +               }
433 +       }
434 +       else if(config == "imsg") {
435 +               if((!this.person.getIMsgRingtone().getLocation()) && (this.person.getIMsgRingtone().getLocation() == "")) {
436 +                       this.controller.get("IMsgRingtoneRow").style.display = "none";
437 +
438 +                       this.modelIMsgAlert.value = "default";
439 +                       this.controller.modelChanged(this.modelIMsgAlert);
440 +                       
441 +                       this.saveContactPreferences("imsg");
442 +               }
443 +       }
444  };
445  
446  // --------------------------------------------
447 @@ -3057,7 +3311,7 @@
448         return newPath;
449  };
450  
451 -EditAssistant.prototype.attachRingtonePicker = function (event) {
452 +/*EditAssistant.prototype.attachRingtonePicker = function (event) {
453         var ringtoneObject = this.person.getRingtone();
454         if (ringtoneObject.getLocation()) {
455                 this.controller.popupSubmenu({
456 @@ -3108,7 +3362,7 @@
457         //Mojo.Log.info("ContactMulti Picking a ringtone for " + this.contact.firstName + " " + this.contact.lastName);
458         Mojo.FilePicker.pickFile(params, this.controller.stageController);
459  };
460 -
461 +*/
462  EditAssistant.prototype.attachFilePicker = function (event) {
463         if (AppAssistant.accountsList.isContactReadOnly(this.selectedContact)) {
464                 return;
465 @@ -3183,7 +3437,7 @@
466         return future;
467  };
468  
469 -EditAssistant.prototype.attachRingtone = function (ringtonePath, name) {
470 +/*EditAssistant.prototype.attachRingtone = function (ringtonePath, name) {
471         if (ringtonePath) {
472                 this.person.dirty = true;
473                 this.person.getRingtone().setName(name);
474 @@ -3196,5 +3450,5 @@
475                 });
476         }
477  };
478 -
479 +*/
480  /////////////////////////
481 --- .orig/usr/palm/applications/com.palm.app.contacts/app/views/edit/edit-scene.html
482 +++ /usr/palm/applications/com.palm.app.contacts/app/views/edit/edit-scene.html
483 @@ -62,4 +62,76 @@
484                         </div>
485                 </div>
486         </div>
487 -</div>
488 \ No newline at end of file
489 +</div>
490 +
491 +<div id="contact_prefs" style="display:none;">
492 +       <div class="palm-page-header">
493 +               <div class="palm-page-header-wrapper">
494 +                       <div class="icon notification-prefs"></div>
495 +             <div class="title" x-mojo-loc='' id="ContactName"></div>
496 +               </div>
497 +       </div>
498 +
499 +       <div class="palm-group" id="PhoneCallGroup">
500 +               <div class="palm-group-title">Phone Call</div>
501 +       
502 +               <div class="palm-list">
503 +                       <div class="palm-row first" id="CallActionRow">
504 +                               <div class="palm-row-wrapper">
505 +                                       <div id="CallAction" x-mojo-element="ListSelector"></div>
506 +                               </div>
507 +                       </div>
508 +               
509 +                       <div class="palm-row" id="PhoneAlertRow">
510 +                               <div class="palm-row-wrapper">
511 +                                       <div id="PhoneAlert" x-mojo-element="ListSelector"></div>
512 +                               </div>
513 +                       </div>
514 +
515 +                       <div class="palm-row last" id="PhoneRingtoneRow">
516 +                               <div class="palm-row-wrapper">
517 +                                       <div class="label right" id="PhoneRingtone">Ringtone</div>
518 +                                       <div class="title">Ringtone</div>
519 +                               </div>
520 +                       </div>
521 +               </div>
522 +       </div>
523 +
524 +       <div class="palm-group">
525 +               <div class="palm-group-title">SMS Message</div>
526 +       
527 +               <div class="palm-list">
528 +                       <div class="palm-row single">
529 +                               <div class="palm-row-wrapper">
530 +                                       <div id="MsgAlert" x-mojo-element="ListSelector"></div>
531 +                               </div>
532 +                       </div>
533 +
534 +                       <div class="palm-row last" id="MsgRingtoneRow">
535 +                               <div class="palm-row-wrapper">
536 +                                       <div class="label right" id="MsgRingtone">Ringtone</div>
537 +                                       <div class="title">Ringtone</div>
538 +                               </div>
539 +                       </div>
540 +               </div>
541 +       </div>
542 +
543 +       <div class="palm-group">
544 +               <div class="palm-group-title">IM Message</div>
545 +       
546 +               <div class="palm-list">
547 +                       <div class="palm-row single">
548 +                               <div class="palm-row-wrapper">
549 +                                       <div id="IMsgAlert" x-mojo-element="ListSelector"></div>
550 +                               </div>
551 +                       </div>
552 +
553 +                       <div class="palm-row last" id="IMsgRingtoneRow">
554 +                               <div class="palm-row-wrapper">
555 +                                       <div class="label right" id="IMsgRingtone">Ringtone</div>
556 +                                       <div class="title">Ringtone</div>
557 +                               </div>
558 +                       </div>
559 +               </div>
560 +       </div>
561 +</div>
562 --- .orig/usr/palm/applications/com.palm.app.contacts/app/controllers/list-assistant.js
563 +++ /usr/palm/applications/com.palm.app.contacts/app/controllers/list-assistant.js
564 @@ -65,7 +65,10 @@
565                 //this.dataSource = new ActiveRecordListBridge(AppAssistant.contactsService.newList.bind(this, this.controller), AppAssistant.contactsService.count.bind(this, this.controller), this.transformListResults);
566                 //this.dataSource.setHandleUpdateCount(this.handleUpdateCount);
567                 
568 -               viewType = AppAssistant.appSettings.getListViewDisplayType() || ContactsUI.PersonListWidget.VIEW.PERSON_LIST;
569 +               viewType = AppAssistant.appSettings.getListViewDisplayMode() || "default";
570 +               
571 +               if(viewType == "default")
572 +                       viewType = AppAssistant.appSettings.getListViewDisplayType() || ContactsUI.PersonListWidget.VIEW.PERSON_LIST;
573  
574                 // Set up the top (view) menu
575                 this.topMenuModel = {
576 @@ -91,8 +94,12 @@
577                 this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, {
578                         items: [{
579                                 icon: 'new-contact',
580 -                               label: $L('New'),
581 -                               command: 'new'
582 +                               label: $L('New Contact'),
583 +                               command: 'new-contact'
584 +                       },{},{
585 +                               icon: 'new-favorite',
586 +                               label: $L('New Favorite'),
587 +                               command: 'new-favorite'
588                         }]
589                 });
590                 
591 @@ -107,6 +114,9 @@
592                         omitDefaultItems: true
593                 }, {
594                         items: [Mojo.Menu.editItem, {
595 +                               label:$L("Sync Now"),
596 +                               command:"syncnow"
597 +                       },      {
598                                 label: $L("Send All to Car Kit"),
599                                 command: "sendcontacts"
600                         }, prefsItem, {
601 @@ -125,6 +135,7 @@
602                 this.personListWidget = new ContactsUI.PersonListWidget();
603                 personListModel = {
604                         listTapCallback: this.handleListTap.bind(this),
605 +                       personListDeleteCallback: this.handlePersonListDelete.bind(this),
606                         mode: ContactsUI.PersonListWidget.MODE.PERSON_AND_FAVORITE_LIST,
607                         defaultView: viewType,
608                         sortOrder: AppAssistant.appPrefs.get(Contacts.AppPrefs.Pref.listSortOrder)
609 @@ -336,12 +347,19 @@
610         
611         handleCommand: function (event) {
612                 if (event.type === Mojo.Event.command) {
613 -                       if (event.command === 'new') {
614 +                       if (event.command === 'new-contact') {
615                                 this.controller.stageController.pushScene('edit', {
616                                         newContact: true,
617                                         makeFavorite: (this.personListWidget.getCurrentView() === ContactsUI.PersonListWidget.VIEW.FAVORITE_LIST) ? true : false 
618                                 //onSaveCallback: this.dataSource.doUpdate.bind(this.dataSource)
619                                 });
620 +                       } else if (event.command === "new-favorite") {
621 +                               this.personListWidget.showFavoriteList(false);
622 +                               this.topMenuModel.items[0].toggleCmd = "toggle-favorites";
623 +                               this.controller.modelChanged(this.topMenuModel);
624 +                               this.personListWidget.showAddFavorite();
625 +                       } else if (event.command === "syncnow") {
626 +                               this.syncAccounts();
627                         } else if (event.command === "toggle-all") {
628                                 this.personListWidget.showPersonList(true);
629                         } else if (event.command === "toggle-favorites") {
630 @@ -359,6 +377,63 @@
631                 }
632         },
633         
634 +       syncAccounts: function() {
635 +               var that = this,
636 +                       future;
637 +       
638 +               this.controller.showBanner($L("Syncing Accounts..."), {});
639 +       
640 +               //TODO: instead of pinging these service directly, this needs to set up background, user-initiated activities with the activity manager
641 +               future = Foundations.Control.mapReduce({
642 +                       map: function (account) {
643 +                               //get the contacts capability
644 +                               var capabilityProvider = Contacts.Utils.getContactsCapabilityProvider(account),
645 +                                       future;
646 +                       
647 +                               //ping the sync method on this capability
648 +                               if (capabilityProvider && capabilityProvider.sync) {
649 +                                       future = new Future();
650 +                               
651 +                                       future.now(this, function () {
652 +                                               return PalmCall.call("palm://com.palm.activitymanager/", "create", {
653 +                                                       activity: {
654 +                                                               type: { 
655 +                                                                       explicit: true,
656 +                                                                       userInitiated: true,
657 +                                                                       background : true
658 +                                                                       //foreground: true
659 +                                                               },
660 +                                                               name: "'Sync Now' sync for " + account.templateId + ", account " + account._id,
661 +                                                               description: "Background sync for account " + account._id + " from 'sync now' button",
662 +                                                               callback: {
663 +                                                                       method: capabilityProvider.sync,
664 +                                                                       params: {
665 +                                                                               "accountId": account._id
666 +                                                                       }
667 +                                                               }
668 +                                                       },
669 +                                                       start: true
670 +                                               });
671 +                                       });
672 +                               
673 +                                       future.then(this, function () {
674 +                                               try {
675 +                                                       var result = future.result;
676 +                                               } catch (ex) {
677 +                                                       Mojo.Log.warn("Ignoring exception during background sync setup for sync now button: " + Contacts.Utils.stringify(ex));
678 +                                               }
679 +                                       
680 +                                               return true;
681 +                                       });
682 +                               
683 +                                       return future;
684 +                               } else {
685 +                                       return new Future(true);
686 +                               }
687 +                       }
688 +               }, AppAssistant.accountsList.getAccountsList());
689 +       },
690 +       
691         sendContacts: function () {
692                 var params = {
693                         "type": "bluetooth",
694 @@ -419,6 +494,33 @@
695                 });
696         },
697         
698 +       handlePersonListDelete: function(event) {
699 +               var person = Contacts.PersonFactory.createPersonDisplay(event.item);
700 +
701 +               if (person.getLauncherId().getValue()) {
702 +                       request = new Mojo.Service.Request("palm://com.palm.applicationManager/removeLaunchPoint", {
703 +                               parameters: {
704 +                                       launchPointId: person.getLauncherId().getValue(),
705 +                                       id: "com.palm.app.contacts"
706 +                               }
707 +                       });
708 +               }
709 +               
710 +               var future = Contacts.Person.getLinkedContacts(person, Contacts.ContactFactory.ContactType.DISPLAYABLE);
711 +
712 +               future.then(this, function test() {
713 +                       var contacts;
714 +                       contacts = future.result || [];
715 +
716 +                       for (i = 0; i < contacts.length; i += 1) {
717 +                               var c = contacts[i];
718 +                               if (!AppAssistant.accountsList.isProviderReadOnly(c.getAccountId().getValue())) {
719 +                                       c.deleteContact();
720 +                               }
721 +                       }
722 +               });
723 +       },
724 +       
725         peoplePickerDetailCallbackFailure: function (resp) {
726                 this.controller.stageController.popScene(resp);
727         },
728 --- .orig/usr/palm/applications/com.palm.app.contacts/app/views/edit/lists-fake.html
729 +++ /usr/palm/applications/com.palm.app.contacts/app/views/edit/lists-fake.html
730 @@ -12,7 +12,7 @@
731          </div>
732      </div>
733  </div>
734 -<div id="RingtoneBox">
735 +<!--<div id="RingtoneBox">
736      <div class="palm-group unlabeled">
737          <div class="palm-list">
738              <div class="palm-row single" id="RingtoneButton" x-mojo-tap-highlight="momentary">
739 @@ -24,7 +24,7 @@
740              </div>
741          </div>
742      </div>
743 -</div>
744 +</div>-->
745  <div id="emailList" name="emailList" class="contactPointList">
746      <div class="palm-group unlabeled">
747          <div class="palm-list">
748 --- .orig/usr/palm/applications/com.palm.app.contacts/stylesheets/prefs.css
749 +++ /usr/palm/applications/com.palm.app.contacts/stylesheets/prefs.css
750 @@ -36,4 +36,9 @@
751  
752  .palm-page-header .icon.app {
753         background-image: url(../images/header-icon-contacts.png);
754 -}
755 \ No newline at end of file
756 +}
757 +
758 +.palm-page-header .icon.notification-prefs { 
759 +       background-image: url(../images/header-icon-notifications.png); 
760 +}
761 +
762 --- .orig/usr/palm/applications/com.palm.app.contacts/app/controllers/prefs-assistant.js
763 +++ /usr/palm/applications/com.palm.app.contacts/app/controllers/prefs-assistant.js
764 @@ -4,8 +4,19 @@
765  /*global console, Mojo, AccountsLib, AppAssistant, $L, Utilities, Foundations, _, PalmCall, Future, Contacts, EventListenerManager, DB,
766  setTimeout, clearTimeout, ContactsUI */
767  
768 -var PrefsAssistant = function () {
769 +var PrefsAssistant = function (view) {
770         this.eventListenerManager = new EventListenerManager();
771 +
772 +       if(view)
773 +               this.prefsView = view;
774 +       else
775 +               this.prefsView = "common_prefs";
776 +
777 +       if(AppAssistant.appPrefs.get(Contacts.AppPrefs.Pref.blockedNumbers) == undefined)
778 +               AppAssistant.appPrefs.set(Contacts.AppPrefs.Pref.blockedNumbers, false);
779 +
780 +       if(AppAssistant.appPrefs.get(Contacts.AppPrefs.Pref.unknownNumbers) == undefined)
781 +               AppAssistant.appPrefs.set(Contacts.AppPrefs.Pref.unknownNumbers, false);
782  };
783  
784  PrefsAssistant.prototype.setup = function () {
785 @@ -16,28 +27,68 @@
786          * First we set up all the widgets
787          */
788         
789 +       this.defaultViewModel = {
790 +               defaultView: AppAssistant.appSettings.getListViewDisplayMode() || "default"
791 +       };
792 +       this.controller.setupWidget("DefaultContactsView", {
793 +               choices: [{
794 +                       label: $L("No Default View"), 
795 +                       value: "default"
796 +               }, {
797 +                       label: $L("All Contacts"), 
798 +                       value: ContactsUI.PersonListWidget.VIEW.PERSON_LIST
799 +               }, {
800 +                       label: $L("Favorites"), 
801 +                       value: ContactsUI.PersonListWidget.VIEW.FAVORITE_LIST
802 +               }],
803 +               modelProperty: 'defaultView'
804 +       }, this.defaultViewModel);
805 +       this.eventListenerManager.addListener(this.controller.get('DefaultContactsView'), Mojo.Event.propertyChange, this.defaultViewChanged.bind(this));
806 +       
807         // Sort order selector
808         this.sortOrderModel = {
809                 sortOrder: AppAssistant.appPrefs.get(Contacts.AppPrefs.Pref.listSortOrder)
810         };
811         this.controller.setupWidget('SortOrderSelector', {
812                 choices: [{
813 -                       label: $L('First name'),
814 +                       label: $L('First Name'),
815                         value: Contacts.ListWidget.SortOrder.firstLast
816                 }, {
817 -                       label: $L('Last name'),
818 +                       label: $L('Last Name'),
819                         value: Contacts.ListWidget.SortOrder.lastFirst
820                 }, {
821 -                       label: $L('Company & first name'),
822 +                       label: $L('Company & First Name'),
823                         value: Contacts.ListWidget.SortOrder.companyFirstLast
824                 }, {
825 -                       label: $L('Company & last name'),
826 +                       label: $L('Company & Last Name'),
827                         value: Contacts.ListWidget.SortOrder.companyLastFirst
828                 }],
829                 modelProperty: 'sortOrder'
830         }, this.sortOrderModel);
831         this.eventListenerManager.addListener(this.controller.get('SortOrderSelector'), Mojo.Event.propertyChange, this.sortOrderChanged.bind(this));
832         
833 +       this.blockedNumbersModel = {
834 +               blockedNumbers: AppAssistant.appPrefs.get(Contacts.AppPrefs.Pref.blockedNumbers)
835 +       };
836 +       this.controller.setupWidget('BlockedNumbers', {
837 +               falseLabel: $L("No"), 
838 +               trueLabel: $L("Yes"),
839 +               modelProperty: 'blockedNumbers'
840 +       }, this.blockedNumbersModel);
841 +       this.eventListenerManager.addListener(this.controller.get('BlockedNumbers'), Mojo.Event.propertyChange, this.blockedNumbersChanged.bind(this));
842 +
843 +       this.unknownNumbersModel = {
844 +               unknownNumbers: AppAssistant.appPrefs.get(Contacts.AppPrefs.Pref.unknownNumbers)
845 +       };
846 +       this.controller.setupWidget('UnknownNumbers', {
847 +               falseLabel: $L("No"), 
848 +               trueLabel: $L("Yes"),
849 +               modelProperty: 'unknownNumbers'
850 +       }, this.unknownNumbersModel);
851 +       this.eventListenerManager.addListener(this.controller.get('UnknownNumbers'), Mojo.Event.propertyChange, this.unknownNumbersChanged.bind(this));
852 +
853 +       this.eventListenerManager.addListener(this.controller.get('UnknownContactsOptions'), Mojo.Event.tap, this.unknownContactsTapped.bind(this));
854 +       
855         // Accounts list
856         this.controller.setupWidget("accountsList", {
857                 filterBy: {
858 @@ -52,11 +103,11 @@
859         this.eventListenerManager.addListener(this.defaultAccountPicker, Mojo.Event.tap, this.openDefaultAccountPicker.bind(this));
860         
861         // Sync now button
862 -       this.controller.setupWidget("syncAccountsButton", {}, {
863 +/*     this.controller.setupWidget("syncAccountsButton", {}, {
864                 buttonLabel: $L("Sync Now")
865         });
866         this.eventListenerManager.addListener(this.controller.get('syncAccountsButton'), Mojo.Event.tap, this.syncAccounts.bind(this));
867 -       
868 +*/     
869         // Add account button
870         this.controller.setupWidget("addAccountButton", {}, {
871                 buttonLabel: $L("Add an account")
872 @@ -76,6 +127,261 @@
873         
874         // Set up the default account picker
875         this.updateDefaultAccountPicker();
876 +
877 +       // Setup unknown prefs
878 +       
879 +       this.unknownContacts = AppAssistant.appPrefs.get(Contacts.AppPrefs.Pref.unknownContacts);
880 +       
881 +       if(!this.unknownContacts) {
882 +               this.unknownContacts = {
883 +                       callAction: "none",
884 +                       callAlert: "default",
885 +                       callRingtoneName: "",
886 +                       callRingtonePath: "",
887 +                       msgAlert: "default",
888 +                       msgRingtoneName: "",
889 +                       msgRingtonePath: "",
890 +                       emailAlert: "default",
891 +                       emailRingtoneName: "",
892 +                       emailRingtonePath: ""   
893 +               };
894 +       }
895 +       
896 +       this.choicesCallAction = [
897 +               {label: $L("Alert Normally"), value: "none"},
898 +               {label: $L("Direct to Voicemail"), value: "direct2vm"},
899 +               {label: $L("Hang Up Automatically"), value: "autohangup"} ];
900 +
901 +       this.modelCallAction = {value: this.unknownContacts.callAction, disabled: false};
902 +
903 +       if((this.unknownContacts.callAction == "direct2vm") || (this.unknownContacts.callAction == "autohangup"))
904 +       {
905 +               this.controller.get("PhoneAlertRow").style.display = "none";
906 +               this.controller.get("PhoneRingtoneRow").style.display = "none";
907 +       }
908 +
909 +       this.controller.setupWidget("CallAction", {
910 +               label: $L("Action"),
911 +               labelPlacement: "left",                 
912 +               choices: this.choicesCallAction},
913 +               this.modelCallAction);
914 +
915 +       this.eventListenerManager.addListener(this.controller.get("CallAction"), Mojo.Event.propertyChange, 
916 +               this.saveUnknownPreferences.bind(this));
917 +
918 +       this.choicesPhoneAlert = [
919 +               {label: $L("Use Default"), value: "default"},
920 +               {label: $L("Ringtone"), value: "ringtone"},
921 +               {label: $L("Mute"), value: "none"} ];
922 +
923 +       this.modelCallAlert = {value: this.unknownContacts.callAlert, disabled: false};
924 +
925 +       if(this.unknownContacts.callAlert != "ringtone")
926 +               this.controller.get("PhoneRingtoneRow").style.display = "none";
927 +
928 +       this.controller.setupWidget("PhoneAlert", {
929 +               label: $L("Alert"),
930 +               labelPlacement: "left",                                                         
931 +               choices: this.choicesPhoneAlert},
932 +               this.modelCallAlert);
933 +
934 +       this.eventListenerManager.addListener(this.controller.get("PhoneAlert"), Mojo.Event.propertyChange, 
935 +               this.saveUnknownPreferences.bind(this));
936 +
937 +       if(this.unknownContacts.callRingtoneName != "")
938 +               this.controller.get("PhoneRingtone").innerHTML = this.unknownContacts.callRingtoneName;
939 +
940 +       this.eventListenerManager.addListener(this.controller.get("PhoneRingtoneRow"), Mojo.Event.tap, 
941 +               this.selectRingtone.bind(this, "call"));
942 +
943 +       this.choicesMsgAlert = [
944 +               {label: $L("Use Default"), value: "default"},
945 +               {label: $L("System Sound"), value: "alert"},
946 +               {label: $L("Ringtone"), value: "ringtone"},
947 +               {label: $L("Vibrate"), value: "vibrate"},
948 +               {label: $L("Mute"), value: "mute"} ];
949 +
950 +       this.modelMsgAlert = {value: this.unknownContacts.msgAlert, disabled: false};
951 +
952 +       if(this.unknownContacts.msgAlert != "ringtone")
953 +               this.controller.get("MsgRingtoneRow").style.display = "none";
954 +
955 +       this.controller.setupWidget("MsgAlert", {
956 +               label: $L("Alert"),
957 +               labelPlacement: "left",                                                         
958 +               choices: this.choicesMsgAlert},
959 +               this.modelMsgAlert);
960 +
961 +       this.eventListenerManager.addListener(this.controller.get("MsgAlert"), Mojo.Event.propertyChange, 
962 +               this.saveUnknownPreferences.bind(this));
963 +
964 +       if(this.unknownContacts.msgRingtonePath != "")
965 +               this.controller.get("MsgRingtone").innerHTML = this.unknownContacts.msgRingtoneName;
966 +
967 +       this.eventListenerManager.addListener(this.controller.get("MsgRingtoneRow"), Mojo.Event.tap, 
968 +               this.selectRingtone.bind(this, "msg"));
969 +
970 +       this.choicesEmailAlert = [
971 +               {label: $L("Use Default"), value: "default"},
972 +               {label: $L("System Sound"), value: "notifications"},
973 +               {label: $L("Ringtone"), value: "ringtone"},
974 +               {label: $L("Vibrate"), value: "vibrate"},
975 +               {label: $L("Mute"), value: "none"} ];
976 +
977 +       this.modelEmailAlert = {value: this.unknownContacts.emailAlert, disabled: false};
978 +
979 +       if(this.unknownContacts.emailAlert != "ringtone")
980 +               this.controller.get("EmailRingtoneRow").style.display = "none";
981 +
982 +       this.controller.setupWidget("EmailAlert", {
983 +               label: $L("Alert"),
984 +               labelPlacement: "left",                                                         
985 +               choices: this.choicesEmailAlert},
986 +               this.modelEmailAlert);
987 +
988 +       this.eventListenerManager.addListener(this.controller.get("EmailAlert"), Mojo.Event.propertyChange, 
989 +               this.saveUnknownPreferences.bind(this));
990 +
991 +       if(this.unknownContacts.emailRingtonePath != "")
992 +               this.controller.get("EmailRingtone").innerHTML = this.unknownContacts.emailRingtoneName;
993 +
994 +       this.eventListenerManager.addListener(this.controller.get("EmailRingtoneRow"), Mojo.Event.tap, 
995 +               this.selectRingtone.bind(this, "email"));
996 +
997 +       if(this.prefsView == "unknown_prefs")
998 +               this.unknownContactsTapped();
999 +};
1000 +
1001 +PrefsAssistant.prototype.saveUnknownPreferences = function() {
1002 +       if(this.modelCallAction.value != "none") {
1003 +               this.controller.get("CallActionRow").style.className = "single";
1004 +               this.controller.get("PhoneAlertRow").style.display = "none";            
1005 +               this.controller.get("PhoneRingtoneRow").style.display = "none";
1006 +
1007 +               this.modelCallAlert.value = "default";
1008 +               this.controller.modelChanged(this.modelCallAlert);
1009 +
1010 +               this.controller.get("PhoneRingtone").innerHTML = "";
1011 +       }
1012 +       else {
1013 +               this.controller.get("CallActionRow").style.className = "first";
1014 +               this.controller.get("PhoneAlertRow").style.display = "block";           
1015 +
1016 +               if(this.modelCallAlert.value != "ringtone") {
1017 +                       this.controller.get("PhoneRingtoneRow").style.display = "none";
1018 +                       this.controller.get("PhoneRingtone").innerHTML = "";
1019 +               }
1020 +               else {
1021 +                       this.controller.get("PhoneRingtoneRow").style.display = "block";
1022 +                       
1023 +                       if(this.unknownContacts.callRingtoneName == "")
1024 +                               this.selectRingtone("call", null);
1025 +                       else
1026 +                               this.controller.get("PhoneRingtone").innerHTML = this.unknownContacts.callRingtoneName;
1027 +               }
1028 +       }
1029 +
1030 +       if(this.modelMsgAlert.value != "ringtone") {
1031 +               this.controller.get("MsgRingtoneRow").style.display = "none";
1032 +               this.controller.get("MsgRingtone").innerHTML = "";      
1033 +       }
1034 +       else {
1035 +               this.controller.get("MsgRingtoneRow").style.display = "block";  
1036 +
1037 +               if(this.unknownContacts.msgRingtoneName == "")
1038 +                       this.selectRingtone("msg", null);
1039 +               else
1040 +                       this.controller.get("MsgRingtone").innerHTML = this.unknownContacts.msgRingtoneName;
1041 +       }
1042 +       
1043 +       if(this.modelEmailAlert.value != "ringtone") {
1044 +               this.controller.get("EmailRingtoneRow").style.display = "none";
1045 +               this.controller.get("EmailRingtone").innerHTML = "";    
1046 +       }
1047 +       else {
1048 +               this.controller.get("EmailRingtoneRow").style.display = "block";        
1049 +
1050 +               if(this.unknownContacts.emailRingtoneName == "")
1051 +                       this.selectRingtone("email", null);
1052 +               else
1053 +                       this.controller.get("EmailRingtone").innerHTML = this.unknownContacts.emailRingtoneName;
1054 +       }
1055 +               
1056 +       this.unknownContacts.callAction = this.modelCallAction.value;
1057 +       this.unknownContacts.callAlert = this.modelCallAlert.value;
1058 +       this.unknownContacts.msgAlert = this.modelMsgAlert.value;
1059 +       this.unknownContacts.emailAlert = this.modelEmailAlert.value;
1060 +       
1061 +       AppAssistant.appPrefs.set(Contacts.AppPrefs.Pref.unknownContacts, this.unknownContacts);
1062 +};
1063 +
1064 +PrefsAssistant.prototype.selectRingtone = function(config, event) {
1065 +       var ringtone = "";
1066 +
1067 +       if(config == "call")
1068 +               ringtone = this.unknownContacts.callRingtonePath || "";
1069 +       else if(config == "msg")
1070 +               ringtone = this.unknownContacts.msgRingtonePath || "";
1071 +       else if(config == "email")
1072 +               ringtone = this.unknownContacts.emailRingtonePath || "";
1073 +
1074 +       Mojo.FilePicker.pickFile({actionType: 'attach', kinds: ['ringtone'], defaultKind: 'ringtone',
1075 +               filePath: ringtone, onSelect: this.setRingtone.bind(this, config),
1076 +               onCancel: this.cancelRingtone.bind(this, config)},
1077 +               this.controller.stageController);
1078 +};
1079 +
1080 +PrefsAssistant.prototype.setRingtone = function(config, file) {
1081 +       var ringtonePath = file.fullPath.replace(/^\s*/, '').replace(/\s*$/, '');
1082 +       if(ringtonePath.indexOf("file://") == 0) 
1083 +               ringtonePath = ringtonePath.substring(7);
1084 +
1085 +       if(config == "call") {
1086 +               this.controller.get("PhoneRingtone").innerHTML = file.name;
1087 +               this.unknownContacts.callRingtoneName = file.name;
1088 +               this.unknownContacts.callRingtonePath = ringtonePath;
1089 +       }
1090 +       else if(config == "msg") {
1091 +               this.controller.get("MsgRingtone").innerHTML = file.name;
1092 +               this.unknownContacts.msgRingtoneName = file.name;
1093 +               this.unknownContacts.msgRingtonePath = ringtonePath;
1094 +       }
1095 +       else if(config == "email") {
1096 +               this.controller.get("EmailRingtone").innerHTML = file.name;
1097 +               this.unknownContacts.emailRingtoneName = file.name;
1098 +               this.unknownContacts.emailRingtonePath = ringtonePath;
1099 +       }
1100 +
1101 +       this.saveUnknownPreferences();
1102 +};
1103 +
1104 +PrefsAssistant.prototype.cancelRingtone = function(config) {
1105 +       if(config == "call") {
1106 +               if((!this.unknownContacts.callRingtoneName) || (this.unknownContacts.callRingtoneName == "")) {
1107 +                       this.controller.get("PhoneRingtoneRow").style.display = "none";
1108 +
1109 +                       this.modelCallAlert.value = "default";
1110 +                       this.controller.modelChanged(this.modelCallAlert);
1111 +               }
1112 +       }
1113 +       else if(config == "msg") {
1114 +               if((!this.unknownContacts.msgRingtoneName) || (this.unknownContacts.msgRingtoneName == "")) {
1115 +                       this.controller.get("MsgRingtoneRow").style.display = "none";
1116 +
1117 +                       this.modelMsgAlert.value = "default";
1118 +                       this.controller.modelChanged(this.modelMsgAlert);
1119 +               }
1120 +       }
1121 +       else if(config == "email") {
1122 +               if((!this.unknownContacts.emailRingtoneName) || (this.unknownContacts.emailRingtoneName == "")) {
1123 +                       this.controller.get("EmailRingtoneRow").style.display = "none";
1124 +
1125 +                       this.modelEmailAlert.value = "default";
1126 +                       this.controller.modelChanged(this.modelEmailAlert);
1127 +               }
1128 +       }
1129 +
1130 +       this.saveUnknownPreferences();
1131  };
1132  
1133  PrefsAssistant.prototype.aboutToActivate = function (callback) {
1134 @@ -96,6 +402,13 @@
1135  };
1136  
1137  /*
1138 + * Default view change handler
1139 + */
1140 +PrefsAssistant.prototype.defaultViewChanged = function (event) {
1141 +       AppAssistant.appSettings.setListViewDisplayMode(this.defaultViewModel.defaultView);
1142 +};
1143 +
1144 +/*
1145   * Sort order change handler
1146   */
1147  PrefsAssistant.prototype.sortOrderChanged = function (event) {
1148 @@ -111,6 +424,37 @@
1149         }
1150  };
1151  
1152 +/*
1153 + * Blocked & Unknown numbers change handlers
1154 + */
1155 +PrefsAssistant.prototype.blockedNumbersChanged = function (event) {
1156 +       AppAssistant.appPrefs.set(Contacts.AppPrefs.Pref.blockedNumbers, this.blockedNumbersModel.blockedNumbers);
1157 +};
1158 +
1159 +PrefsAssistant.prototype.unknownNumbersChanged = function (event) {
1160 +       AppAssistant.appPrefs.set(Contacts.AppPrefs.Pref.unknownNumbers, this.unknownNumbersModel.unknownNumbers);
1161 +};
1162 +
1163 +/*
1164 + * Unknown contacts options tap handler
1165 + */
1166 +PrefsAssistant.prototype.unknownContactsTapped = function (event) {
1167 +       this.prefsView = "unknown_prefs";
1168 +       this.controller.get("common_prefs").style.display = "none";
1169 +       this.controller.get("unknown_prefs").style.display = "block";
1170 +       this.controller.getSceneScroller().mojo.scrollTo(0,0);  
1171 +};
1172 +
1173 +PrefsAssistant.prototype.handleCommand = function (event) {
1174 +       if ((event.type === Mojo.Event.back) && (this.prefsView == "unknown_prefs")) {
1175 +               Mojo.Event.stop(event);
1176 +               this.prefsView = "common_prefs";
1177 +               this.controller.get("unknown_prefs").style.display = "none";
1178 +               this.controller.get("common_prefs").style.display = "block";
1179 +               this.controller.getSceneScroller().mojo.scrollTo(0,0);
1180 +       }
1181 +};
1182 +
1183  /*
1184   * Callbacks used for the SIM account preferences scene
1185   */
1186 --- .orig/usr/palm/applications/com.palm.app.contacts/app/views/prefs/prefs-scene.html
1187 +++ /usr/palm/applications/com.palm.app.contacts/app/views/prefs/prefs-scene.html
1188 @@ -1,3 +1,4 @@
1189 +<div id="common_prefs">
1190  <div class="palm-page-header multi-line">
1191         <div class="palm-page-header-wrapper">
1192           <div class="icon app"></div>
1193 @@ -8,7 +9,20 @@
1194  </div>                                                                                         
1195  
1196  <div class="palm-group">
1197 -       <div class="palm-group-title" x-mojo-loc="">List order</div>
1198 +       <div class="palm-group-title">Default Contacts View</div>
1199 +
1200 +       <div class="palm-list">
1201 +               <div class="palm-row single" x-mojo-tap-highlight="momentary">
1202 +                       <div class="palm-row-wrapper">
1203 +                               <div id="DefaultContactsView" x-mojo-element="ListSelector"></div>
1204 +                       </div>
1205 +               </div>
1206 +       </div>
1207 +</div>
1208 +
1209 +<div class="palm-group">
1210 +       <div class="palm-group-title" x-mojo-loc="">Contacts List Order</div>
1211 +
1212                 <div class="palm-list">
1213                         <div class="palm-row single" x-mojo-tap-highlight="momentary">
1214                                 <div class="palm-row-wrapper">
1215 @@ -18,6 +32,30 @@
1216                 </div>
1217  </div>
1218         
1219 +<div class="palm-group">
1220 +       <div class="palm-group-title">Unknown Contacts</div>
1221 +       
1222 +       <div class="palm-list">
1223 +               <div class="palm-row first">
1224 +                       <div class="palm-row-wrapper">
1225 +                               <div id="BlockedNumbers" x-mojo-element="ToggleButton"></div>
1226 +                               <div class="title left" x-mojo-loc="">Blocked Numbers</div>
1227 +                       </div>
1228 +               </div>
1229 +
1230 +               <div class="palm-row last">
1231 +                       <div class="palm-row-wrapper">
1232 +                               <div id="UnknownNumbers" x-mojo-element="ToggleButton"></div>
1233 +                               <div class="title left" x-mojo-loc="">Unknown Numbers</div>
1234 +                       </div>
1235 +               </div>
1236 +       </div>
1237 +</div>
1238 +
1239 +<div id="UnknownContactsOptions" class="palm-button" x-mojo-tap-highlight="momentary" x-mojo-loc="">
1240 +       Unknown Contacts Options
1241 +</div>
1242 +       
1243  <div id="accountsList" x-mojo-element="AccountsList"></div>
1244  
1245  <div id="PrimaryAccountPickerContainer"></div>
1246 @@ -29,8 +67,82 @@
1247                 </div>
1248         </div>
1249      </div>
1250 +
1251 +       <div x-mojo-loc="" class="palm-info-text">All added and imported contacts will default to this account.</div>
1252 +
1253 +<!--<div id="syncAccountsButton" x-mojo-element="Button"></div>-->
1254 +       <div id="addAccountButton" x-mojo-element="Button"></div>
1255  </div>
1256 -<div x-mojo-loc="" class="palm-info-text">New contacts will default to this account</div>
1257  
1258 -<div id="syncAccountsButton" x-mojo-element="Button"></div>
1259 -<div id="addAccountButton" x-mojo-element="Button"></div>
1260 +<div id="unknown_prefs" style="display:none;">
1261 +       <div class="palm-page-header">
1262 +               <div class="palm-page-header-wrapper">
1263 +                       <div class="icon notification-prefs"></div>
1264 +      <div class="title">Unknown Contacts</div>
1265 +               </div>
1266 +       </div>
1267 +
1268 +       <div class="palm-group" id="PhoneCallGroup">
1269 +               <div class="palm-group-title">Phone Call</div>
1270 +       
1271 +               <div class="palm-list">
1272 +                       <div class="palm-row first" id="CallActionRow">
1273 +                               <div class="palm-row-wrapper">
1274 +                                       <div id="CallAction" x-mojo-element="ListSelector"></div>
1275 +                               </div>
1276 +                       </div>
1277 +               
1278 +                       <div class="palm-row" id="PhoneAlertRow">
1279 +                               <div class="palm-row-wrapper">
1280 +                                       <div id="PhoneAlert" x-mojo-element="ListSelector"></div>
1281 +                               </div>
1282 +                       </div>
1283 +
1284 +                       <div class="palm-row last" id="PhoneRingtoneRow">
1285 +                               <div class="palm-row-wrapper">
1286 +                                       <div class="label right" id="PhoneRingtone">Ringtone</div>
1287 +                                       <div class="title">Ringtone</div>
1288 +                               </div>
1289 +                       </div>
1290 +               </div>
1291 +       </div>
1292 +
1293 +       <div class="palm-group">
1294 +               <div class="palm-group-title">SMS Message</div>
1295 +       
1296 +               <div class="palm-list">
1297 +                       <div class="palm-row single">
1298 +                               <div class="palm-row-wrapper">
1299 +                                       <div id="MsgAlert" x-mojo-element="ListSelector"></div>
1300 +                               </div>
1301 +                       </div>
1302 +
1303 +                       <div class="palm-row last" id="MsgRingtoneRow">
1304 +                               <div class="palm-row-wrapper">
1305 +                                       <div class="label right" id="MsgRingtone">Ringtone</div>
1306 +                                       <div class="title">Ringtone</div>
1307 +                               </div>
1308 +                       </div>
1309 +               </div>
1310 +       </div>
1311 +
1312 +       <div class="palm-group">
1313 +               <div class="palm-group-title">Email Message</div>
1314 +       
1315 +               <div class="palm-list">
1316 +                       <div class="palm-row single">
1317 +                               <div class="palm-row-wrapper">
1318 +                                       <div id="EmailAlert" x-mojo-element="ListSelector"></div>
1319 +                               </div>
1320 +                       </div>
1321 +
1322 +                       <div class="palm-row last" id="EmailRingtoneRow">
1323 +                               <div class="palm-row-wrapper">
1324 +                                       <div class="label right" id="EmailRingtone">Ringtone</div>
1325 +                                       <div class="title">Ringtone</div>
1326 +                               </div>
1327 +                       </div>
1328 +               </div>
1329 +       </div>
1330 +</div>
1331 +       
1332 --- .orig/etc/palm/db/kinds/com.palm.person
1333 +++ /etc/palm/db/kinds/com.palm.person
1334 @@ -559,6 +559,88 @@
1335                                                 "description": "The location on the filesystem where this ringtone is located."
1336                                         }
1337                                 }
1338 +                       },
1339 +                       "callAlert": {
1340 +                               "type": "object",
1341 +                               "optional": true,
1342 +                               "description": "The call alert that is associated with this person",
1343 +                               "properties": {
1344 +                                       "alert": {
1345 +                                               "type": "string",
1346 +                                               "optional": true,
1347 +                                               "description": "The type of the call alert."
1348 +                                       }
1349 +                               }
1350 +                       },
1351 +                       "callAction": {
1352 +                               "type": "object",
1353 +                               "optional": true,
1354 +                               "description": "The call action that is associated with this person",
1355 +                               "properties": {
1356 +                                       "action": {
1357 +                                               "type": "string",
1358 +                                               "optional": true,
1359 +                                               "description": "The action to take when incoming call."
1360 +                                       }
1361 +                               }
1362 +                       },
1363 +                       "msgRingtone": {
1364 +                               "type": "object",
1365 +                               "optional": true,
1366 +                               "description": "The message ringtone that is associated with this person",
1367 +                               "properties": {
1368 +                                       "name": {
1369 +                                               "type": "string",
1370 +                                               "optional": true,
1371 +                                               "description": "The displayable name of the message ringtone."
1372 +                                       },
1373 +                                       "location": {
1374 +                                               "type": "string",
1375 +                                               "optional": true,
1376 +                                               "description": "The location on the filesystem where this message ringtone is located."
1377 +                                       }
1378 +                               }
1379 +                       },
1380 +                       "msgAlert": {
1381 +                               "type": "object",
1382 +                               "optional": true,
1383 +                               "description": "The message alert that is associated with this person",
1384 +                               "properties": {
1385 +                                       "alert": {
1386 +                                               "type": "string",
1387 +                                               "optional": true,
1388 +                                               "description": "The type of the message alert."
1389 +                                       }
1390 +                               }
1391 +                       },
1392 +                       "iMsgRingtone": {
1393 +                               "type": "object",
1394 +                               "optional": true,
1395 +                               "description": "The isntant messaging ringtone that is associated with this person",
1396 +                               "properties": {
1397 +                                       "name": {
1398 +                                               "type": "string",
1399 +                                               "optional": true,
1400 +                                               "description": "The displayable name of the instant messaging ringtone."
1401 +                                       },
1402 +                                       "location": {
1403 +                                               "type": "string",
1404 +                                               "optional": true,
1405 +                                               "description": "The location on the filesystem where this instant messaging ringtone is located."
1406 +                                       }
1407 +                               }
1408 +                       },
1409 +                       "iMsgAlert": {
1410 +                               "type": "object",
1411 +                               "optional": true,
1412 +                               "description": "The instant messaging alert that is associated with this person",
1413 +                               "properties": {
1414 +                                       "alert": {
1415 +                                               "type": "string",
1416 +                                               "optional": true,
1417 +                                               "description": "The type of the instant messaging alert."
1418 +                                       }
1419 +                               }
1420                         }
1421                 }
1422         },
1423 --- .orig/etc/palm/db/permissions/com.palm.person
1424 +++ /etc/palm/db/permissions/com.palm.person
1425 @@ -14,6 +14,7 @@
1426                 "operations": {
1427                         "read": "allow",
1428                         "create": "allow",
1429 +                       "delete": "allow",
1430                         "update": "allow"
1431                 }
1432         },
1433 --- .orig/usr/palm/frameworks/accounts.ui/submission/40.3accounts_ui.js
1434 +++ /usr/palm/frameworks/accounts.ui/submission/40.3accounts_ui.js
1435 @@ -22,7 +22,7 @@
1436  cp.config)});_.extend(allConfigs,result.config);_.extend(allConfigs,result.defaultResult.result.config);if(result.otherResults&&_.isArray(result.otherResults))result.otherResults.forEach(function(other){if(other.result){_.extend(allCreds,other.result.credentials);_.extend(allConfigs,other.result.config)}});match=_.detect(existingAccounts,function(account){var caps=_.pluck(account.capabilityProviders,"capability");return requestedCapability&&account.username===result.username&&account.templateId===
1437  result.template.templateId&&!_.include(caps,requestedCapability)});if(match){result.template.capabilityProviders.forEach(function(cp){var matchingResult;if(cp.validator){matchingResult=_.detect(result.otherResults,isValidatorMatch,cp);if(matchingResult&&matchingResult.result)capabilityProviders.push({id:cp.id})}else capabilityProviders.push({id:cp.id})});scene.serviceRequest("palm://com.palm.service.accounts",{method:"modifyAccount",parameters:{accountId:match._id,object:{capabilityProviders:capabilityProviders}},
1438  onSuccess:handleCreateSuccess,onFailure:handleCreateFailure})}else scene.serviceRequest("palm://com.palm.service.accounts",{method:"createAccount",parameters:{templateId:result.template.templateId,alias:toSave.alias,capabilityProviders:selectedCapabilities||[],username:result.username,credentials:allCreds,config:allConfigs},onSuccess:handleCreateSuccess,onFailure:handleCreateFailure})}}}();var AccountsListWidget=function(){var stylesheets=["stylesheets/accounts-list.css"];function styleop(op,div,relativePath){var fn;if(op==="load")fn=Mojo.loadStylesheet;else if(op==="unload")fn=Mojo.unloadStylesheet;if(fn)fn(div.ownerDocument,relativePath,MojoLoader.root)}function toggleAppStylesheets(doc,enable){var links=doc.querySelectorAll('link[type="text/css"]');var href;var libPrefix="file://"+MojoLoader.root;for(var i=0;i<links.length;i++){href=links[i].href;if(!(href.indexOf(libPrefix)===0||
1439 -href.match(/\/usr\/palm\/frameworks\/mojo/)))links[i].disabled=!enable}}function handleListTap(e){var template,account=_.clone(e.item);account.capabilityProviders=account.capabilityProviders.map(_.clone);template=Util.getTemplateById(this.templates,account.templateId);if(this.attrs.handleListTap)this.attrs.handleListTap(account,template);else if(account.templateId==="com.palm.sim")this.stage.pushScene({name:"sim",assistantConstructor:SimAssistant,templateRoot:MojoLoader.root,sceneTemplate:"templates/sim-scene",
1440 +href.match(/\/usr\/palm\/frameworks\/mojo/)))links[i].disabled=!enable}}function handleListTap(e){var template,account=_.clone(e.item);account.capabilityProviders=account.capabilityProviders.map(_.clone);template=Util.getTemplateById(this.templates,account.templateId);if(this.attrs.handleListTap){if(e.originalEvent.target.className=="notifications icon selected")this.attrs.handleListTap(account, template, "notifications");else this.attrs.handleListTap(account,template);}else if(account.templateId==="com.palm.sim")this.stage.pushScene({name:"sim",assistantConstructor:SimAssistant,templateRoot:MojoLoader.root,sceneTemplate:"templates/sim-scene",
1441  templateModel:account},{account:account,onSetup:this.disableAppStyles,onCleanup:this.enableAppStyles});else this.stage.pushScene({name:"modify",assistantConstructor:ModifyAssistant,templateRoot:MojoLoader.root,sceneTemplate:"templates/modify-scene",templateModel:account},{template:template,account:account,onSetup:this.disableAppStyles,onCleanup:this.enableAppStyles})}function handleListAdd(options){var sceneTemplate;var selectedTemplates=Util.filterTemplates(this.templates,this.filterBy);var capability=
1442  this.filterBy&&this.filterBy.capability;if(selectedTemplates.length===0)Mojo.Controller.errorDialog("No services implement this functionality: "+this.filterBy.capability);else if(false&&selectedTemplates.length===1)LoginUtil.pushLoginScene(this.stage,selectedTemplates[0],this.templates,capability);else{sceneTemplate="templates/";if(this.filterBy)sceneTemplate+="template-list-firstlaunch-scene";else sceneTemplate+="template-list-scene";if(!options)options={};options.filterBy=this.filterBy;this.stage.pushScene({name:"template-list",
1443  assistantConstructor:TemplateListAssistant,templateRoot:MojoLoader.root,sceneTemplate:sceneTemplate},selectedTemplates,this.templates,options,this.disableAppStyles,this.enableAppStyles)}}function decorateItem(item){var selected,iconPath,displayText,match,annotated=Util.annotateAccount(item,this.templates);_.extend(item,annotated);if(annotated.icon)iconPath=annotated.icon.loc_32x32;displayText=annotated.loc_name;if(this.filterBy&&this.filterBy.capability){selected=this.filterBy.capability;match=_.detect(annotated.capabilityProviders,
1444 --- .orig/usr/palm/frameworks/accounts.ui/submission/40.3/stylesheets/accounts-list.css
1445 +++ /usr/palm/frameworks/accounts.ui/submission/40.3/stylesheets/accounts-list.css
1446 @@ -27,6 +27,17 @@
1447         background: url(../images/icon-accounts.png) center center no-repeat; 
1448  }
1449  
1450 +.notifications.icon {
1451 +       margin: 1px 3px -1px 0px;
1452 +       background: url(../images/icon-notifications.png) top right no-repeat;
1453 +       display: none;
1454 +       width: 60px;
1455 +       height: 50px;
1456 +}
1457 +
1458 +.notifications.icon.selected { background-position: bottom right; }
1459 +.show-notifications .notifications.icon { display: block; }
1460 +
1461  /* List */
1462  
1463  .no-account {
1464 --- .orig/usr/palm/frameworks/accounts.ui/submission/40.3/templates/accounts-list-item.html
1465 +++ /usr/palm/frameworks/accounts.ui/submission/40.3/templates/accounts-list-item.html
1466 @@ -5,5 +5,6 @@
1467                         <div class="account-label-title truncating-text">#{displayText}</div>
1468                         <div class="account-label-subtitle truncating-text">#{username}</div>
1469                 </div>
1470 +               <div class="notifications icon" x-mojo-tap-highlight="momentary"></div>
1471         </div>
1472  </div>
1473 --- .orig/usr/palm/frameworks/accounts.ui/submission/40.3/javascript/accountslist-widget.js
1474 +++ /usr/palm/frameworks/accounts.ui/submission/40.3/javascript/accountslist-widget.js
1475 @@ -38,7 +38,10 @@
1476                 template = Util.getTemplateById(this.templates, account.templateId);
1477                 
1478                 if (this.attrs.handleListTap) {
1479 -                       this.attrs.handleListTap(account, template);
1480 +                       if(e.originalEvent.target.className == "notifications icon selected")
1481 +                               this.attrs.handleListTap(account, template, "notifications");
1482 +                       else
1483 +                               this.attrs.handleListTap(account, template);    
1484                 } else if (account.templateId === "com.palm.sim") {
1485                         // Push SIM scene
1486                         this.stage.pushScene({
1487 --- .orig/usr/palm/frameworks/accounts.ui/submission/40.3/concatenated.js
1488 +++ /usr/palm/frameworks/accounts.ui/submission/40.3/concatenated.js
1489 @@ -743,7 +743,10 @@
1490                 template = Util.getTemplateById(this.templates, account.templateId);
1491                 
1492                 if (this.attrs.handleListTap) {
1493 -                       this.attrs.handleListTap(account, template);
1494 +                       if(e.originalEvent.target.className == "notifications icon selected")
1495 +                               this.attrs.handleListTap(account, template, "notifications");
1496 +                       else
1497 +                               this.attrs.handleListTap(account, template);    
1498                 } else if (account.templateId === "com.palm.sim") {
1499                         // Push SIM scene
1500                         this.stage.pushScene({
1501 --- .orig/usr/palm/frameworks/contacts.ui/submission/38contacts_ui.js
1502 +++ /usr/palm/frameworks/contacts.ui/submission/38contacts_ui.js
1503 @@ -2,18 +2,17 @@
1504  var resourceBundleFactory=new Globalization.ResourceBundleFactory(MojoLoader.root);var RB=resourceBundleFactory.getResourceBundle();AccountsLib.enableExtensions();var PersonListWidget=exports.PersonListWidget=function(){Assert.requireDefined(Mojo,"PersonListWidget: Failed to detect the Mojo framework");var _sceneController,_div,_model,_uniqueId="PFLW_"+Date.now(),_stylesheets=[Utils.getStylesheetPath("common.css"),Utils.getStylesheetPath("list.css")],_eventListenerManager=new EventListenerManager,_personListScrollPosition,_favoriteListScrollPosition,_personListDataSource,_favoriteListDataSource,_personListElement,_favoriteListElement,_currentView,_filterString=
1505  "",getWidgetElementId=function(id){return _uniqueId+id},getWidgetElement=function(id){return _sceneController.get(getWidgetElementId(id))},transformListItem=function(person){if(!person)return person;person=Contacts.PersonFactory.createPersonDisplayLite(person,_model.sortOrder);if(_model.exclusions&&Array.isArray(_model.exclusions))if(_model.exclusions.indexOf(person._id)!==-1)person.exclude="exclude";return person},dividerLabelCallback=function(person){if(person&&!person.exclude)return person.dividerText;
1506  else return""},personDecorator=function(itemModel){var decorations={},displayName=Foundations.StringUtils.escapeHTML(itemModel.displayName);if(_filterString)decorations.displayName=Mojo.PatternMatching.addContactMatchFormatting(displayName,_filterString);else decorations.displayName=displayName;return decorations},createAsyncPersonDecorator=function(items,callback){return new PersonAsyncDecorator(items,callback)},setupPersonList=function(){var dataSourceAssistant=Contacts.ListWidget.getTypedownDBDataSourceAssistant({favoritesOnly:_model.favoritesOnly,
1507 -excludeFavorites:_model.excludeFavorites}),wrappedDataSourceAssistant=Utils.formatDataSourceAssistant(dataSourceAssistant,transformListItem),dividerTemplate;_personListDataSource=new Mojo.DataSource(wrappedDataSourceAssistant);_personListElement=getWidgetElement("person-list");_model.personListTapCallback=_model.personListTapCallback||_model.listTapCallback;if(_model.sortOrder===Contacts.ListWidget.SortOrder.firstLast||_model.sortOrder===Contacts.ListWidget.SortOrder.lastFirst)dividerTemplate=Utils.getTemplatePath("person-filter-list-widget/group-separator");
1508 -else dividerTemplate=Utils.getTemplatePath("person-filter-list-widget/multiline-separator");_sceneController.setupWidget(getWidgetElementId("person-list"),{templateRoot:LIB_ROOT,templates:{item:Utils.getTemplatePath("person-filter-list-widget/person-item"),empty:Utils.getTemplatePath("person-filter-list-widget/empty")},uniquenessProperty:"_id",dataSource:_personListDataSource,dividers:{labelCallback:dividerLabelCallback,template:dividerTemplate},decorator:personDecorator,asyncDecorator:createAsyncPersonDecorator},
1509 -{});if(_model.personListTapCallback&&_.isFunction(_model.personListTapCallback))_eventListenerManager.addListener(_personListElement,Mojo.Event.listTap,_model.personListTapCallback);else console.warn("PersonListWidget (setupPersonList) was set up without a listTapCallback.  Do you really want to do this?")},handleAddFavorite=function(person){person.makeFavorite(true)},handleAddFavoriteTap=function(event){pushPeoplePickerScene(_sceneController.stageController,{excludeFavorites:true,iconClass:"icon-add-fav",
1510 -message:RB.$L("Add to Favorites"),callback:handleAddFavorite})},handleFavoriteDelete=function(items,callback){items.forEach(function(item){var person=Contacts.PersonFactory.createPersonDisplay(item);person.unfavorite(true)});callback()},setupFavoriteList=function(){var dataSourceAssistant=Contacts.ListWidget.getTypedownDBDataSourceAssistant({favoritesOnly:true}),wrappedDataSourceAssistant=Utils.formatDataSourceAssistant(dataSourceAssistant,transformListItem);_favoriteListDataSource=new Mojo.DataSource(wrappedDataSourceAssistant);
1511 -_favoriteListElement=getWidgetElement("favorite-list");_model.favoriteListTapCallback=_model.favoriteListTapCallback||_model.listTapCallback;_favoriteListDataSource.removeItems=handleFavoriteDelete;_sceneController.setupWidget(getWidgetElementId("favorite-list"),{templateRoot:LIB_ROOT,templates:{item:Utils.getTemplatePath("person-filter-list-widget/person-item")},uniquenessProperty:"_id",dataSource:_favoriteListDataSource,decorator:personDecorator,asyncDecorator:createAsyncPersonDecorator,addItem:{label:RB.$L("Add Favorite...")},
1512 -swipeDelete:{deleteText:RB.$L("Remove")}},{});if(_model.favoriteListTapCallback&&_.isFunction(_model.favoriteListTapCallback))_eventListenerManager.addListener(_favoriteListElement,Mojo.Event.listTap,_model.favoriteListTapCallback);else console.warn("PersonListWidget (setupFavoriteList) was set up without a listTapCallback.  Do you really want to do this?");_eventListenerManager.addListener(_favoriteListElement,Mojo.Event.listAdd,handleAddFavoriteTap)},swapLists=function(elementIdToShow,elementIdToHide,
1513 +excludeFavorites:_model.excludeFavorites}),wrappedDataSourceAssistant=Utils.formatDataSourceAssistant(dataSourceAssistant,transformListItem),dividerTemplate;_personListDataSource=new Mojo.DataSource(wrappedDataSourceAssistant);_personListElement=getWidgetElement("person-list");_model.personListTapCallback=_model.personListTapCallback||_model.listTapCallback;_model.personListDeleteCallback=_model.personListDeleteCallback;if(_model.sortOrder===Contacts.ListWidget.SortOrder.firstLast||_model.sortOrder===Contacts.ListWidget.SortOrder.lastFirst)dividerTemplate=Utils.getTemplatePath("person-filter-list-widget/group-separator");
1514 +else dividerTemplate=Utils.getTemplatePath("person-filter-list-widget/multiline-separator");if(_model.personListDeleteCallback&&_.isFunction(_model.personListDeleteCallback))var allowDelete=true;else var allowDelete=false;_sceneController.setupWidget(getWidgetElementId("person-list"),{templateRoot:LIB_ROOT,templates:{item:Utils.getTemplatePath("person-filter-list-widget/person-item"),empty:Utils.getTemplatePath("person-filter-list-widget/empty")},uniquenessProperty:"_id",dataSource:_personListDataSource,dividers:{labelCallback:dividerLabelCallback,template:dividerTemplate},decorator:personDecorator,asyncDecorator:createAsyncPersonDecorator,swipeDelete:true},
1515 +{});if(_model.personListTapCallback&&_.isFunction(_model.personListTapCallback))_eventListenerManager.addListener(_personListElement,Mojo.Event.listTap,_model.personListTapCallback);else console.warn("PersonListWidget (setupPersonList) was set up without a listTapCallback.  Do you really want to do this?");if(_model.personListDeleteCallback&&_.isFunction(_model.personListDeleteCallback))_eventListenerManager.addListener(_personListElement,Mojo.Event.listDelete,_model.personListDeleteCallback);},handleAddFavorite=function(person){person.makeFavorite(true)},handleFavoriteDelete=function(items,callback){items.forEach(function(item){var person=Contacts.PersonFactory.createPersonDisplay(item);person.unfavorite(true)});callback()},setupFavoriteList=function(){var dataSourceAssistant=Contacts.ListWidget.getTypedownDBDataSourceAssistant({favoritesOnly:true}),wrappedDataSourceAssistant=Utils.formatDataSourceAssistant(dataSourceAssistant,transformListItem);_favoriteListDataSource=new Mojo.DataSource(wrappedDataSourceAssistant);
1516 +_favoriteListElement=getWidgetElement("favorite-list");_model.favoriteListTapCallback=_model.favoriteListTapCallback||_model.listTapCallback;_favoriteListDataSource.removeItems=handleFavoriteDelete;_sceneController.setupWidget(getWidgetElementId("favorite-list"),{templateRoot:LIB_ROOT,templates:{item:Utils.getTemplatePath("person-filter-list-widget/person-item")},uniquenessProperty:"_id",dataSource:_favoriteListDataSource,decorator:personDecorator,asyncDecorator:createAsyncPersonDecorator,
1517 +swipeDelete:{deleteText:RB.$L("Remove")}},{});if(_model.favoriteListTapCallback&&_.isFunction(_model.favoriteListTapCallback))_eventListenerManager.addListener(_favoriteListElement,Mojo.Event.listTap,_model.favoriteListTapCallback);else console.warn("PersonListWidget (setupFavoriteList) was set up without a listTapCallback.  Do you really want to do this?");_eventListenerManager.addListener(_favoriteListElement,Mojo.Event.listDelete,handleFavoriteDelete)},swapLists=function(elementIdToShow,elementIdToHide,
1518  useTransition,state){var elementToShow=getWidgetElement(elementIdToShow),elementToHide=getWidgetElement(elementIdToHide),transition;if(useTransition)transition=_sceneController.prepareTransition(Mojo.Transition.crossFade,false);Mojo.Dom.show(elementToShow);Mojo.Dom.hide(elementToHide);_sceneController.showWidgetContainer(elementToShow);_sceneController.hideWidgetContainer(elementToHide);if(state)_sceneController.sceneScroller.mojo.setState(state);if(transition)transition.run()};return{setup:function(sceneController,
1519  div,model){Assert.requireFalse(_sceneController,"PersonListWidget setup() has already been called! Aborting.");Assert.require(sceneController,"PersonListWidget requires a sceneController");_sceneController=sceneController;_div=div&&_.isString(div)?sceneController.get(div):div;_model=model||{};_model.mode=_model.mode||PersonListWidget.MODE.PERSON_AND_FAVORITE_LIST;Assert.require(div,"PersonListWidget requires a div element");if(!_model.sortOrder){Mojo.Log.warning("PersonListWidget: no sort order provided!  Defaulting to Contacts.ListWidget.SortOrder.defaultSortOrder");
1520  _model.sortOrder=Contacts.ListWidget.SortOrder.defaultSortOrder}Utils.loadSceneStyles(_sceneController,_stylesheets,_uniqueId);var listWidgetModel={uniqueId:_uniqueId},hasPersonList=false,hasFavoriteList=false;div.innerHTML=Mojo.View.render({object:listWidgetModel,templateRoot:LIB_ROOT,template:Utils.getTemplatePath("person-filter-list-widget/widget-template")});if(_model.mode===PersonListWidget.MODE.PERSON_AND_FAVORITE_LIST||_model.mode===PersonListWidget.MODE.PERSON_LIST){setupPersonList();hasPersonList=
1521  true}if(_model.mode===PersonListWidget.MODE.PERSON_AND_FAVORITE_LIST||_model.mode===PersonListWidget.MODE.FAVORITE){setupFavoriteList();hasFavoriteList=true}if(_model.defaultView===PersonListWidget.VIEW.PERSON_LIST)this.showPersonList();else if(_model.defaultView===PersonListWidget.VIEW.FAVORITE_LIST)this.showFavoriteList();else if(hasPersonList)this.showPersonList();else if(hasFavoriteList)this.showFavoriteList()},getCurrentView:function(){return _currentView},teardown:function(){Utils.unloadSceneStyles(_sceneController,
1522  _stylesheets,_uniqueId);_eventListenerManager.destroyListeners()},showPersonList:function(useTransition){if(_currentView===PersonListWidget.VIEW.PERSON_LIST)return;_currentView=PersonListWidget.VIEW.PERSON_LIST;_favoriteListScrollPosition=_sceneController.sceneScroller.mojo.getState();swapLists("person-list-container","favorite-list-container",useTransition,_personListScrollPosition)},showFavoriteList:function(useTransition){if(_currentView===PersonListWidget.VIEW.FAVORITE_LIST)return;_currentView=
1523 -PersonListWidget.VIEW.FAVORITE_LIST;_personListScrollPosition=_sceneController.sceneScroller.mojo.getState();swapLists("favorite-list-container","person-list-container",useTransition,_favoriteListScrollPosition)},filter:function(str,setCountFn){var dataSource,listElement;if(_currentView===PersonListWidget.VIEW.FAVORITE_LIST){dataSource=_favoriteListDataSource;listElement=_favoriteListElement}else{dataSource=_personListDataSource;listElement=_personListElement}_filterString=str;dataSource.setFilterString(str);
1524 +PersonListWidget.VIEW.FAVORITE_LIST;_personListScrollPosition=_sceneController.sceneScroller.mojo.getState();swapLists("favorite-list-container","person-list-container",useTransition,_favoriteListScrollPosition)},showAddFavorite:function(){pushPeoplePickerScene(_sceneController.stageController,{excludeFavorites:true,iconClass:"icon-add-fav",message:RB.$L("Add to Favorites"),callback:handleAddFavorite});},filter:function(str,setCountFn){var dataSource,listElement;if(_currentView===PersonListWidget.VIEW.FAVORITE_LIST){dataSource=_favoriteListDataSource;listElement=_favoriteListElement}else{dataSource=_personListDataSource;listElement=_personListElement}_filterString=str;dataSource.setFilterString(str);
1525  dataSource.getCount(setCountFn);listElement.mojo.invalidate()},invalidate:function(){_favoriteListElement.mojo.invalidate();_personListElement.mojo.invalidate()}}};PersonListWidget.MODE={PERSON_LIST:"mode_person_list",FAVORITE_LIST:"mode_favorite_list",PERSON_AND_FAVORITE_LIST:"mode_person_and_favorite_list"};PersonListWidget.VIEW={PERSON_LIST:"view_person_list",FAVORITE_LIST:"view_favorite_list"};var DetailWidget=exports.DetailWidget=function(){Assert.requireDefined(Mojo,"DetailWidget: Failed to detect the Mojo framework");this.controller=undefined;this._widget={div:undefined,model:undefined,stylesheets:[Utils.getStylesheetPath("common.css"),Utils.getStylesheetPath("detail.css"),Utils.getStylesheetPath("sandbox-styles.css")],uniqueId:"PFLW_"+Date.now()};this.person=undefined;this.personId=undefined;this.personRev=undefined;this.clippedModel={};this.currentlyLinking=false;this.listConfigs=
1526  [{listName:"phone",listId:"phoneList",itemTemplate:"phone-item"},{listName:"email",listId:"emailList",itemTemplate:"email-item"},{listName:"messaging",listId:"messagingList",itemTemplate:"messaging-item"},{listName:"address",listId:"addressList",itemTemplate:"address-item"},{listName:"url",listId:"urlList",itemTemplate:"url-item"},{listName:"notes",listId:"notesList",itemTemplate:"notes-item"},{listName:"moredetails",listId:"moredetailsList",itemTemplate:"moredetails-item"}];this.eventListenerManager=
1527  new EventListenerManager;this.listManager=new MultipleListManager;this.imStatusWatchers={}};
1528 --- .orig/usr/palm/frameworks/contacts/submission/94contacts.js
1529 +++ /usr/palm/frameworks/contacts/submission/94contacts.js
1530 @@ -152,7 +152,7 @@
1531  ContactPhoto.TYPE=Utils.defineConstants({BIG:PersonPhotos.TYPE.BIG,SQUARE:PersonPhotos.TYPE.SQUARE});var PhoneNumberExtended=PropertyBase.create({superClass:FavoritablePhoneNumber,data:[{dbFieldName:"value",defaultValue:"",setterName:"setValue",getterName:"getValue",beforeSet:function(value){this.doGenerateNormalizedValue=true;return value}},{dbFieldName:"normalizedValue",defaultValue:"",setterName:"setNormalizedValue",getterName:"getNormalizedValue",beforeGet:function(origNormalizedValue){var normalizedValue=origNormalizedValue,value=this.getValue();if(!value||this.doGenerateNormalizedValue){normalizedValue=
1532  PhoneNumber.normalizePhoneNumber(value);this.setNormalizedValue(normalizedValue);this.doGenerateNormalizedValue=false}return normalizedValue}},{dbFieldName:"speedDial",defaultValue:"",setterName:"setSpeedDial",getterName:"getSpeedDial"}]});PhoneNumberExtended.prototype._extendedGetDBObject=function(dbObject){dbObject.normalizedValue=this.getNormalizedValue();return dbObject};var ReadOnly=PropertyBase.create({data:[{dbFieldName:"",defaultValue:false,setterName:"setValue",getterName:"getValue"}]});var Relation=exports.Relation=PropertyBase.create({data:[{dbFieldName:"value",defaultValue:"",setterName:"setValue",getterName:"getValue"},{dbFieldName:"type",defaultValue:"",setterName:"setType",getterName:"getType"},{dbFieldName:"primary",defaultValue:false,setterName:"setPrimary",getterName:"getPrimary"}]});Relation.prototype.getNormalizedHashKey=function(){return this.getValue()+":(|)"+this.getType()};
1533  Relation.prototype.equals=function(obj){if(obj instanceof Relation)return this.getValue()===obj.getValue()&&this.getType()===obj.getType()&&this.getPrimary()===obj.getPrimary();return false};Relation.prototype.getDisplayValue=function(){return this.getValue()};Relation.prototype.__defineGetter__("x_displayValue",function(){return this.getDisplayValue()});
1534 -Relation.TYPE=Utils.defineConstants({ASSISTANT:"type_assistant",BROTHER:"type_brother",CHILD:"type_child",DOMESTIC_PARTNER:"type_domestic_partner",FATHER:"type_father",FRIEND:"type_friend",MANAGER:"type_manager",MOTHER:"type_mother",PARENT:"type_parent",PARTNER:"type_partner",REFERRED_BY:"type_referred_by",RELATIVE:"type_relative",SISTER:"type_sister",SPOUSE:"type_spouse",OTHER:"type_other"});var Reminder=PropertyBase.create({data:[{dbFieldName:"",defaultValue:"",setterName:"setValue",getterName:"getValue"}]});var Ringtone=PropertyBase.create({data:[{dbFieldName:"name",defaultValue:"",setterName:"setName",getterName:"getName"},{dbFieldName:"location",defaultValue:"",setterName:"setLocation",getterName:"getLocation"}]});var SearchTerm=PropertyBase.create({data:[{dbFieldName:"",defaultValue:"",setterName:"setValue",getterName:"getValue"}]});var SimEntryType=PropertyBase.create({data:[{dbFieldName:"",defaultValue:"",setterName:"setValue",getterName:"getValue"}]});var SimIndex=PropertyBase.create({data:[{dbFieldName:"",defaultValue:-1,setterName:"setValue",getterName:"getValue"}]});var SortKey=exports.SortKey=PropertyBase.create({data:[{dbFieldName:"",defaultValue:"",setterName:"setValue",getterName:"getValue"}]});
1535 +Relation.TYPE=Utils.defineConstants({ASSISTANT:"type_assistant",BROTHER:"type_brother",CHILD:"type_child",DOMESTIC_PARTNER:"type_domestic_partner",FATHER:"type_father",FRIEND:"type_friend",MANAGER:"type_manager",MOTHER:"type_mother",PARENT:"type_parent",PARTNER:"type_partner",REFERRED_BY:"type_referred_by",RELATIVE:"type_relative",SISTER:"type_sister",SPOUSE:"type_spouse",OTHER:"type_other"});var Reminder=PropertyBase.create({data:[{dbFieldName:"",defaultValue:"",setterName:"setValue",getterName:"getValue"}]});var Ringtone=PropertyBase.create({data:[{dbFieldName:"name",defaultValue:"",setterName:"setName",getterName:"getName"},{dbFieldName:"location",defaultValue:"",setterName:"setLocation",getterName:"getLocation"}]});var CallAlert=PropertyBase.create({data:[{dbFieldName:"alert",defaultValue:"",setterName:"setAlert",getterName:"getAlert"}]});var CallAction=PropertyBase.create({data:[{dbFieldName:"action",defaultValue:"",setterName:"setAction",getterName:"getAction"}]});var MsgRingtone=PropertyBase.create({data:[{dbFieldName:"name",defaultValue:"",setterName:"setName",getterName:"getName"},{dbFieldName:"location",defaultValue:"",setterName:"setLocation",getterName:"getLocation"}]});var MsgAlert=PropertyBase.create({data:[{dbFieldName:"alert",defaultValue:"",setterName:"setAlert",getterName:"getAlert"}]});var IMsgRingtone=PropertyBase.create({data:[{dbFieldName:"name",defaultValue:"",setterName:"setName",getterName:"getName"},{dbFieldName:"location",defaultValue:"",setterName:"setLocation",getterName:"getLocation"}]});var IMsgAlert=PropertyBase.create({data:[{dbFieldName:"alert",defaultValue:"",setterName:"setAlert",getterName:"getAlert"}]});var SearchTerm=PropertyBase.create({data:[{dbFieldName:"",defaultValue:"",setterName:"setValue",getterName:"getValue"}]});var SimEntryType=PropertyBase.create({data:[{dbFieldName:"",defaultValue:"",setterName:"setValue",getterName:"getValue"}]});var SimIndex=PropertyBase.create({data:[{dbFieldName:"",defaultValue:-1,setterName:"setValue",getterName:"getValue"}]});var SortKey=exports.SortKey=PropertyBase.create({data:[{dbFieldName:"",defaultValue:"",setterName:"setValue",getterName:"getValue"}]});
1536  SortKey.generateSortKey=function(person,optionalConfigParams){var future=new Future,configParams;future.now(function(){Assert.require(person,"SortKey.generateSortKey requires a person that is truthy");configParams=optionalConfigParams||{};if(configParams.listSortOrder)return true;else var appPrefs=new AppPrefs(future.callback(function(){var dummy=future.result;configParams.listSortOrder=appPrefs.get(AppPrefs.Pref.listSortOrder);future.result=true}))});future.then(function(){var dummy=future.result;
1537  return SortKey._generateSortKeyFromSortOrder(person,configParams)});return future};
1538  SortKey._generateSortKeyFromSortOrder=function(person,configParams){var future=new Future,givenName="",familyName="",companyName="",displayName="";future.now(function(){var name,company;Assert.require(person,"SortKey.generateSortKey requires a person that is truthy");Assert.requireObject(configParams,"SortKey.generateSortKey requires an object as the configParams");Assert.requireString(configParams.listSortOrder,"SortKey.generateSortKey requires a listSortOrder that is a string");if(person instanceof
1539 @@ -164,7 +164,7 @@
1540  SpeedDialHash.prototype.setPlainValue=function(value){this.setHashedPhoneNumber(value?Crypto.MD5.b64_md5(value):null)};SpeedDialHash.prototype.isPlainValueEqual=function(value){return value?Crypto.MD5.b64_md5(value)===this.getHashedPhoneNumber():value===this.getHashedPhoneNumber()};var SyncSource=PropertyBase.create({data:[{dbFieldName:"name",defaultValue:null,setterName:"setName",getterName:"getName"},{dbFieldName:"extended",defaultValue:{},setterName:"setExtended",getterName:"getExtended"}]});SyncSource.prototype.equals=function(obj){if(obj instanceof SyncSource)return this.getName()===obj.getName();return false};var Tag=PropertyBase.create({data:[{dbFieldName:"",defaultValue:"",setterName:"setValue",getterName:"getValue"}]});var Url=exports.Url=PropertyBase.create({data:[{dbFieldName:"value",defaultValue:"",setterName:"setValue",getterName:"getValue"},{dbFieldName:"type",defaultValue:"",setterName:"setType",getterName:"getType"},{dbFieldName:"primary",defaultValue:false,setterName:"setPrimary",getterName:"getPrimary"}]});Url.prototype.getDisplayValue=function(){return this.getValue().toLocaleLowerCase()};Url.prototype.__defineGetter__("x_displayValue",function(){return this.getDisplayValue()});
1541  Url.TYPE=Utils.defineConstants({HOME:"type_home",HOMEPAGE:"type_homepage",BLOG:"type_blog",FTP:"type_ftp",PROFILE:"type_profile",WORK:"type_work",OTHER:"type_other"});Url.prototype.getNormalizedHashKey=function(){return this.getValue().toLowerCase()};
1542  Url.Labels=Utils.createLabelFunctions([{value:Url.TYPE.HOME,displayValue:RB.$L("Home"),isPopupLabel:false},{value:Url.TYPE.HOMEPAGE,displayValue:RB.$L("Homepage"),isPopupLabel:false},{value:Url.TYPE.BLOG,displayValue:RB.$L("Blog"),isPopupLabel:false},{value:Url.TYPE.FTP,displayValue:RB.$L("FTP"),isPopupLabel:false},{value:Url.TYPE.PROFILE,displayValue:RB.$L("Profile"),isPopupLabel:false},{value:Url.TYPE.WORK,displayValue:RB.$L("Work"),isPopupLabel:false},{value:Url.TYPE.OTHER,displayValue:RB.$L("Other"),
1543 -isPopupLabel:false}]);var AppPrefs=exports.AppPrefs=function(onReady,kind,defaults){kind=kind||AppPrefs.dbKind;defaults=defaults||{listSortOrder:ListWidget.SortOrder.defaultSortOrder,defaultAccountId:""};this.ready=false;this._kind=kind;this._defaults=defaults;this._onReady=onReady;Utils.mixInBroadcaster(this);this._doQuery()};Utils.defineConstant("dbKind","com.palm.app.contacts.prefs:1",AppPrefs);AppPrefs.Pref=Utils.defineConstants({listSortOrder:"listSortOrder",defaultAccountId:"defaultAccountId"});
1544 +isPopupLabel:false}]);var AppPrefs=exports.AppPrefs=function(onReady,kind,defaults){kind=kind||AppPrefs.dbKind;defaults=defaults||{listSortOrder:ListWidget.SortOrder.defaultSortOrder,defaultAccountId:"",blockedNumbers:true,unknownNumbers:true,unknownContacts:{}};this.ready=false;this._kind=kind;this._defaults=defaults;this._onReady=onReady;Utils.mixInBroadcaster(this);this._doQuery()};Utils.defineConstant("dbKind","com.palm.app.contacts.prefs:1",AppPrefs);AppPrefs.Pref=Utils.defineConstants({listSortOrder:"listSortOrder",defaultAccountId:"defaultAccountId",blockedNumbers:"blockedNumbers",unknownNumbers:"unknownNumbers",unknownContacts:"unknownContacts"});
1545  AppPrefs.prototype._doQuery=function(){this._future=DB.find({from:this._kind,limit:2});this._future.then(this,this._handleResult)};
1546  AppPrefs.prototype._handleResult=function(future){var length=future.result.results.length,shallowCopy;if(length>1)console.error("AppPrefs: Expected singleton object for "+this._kind+", but received >1 result.");else if(length===0){console.log("AppPrefs: No prefs found, creating "+this._kind);shallowCopy=_.clone(this._defaults);shallowCopy._kind=this._kind;DB.put([shallowCopy]);this._doQuery();return}this._prefs=future.result.results[0];this.ready=true;if(this._onReady){this._onReady();this._onReady=
1547  undefined}};AppPrefs.prototype.get=function(propName){var result=this._prefs,props;if(!this.ready){console.error("AppPrefs: Access to pref "+propName+" before prefs object is ready. Using default.");result=this._defaults}props=propName.split(".");while(result&&props.length>0)result=result[props.shift()];if(props.length>0)console.warn("AppPrefs: Invalid attempt to access pref at "+propName);return result};
1548 @@ -227,7 +227,7 @@
1549  params));callback(newItems)})};return dataSourceAssistant},isRcsAvailable:function(){var future=getRcsAccounts();future.then(function(){return future.result.length>0});return future},SortOrder:Utils.defineConstants({defaultSortOrder:"LAST_FIRST",lastFirst:"LAST_FIRST",firstLast:"FIRST_LAST",companyLastFirst:"COMPANY_LAST_FIRST",companyFirstLast:"COMPANY_FIRST_LAST"})}}();var Person=Class.create({initialize:function(rawPerson){if(!rawPerson)rawPerson={};var hasDatabaseId=!!rawPerson._id,constructedFromContact=rawPerson instanceof Contact,_data={_kind:Person.kind,_id:rawPerson._id||undefined,_rev:rawPerson._rev,_del:rawPerson._del,favorite:Utils.lazyWrapper(Favorite,[rawPerson.favorite,hasDatabaseId]),contactIds:Utils.lazyWrapper(PropertyArray,[ContactId,rawPerson.contactIds,hasDatabaseId]),sortKey:Utils.lazyWrapper(SortKey,[rawPerson.sortKey,hasDatabaseId]),name:Utils.lazyWrapper(Name,
1550  [rawPerson.name,hasDatabaseId]),names:Utils.lazyWrapper(PropertyArray,[Name,rawPerson.names,hasDatabaseId]),nickname:Utils.lazyWrapper(Nickname,[rawPerson.nickname,hasDatabaseId]),organization:Utils.lazyWrapper(Organization,[rawPerson.organization,hasDatabaseId]),searchTerms:Utils.lazyWrapper(PropertyArray,[SearchTerm,rawPerson.searchTerms,hasDatabaseId]),emails:Utils.lazyWrapper(PropertyArray,[EmailAddressExtended,rawPerson.emails,hasDatabaseId]),phoneNumbers:Utils.lazyWrapper(PropertyArray,[PhoneNumberExtended,
1551  rawPerson.phoneNumbers,hasDatabaseId]),ims:Utils.lazyWrapper(PropertyArray,[IMAddressExtended,rawPerson.ims,hasDatabaseId]),photos:Utils.lazyWrapper(PersonPhotos,[rawPerson.photos,hasDatabaseId]),addresses:Utils.lazyWrapper(PropertyArray,[Address,rawPerson.addresses,hasDatabaseId]),urls:Utils.lazyWrapper(PropertyArray,[Url,rawPerson.urls,hasDatabaseId]),notes:Utils.lazyWrapper(PropertyArray,[Note,rawPerson.notes,hasDatabaseId]),birthday:Utils.lazyWrapper(Birthday,[rawPerson.birthday,hasDatabaseId]),
1552 -anniversary:Utils.lazyWrapper(Anniversary,[rawPerson.anniversary,hasDatabaseId]),gender:Utils.lazyWrapper(Gender,[rawPerson.gender,hasDatabaseId]),reminder:Utils.lazyWrapper(Reminder,[rawPerson.reminder,hasDatabaseId]),launcherId:Utils.lazyWrapper(LauncherId,[rawPerson.launcherId,hasDatabaseId]),relations:Utils.lazyWrapper(PropertyArray,[Relation,rawPerson.relations,hasDatabaseId]),ringtone:Utils.lazyWrapper(Ringtone,[rawPerson.ringtone,hasDatabaseId])},_contacts=new PropertyArray(Contact,null),_transientFavoriteState=
1553 +anniversary:Utils.lazyWrapper(Anniversary,[rawPerson.anniversary,hasDatabaseId]),gender:Utils.lazyWrapper(Gender,[rawPerson.gender,hasDatabaseId]),reminder:Utils.lazyWrapper(Reminder,[rawPerson.reminder,hasDatabaseId]),launcherId:Utils.lazyWrapper(LauncherId,[rawPerson.launcherId,hasDatabaseId]),relations:Utils.lazyWrapper(PropertyArray,[Relation,rawPerson.relations,hasDatabaseId]),ringtone:Utils.lazyWrapper(Ringtone,[rawPerson.ringtone,hasDatabaseId]),callAlert:Utils.lazyWrapper(CallAlert,[rawPerson.callAlert,hasDatabaseId]),callAction:Utils.lazyWrapper(CallAction,[rawPerson.callAction,hasDatabaseId]),msgRingtone:Utils.lazyWrapper(MsgRingtone,[rawPerson.msgRingtone,hasDatabaseId]),msgAlert:Utils.lazyWrapper(MsgAlert,[rawPerson.msgAlert,hasDatabaseId]),iMsgRingtone:Utils.lazyWrapper(IMsgRingtone,[rawPerson.iMsgRingtone,hasDatabaseId]),iMsgAlert:Utils.lazyWrapper(IMsgAlert,[rawPerson.iMsgAlert,hasDatabaseId])},_contacts=new PropertyArray(Contact,null),_transientFavoriteState=
1554  {instantiationFavoriteValue:false,favoriteDefaultsChanged:false},_beingSaved=false;this.accessor=function(fieldName){var field=_data[fieldName];Assert.requireDefined(fieldName,"fieldName must be specified for the accessor");if(field&&typeof field==="object"&&field.isLazyWrapper)field=_data[fieldName]=field.createInstance();return field};_transientFavoriteState.instantiationFavoriteValue=this.accessor("favorite").getValue();this._getTransientFavoriteState=function(){return _transientFavoriteState};
1555  this._isBeingSaved=function(){return _beingSaved};this._setBeingSaved=function(value){_beingSaved=value};this.setId=function(id){_data._id=id};this.setRev=function(rev){_data._rev=rev};this.getContacts=function(){return _contacts.getArray()};this.setContacts=function(contacts){_contacts.set(contacts)};this.getDBObject=function(){return Utils.getDBObjectForAllProperties(this.accessor,_.keys(_data))};this.getDirtyDBObject=function(){return Utils.getDBObjectForAllDirtyProperties(this.accessor,_.keys(_data))};
1556  if(constructedFromContact)this.populateFromContact(rawPerson)},populateFromContact:function(contact){Assert.requireDefined(contact,"populateFromContact requires a person argument");Assert.require(contact instanceof Contact,"populateFromContact requires a person argument that is a child of Person");this.setContacts([contact]);this.fixupNoReloadContacts();return true},getKind:function(){return this.accessor("_kind")},getId:function(){return this.accessor("_id")},getLauncherId:function(){return this.accessor("launcherId")},
1557 @@ -241,7 +241,7 @@
1558  false},getContactIds:function(){return this.accessor("contactIds")},setContactWithIdAsPrimary:function(contactIdToSetPrimary){var contactIds=this.getContactIds().getArray(),indexFoundContactId=-1,removedContactId;contactIds.some(function(contactId,index){if(contactId.getValue()===contactIdToSetPrimary){indexFoundContactId=index;return true}return false});if(indexFoundContactId>0){removedContactId=contactIds[indexFoundContactId];contactIds.splice(indexFoundContactId,1);contactIds.splice(0,0,removedContactId);
1559  this.getContactIds().set(contactIds);return true}else return false},getSortKey:function(){return this.accessor("sortKey")},getName:function(){return this.accessor("name")},getNames:function(){return this.accessor("names")},getNickname:function(){return this.accessor("nickname")},getOrganization:function(){return this.accessor("organization")},getEmails:function(){return this.accessor("emails")},getIms:function(){return this.accessor("ims")},getPhoneNumbers:function(){return this.accessor("phoneNumbers")},
1560  getPhotos:function(){return this.accessor("photos")},getAddresses:function(){return this.accessor("addresses")},getUrls:function(){return this.accessor("urls")},getNotes:function(){return this.accessor("notes")},getBirthday:function(){return this.accessor("birthday")},getAnniversary:function(){return this.accessor("anniversary")},getGender:function(){return this.accessor("gender")},getSearchTerms:function(){return this.accessor("searchTerms")},getReminder:function(){return this.accessor("reminder")},
1561 -getRelations:function(){return this.accessor("relations")},getRingtone:function(){return this.accessor("ringtone")},generateDisplayName:function(includeBasedOnField){return Utils.generateDisplayName(this,includeBasedOnField)},generateWorkInfoLine:function(){var arr=[],title=this.getOrganization().getTitle(),orgName=this.getOrganization().getName();if(title)arr.push(title);if(orgName)arr.push(orgName);return arr.join(", ")},reloadContacts:function(contactType){var future=null;contactType=contactType||
1562 +getRelations:function(){return this.accessor("relations")},getRingtone:function(){return this.accessor("ringtone")},getCallAlert:function(){return this.accessor("callAlert")},getCallAction:function(){return this.accessor("callAction")},getMsgAlert:function(){return this.accessor("msgAlert")},getMsgRingtone:function(){return this.accessor("msgRingtone")},getIMsgAlert:function(){return this.accessor("iMsgAlert")},getIMsgRingtone:function(){return this.accessor("iMsgRingtone")},generateDisplayName:function(includeBasedOnField){return Utils.generateDisplayName(this,includeBasedOnField)},generateWorkInfoLine:function(){var arr=[],title=this.getOrganization().getTitle(),orgName=this.getOrganization().getName();if(title)arr.push(title);if(orgName)arr.push(orgName);return arr.join(", ")},reloadContacts:function(contactType){var future=null;contactType=contactType||
1563  this.getDefaultContactType();future=Person.getLinkedContacts(this,contactType);future.then(this,function getContactsFromResultsAndSetOnPerson(){var contacts;contacts=future.result||[];this.setContacts(contacts);future.result=contacts});return future},clearFieldsForFixup:function(){this.getName().clear();this.getNames().clear();this.getNickname().clear();this.getOrganization().clear();this.getSearchTerms().clear();this.getEmails().clear();this.getPhoneNumbers().clear();this.getIms().clear();this.getAddresses().clear();
1564  this.getUrls().clear();this.getNotes().clear();this.getBirthday().setValue("");this.getAnniversary().setValue("");this.getGender().setValue("");this.getPhotos().clear();this.getSortKey().setValue("");this.getRelations().clear()},fixup:function(otherPeopleBeingLinked,configParams){return this.fixupFromObjects(undefined,ContactType.EDITABLE,otherPeopleBeingLinked,configParams)},fixupNoReloadContacts:function(otherPeopleBeingLinked,configParams){return this.fixupFromObjects(this.getContacts(),ContactType.EDITABLE,
1565  otherPeopleBeingLinked,configParams)},fixupFromObjects:function(contacts,contactType,otherPeopleBeingLinked,configParams){var future,allPeopleBeingLinked,dupeFavoriteBackupData,notDupeFavoriteBackupData,speedDialSaver,rawNewPersonPhotos,newListContactPhoto,wasAFavoriteFromBackups=false,timingRecorder=configParams&&configParams.timingRecorder||{startTimingForJob:function(){},stopTimingForJob:function(){}};if(!contacts){timingRecorder.startTimingForJob("Fixup_Reload_Contacts");future=this.reloadContacts()}else{future=
1566 @@ -289,7 +289,7 @@
1567  for(i=0;i<properties.length;i+=1){property=properties[i];isEqual=isEqual&&this.accessor(property).equals(otherPerson.accessor(property))}for(j=0;j<propertyArrays.length;j+=1){property=propertyArrays[j];tempArray=this.accessor(property).getArray();otherTempArray=otherPerson.accessor(property).getArray();for(i=0;i<tempArray.length;i+=1)isEqual=isEqual&&tempArray[i].equals(otherTempArray[i])}return isEqual},setCroppedContactPhoto:function(path,cropInfo,photoType){var future,param={};param.personId=this.getId();
1568  param.path=path;param.cropInfo=cropInfo;param.photoType=photoType;future=PalmCall.call("palm://com.palm.service.contacts/","setCroppedContactPhoto",param);future.then(function(){var result=future.result;PalmCall.cancel(future);future.result=result});return future},stripTmpPhoneNumberField:function(obj){var i,phoneNumber,contacts,contact,future;if(obj.length>0){this.getPhoneNumbers().clear();for(i=0;i<obj.length;i+=1){this.getPhoneNumbers().add(new PhoneNumber);phoneNumber=this.getPhoneNumbers().getArray()[i];
1569  phoneNumber.setValue(obj[i].value?obj[i].value:phoneNumber.getValue());phoneNumber.setType(obj[i].type?obj[i].type:phoneNumber.getType());phoneNumber.setPrimary(obj[i].primary?obj[i].primary:phoneNumber.getPrimary());phoneNumber.setNormalizedValue(obj[i].normalizedValue?obj[i].normalizedValue:phoneNumber.getNormalizedValue());phoneNumber.setSpeedDial(obj[i].speedDial?obj[i].speedDial:phoneNumber.getSpeedDial())}future=Person.getLinkedContacts(this,ContactType.RAWOBJECT);future.then(this,function(){contacts=
1570 -future.result||[];for(i=0;i<contacts.length;i+=1){contact=new Contact(contacts[0]);contact.stripTmpPhoneNumberField();contact.save()}future.result=contacts});return future}}});Utils.defineConstant("kind","com.palm.person:1",Person);Person.PROPERTIES={objects:["favorite","sortKey","name","nickname","organization","photos","reminder","ringtone"],arrays:["contactIds","names","searchTerms","emails","phoneNumbers","ims"]};
1571 +future.result||[];for(i=0;i<contacts.length;i+=1){contact=new Contact(contacts[0]);contact.stripTmpPhoneNumberField();contact.save()}future.result=contacts});return future}}});Utils.defineConstant("kind","com.palm.person:1",Person);Person.PROPERTIES={objects:["favorite","sortKey","name","nickname","organization","photos","reminder","ringtone","callAlert","callAction","msgAlert","msgRingtone","iMsgAlert","iMsgRingtone"],arrays:["contactIds","names","searchTerms","emails","phoneNumbers","ims"]};
1572  Person.generateDisplayNameFromRawPerson=function(rawPerson,includeBasedOnField){var obj=rawPerson,displayName="",basedOnField=null,fullName=Name.getFullNameFromRawObject(obj.name),org;if(fullName){displayName=fullName;basedOnField=DisplayNameType.NAME}else if(obj.nickname){displayName=obj.nickname;basedOnField=DisplayNameType.NICKNAME}if(!displayName&&obj.organization)if(obj.organization.title&&obj.organization.name){displayName=obj.organization.title+", "+obj.organization.name;basedOnField=DisplayNameType.TITLE_AND_ORGANIZATION_NAME}else if(!obj.organization.title&&
1573  obj.organization.name){displayName=obj.organization.name;basedOnField=DisplayNameType.ORGANIZATION_NAME}else if(obj.organization.title&&!obj.organization.name){displayName=obj.organization.title;basedOnField=DisplayNameType.TITLE}if(!displayName)if(obj.emails&&obj.emails.length){displayName=obj.emails[0].value;basedOnField=DisplayNameType.EMAIL}else if(obj.ims&&obj.ims.length){displayName=obj.ims[0].value;basedOnField=DisplayNameType.IM}else if(obj.phoneNumbers&&obj.phoneNumbers.length){displayName=
1574  obj.phoneNumbers[0].value;basedOnField=DisplayNameType.PHONE}else{displayName=RB.$L("[No Name Available]");basedOnField=DisplayNameType.NONE}if(includeBasedOnField)return{displayName:displayName,basedOnField:basedOnField};else return displayName};Person.getDisplayablePersonAndContactsById=function(id){return Person.getPersonAndContactsById(id,PersonType.DISPLAYABLE,ContactType.DISPLAYABLE)};
1575 --- .orig/usr/palm/frameworks/contacts/submission/94/javascript/AppPrefs.js
1576 +++ /usr/palm/frameworks/contacts/submission/94/javascript/AppPrefs.js
1577 @@ -21,7 +21,10 @@
1578         kind = kind || AppPrefs.dbKind;
1579         defaults = defaults || {
1580                 listSortOrder: ListWidget.SortOrder.defaultSortOrder,
1581 -               defaultAccountId: ""
1582 +               defaultAccountId: "",
1583 +               blockedNumbers: true,
1584 +               unknownNumbers: true,
1585 +               unknownContacts: {}
1586         };
1587         
1588         this.ready = false; // set to true after we've loaded our prefs object.
1589 @@ -40,7 +43,10 @@
1590  //the list of prefs currently stored in this object in the db
1591  AppPrefs.Pref = Utils.defineConstants({
1592         listSortOrder: "listSortOrder",
1593 -       defaultAccountId: "defaultAccountId"
1594 +       defaultAccountId: "defaultAccountId",
1595 +       blockedNumbers: "blockedNumbers",
1596 +       unknownNumbers: "unknownNumbers",
1597 +       unknownContacts: "unknownContacts"      
1598  });
1599  
1600  AppPrefs.prototype._doQuery = function () {
1601 --- .orig/usr/palm/frameworks/contacts/submission/94/javascript/Person.js
1602 +++ /usr/palm/frameworks/contacts/submission/94/javascript/Person.js
1603 @@ -88,7 +88,13 @@
1604                                 reminder: Utils.lazyWrapper(Reminder, [rawPerson.reminder, hasDatabaseId]),
1605                                 launcherId: Utils.lazyWrapper(LauncherId, [rawPerson.launcherId, hasDatabaseId]),
1606                                 relations: Utils.lazyWrapper(PropertyArray, [Relation, rawPerson.relations, hasDatabaseId]),
1607 -                               ringtone: Utils.lazyWrapper(Ringtone, [rawPerson.ringtone, hasDatabaseId])
1608 +                               ringtone: Utils.lazyWrapper(Ringtone, [rawPerson.ringtone, hasDatabaseId]),
1609 +                               callAlert: Utils.lazyWrapper(CallAlert, [rawPerson.callAlert, hasDatabaseId]),
1610 +                               callAction: Utils.lazyWrapper(CallAction, [rawPerson.callAction, hasDatabaseId]),                               
1611 +                               msgRingtone: Utils.lazyWrapper(MsgRingtone, [rawPerson.msgRingtone, hasDatabaseId]),
1612 +                               msgAlert: Utils.lazyWrapper(MsgAlert, [rawPerson.msgAlert, hasDatabaseId]),
1613 +                               iMsgRingtone: Utils.lazyWrapper(IMsgRingtone, [rawPerson.iMsgRingtone, hasDatabaseId]),
1614 +                               iMsgAlert: Utils.lazyWrapper(IMsgAlert, [rawPerson.iMsgAlert, hasDatabaseId])
1615                         },
1616                         _contacts = new PropertyArray(Contact, null),
1617                         _transientFavoriteState = { 
1618 @@ -669,6 +675,30 @@
1619                 return this.accessor("ringtone");
1620         },
1621         
1622 +       getCallAlert: function () {
1623 +               return this.accessor("callAlert");
1624 +       },
1625 +
1626 +       getCallAction: function () {
1627 +               return this.accessor("callAction");
1628 +       },
1629 +
1630 +       getMsgRingtone: function () {
1631 +               return this.accessor("msgRingtone");
1632 +       },
1633 +
1634 +       getMsgAlert: function () {
1635 +               return this.accessor("msgAlert");
1636 +       },
1637 +
1638 +       getIMsgRingtone: function () {
1639 +               return this.accessor("iMsgRingtone");
1640 +       },
1641 +
1642 +       getIMsgAlert: function () {
1643 +               return this.accessor("iMsgAlert");
1644 +       },
1645 +
1646         /**
1647          * Generates a display name for the person based on the following criteria:<br>
1648          * 1) Name<br>
1649 @@ -2010,7 +2040,7 @@
1650  Utils.defineConstant("kind", "com.palm.person:1", Person);
1651  
1652  Person.PROPERTIES = { 
1653 -       objects: ["favorite", "sortKey", "name", "nickname", "organization", "photos", "reminder", "ringtone"],
1654 +       objects: ["favorite", "sortKey", "name", "nickname", "organization", "photos", "reminder", "ringtone", "callAlert", "callAction", "msgRingtone", "msgAlert", "iMsgRingtone", "iMsgAlert"],
1655         arrays: ["contactIds", "names", "searchTerms", "emails", "phoneNumbers", "ims"]
1656  };
1657  
1658 --- .orig/usr/palm/frameworks/contacts.ui/submission/38/javascript/PersonListWidget.js
1659 +++ /usr/palm/frameworks/contacts.ui/submission/38/javascript/PersonListWidget.js
1660 @@ -100,6 +100,7 @@
1661                         _personListDataSource = new Mojo.DataSource(wrappedDataSourceAssistant);
1662                         _personListElement = getWidgetElement("person-list");
1663                         _model.personListTapCallback = _model.personListTapCallback || _model.listTapCallback;
1664 +                       _model.personListDeleteCallback = _model.personListDeleteCallback;
1665                         
1666                         if (_model.sortOrder === Contacts.ListWidget.SortOrder.firstLast || _model.sortOrder === Contacts.ListWidget.SortOrder.lastFirst) {
1667                                 dividerTemplate = Utils.getTemplatePath("person-filter-list-widget/group-separator");
1668 @@ -107,6 +108,11 @@
1669                                 dividerTemplate = Utils.getTemplatePath("person-filter-list-widget/multiline-separator");
1670                         }
1671                         
1672 +                       if(_model.personListDeleteCallback && _.isFunction(_model.personListDeleteCallback))
1673 +                               var allowDelete=true;
1674 +                       else
1675 +                               var allowDelete=false;
1676 +
1677                         _sceneController.setupWidget(getWidgetElementId("person-list"), {
1678                                 templateRoot: LIB_ROOT,
1679                                 templates: {
1680 @@ -120,7 +126,8 @@
1681                                         template: dividerTemplate
1682                                 },
1683                                 decorator: personDecorator,
1684 -                               asyncDecorator: createAsyncPersonDecorator
1685 +                               asyncDecorator: createAsyncPersonDecorator,
1686 +                               swipeDelete: allowDelete
1687                         }, {});
1688                         
1689                         if (_model.personListTapCallback && _.isFunction(_model.personListTapCallback)) {
1690 @@ -128,6 +135,9 @@
1691                         } else {
1692                                 console.warn("PersonListWidget (setupPersonList) was set up without a listTapCallback.  Do you really want to do this?");
1693                         }
1694 +
1695 +                       if(_model.personListDeleteCallback && _.isFunction(_model.personListDeleteCallback))
1696 +                               _eventListenerManager.addListener(_personListElement,Mojo.Event.listDelete,_model.personListDeleteCallback);
1697                 },
1698                 
1699                 handleAddFavorite = function (person) {
1700 @@ -135,7 +145,7 @@
1701                         // TODO: could add a UI hack to inject this favorite into the list for fast feedback while the DB updates & fires the watch
1702                 },
1703                 
1704 -               handleAddFavoriteTap = function (event) {
1705 +/*             handleAddFavoriteTap = function (event) {
1706                         pushPeoplePickerScene(_sceneController.stageController, {
1707                                 excludeFavorites: true,
1708                                 iconClass: "icon-add-fav",
1709 @@ -143,7 +153,7 @@
1710                                 callback: handleAddFavorite
1711                         });
1712                 },
1713 -               
1714 +*/             
1715                 handleFavoriteDelete = function (items, callback) {
1716                         items.forEach(function (item) {
1717                                 var person = Contacts.PersonFactory.createPersonDisplay(item);
1718 @@ -175,9 +185,10 @@
1719                                 dataSource: _favoriteListDataSource,
1720                                 decorator: personDecorator,
1721                                 asyncDecorator: createAsyncPersonDecorator,
1722 -                               addItem: {
1723 +/*                             addItem: {
1724                                         label: RB.$L("Add Favorite...")
1725                                 },
1726 +*/
1727                                 swipeDelete: {
1728                                         deleteText: RB.$L("Remove")
1729                                 }
1730 @@ -189,7 +200,8 @@
1731                                 console.warn("PersonListWidget (setupFavoriteList) was set up without a listTapCallback.  Do you really want to do this?");
1732                         }
1733                         
1734 -                       _eventListenerManager.addListener(_favoriteListElement, Mojo.Event.listAdd, handleAddFavoriteTap);
1735 +//                     _eventListenerManager.addListener(_favoriteListElement, Mojo.Event.listAdd, handleAddFavoriteTap);
1736 +                       _eventListenerManager.addListener(_favoriteListElement, Mojo.Event.listDelete, handleFavoriteDelete);
1737                 },
1738                 
1739                 swapLists = function (elementIdToShow, elementIdToHide, useTransition, state) {
1740 @@ -313,6 +325,15 @@
1741                         swapLists("favorite-list-container", "person-list-container", useTransition, _favoriteListScrollPosition);
1742                 },
1743                 
1744 +               showAddFavorite: function () {
1745 +                       pushPeoplePickerScene(_sceneController.stageController, {
1746 +                               excludeFavorites: true,
1747 +                               iconClass: "icon-add-fav",
1748 +                               message: RB.$L("Add to Favorites"),
1749 +                               callback: handleAddFavorite
1750 +                       });
1751 +               },
1752 +               
1753                 // Filters the visible list
1754                 filter: function (str, setCountFn) {
1755                         var dataSource,
1756 --- .orig/usr/palm/frameworks/contacts.ui/submission/38/stylesheets/common.css
1757 +++ /usr/palm/frameworks/contacts.ui/submission/38/stylesheets/common.css
1758 @@ -104,10 +104,10 @@
1759  
1760  .contacts-avatar-set {
1761         float: right;
1762 -       margin: 6px 10px;
1763 -       width: 52px;
1764 -       height: 52px;
1765 -       -webkit-background-size: 50px;
1766 +       margin: 5px 10px;
1767 +       width: 50px;
1768 +       height: 50px;
1769 +       -webkit-background-size: 48px;
1770         background: url() center center no-repeat;
1771      -webkit-border-radius: 9px;
1772  }
1773 --- .orig/usr/palm/frameworks/contacts.ui/submission/38/concatenated.js
1774 +++ /usr/palm/frameworks/contacts.ui/submission/38/concatenated.js
1775 @@ -145,6 +145,7 @@
1776                         _personListDataSource = new Mojo.DataSource(wrappedDataSourceAssistant);
1777                         _personListElement = getWidgetElement("person-list");
1778                         _model.personListTapCallback = _model.personListTapCallback || _model.listTapCallback;
1779 +                       _model.personListDeleteCallback = _model.personListDeleteCallback;
1780                         
1781                         if (_model.sortOrder === Contacts.ListWidget.SortOrder.firstLast || _model.sortOrder === Contacts.ListWidget.SortOrder.lastFirst) {
1782                                 dividerTemplate = Utils.getTemplatePath("person-filter-list-widget/group-separator");
1783 @@ -152,6 +153,11 @@
1784                                 dividerTemplate = Utils.getTemplatePath("person-filter-list-widget/multiline-separator");
1785                         }
1786                         
1787 +                       if(_model.personListDeleteCallback && _.isFunction(_model.personListDeleteCallback))
1788 +                               var allowDelete=true;
1789 +                       else
1790 +                               var allowDelete=false;
1791 +
1792                         _sceneController.setupWidget(getWidgetElementId("person-list"), {
1793                                 templateRoot: LIB_ROOT,
1794                                 templates: {
1795 @@ -165,7 +171,8 @@
1796                                         template: dividerTemplate
1797                                 },
1798                                 decorator: personDecorator,
1799 -                               asyncDecorator: createAsyncPersonDecorator
1800 +                               asyncDecorator: createAsyncPersonDecorator,
1801 +                               swipeDelete: allowDelete
1802                         }, {});
1803                         
1804                         if (_model.personListTapCallback && _.isFunction(_model.personListTapCallback)) {
1805 @@ -173,6 +180,9 @@
1806                         } else {
1807                                 console.warn("PersonListWidget (setupPersonList) was set up without a listTapCallback.  Do you really want to do this?");
1808                         }
1809 +
1810 +                       if(_model.personListDeleteCallback && _.isFunction(_model.personListDeleteCallback))
1811 +                               _eventListenerManager.addListener(_personListElement,Mojo.Event.listDelete,_model.personListDeleteCallback);
1812                 },
1813                 
1814                 handleAddFavorite = function (person) {
1815 @@ -180,7 +190,7 @@
1816                         // TODO: could add a UI hack to inject this favorite into the list for fast feedback while the DB updates & fires the watch
1817                 },
1818                 
1819 -               handleAddFavoriteTap = function (event) {
1820 +/*             handleAddFavoriteTap = function (event) {
1821                         pushPeoplePickerScene(_sceneController.stageController, {
1822                                 excludeFavorites: true,
1823                                 iconClass: "icon-add-fav",
1824 @@ -188,7 +198,7 @@
1825                                 callback: handleAddFavorite
1826                         });
1827                 },
1828 -               
1829 +*/             
1830                 handleFavoriteDelete = function (items, callback) {
1831                         items.forEach(function (item) {
1832                                 var person = Contacts.PersonFactory.createPersonDisplay(item);
1833 @@ -220,9 +230,10 @@
1834                                 dataSource: _favoriteListDataSource,
1835                                 decorator: personDecorator,
1836                                 asyncDecorator: createAsyncPersonDecorator,
1837 -                               addItem: {
1838 +/*                             addItem: {
1839                                         label: RB.$L("Add Favorite...")
1840                                 },
1841 +*/
1842                                 swipeDelete: {
1843                                         deleteText: RB.$L("Remove")
1844                                 }
1845 @@ -234,7 +245,8 @@
1846                                 console.warn("PersonListWidget (setupFavoriteList) was set up without a listTapCallback.  Do you really want to do this?");
1847                         }
1848                         
1849 -                       _eventListenerManager.addListener(_favoriteListElement, Mojo.Event.listAdd, handleAddFavoriteTap);
1850 +//                     _eventListenerManager.addListener(_favoriteListElement, Mojo.Event.listAdd, handleAddFavoriteTap);
1851 +                       _eventListenerManager.addListener(_favoriteListElement, Mojo.Event.listDelete, handleFavoriteDelete);
1852                 },
1853                 
1854                 swapLists = function (elementIdToShow, elementIdToHide, useTransition, state) {
1855 @@ -358,6 +370,15 @@
1856                         swapLists("favorite-list-container", "person-list-container", useTransition, _favoriteListScrollPosition);
1857                 },
1858                 
1859 +               showAddFavorite: function () {
1860 +                       pushPeoplePickerScene(_sceneController.stageController, {
1861 +                               excludeFavorites: true,
1862 +                               iconClass: "icon-add-fav",
1863 +                               message: RB.$L("Add to Favorites"),
1864 +                               callback: handleAddFavorite
1865 +                       });
1866 +               },
1867 +               
1868                 // Filters the visible list
1869                 filter: function (str, setCountFn) {
1870                         var dataSource,
1871 @@ -4043,4 +4064,4 @@
1872         stageController.pushScene.apply(stageController, [pushSceneParams, launchParams]);
1873  };
1874  
1875 -}
1876 \ No newline at end of file
1877 +}
1878 --- .orig/usr/palm/frameworks/contacts/submission/94/manifest.json
1879 +++ /usr/palm/frameworks/contacts/submission/94/manifest.json
1880 @@ -19,6 +19,8 @@
1881                         "properties/Address.js",
1882                         "properties/Anniversary.js",
1883                         "properties/Birthday.js",
1884 +                       "properties/CallAction.js",
1885 +                       "properties/CallAlert.js",
1886                         "properties/ContactBackupHash.js",
1887                         "properties/ContactId.js",
1888                         "properties/DefaultPropertyHash.js",
1889 @@ -33,7 +35,11 @@
1890                         "properties/IMAddress.js",
1891                         "properties/FavoritableIMAddress.js",
1892                         "properties/IMAddressExtended.js",
1893 +                       "properties/IMsgAlert.js",
1894 +                       "properties/IMsgRingtone.js",
1895                         "properties/LauncherId.js",
1896 +                       "properties/MsgAlert.js",
1897 +                       "properties/MsgRingtone.js",
1898                         "properties/Name.js",
1899                         "properties/Nickname.js",
1900                         "properties/Note.js",
1901 --- .orig/usr/palm/frameworks/contacts.ui/submission/38/templates/person-filter-list-widget/person-item.html
1902 +++ /usr/palm/frameworks/contacts.ui/submission/38/templates/person-filter-list-widget/person-item.html
1903 @@ -2,7 +2,7 @@
1904         <div class="palm-row-wrapper status">
1905                 <div class="icon left #{imStatusClassName}"></div>
1906                 <div id="#{imageId}" class="contacts-avatar-set" style="background-image:url(#{listPhotoPath})"><div class="contacts-avatar-frame"></div></div>
1907 -               <div class="title #{favoriteClass}">
1908 +               <div class="title #{favoriteClass}" style="padding-top:15px;">
1909                         <div class="truncating-text">#{-displayName}</div>
1910                 </div>
1911         </div>
1912 --- .orig/usr/palm/frameworks/mojo/submissions/367/stylesheets/global.css
1913 +++ /usr/palm/frameworks/mojo/submissions/367/stylesheets/global.css
1914 @@ -419,7 +419,7 @@
1915  
1916  .sliding-toggle {
1917    height: 48px;
1918 -  margin: 1px 0 0 0;
1919 +  margin: 4px 0 0 0;
1920    border-width: 9px 29px 9px 29px;
1921    -webkit-box-sizing: border-box;
1922    -webkit-border-image: url(../images/header-toggle-background.png) 9 29 9 29 repeat repeat;
1923 --- .orig/usr/palm/frameworks/mojo/submissions/367/stylesheets/global-lists.css
1924 +++ /usr/palm/frameworks/mojo/submissions/367/stylesheets/global-lists.css
1925 @@ -397,6 +397,15 @@
1926    line-height: 24px;
1927  }
1928  
1929 +.palm-list-selector.right .title {
1930 +  text-transform: uppercase;
1931 +  font-size: 14px;
1932 +  color: #1f75bf;
1933 +  text-shadow: #ffffff 0px 1px 0px;
1934 +  line-height: 28px;
1935 +  max-height:24px;
1936 +}
1937 +
1938  .palm-row.removable .title {
1939    padding-left: 0;
1940  }
1941 @@ -460,7 +469,15 @@
1942  .palm-list-selector .label,
1943  .palm-row .truncating-text .label,
1944  .palm-row .truncating-text.label {
1945 -  max-width: 40%;
1946 +  max-width: 50%;
1947 +}
1948 +
1949 +.palm-list-selector.right .label {
1950 +  text-transform: none;
1951 +  font-size: 20px;
1952 +  color: black;
1953 +  max-width: 50%;
1954 +  line-height: 24px;
1955  }
1956  
1957  .palm-row .truncating-text .label,
1958 --- .orig/usr/palm/frameworks/mojo/submissions/367/stylesheets/global-lists-dark.css
1959 +++ /usr/palm/frameworks/mojo/submissions/367/stylesheets/global-lists-dark.css
1960 @@ -51,6 +51,23 @@
1961    color: #999999;
1962  }
1963  
1964 +.palm-dark .palm-list-selector.right .title {
1965 +  text-transform: uppercase;
1966 +  font-size: 14px;
1967 +  color: #aaa;
1968 +  text-shadow: #222 0px 1px 0px;
1969 +  line-height: 28px;
1970 +  max-height:24px;
1971 +}
1972 +
1973 +.palm-dark .palm-list-selector.right .label {
1974 +  text-transform: none;
1975 +  font-size: 20px;
1976 +  color: white;
1977 +  max-width: 50%;
1978 +  line-height: 24px;
1979 +}
1980 +
1981  .palm-dark .label.mv-picker-label,
1982  .palm-dark .palm-row .label {
1983    color: #aaa;
1984 --- .orig/usr/palm/frameworks/mojo/submissions/367/stylesheets/global-widget-mvpicker.css
1985 +++ /usr/palm/frameworks/mojo/submissions/367/stylesheets/global-widget-mvpicker.css
1986 @@ -19,12 +19,18 @@
1987    padding-top: 19px;
1988  }
1989  
1990 -.label.left.mv-picker-label {
1991 -  float: left;
1992 -  margin: 20px 4px 0px 13px;
1993 -  padding-right: 5px;
1994 +.title.left.mv-picker-label {
1995 +/*  float: left;*/
1996 +/*  margin: 15px 4px 0px 13px;*/
1997 +/*  padding-right: 5px;*/
1998 +  padding: 13px 14px 15px 14px;
1999  }
2000  
2001 +.mv-picker-capsules-container {
2002 +       float:right;
2003 +       margin-right:5px;
2004 +},
2005 +
2006  .focused .mv-picker-label {
2007    z-index: 99000;
2008    position: relative;
2009 @@ -45,7 +51,7 @@