updateds
[webos-internals:modifications.git] / email / email-hold-tap-context--menu.patch
1 diff --git a/usr/palm/applications/com.palm.app.email/app/controllers/message-assistant.js b/usr/palm/applications/com.palm.app.email/app/controllers/message-assistant.js
2 index 95bb302..bf1beac 100644
3 --- a/usr/palm/applications/com.palm.app.email/app/controllers/message-assistant.js
4 +++ b/usr/palm/applications/com.palm.app.email/app/controllers/message-assistant.js
5 @@ -81,6 +81,7 @@ var MessageAssistant = function(targetEmail, focusStage, detailsObj){
6         this.handleWebViewSingleTap = this.handleWebViewSingleTap.bind(this);
7         this.handleDOMClicked = this.handleDOMClicked.bind(this);
8         this.handleMessageDownloadRetry = this.handleMessageDownloadRetry.bind(this);
9 +       this.boundHandleWebViewHoldTap = this.handleWebViewHoldTap.bind(this);
10         
11         this.displayContactAvatarAndPresence = this.displayContactAvatarAndPresence.bind(this);
12         
13 @@ -220,6 +221,7 @@ var MessageAssistant = function(targetEmail, focusStage, detailsObj){
14                 this.webview.removeEventListener(Mojo.Event.webViewMimeHandoff, this.handleLinkClicked, false);
15                 this.webview.removeEventListener(Mojo.Event.webViewImageSaved, this.handleInlineImageSaved, false);
16                 this.webview.removeEventListener('singletap', this.handleWebViewSingleTap, true);
17 +               this.webview.removeEventListener(Mojo.Event.hold, this.boundHandleWebViewHoldTap, true);
18                 
19                 this.webview.removeEventListener(Mojo.Event.webViewLoadStarted, this.boundBodyRenderComplete, true);
20                 
21 @@ -558,6 +560,7 @@ var MessageAssistant = function(targetEmail, focusStage, detailsObj){
22                 this.webview.addEventListener(Mojo.Event.webViewMimeHandoff, this.handleLinkClicked, false);
23                 this.webview.addEventListener(Mojo.Event.webViewImageSaved, this.handleInlineImageSaved, false);
24                 this.webview.addEventListener('singletap', this.handleWebViewSingleTap, true);
25 +               this.webview.addEventListener(Mojo.Event.hold, this.boundHandleWebViewHoldTap, true);
26         
27                 this.boundBodyRenderComplete = this.bodyRenderComplete.bind(this);
28                 this.webview.addEventListener(Mojo.Event.webViewLoadStarted, this.boundBodyRenderComplete, true);
29 @@ -2014,8 +2017,15 @@ MessageAssistant.prototype._getAttachmentById = function(id) {
30         MessageAssistant.prototype.handleWebViewSingleTap = function(event) {   
31                 try {
32                         var tapPt = Mojo.Dom.viewportOffset(this.webview);
33 -                       tapPt.left = event.centerX - tapPt.left;
34 -                       tapPt.top  = event.centerY - tapPt.top;
35 +                       if(event.isHoldTap) {
36 +                               event.altKey = true;
37 +                               tapPt.left = event.down.offsetX;
38 +                               tapPt.top = event.down.offsetY;
39 +                       }
40 +                       else {
41 +                               tapPt.left = event.centerX - tapPt.left;
42 +                               tapPt.top  = event.centerY - tapPt.top;
43 +                       }
44  
45                         //Mojo.Log.info("MessageAssistant.handleWebViewSingleTap(): event.altKey=%s, tapPt.left=%d, tapPt.top=%d", event.altKey, tapPt.left, tapPt.top);
46                         if (event.altKey) {
47 @@ -2629,6 +2639,11 @@ MessageAssistant.prototype._getAttachmentById = function(id) {
48                 });     
49         };
50         
51 +       MessageAssistant.prototype.handleWebViewHoldTap = function(event) {     
52 +               event.isHoldTap = true;
53 +               this.handleWebViewSingleTap(event);
54 +       },
55 +       
56  
57  
58  MessageAssistant.kAppMenuMarkRead = $L('Mark as Read');