updates and additions
[webos-internals:modifications.git] / phone / phone-whitepages-call-log-phone-lookup.patch
1 diff --git a/usr/palm/applications/com.palm.app.phone/app/controllers/calllog-assistant.js b/usr/palm/applications/com.palm.app.phone/app/controllers/calllog-assistant.js
2 index 2cb234a..c2af04b 100644
3 --- a/usr/palm/applications/com.palm.app.phone/app/controllers/calllog-assistant.js
4 +++ b/usr/palm/applications/com.palm.app.phone/app/controllers/calllog-assistant.js
5 @@ -480,15 +480,17 @@ var CalllogAssistant = Class.create({
6                         };
7                         view_contact = Mojo.View.render({template: 'calllog/listitem_contact', object: template_model});
8                 }
9 -               
10 +
11                 var element = Mojo.View.convertToNode('<div name="rowdrawer" class="calllogdetails" x-mojo-element="Drawer"> '
12 -                                                                                         + call_details + '<div name="contact_numbers_placeholder"></div>' + view_contact
13 +                                                                                         + call_details + '<div name="contact_numbers_placeholder"></div>'
14 +                                                                                         + '<div class="palm-row" x-mojo-touch-feedback="momentary" name="wplookup" value="' + itemModel.contactId + '" number="' + itemModel.number + '"><div class="palm-row-wrapper"><div class="title truncating-text">Lookup with WhitePages</div></div></div>'
15 +                                                                                         + view_contact
16                                                                                           + '</div>', this.controller.window.document);
17                 
18                 itemNode.querySelector(".palm-row-wrapper").appendChild(element);
19                 
20                 this.loadContactNumbers(element, itemModel, is_valid);
21 -               
22 +
23                 // no 'add to contact' or altnum row
24                 if ( ! is_valid && itemModel.contactId == -1 ) {
25                         element.querySelector('div[name="call-log-details-row"]').removeClassName('first').addClassName('single');
26 @@ -620,6 +622,40 @@ var CalllogAssistant = Class.create({
27                                                 this.dialNumber(details.number, itemModel.contactId, details.label);
28                                         }
29                                         return;
30 +                               
31 +                               case "wplookup":
32 +                                       this.controller.serviceRequest('palm://com.palm.applicationManager', {
33 +                                               method: 'launch',
34 +                                               parameters: {
35 +                                                       id: "com.whitepages.mobile",
36 +                                                       params:{action: "search", scene: "reverse", search_number: target.getAttribute('number'), autosearch:true}
37 +                                               },
38 +                                               onSuccess:function(){
39 +                                                       Mojo.Log.info("launched just fine.");
40 +                                               }.bind(this),
41 +                                               onFailure:function(){
42 +                                                       this.controller.showAlertDialog({
43 +                                                               onChoose: function(value){
44 +                                                                       if (value=="open"){
45 +                                                                               this.controller.serviceRequest('palm://com.palm.applicationManager', {
46 +                                                                                       method:'open',
47 +                                                                                       parameters:{
48 +                                                                                               target: "http://developer.palm.com/appredirect/?packageid=com.whitepages.mobile"
49 +                                                                                       }
50 +                                                                               });
51 +                                                                       }
52 +                                                               },
53 +                                                               preventCancel: false,
54 +                                                               title: $L("WhitePages App Not Installed"),
55 +                                                               message: $L("Sorry! WhitePages is not installed on your device. You can download this app from the App Catalog (Free)."),
56 +                                                               choices:[
57 +                                                                       {label:$L('Open in App Catalog'), value:"open", type:'affirmative'},
58 +                                                                       {label:$L('Ok'), value:"ok", type:'dismissal'}
59 +                                                               ]
60 +                                                       });
61 +                                               }.bind(this)
62 +                                       });
63 +                                       return;
64                                         
65                                 case "contact":
66                                         if ( target.getAttribute('value') == -1 ) {