updates by rod
[webos-internals:djcin7s-modifications.git] / browser / browser-tweet-url-and-title-via-spaz.patch
1 diff --git a/usr/palm/applications/com.palm.app.browser/app/controllers/page-applicationmenu.js b/usr/palm/applications/com.palm.app.browser/app/controllers/page-applicationmenu.js
2 index 9030f4d..148b2b7 100644
3 --- a/usr/palm/applications/com.palm.app.browser/app/controllers/page-applicationmenu.js
4 +++ b/usr/palm/applications/com.palm.app.browser/app/controllers/page-applicationmenu.js
5 @@ -17,6 +17,12 @@ MenuData.ApplicationMenu = {
6                 checkEnabled: true
7         },
8         
9 +       TweetViaSpaz: {
10 +               label: $L('Tweet Link'),
11 +               command: 'add-spaz-cmd',
12 +               checkEnabled: true
13 +       },
14 +       
15         AddToLauncher: {
16                 label: $L('Add to Launcher'),
17                 command: 'add-launch-icon-cmd',
18 diff --git a/usr/palm/applications/com.palm.app.browser/app/controllers/page-assistant.js b/usr/palm/applications/com.palm.app.browser/app/controllers/page-assistant.js
19 index 09c898f..cea30e5 100644
20 --- a/usr/palm/applications/com.palm.app.browser/app/controllers/page-assistant.js
21 +++ b/usr/palm/applications/com.palm.app.browser/app/controllers/page-assistant.js
22 @@ -791,6 +791,7 @@ PageAssistant.prototype._setupMenus = function() {
23                                 {
24                                         label: $L("Page"),
25                                         items: [
26 +                                               MenuData.ApplicationMenu.TweetViaSpaz,
27                                                 MenuData.ApplicationMenu.AddToLauncher,
28                                                 MenuData.ApplicationMenu.SharePage]
29                                 },
30 @@ -2119,6 +2120,45 @@ PageAssistant.prototype.handleCommand = function(event) {
31                                         this._createDefaultBookmarkImages(urlReference);
32                                         this.showBookmarkDialog(BookmarkDialogAssistant.createLaunchpointTask, urlReference);
33                                         break;
34 +                               
35 +                               case MenuData.ApplicationMenu.TweetViaSpaz.command:
36 +                                       // Send the URL to Twee
37 +                                       try{
38 +                                               this.spazappid = "com.funkatron.app.spaz-beta";
39 +                                               this.controller.serviceRequest("palm://com.palm.applicationManager", {
40 +                                                       method: 'open',
41 +                                                       parameters: {
42 +                                                               id: this.spazappid,
43 +                                                               params: {action: 'tweet', tweet: this.currentTitle + ' ' + this.currentUrl}
44 +                                                       },
45 +                                                       onFailure:function(){
46 +                                                               //--> How do they not have it installed?
47 +                                                               this.controller.showAlertDialog({
48 +                                                                       onChoose: function(value){
49 +                                                                               if (value=="yes"){
50 +                                                                                       //--> And weee'rrre.. of to see the wizard
51 +                                                                                       this.controller.serviceRequest('palm://com.palm.applicationManager', {
52 +                                                                                               method:'open',
53 +                                                                                               parameters:{
54 +                                                                                                       target: "http://developer.palm.com/appredirect/?packageid=" + this.spazappid
55 +                                                                                               }
56 +                                                                                       });
57 +                                                                               }
58 +                                                                       },
59 +                                                                       preventCancel: false,
60 +                                                                       title: $L("Spaz Not Installed"),
61 +                                                                       message: $L("Spaz is not installed. Would you like to download it?"),
62 +                                                                       choices:[
63 +                                                                               {label:$L('Yes'), value:"yes", type:'affirmative'},
64 +                                                                               {label:$L('No'), value:"no", type:'dismissal'}
65 +                                                                       ]
66 +                                                               });
67 +                                                       }.bind(this)
68 +                                               })
69 +                                       }catch(e){
70 +                                               Mojo.Log.error("Spaz Patch Error: " + e);
71 +                                       }
72 +                                       break;
73  
74                                 case MenuData.ApplicationMenu.SharePage.command:
75                                         this._shareUrl(this.currentUrl, this._getDisplayTitle(), true /*capture*/);