6 new and 3 modified patches. All via New Portal.
[webos-internals:imagineer1981s-modifications.git] / contacts / contacts-send-all-contacts-via-email.patch
1 --- /usr/palm/applications/com.palm.app.contacts/app/controllers/list-assistant.js.orig 2009-08-19 19:19:40.000000000 -0400
2 +++ /usr/palm/applications/com.palm.app.contacts/app/controllers/list-assistant.js      2010-01-08 01:11:12.380734400 -0500
3 @@ -284,6 +284,9 @@
4                                 items: [Mojo.Menu.editItem,{
5                                         label:$L("Send All to Car Kit"),
6                                         command:"sendcontacts"
7 +                               }, {
8 +                                       label:$L("Save All via Email"),
9 +                                       command:"emailcontacts"
10                                 }, prefsItem, {
11                                         label: $LL('Help'),
12                                         command: Mojo.Menu.helpCmd
13 @@ -463,12 +466,31 @@
14                         this.controller.stageController.pushScene('prefs');
15                 }else if (event.type == Mojo.Event.command && event.command == "sendcontacts") {
16                         this.sendContacts();
17 +               }else if (event.type == Mojo.Event.command && event.command == "emailcontacts") {
18 +                       this.emailContacts();
19                 }
20                 if (event.type == Mojo.Event.commandEnable && event.command == Mojo.Menu.prefsCmd) {
21                         // funkay!  this is apparently how you declare you want to activate the prefs menu item
22                         event.stopPropagation();
23                 }
24         },
25 +    
26 +    emailContacts:function(){
27 +        this.vcardRequest = AppAssistant.contactsService.makeVCardList(this.controller, {
28 +                stripPhoneNumbers:false
29 +            }, this.gotVCard.bind(this, "email"));
30 +        var cancelFn = function(){
31 +            this.vcardRequest.cancel();
32 +            this.vcardRequest = null;
33 +        }.bind(this)
34 +        console.log("Setting up a dialog");
35 +        this.sendContactsPopupAssistant = new SendContactsPopupAssistant(this.controller, cancelFn);
36 +        this.controller.showDialog({
37 +            template: 'list/send-contact-popup',
38 +            assistant: this.sendContactsPopupAssistant,
39 +            preventCancel:true
40 +        });
41 +       },
42  
43         sendContacts:function(){
44  
45 @@ -479,7 +501,7 @@
46  
47         bluetoothResponse:function(response){
48                 if (response == "BT-On" || response == "BT-StartingUp") {
49 -                       this.vcardRequest = AppAssistant.contactsService.makeVCardList(this.controller, {stripPhoneNumbers:true}, this.gotVCard.bind(this));
50 +                       this.vcardRequest = AppAssistant.contactsService.makeVCardList(this.controller, {stripPhoneNumbers:true}, this.gotVCard.bind(this, "bluetooth"));
51                         var cancelFn = function(){
52                                 this.vcardRequest.cancel();
53                                 this.vcardRequest = null;
54 @@ -494,18 +516,39 @@
55                 }
56         },
57  
58 -       gotVCard:function(resp){
59 -               var appArgs = {
60 -                       appId:"com.palm.app.bluetooth",
61 -                       name:"btopp"
62 -               }
63 -               var sceneArgs = {
64 -                       file:resp.file
65 -               }
66 -               
67 -               this.sendContactsPopupAssistant.widget.mojo.close();
68 -               
69 -               this.controller.stageController.pushScene(appArgs, sceneArgs)
70 +       gotVCard:function(type, resp){
71 +        if (type == "bluetooth") {
72 +            var appArgs = {
73 +                appId:"com.palm.app.bluetooth",
74 +                name:"btopp"
75 +            }
76 +            var sceneArgs = {
77 +                file:resp.file
78 +            }
79 +            
80 +            this.sendContactsPopupAssistant.widget.mojo.close();
81 +            
82 +            this.controller.stageController.pushScene(appArgs, sceneArgs)
83 +        }
84 +        else if (type == "email") {
85 +            var vcfPath = resp.file;
86 +            
87 +            this.sendContactsPopupAssistant.widget.mojo.close();
88 +            
89 +            this.controller.serviceRequest('palm://com.palm.applicationManager', {
90 +                           method: 'open',
91 +                           parameters: {
92 +                               id: 'com.palm.app.email',
93 +                               params: {
94 +                                   summary: 'Palm Contacts',
95 +                                   attachments: [{
96 +                                       fullPath:vcfPath,
97 +                                       mimeType:'text/x-vcard'
98 +                                   }]
99 +                               }
100 +                           }
101 +                       });                     
102 +        }
103         },
104  
105         handleListTap: function(event){