updates by rod
[webos-internals:djcin7s-modifications.git] / browser / browser-tweet-via-spaz-and-add-to-relego.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..659ecce 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,18 @@ 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 +       AddToRelego: {
16 +               label: $L('Add To Relego'),
17 +               command: 'add-relego-cmd',
18 +               checkEnabled: true
19 +       },
20 +       
21         AddToLauncher: {
22                 label: $L('Add to Launcher'),
23                 command: 'add-launch-icon-cmd',
24 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
25 index 09c898f..619234c 100644
26 --- a/usr/palm/applications/com.palm.app.browser/app/controllers/page-assistant.js
27 +++ b/usr/palm/applications/com.palm.app.browser/app/controllers/page-assistant.js
28 @@ -791,6 +791,8 @@ PageAssistant.prototype._setupMenus = function() {
29                                 {
30                                         label: $L("Page"),
31                                         items: [
32 +                                               MenuData.ApplicationMenu.TweetViaSpaz,
33 +                                               MenuData.ApplicationMenu.AddToRelego,
34                                                 MenuData.ApplicationMenu.AddToLauncher,
35                                                 MenuData.ApplicationMenu.SharePage]
36                                 },
37 @@ -2119,6 +2121,84 @@ PageAssistant.prototype.handleCommand = function(event) {
38                                         this._createDefaultBookmarkImages(urlReference);
39                                         this.showBookmarkDialog(BookmarkDialogAssistant.createLaunchpointTask, urlReference);
40                                         break;
41 +                               
42 +                               case MenuData.ApplicationMenu.TweetViaSpaz.command:
43 +                                       // Send the URL to Twee
44 +                                       try{
45 +                                               this.spazappid = "com.funkatron.app.spaz-beta";
46 +                                               this.controller.serviceRequest("palm://com.palm.applicationManager", {
47 +                                                       method: 'open',
48 +                                                       parameters: {
49 +                                                               id: this.spazappid,
50 +                                                               params: {action: 'tweet', tweet: this.currentTitle + ' ' + this.currentUrl}
51 +                                                       },
52 +                                                       onFailure:function(){
53 +                                                               //--> How do they not have it installed?
54 +                                                               this.controller.showAlertDialog({
55 +                                                                       onChoose: function(value){
56 +                                                                               if (value=="yes"){
57 +                                                                                       //--> And weee'rrre.. of to see the wizard
58 +                                                                                       this.controller.serviceRequest('palm://com.palm.applicationManager', {
59 +                                                                                               method:'open',
60 +                                                                                               parameters:{
61 +                                                                                                       target: "http://developer.palm.com/appredirect/?packageid=" + this.spazappid
62 +                                                                                               }
63 +                                                                                       });
64 +                                                                               }
65 +                                                                       },
66 +                                                                       preventCancel: false,
67 +                                                                       title: $L("Spaz Not Installed"),
68 +                                                                       message: $L("Spaz is not installed. Would you like to download it?"),
69 +                                                                       choices:[
70 +                                                                               {label:$L('Yes'), value:"yes", type:'affirmative'},
71 +                                                                               {label:$L('No'), value:"no", type:'dismissal'}
72 +                                                                       ]
73 +                                                               });
74 +                                                       }.bind(this)
75 +                                               })
76 +                                       }catch(e){
77 +                                               Mojo.Log.error("Spaz Patch Error: " + e);
78 +                                       }
79 +                                       break;
80 +                               
81 +                               case MenuData.ApplicationMenu.AddToRelego.command:
82 +                                       // Send the URL to Spare Time
83 +                                       try{
84 +                                               this.relegoappid = "com.webosroundup.relego";
85 +                                               this.controller.serviceRequest("palm://com.palm.applicationManager", {
86 +                                                       method: 'open',
87 +                                                       parameters: {
88 +                                                               id: this.relegoappid,
89 +                                                               params: {action: 'addtorelego', url: this.currentUrl, title: this.currentTitle}
90 +                                                       },
91 +                                                       onFailure:function(){
92 +                                                               //--> How do they not have it installed?
93 +                                                               this.controller.showAlertDialog({
94 +                                                                       onChoose: function(value){
95 +                                                                               if (value=="yes"){
96 +                                                                                       //--> And weee'rrre.. of to see the wizard
97 +                                                                                       this.controller.serviceRequest('palm://com.palm.applicationManager', {
98 +                                                                                               method:'open',
99 +                                                                                               parameters:{
100 +                                                                                                       target: "http://developer.palm.com/appredirect/?packageid=" + this.relegoappid
101 +                                                                                               }
102 +                                                                                       });
103 +                                                                               }
104 +                                                                       },
105 +                                                                       preventCancel: false,
106 +                                                                       title: $L("Relego Not Installed"),
107 +                                                                       message: $L("Relego is not installed. Would you like to download it? It's Free!"),
108 +                                                                       choices:[
109 +                                                                               {label:$L('Yes'), value:"yes", type:'affirmative'},
110 +                                                                               {label:$L('No'), value:"no", type:'dismissal'}
111 +                                                                       ]
112 +                                                               });
113 +                                                       }.bind(this)
114 +                                               })
115 +                                       }catch(e){
116 +                                               Mojo.Log.error("Relego Patch Error: " + e);
117 +                                       }
118 +                                       break;
119  
120                                 case MenuData.ApplicationMenu.SharePage.command:
121                                         this._shareUrl(this.currentUrl, this._getDisplayTitle(), true /*capture*/);