8 new, 2 modified patches.
[webos-internals:imagineer1981s-modifications.git] / browser / browser-add-option-to-send-link-message.patch
1 Name: Share Link Message Option
2 Version: 1.3.5-1
3 Author: Fritos1406
4 Description: Adds An option to share link through messaging app
5
6 --- .orig/usr/palm/applications/com.palm.app.browser/app/controllers/page-assistant.js
7 +++ /usr/palm/applications/com.palm.app.browser/app/controllers/page-assistant.js
8 @@ -625,7 +625,8 @@
9  
10                         var popupItems = [
11                                 {label: $L('Open In New Card'), command:'openNew'},
12 -                               {label: $L('Share Link'), command:'shareUrl'},
13 +                               {label: $L('Share Link Email'), command:'shareUrl'},
14 +                               {label: $L('Share Link Message'), command:'shareUrlMms'},
15                                 {label: $L('Copy URL'), command:'copyUrl'},
16                                 {label: $L('Copy to Photos'), command:'copyToPhotos'},
17                                 {label: $L('Share Image'), command:'shareImage'},
18 @@ -675,6 +676,9 @@
19                                         case 'shareUrl':
20                                                 this._shareUrl(urlInfo.url, urlInfo.desc, false /*no capture*/);
21                                                 break;
22 +                                       case 'shareUrlMms':
23 +                                               this._shareUrlMms(urlInfo.url, urlInfo.desc, false /*no capture*/);
24 +                                               break;                                          
25                                         case 'copyUrl':
26                                                 this.controller.stageController.setClipboard(urlInfo.url);
27                                                 break;
28 @@ -697,6 +701,7 @@
29                                 if (urlInfo.url) {
30                                         usedItems.push( findItem('openNew') );
31                                         usedItems.push( findItem('shareUrl') );
32 +                                       usedItems.push( findItem('shareUrlMms') );
33                                         usedItems.push( findItem('copyUrl') );
34                                 }
35  
36 @@ -1763,6 +1768,45 @@
37                 method: 'open',
38                 parameters: parameters
39         });
40 +};PageAssistant.prototype._shareUrlMms = function(url, title, withCapture) {
41 +
42 +       if (url === undefined) {
43 +               return;
44 +       }
45 +
46 +       if (!title) {
47 +               try {
48 +                       title = $L("page at #{host}").interpolate({host: UrlUtil.getUrlHost(url)});
49 +               }
50 +               catch (e) {
51 +                       title = url;
52 +               }
53 +       }
54 +
55 +       var captureFile;
56 +       if (withCapture) {
57 +               captureFile = '/tmp/captures/browser_page.png';
58 +
59 +               this._webView.mojo.saveViewToFile(captureFile);
60 +       }
61 +
62 +       var msg = $L("Here's a website I think you'll like: #{src}").interpolate(
63 +                       {src: url, title: title});
64 +       var parameters = {
65 +               id: 'com.palm.app.messaging',
66 +               params: {
67 +                       messageText: msg
68 +               }
69 +       };
70 +
71 +       if (withCapture) {
72 +               parameters.params.attachments = [{fullPath: captureFile}];
73 +       }
74 +
75 +       this.controller.serviceRequest('palm://com.palm.applicationManager', {
76 +               method: 'open',
77 +               parameters: parameters
78 +       });
79  };
80  
81  PageAssistant.prototype._setWallpaper = function(pathToImage) {