Difference between revisions of "Patch Contacts Send All via Email"
m (New page: Forthcoming...) |
|||
Line 1: | Line 1: | ||
− | + | {{template:patch}} | |
+ | [[Image:Send_all_via_email.png|right]] | ||
+ | |||
+ | ==Introduction== | ||
+ | |||
+ | This patch allows you to create a vCard file containing all your contacts, and then attach that file to an e-mail. WebOS does not offer a built-in way to export your contacts, so this seems to be the next best thing. | ||
+ | |||
+ | ===Patch Source (emailall.patch)=== | ||
+ | |||
+ | <source lang="diff"> | ||
+ | --- /usr/palm/applications/com.palm.app.contacts/app/controllers/list-assistant.js.orig 2009-08-19 19:19:40.000000000 -0400 | ||
+ | +++ /usr/palm/applications/com.palm.app.contacts/app/controllers/list-assistant.js 2010-01-08 01:11:12.380734400 -0500 | ||
+ | @@ -284,6 +284,9 @@ | ||
+ | items: [Mojo.Menu.editItem,{ | ||
+ | label:$L("Send All to Car Kit"), | ||
+ | command:"sendcontacts" | ||
+ | + }, { | ||
+ | + label:$L("Save All via Email"), | ||
+ | + command:"emailcontacts" | ||
+ | }, prefsItem, { | ||
+ | label: $LL('Help'), | ||
+ | command: Mojo.Menu.helpCmd | ||
+ | @@ -463,12 +466,31 @@ | ||
+ | this.controller.stageController.pushScene('prefs'); | ||
+ | }else if (event.type == Mojo.Event.command && event.command == "sendcontacts") { | ||
+ | this.sendContacts(); | ||
+ | + }else if (event.type == Mojo.Event.command && event.command == "emailcontacts") { | ||
+ | + this.emailContacts(); | ||
+ | } | ||
+ | if (event.type == Mojo.Event.commandEnable && event.command == Mojo.Menu.prefsCmd) { | ||
+ | // funkay! this is apparently how you declare you want to activate the prefs menu item | ||
+ | event.stopPropagation(); | ||
+ | } | ||
+ | }, | ||
+ | + | ||
+ | + emailContacts:function(){ | ||
+ | + this.vcardRequest = AppAssistant.contactsService.makeVCardList(this.controller, { | ||
+ | + stripPhoneNumbers:false | ||
+ | + }, this.gotVCard.bind(this, "email")); | ||
+ | + var cancelFn = function(){ | ||
+ | + this.vcardRequest.cancel(); | ||
+ | + this.vcardRequest = null; | ||
+ | + }.bind(this) | ||
+ | + console.log("Setting up a dialog"); | ||
+ | + this.sendContactsPopupAssistant = new SendContactsPopupAssistant(this.controller, cancelFn); | ||
+ | + this.controller.showDialog({ | ||
+ | + template: 'list/send-contact-popup', | ||
+ | + assistant: this.sendContactsPopupAssistant, | ||
+ | + preventCancel:true | ||
+ | + }); | ||
+ | + }, | ||
+ | |||
+ | sendContacts:function(){ | ||
+ | |||
+ | @@ -479,7 +501,7 @@ | ||
+ | |||
+ | bluetoothResponse:function(response){ | ||
+ | if (response == "BT-On" || response == "BT-StartingUp") { | ||
+ | - this.vcardRequest = AppAssistant.contactsService.makeVCardList(this.controller, {stripPhoneNumbers:true}, this.gotVCard.bind(this)); | ||
+ | + this.vcardRequest = AppAssistant.contactsService.makeVCardList(this.controller, {stripPhoneNumbers:true}, this.gotVCard.bind(this, "bluetooth")); | ||
+ | var cancelFn = function(){ | ||
+ | this.vcardRequest.cancel(); | ||
+ | this.vcardRequest = null; | ||
+ | @@ -494,18 +516,39 @@ | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | - gotVCard:function(resp){ | ||
+ | - var appArgs = { | ||
+ | - appId:"com.palm.app.bluetooth", | ||
+ | - name:"btopp" | ||
+ | - } | ||
+ | - var sceneArgs = { | ||
+ | - file:resp.file | ||
+ | - } | ||
+ | - | ||
+ | - this.sendContactsPopupAssistant.widget.mojo.close(); | ||
+ | - | ||
+ | - this.controller.stageController.pushScene(appArgs, sceneArgs) | ||
+ | + gotVCard:function(type, resp){ | ||
+ | + if (type == "bluetooth") { | ||
+ | + var appArgs = { | ||
+ | + appId:"com.palm.app.bluetooth", | ||
+ | + name:"btopp" | ||
+ | + } | ||
+ | + var sceneArgs = { | ||
+ | + file:resp.file | ||
+ | + } | ||
+ | + | ||
+ | + this.sendContactsPopupAssistant.widget.mojo.close(); | ||
+ | + | ||
+ | + this.controller.stageController.pushScene(appArgs, sceneArgs) | ||
+ | + } | ||
+ | + else if (type == "email") { | ||
+ | + var vcfPath = resp.file; | ||
+ | + | ||
+ | + this.sendContactsPopupAssistant.widget.mojo.close(); | ||
+ | + | ||
+ | + this.controller.serviceRequest('palm://com.palm.applicationManager', { | ||
+ | + method: 'open', | ||
+ | + parameters: { | ||
+ | + id: 'com.palm.app.email', | ||
+ | + params: { | ||
+ | + summary: 'Palm Contacts', | ||
+ | + attachments: [{ | ||
+ | + fullPath:vcfPath, | ||
+ | + mimeType:'text/x-vcard' | ||
+ | + }] | ||
+ | + } | ||
+ | + } | ||
+ | + }); | ||
+ | + } | ||
+ | }, | ||
+ | |||
+ | handleListTap: function(event){ | ||
+ | |||
+ | |||
+ | </source> |
Revision as of 07:33, 8 January 2010
Introduction
This patch allows you to create a vCard file containing all your contacts, and then attach that file to an e-mail. WebOS does not offer a built-in way to export your contacts, so this seems to be the next best thing.
Patch Source (emailall.patch)
<source lang="diff"> --- /usr/palm/applications/com.palm.app.contacts/app/controllers/list-assistant.js.orig 2009-08-19 19:19:40.000000000 -0400 +++ /usr/palm/applications/com.palm.app.contacts/app/controllers/list-assistant.js 2010-01-08 01:11:12.380734400 -0500 @@ -284,6 +284,9 @@
items: [Mojo.Menu.editItem,{ label:$L("Send All to Car Kit"), command:"sendcontacts"
+ }, { + label:$L("Save All via Email"), + command:"emailcontacts"
}, prefsItem, { label: $LL('Help'), command: Mojo.Menu.helpCmd
@@ -463,12 +466,31 @@
this.controller.stageController.pushScene('prefs'); }else if (event.type == Mojo.Event.command && event.command == "sendcontacts") { this.sendContacts();
+ }else if (event.type == Mojo.Event.command && event.command == "emailcontacts") { + this.emailContacts();
} if (event.type == Mojo.Event.commandEnable && event.command == Mojo.Menu.prefsCmd) { // funkay! this is apparently how you declare you want to activate the prefs menu item event.stopPropagation(); } },
+ + emailContacts:function(){ + this.vcardRequest = AppAssistant.contactsService.makeVCardList(this.controller, { + stripPhoneNumbers:false + }, this.gotVCard.bind(this, "email")); + var cancelFn = function(){ + this.vcardRequest.cancel(); + this.vcardRequest = null; + }.bind(this) + console.log("Setting up a dialog"); + this.sendContactsPopupAssistant = new SendContactsPopupAssistant(this.controller, cancelFn); + this.controller.showDialog({ + template: 'list/send-contact-popup', + assistant: this.sendContactsPopupAssistant, + preventCancel:true + }); + },
sendContacts:function(){
@@ -479,7 +501,7 @@
bluetoothResponse:function(response){ if (response == "BT-On" || response == "BT-StartingUp") {
- this.vcardRequest = AppAssistant.contactsService.makeVCardList(this.controller, {stripPhoneNumbers:true}, this.gotVCard.bind(this)); + this.vcardRequest = AppAssistant.contactsService.makeVCardList(this.controller, {stripPhoneNumbers:true}, this.gotVCard.bind(this, "bluetooth"));
var cancelFn = function(){ this.vcardRequest.cancel(); this.vcardRequest = null;
@@ -494,18 +516,39 @@
} },
- gotVCard:function(resp){ - var appArgs = { - appId:"com.palm.app.bluetooth", - name:"btopp" - } - var sceneArgs = { - file:resp.file - } - - this.sendContactsPopupAssistant.widget.mojo.close(); - - this.controller.stageController.pushScene(appArgs, sceneArgs) + gotVCard:function(type, resp){ + if (type == "bluetooth") { + var appArgs = { + appId:"com.palm.app.bluetooth", + name:"btopp" + } + var sceneArgs = { + file:resp.file + } + + this.sendContactsPopupAssistant.widget.mojo.close(); + + this.controller.stageController.pushScene(appArgs, sceneArgs) + } + else if (type == "email") { + var vcfPath = resp.file; + + this.sendContactsPopupAssistant.widget.mojo.close(); + + this.controller.serviceRequest('palm://com.palm.applicationManager', { + method: 'open', + parameters: { + id: 'com.palm.app.email', + params: { + summary: 'Palm Contacts', + attachments: [{ + fullPath:vcfPath, + mimeType:'text/x-vcard' + }] + } + } + }); + }
}, handleListTap: function(event){
</source>