21 New Patches.
[webos-internals:djcin7s-modifications.git] / browser / browser-share-image-message-option.patch
1 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
2 index 09c898f..525086c 100644
3 --- a/usr/palm/applications/com.palm.app.browser/app/controllers/page-assistant.js
4 +++ b/usr/palm/applications/com.palm.app.browser/app/controllers/page-assistant.js
5 @@ -628,7 +628,8 @@ PageAssistant.prototype._onWebViewSingleTap = function(event) {
6                                 {label: $L('Share Link'), command:'shareUrl'},
7                                 {label: $L('Copy URL'), command:'copyUrl'},
8                                 {label: $L('Copy to Photos'), command:'copyToPhotos'},
9 -                               {label: $L('Share Image'), command:'shareImage'},
10 +                               {label: $L('Share Image Email'), command:'shareImage'},
11 +                               {label: $L('Share Image Message '), command:'shareImageMms'},
12                                 {label: $L('Set Wallpaper'), command:'setWallpaper'}
13                         ];
14  
15 @@ -650,6 +651,9 @@ PageAssistant.prototype._onWebViewSingleTap = function(event) {
16                                                 case 'shareImage':
17                                                         this._shareImage(imageInfo, path);
18                                                         break;
19 +                                               case 'shareImageMms':
20 +                                                       this._shareImageMms(imageInfo, path);
21 +                                                       break;
22                                                 case 'setWallpaper':
23                                                         this._setWallpaper(path);
24                                                         break;
25 @@ -684,6 +688,9 @@ PageAssistant.prototype._onWebViewSingleTap = function(event) {
26                                         case 'shareImage':
27                                                 this._webView.mojo.saveImageAtPoint(tapPt.left, tapPt.top, "/tmp", saveImageCallback);
28                                                 break;
29 +                                       case 'shareImageMms':
30 +                                               this._webView.mojo.saveImageAtPoint(tapPt.left, tapPt.top, "/tmp", saveImageCallback);
31 +                                               break;
32                                         case 'setWallpaper':
33                                                 this._webView.mojo.saveImageAtPoint(tapPt.left, tapPt.top, "/media/internal", saveImageCallback);
34                                                 break;
35 @@ -702,6 +709,7 @@ PageAssistant.prototype._onWebViewSingleTap = function(event) {
36  
37                                 if (response.src) {
38                                         usedItems.push( findItem('shareImage') );
39 +                                       usedItems.push( findItem('shareImageMms') );
40                                 }
41  
42                                 if (this._supportedImageType(response.src, response.mimeType)) {
43 @@ -1873,6 +1881,25 @@ PageAssistant.prototype._shareImage = function(imageInfoObj, pathToImage) {
44  };
45  
46  /**
47 + * Send text message with the supplied image attached.
48 + */
49 +PageAssistant.prototype._shareImageMms = function(imageInfoObj, pathToImage) {
50 +
51 +       var parameters = {
52 +               id: 'com.palm.app.messaging',
53 +               params: {
54 +                       messageText: $L('Check out this picture...'),
55 +                       "attachment": pathToImage
56 +               }
57 +       };
58 +
59 +       this.controller.serviceRequest('palm://com.palm.applicationManager', {
60 +               method: 'open',
61 +               parameters: parameters
62 +       });
63 +};
64 +
65 +/**
66   * Called whenever the scroller is moved.
67   */
68  PageAssistant.prototype.moved = function() {