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