updates and additions
[webos-internals:modifications.git] / browser / browser-sharing-super-mix.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 6bf5870..207a127 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 @@ -19,6 +19,97 @@ MenuData.ApplicationMenu = {
6                 checkEnabled: true
7         },
8         
9 +       
10 +       ShareViaFacebook: {
11 +               label: $L('Facebook'),
12 +               command: 'share-fb-cmd',
13 +               checkEnabled: true
14 +       },
15 +       
16 +       TweetViaBadKitty: {
17 +               label: $L('Bad Kitty'),
18 +               command: 'share-bk-cmd',
19 +               checkEnabled: true
20 +       },
21 +       
22 +       TweetViaSpaz: {
23 +               label: $L('Spaz'),
24 +               command: 'share-spaz-cmd',
25 +               checkEnabled: true
26 +       },
27 +       
28 +       TweetViaTwee: {
29 +               label: $L('Twee'),
30 +               command: 'share-twee-cmd',
31 +               checkEnabled: true
32 +       },
33 +       
34 +       TweetViaTweed: {
35 +               label: $L('Tweed'),
36 +               command: 'share-tweed-cmd',
37 +               checkEnabled: true
38 +       },
39 +       
40 +       TweetViaCarbon: {
41 +               label: $L('Carbon'),
42 +               command: 'share-carbon-cmd',
43 +               checkEnabled: true
44 +       },
45 +       
46 +       SendViaQuickPost: {
47 +               label: $L('Quick Post'),
48 +               command: 'share-quickpost-cmd',
49 +               checkEnabled: true
50 +       },
51 +
52 +       AddToRelego: {
53 +               label: $L('Add To Relego'),
54 +               command: 'add-relego-cmd',
55 +               checkEnabled: true
56 +       },
57 +
58 +       AddToSpareTime: {
59 +               label: $L('Add To Spare Time'),
60 +               command: 'add-sparetime-cmd',
61 +               checkEnabled: true
62 +       },
63 +       
64 +       NeatoThatUrl: {
65 +               label: $L('Send via Neato!'),
66 +               command: 'add-neato-cmd',
67 +               checkEnabled: true
68 +       },      
69 +       
70 +       ShortenURL: {
71 +               label: $L('Shorten URL'),
72 +               command: 'shorten-url-cmd',
73 +               checkEnabled: true
74 +       },
75 +       
76 +       CopyToClipboard: {
77 +               label: $L('Copy to Clipboard'),
78 +               command: 'copy-clipboard-cmd',
79 +               checkEnabled: true
80 +       },
81 +       
82 +   ReKindleIt: {
83 +               label: $L('ReKindleIt!'),
84 +               command: 'add-rekindleit-cmd',
85 +               checkEnabled: true
86 +       },
87 +               
88 +       ShareViaSMS: {
89 +               label: $L('SMS'),
90 +               command: 'share-sms-cmd',
91 +               checkEnabled: true
92 +       },
93 +       
94 +       ShareViaEmail: {
95 +               label: $L('Email'),
96 +               command: 'share-email-cmd',
97 +               checkEnabled: true
98 +       },
99 +       
100         AddToLauncher: {
101                 label: $L('Add to Launcher'),
102                 command: 'add-launch-icon-cmd',
103 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
104 index 388cffc..f6e7249 100644
105 --- a/usr/palm/applications/com.palm.app.browser/app/controllers/page-assistant.js
106 +++ b/usr/palm/applications/com.palm.app.browser/app/controllers/page-assistant.js
107 @@ -788,20 +788,69 @@ PageAssistant.prototype._setupMenus = function() {
108                 this._pageControls.setup(true);
109  
110                 // Create the application menus and shortcuts (once the modifier keys work).
111 +               
112                 this.appMenuModel = {
113                         visible: true,
114                         items: [
115 -                               MenuData.ApplicationMenu.NewCard,
116 -                               MenuData.ApplicationMenu.AddBookmark,
117                                 {
118                                         label: $L("Page"),
119                                         items: [
120 -                                               MenuData.ApplicationMenu.AddToLauncher,
121 -                                               MenuData.ApplicationMenu.SharePage]
122 +                                               {label:$L('Add Bookmark'), shortcut:'m', command:'add-bookmark-cmd'},
123 +                                               {label:$L('Add To Launcher'),     shortcut:'l', command:'add-launch-icon-cmd'},
124 +                                               ]
125 +                               },
126 +                               {               
127 +                                       label: $L("Share via..."),
128 +                                       items: [
129 +                                               {label:$L('SMS'), shortcut:'s', command:'share-sms-cmd'},
130 +                                               {label:$L('Email'), shortcut:'e', command:'share-email-cmd'},
131 +                                               ]
132                                 },
133 -                               MenuData.ApplicationMenu.ShowBookmarks,
134 -                               MenuData.ApplicationMenu.ShowHistory]
135 +                               {label:$L('New Card'), shortcut:'n', command:'new-page-cmd'},
136 +                               {label:$L('Refresh Page'), shortcut:'r', command:'refresh'},
137 +                               {label:$L('Bookmarks'), shortcut:'b', command:'show-bookmarks-cmd'},
138 +                               {label:$L('History'), shortcut:'h', command:'show-history-cmd'},
139 +                               
140 +                               ]
141 +                               
142 +                               
143                 };
144 +               
145 +               this.getTweaksPrefs = new Mojo.Service.Request("palm://org.webosinternals.tweaks.prefs/", {
146 +                       method: 'get', parameters: {'owner': "browser-sharing-super-mix", 
147 +                       keys: ["showNeato","showSpareTime", "showRelego", "showClipboard", "shortenURL", "reKindleIt", 
148 +                                       "showFacebook", "showBadKitty", "showSpaz", "showTwee", "showTweed", "showCarbon", "showQuickPost"]},
149 +                       onSuccess: function(response) {
150 +                               if(response) {
151 +                                       if(response.showNeato == true)
152 +                                               this.appMenuModel.items[0].items.push(MenuData.ApplicationMenu.NeatoThatUrl);
153 +                                       if(response.showSpareTime == true) 
154 +                                               this.appMenuModel.items[0].items.push(MenuData.ApplicationMenu.AddToSpareTime);
155 +                                       if(response.showRelego == true) 
156 +                                               this.appMenuModel.items[0].items.push(MenuData.ApplicationMenu.AddToRelego);
157 +                                       if(response.showClipboard == true) 
158 +                                               this.appMenuModel.items[0].items.push(MenuData.ApplicationMenu.CopyToClipboard);
159 +                                       if(response.shortenURL == true) 
160 +                                               this.appMenuModel.items[0].items.push(MenuData.ApplicationMenu.ShortenURL);
161 +                                       if(response.reKindleIt == true) 
162 +                                               this.appMenuModel.items[0].items.push(MenuData.ApplicationMenu.ReKindleIt);
163 +                                       if(response.showFacebook == true) 
164 +                                               this.appMenuModel.items[1].items.push(MenuData.ApplicationMenu.ShareViaFacebook);
165 +                                       if(response.showBadKitty == true) 
166 +                                               this.appMenuModel.items[1].items.push(MenuData.ApplicationMenu.TweetViaBadKitty);
167 +                                       if(response.showSpaz == true) 
168 +                                               this.appMenuModel.items[1].items.push(MenuData.ApplicationMenu.TweetViaSpaz);
169 +                                       if(response.showTwee == true) 
170 +                                               this.appMenuModel.items[1].items.push(MenuData.ApplicationMenu.TweetViaTwee);                   
171 +                                       if(response.showTweed == true) 
172 +                                               this.appMenuModel.items[1].items.push(MenuData.ApplicationMenu.TweetViaTweed);
173 +                                       if(response.showCarbon == true) 
174 +                                               this.appMenuModel.items[1].items.push(MenuData.ApplicationMenu.TweetViaCarbon);
175 +                                       if(response.showQuickPost == true)
176 +                                               this.appMenuModel.items[1].items.push(MenuData.ApplicationMenu.SendViaQuickPost);
177 +                               }
178 +                       }.bind(this)});
179 +                                       
180  
181                 this.controller.setupWidget(Mojo.Menu.appMenu, undefined, this.appMenuModel);
182  
183 @@ -1066,7 +1115,7 @@ PageAssistant.prototype._updateHistory = function() {
184         if (!this.currentUrl || (this.currentUrl.length === 0)) {
185                 return;
186         }
187 -
188 +       
189         var title = this.currentTitle || null;
190         this.historyStore.addHistory(this.currentUrl, title, new Date(),
191                 function(response) {Mojo.Log.info("***_UpdateHistory Successful:"+JSON.stringify(response));},
192 @@ -2172,8 +2221,488 @@ PageAssistant.prototype.handleCommand = function(event) {
193                                         this._createDefaultBookmarkImages(urlReference);
194                                         this.showBookmarkDialog(BookmarkDialogAssistant.createLaunchpointTask, urlReference);
195                                         break;
196 -
197 -                               case MenuData.ApplicationMenu.SharePage.command:
198 +                               
199 +                               //NEATO 
200 +                               case MenuData.ApplicationMenu.NeatoThatUrl.command:
201 +                                       // Lets Neato! that URL
202 +                                       try{
203 +                                               this.neatoappid = "com.zhephree.neato";
204 +                                               this.controller.serviceRequest("palm://com.palm.applicationManager", {
205 +                                                       method: 'open',
206 +                                                       parameters: {
207 +                                                               id: this.neatoappid,
208 +                                                               params: {send: '{"a":"url","c":"'+this.currentUrl+'"}'}
209 +                                                       },
210 +                                                       onFailure:function(){
211 +                                                               //--> Promt to download if Neato! is not installed
212 +                                                               this.controller.showAlertDialog({
213 +                                                                       onChoose: function(value){
214 +                                                                               if (value=="yes"){
215 +                                                                                       //--> open app catalog at Neato! page
216 +                                                                                       this.controller.serviceRequest('palm://com.palm.applicationManager', {
217 +                                                                                               method:'open',
218 +                                                                                               parameters:{
219 +                                                                                                       target: "http://developer.palm.com/appredirect/?packageid=" + this.neatoappid
220 +                                                                                               }
221 +                                                                                       });
222 +                                                                               }
223 +                                                                       },
224 +                                                                       preventCancel: false,
225 +                                                                       title: $L("Neato! Not Installed"),
226 +                                                                       message: $L("Neato! is not installed. Would you like to download it?"),
227 +                                                                       choices:[
228 +                                                                               {label:$L('Yes'), value:"yes", type:'affirmative'},
229 +                                                                               {label:$L('No'), value:"no", type:'dismissal'}
230 +                                                                       ]
231 +                                                               });
232 +                                                       }.bind(this)
233 +                                               })
234 +                                       }catch(e){
235 +                                               Mojo.Log.error("Neato Patch Error: " + e);
236 +                                       }
237 +                                       break;
238 +                                       
239 +                               //SPARE TIME
240 +                               case MenuData.ApplicationMenu.AddToSpareTime.command:
241 +                                       // Send the URL to Spare Time
242 +                                       try{
243 +                                               this.sparetimeappid = "com.semicolonapps.sparetime";
244 +                                               this.controller.serviceRequest("palm://com.palm.applicationManager", {
245 +                                                       method: 'open',
246 +                                                       parameters: {
247 +                                                               id: this.sparetimeappid,
248 +                                                               params: {action: "add_url", url: this.currentUrl, title: this.currentTitle}
249 +                                                       },
250 +                                                       onFailure:function(){
251 +                                                               //--> How do they not have it installed?
252 +                                                               this.controller.showAlertDialog({
253 +                                                                       onChoose: function(value){
254 +                                                                               if (value=="yes"){
255 +                                                                                       //--> And weee'rrre.. of to see the wizard
256 +                                                                                       this.controller.serviceRequest('palm://com.palm.applicationManager', {
257 +                                                                                               method:'open',
258 +                                                                                               parameters:{
259 +                                                                                                       target: "http://developer.palm.com/appredirect/?packageid=" + this.sparetimeappid
260 +                                                                                               }
261 +                                                                                       });
262 +                                                                               }
263 +                                                                       },
264 +                                                                       preventCancel: false,
265 +                                                                       title: $L("Spare Time Not Installed"),
266 +                                                                       message: $L("Spare Time is not installed. Would you like to download it?"),
267 +                                                                       choices:[
268 +                                                                               {label:$L('Yes'), value:"yes", type:'affirmative'},
269 +                                                                               {label:$L('No'), value:"no", type:'dismissal'}
270 +                                                                       ]
271 +                                                               });
272 +                                                       }.bind(this)
273 +                                               })
274 +                                       }catch(e){
275 +                                               Mojo.Log.error("Spare Time Patch Error: " + e);
276 +                                       }
277 +                                       break;
278 +                               
279 +                               //RELEGO
280 +                               case MenuData.ApplicationMenu.AddToRelego.command:
281 +                                       // Send the URL to Spare Time
282 +                                       try{
283 +                                               this.relegoappid = "com.webosroundup.relego";
284 +                                               this.controller.serviceRequest("palm://com.palm.applicationManager", {
285 +                                                       method: 'open',
286 +                                                       parameters: {
287 +                                                               id: this.relegoappid,
288 +                                                               params: {action: 'addtorelego', url: this.currentUrl, title: this.currentTitle}
289 +                                                       },
290 +                                                       onFailure:function(){
291 +                                                               this.controller.showAlertDialog({
292 +                                                                       onChoose: function(value){
293 +                                                                               if (value=="yes"){
294 +                                                                                       //--> And weee'rrre.. of to see the wizard
295 +                                                                                       this.controller.serviceRequest('palm://com.palm.applicationManager', {
296 +                                                                                               method:'open',
297 +                                                                                               parameters:{
298 +                                                                                                       target: "http://developer.palm.com/appredirect/?packageid=" + this.relegoappid
299 +                                                                                               }
300 +                                                                                       });
301 +                                                                               }
302 +                                                                       },
303 +                                                                       preventCancel: false,
304 +                                                                       title: $L("Relego Not Installed"),
305 +                                                                       message: $L("Relego is not installed. Would you like to download it? It's Free!"),
306 +                                                                       choices:[
307 +                                                                               {label:$L('Yes'), value:"yes", type:'affirmative'},
308 +                                                                               {label:$L('No'), value:"no", type:'dismissal'}
309 +                                                                       ]
310 +                                                               });
311 +                                                       }.bind(this)
312 +                                               })
313 +                                       }catch(e){
314 +                                               Mojo.Log.error("Relego Patch Error: " + e);
315 +                                       }
316 +                                       break;
317 +                               
318 +                               //CLIPBOARD
319 +                               case MenuData.ApplicationMenu.CopyToClipboard.command:
320 +                                       this.controller.stageController.setClipboard(this.currentTitle + ' - ' + this.currentUrl);
321 +                                       Mojo.Controller.getAppController().showBanner("Copied to Clipboard!",  {source: 'notification'});
322 +                                       break;
323 +                                       
324 +                               //SHORTEN URL
325 +                               case MenuData.ApplicationMenu.ShortenURL.command:
326 +                                       // Set up the url
327 +                                               var url = "http://is.gd/api.php?longurl=" + this.currentUrl;
328 +                                       var target = this;
329 +       
330 +                                       // Attempt to connect to api
331 +                                               var request = new Ajax.Request(url, {
332 +                                                       method: 'get',
333 +                                                       evalJSON: 'false',
334 +                                                       onSuccess: function(response) {
335 +                                                               // Retrieve the short url and copy it
336 +                                                               var short_url = response.responseText;
337 +                                                               target.controller.stageController.setClipboard(short_url, false);
338 +               
339 +                                                               // Set up and show the banner message for success
340 +                                                               var message = "Short URL copied to clipboard.";
341 +                                                               var appController = Mojo.Controller.getAppController();
342 +                                                               var bannerParams = {soundClass: '', soundFile: '', icon: '', messageText: message};
343 +                                                               appController.showBanner(bannerParams, {banner: message});
344 +                                                       },
345 +                                                       onFailure: function(response) {
346 +                                                       // What happens when the api call fails
347 +                                                       }
348 +                                               });
349 +                               break;
350 +                               
351 +                               //REKINDLEIT
352 +                               case MenuData.ApplicationMenu.ReKindleIt.command:
353 +                                               this._newBrowserPage("http://www.rekindle.it/queue?r=" + this.currentUrl);
354 +                                               break;
355 +                               
356 +                               //FACEBOOK
357 +                               case MenuData.ApplicationMenu.ShareViaFacebook.command:
358 +                                       var facebookappids = ['com.palm.app.facebook.beta', 'com.palm.app.facebook'], facebookindex = 0;
359 +                                       var target = this;
360 +                                       function makeCall() {
361 +                                               if (facebookindex < facebookappids.length) {
362 +                                
363 +                                                       Mojo.Log.info('Trying to launch with appid %s', facebookappids[facebookindex]);
364 +                                
365 +                                                       var request = new Mojo.Service.Request("palm://com.palm.applicationManager", {
366 +                                                               method: 'launch',
367 +                                                               parameters: {
368 +                                                                       id: facebookappids[facebookindex],
369 +                                                                       params: {tweet: target.currentTitle + ' - ' + target.currentUrl}
370 +                                                               },
371 +                                                               onFailure: function() {
372 +                                                                       Mojo.Log.info('Facebook failed to launch with appid %s', facebookappids[facebookindex]);
373 +                                                                       facebookindex++; // go to next appid
374 +                                                                       makeCall(); // retry
375 +                                                               }.bind(this)
376 +                                                       });
377 +                                
378 +                                               } else {
379 +                                                       Mojo.Log.error('Facebook failed to launch');
380 +                                                       target.controller.showAlertDialog({
381 +                                                                       onChoose: function(value){
382 +                                                                               if (value=="yes"){
383 +                                                                                       //--> And weee'rrre.. of to see the wizard
384 +                                                                                       target.controller.serviceRequest('palm://com.palm.applicationManager', { 
385 +                                                                                               method:'open',
386 +                                                                                               parameters:{
387 +                                                                                                       target: "http://developer.palm.com/appredirect/?packageid=" + facebookappids[1]
388 +                                                                                               }
389 +                                                                                       });
390 +                                                                               }
391 +                                                                       },
392 +                                                                       preventCancel: false,
393 +                                                                       title: $L("Facebook Not Installed"),
394 +                                                                       message: $L("Facebook is not installed. Would you like to download it? It's free!"),
395 +                                                                       choices:[
396 +                                                                               {label:$L('Yes'), value:"yes", type:'affirmative'},
397 +                                                                               {label:$L('No'), value:"no", type:'dismissal'}
398 +                                                                       ]
399 +                                                               });
400 +                                               }
401 +                                
402 +                                       }
403 +                                       makeCall();
404 +                                       break;
405 +                               
406 +                               //BAD KITTY
407 +                               case MenuData.ApplicationMenu.TweetViaBadKitty.command:
408 +                                       // Send the URL to Bad Kitty
409 +                                       try{
410 +                                               this.badkittyappid = "com.superinhuman.badkitty";
411 +                                               this.controller.serviceRequest("palm://com.palm.applicationManager", {
412 +                                                       method: 'open',
413 +                                                       parameters: {
414 +                                                               id: this.badkittyappid,
415 +                                                               params: {action: 'tweet', tweet: this.currentTitle + ' - ' + this.currentUrl}
416 +                                                       },
417 +                                                       onFailure:function(){
418 +                                                               this.controller.showAlertDialog({
419 +                                                                       onChoose: function(value){
420 +                                                                               if (value=="yes"){
421 +                                                                                       //--> And weee'rrre.. of to see the wizard
422 +                                                                                       this.controller.serviceRequest('palm://com.palm.applicationManager', { 
423 +                                                                                               method:'open',
424 +                                                                                               parameters:{
425 +                                                                                                       target: "http://developer.palm.com/appredirect/?packageid=" + this.badkittyappid
426 +                                                                                               }
427 +                                                                                       });
428 +                                                                               }
429 +                                                                       },
430 +                                                                       preventCancel: false,
431 +                                                                       title: $L("Bad Kitty Not Installed"),
432 +                                                                       message: $L("Bad Kitty is not installed. Would you like to download it?"),
433 +                                                                       choices:[
434 +                                                                               {label:$L('Yes'), value:"yes", type:'affirmative'},
435 +                                                                               {label:$L('No'), value:"no", type:'dismissal'}
436 +                                                                       ]
437 +                                                               });
438 +                                                       }.bind(this)
439 +                                               })
440 +                                       }catch(e){
441 +                                               Mojo.Log.error("Bad Kitty Patch Error: " + e);
442 +                                       }
443 +                                       break;
444 +                               
445 +                               //SPAZ
446 +                               case MenuData.ApplicationMenu.TweetViaSpaz.command:
447 +                                       var spazappids = ['com.funkatron.app.spaz-beta', 'com.funkatron.app.spaz-sped', 'com.funkatron.app.spaz'], spazindex = 0;
448 +                                       var target = this;
449 +                                       function makeCall() {
450 +                                               if (spazindex < spazappids.length) {
451 +                                
452 +                                                       Mojo.Log.info('Trying to launch with appid %s', spazappids[spazindex]);
453 +                                
454 +                                                       var request = new Mojo.Service.Request("palm://com.palm.applicationManager", {
455 +                                                               method: 'launch',
456 +                                                               parameters: {
457 +                                                                       id: spazappids[spazindex],
458 +                                                                       params: {tweet: target.currentTitle + ' - ' + target.currentUrl}
459 +                                                               },
460 +                                                               onFailure: function() {
461 +                                                                       Mojo.Log.info('Spaz failed to launch with appid %s', spazappids[spazindex]);
462 +                                                                       spazindex++; // go to next appid
463 +                                                                       makeCall(); // retry
464 +                                                               }.bind(this)
465 +                                                       });
466 +                                
467 +                                               } else {
468 +                                                       Mojo.Log.error('Spaz failed to launch');
469 +                                                       target.controller.showAlertDialog({
470 +                                                                       onChoose: function(value){
471 +                                                                               if (value=="yes"){
472 +                                                                                       //--> And weee'rrre.. of to see the wizard
473 +                                                                                       target.controller.serviceRequest('palm://com.palm.applicationManager', { 
474 +                                                                                               method:'open',
475 +                                                                                               parameters:{
476 +                                                                                                       target: "http://developer.palm.com/appredirect/?packageid=" + spazappids[2]
477 +                                                                                               }
478 +                                                                                       });
479 +                                                                               }
480 +                                                                       },
481 +                                                                       preventCancel: false,
482 +                                                                       title: $L("Spaz Not Installed"),
483 +                                                                       message: $L("Spaz is not installed. Would you like to download it? It's free!"),
484 +                                                                       choices:[
485 +                                                                               {label:$L('Yes'), value:"yes", type:'affirmative'},
486 +                                                                               {label:$L('No'), value:"no", type:'dismissal'}
487 +                                                                       ]
488 +                                                               });
489 +                                               }
490 +                                
491 +                                       }
492 +                                       makeCall();
493 +                                       break;
494 +                                       
495 +                               //TWEE
496 +                               case MenuData.ApplicationMenu.TweetViaTwee.command:
497 +                                       // Send the URL to Twee
498 +                                       try{
499 +                                               this.tweeappid = "com.deliciousmorsel.twee";
500 +                                               this.controller.serviceRequest("palm://com.palm.applicationManager", {
501 +                                                       method: 'open',
502 +                                                       parameters: {
503 +                                                               id: this.tweeappid,
504 +                                                               params: {tweet: this.currentTitle + ' - ' + this.currentUrl}
505 +                                                       },
506 +                                                       onFailure:function(){
507 +                                                               this.controller.showAlertDialog({
508 +                                                                       onChoose: function(value){
509 +                                                                               if (value=="yes"){
510 +                                                                                       //--> And weee'rrre.. of to see the wizard
511 +                                                                                       this.controller.serviceRequest('palm://com.palm.applicationManager', { 
512 +                                                                                               method:'open',
513 +                                                                                               parameters:{
514 +                                                                                                       target: "http://developer.palm.com/appredirect/?packageid=" + this.tweeappid
515 +                                                                                               }
516 +                                                                                       });
517 +                                                                               }
518 +                                                                       },
519 +                                                                       preventCancel: false,
520 +                                                                       title: $L("Twee Not Installed"),
521 +                                                                       message: $L("Twee is not installed. Would you like to download it?"),
522 +                                                                       choices:[
523 +                                                                               {label:$L('Yes'), value:"yes", type:'affirmative'},
524 +                                                                               {label:$L('No'), value:"no", type:'dismissal'}
525 +                                                                       ]
526 +                                                               });
527 +                                                       }.bind(this)
528 +                                               })
529 +                                       }catch(e){
530 +                                               Mojo.Log.error("Twee Patch Error: " + e);
531 +                                       }
532 +                                       break;
533 +                               
534 +                               //TWEED                         
535 +                               case MenuData.ApplicationMenu.TweetViaTweed.command:
536 +                                       // Send the URL to Tweed
537 +                                       try{
538 +                                               this.tweedappid = "com.pivotallabs.webos.tweed";
539 +                                               this.controller.serviceRequest("palm://com.palm.applicationManager", {
540 +                                                       method: 'open',
541 +                                                       parameters: {
542 +                                                               id: this.tweedappid,
543 +                                                               params: {newTweet: this.currentTitle + ' - ' + this.currentUrl}
544 +                                                       },
545 +                                                       onFailure:function(){
546 +                                                               this.controller.showAlertDialog({
547 +                                                                       onChoose: function(value){
548 +                                                                               if (value=="yes"){
549 +                                                                                       //--> And weee'rrre.. of to see the wizard
550 +                                                                                       this.controller.serviceRequest('palm://com.palm.applicationManager', { 
551 +                                                                                               method:'open',
552 +                                                                                               parameters:{
553 +                                                                                                       target: "http://developer.palm.com/appredirect/?packageid=" + this.tweedappid
554 +                                                                                               }
555 +                                                                                       });
556 +                                                                               }
557 +                                                                       },
558 +                                                                       preventCancel: false,
559 +                                                                       title: $L("Tweed Not Installed"),
560 +                                                                       message: $L("Tweed is not installed. Would you like to download it?"),
561 +                                                                       choices:[
562 +                                                                               {label:$L('Yes'), value:"yes", type:'affirmative'},
563 +                                                                               {label:$L('No'), value:"no", type:'dismissal'}
564 +                                                                       ]
565 +                                                               });
566 +                                                       }.bind(this)
567 +                                               })
568 +                                       }catch(e){
569 +                                               Mojo.Log.error("Tweed Patch Error: " + e);
570 +                                       }
571 +                                       break;
572 +                               
573 +                               //CARBON                                
574 +                               case MenuData.ApplicationMenu.TweetViaCarbon.command:
575 +                                       // Send the URL to Carbon
576 +                                       try{
577 +                                               this.carbonappid = "com.dotsandlines.carbon";
578 +                                               this.controller.serviceRequest("palm://com.palm.applicationManager", {
579 +                                                       method: 'open',
580 +                                                       parameters: {
581 +                                                               id: this.carbonappid,
582 +                                                               params: {action: "compose", body: this.currentTitle + ' - ' + this.currentUrl}
583 +                                                       },
584 +                                                       onFailure:function(){
585 +                                                               this.controller.showAlertDialog({
586 +                                                                       onChoose: function(value){
587 +                                                                               if (value=="yes"){
588 +                                                                                       //--> And weee'rrre.. of to see the wizard
589 +                                                                                       this.controller.serviceRequest('palm://com.palm.applicationManager', { 
590 +                                                                                               method:'open',
591 +                                                                                               parameters:{
592 +                                                                                                       target: "http://developer.palm.com/appredirect/?packageid=" + this.carbonappid
593 +                                                                                               }
594 +                                                                                       });
595 +                                                                               }
596 +                                                                       },
597 +                                                                       preventCancel: false,
598 +                                                                       title: $L("Carbon Not Installed"),
599 +                                                                       message: $L("Carbon is not installed. Would you like to download it?"),
600 +                                                                       choices:[
601 +                                                                               {label:$L('Yes'), value:"yes", type:'affirmative'},
602 +                                                                               {label:$L('No'), value:"no", type:'dismissal'}
603 +                                                                       ]
604 +                                                               });
605 +                                                       }.bind(this)
606 +                                               })
607 +                                       }catch(e){
608 +                                               Mojo.Log.error("Carbon Patch Error: " + e);
609 +                                       }
610 +                                       break;
611 +                               
612 +                               //QUICKPOST
613 +                               case MenuData.ApplicationMenu.SendViaQuickPost.command:
614 +                                       try{
615 +                                               this.quickpostappid = "com.hedami.quickpost";
616 +                                               this.controller.serviceRequest("palm://com.palm.applicationManager", {
617 +                                                       method: 'open',
618 +                                                       parameters: {
619 +                                                               id: this.quickpostappid,
620 +                                                               params: {quickPost: this.currentTitle + ' - ' + this.currentUrl}
621 +                                                       },
622 +                                                       onFailure:function(){
623 +                                                               this.controller.showAlertDialog({
624 +                                                                       onChoose: function(value){
625 +                                                                               if (value=="yes"){
626 +                                                                                       //--> And weee'rrre.. of to see the wizard
627 +                                                                                       this.controller.serviceRequest('palm://com.palm.applicationManager', { 
628 +                                                                                               method:'open',
629 +                                                                                               parameters:{
630 +                                                                                                       target: "http://developer.palm.com/appredirect/?packageid=" + this.quickpostappid
631 +                                                                                               }
632 +                                                                                       });
633 +                                                                               }
634 +                                                                       },
635 +                                                                       preventCancel: false,
636 +                                                                       title: $L("Quick Post Not Installed"),
637 +                                                                       message: $L("Quick Post is not installed. Would you like to download it?"),
638 +                                                                       choices:[
639 +                                                                               {label:$L('Yes'), value:"yes", type:'affirmative'},
640 +                                                                               {label:$L('No'), value:"no", type:'dismissal'}
641 +                                                                       ]
642 +                                                               });
643 +                                                       }.bind(this)
644 +                                               })
645 +                                       }catch(e){
646 +                                               Mojo.Log.error("Quick Post Patch Error: " + e);
647 +                                       }
648 +                                       break;
649 +                               
650 +                               //SMS
651 +                               case MenuData.ApplicationMenu.ShareViaSMS.command:
652 +                                       // Set up the url
653 +                                               var url = "http://is.gd/api.php?longurl=" + this.currentUrl;
654 +                                               var target = this;
655 +       
656 +                                       // Attempt to connect to api
657 +                                               var request = new Ajax.Request(url, {
658 +                                                       method: 'get',
659 +                                                       evalJSON: 'false',
660 +                                                       onSuccess: function(response) {
661 +                                                               // Retrieve the short url and copy it
662 +                                                               var short_url = response.responseText;
663 +                                                               var request = new Mojo.Service.Request("palm://com.palm.applicationManager", {
664 +                                                                       method: 'open',
665 +                                                                       parameters: {
666 +                                                                               id: "com.palm.app.messaging",
667 +                                                                               params: {messageText: target.currentTitle + ' - ' + short_url}
668 +                                                                       }
669 +                                                               });
670 +                                                       },
671 +                                                       onFailure: function(response) {
672 +                                                       // What happens when the api call fails
673 +                                                       Mojo.Controller.getAppController().showBanner("Share Via SMS Failed",  {source: 'notification'});
674 +                                                       }
675 +                                               });
676 +                                               break;
677 +                               
678 +                               //EMAIL
679 +                               case MenuData.ApplicationMenu.ShareViaEmail.command:
680                                         this._shareUrl(this.currentUrl, this._getDisplayTitle(), true /*capture*/);
681                                         break;
682