From: Michael M Slusarz Date: Tue, 13 Oct 2009 10:53:34 +0000 (-0600) Subject: Added contextmenu support in DIMP for Opera X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=4a63e5afc4e5ceb8d482ec3030c1dea0d4924747;p=horde.git Added contextmenu support in DIMP for Opera --- diff --git a/imp/docs/CHANGES b/imp/docs/CHANGES index 02ba03671..e20095dfc 100644 --- a/imp/docs/CHANGES +++ b/imp/docs/CHANGES @@ -2,6 +2,7 @@ v5.0-git -------- +[mms] Added contextmenu support in DIMP for Opera. [mms] Display HTML parts inline by using IFRAMEs (based on code by rui.carneiro@portugalmail.net; Request #8592). [mms] Add ability to search by relative date intervals (Request #3438). diff --git a/imp/js/ContextSensitive.js b/imp/js/ContextSensitive.js index 743cf6480..d963ee5c3 100644 --- a/imp/js/ContextSensitive.js +++ b/imp/js/ContextSensitive.js @@ -4,6 +4,9 @@ * document, and works only where these are possible to override. It allows * contextmenus to be created via both a left and right mouse click. * + * On Opera, the context menu is triggered by a left click + SHIFT + CTRL + * combination. + * * Requires prototypejs 1.6+ and scriptaculous 1.8+ (effects.js only). * * Original code by Havard Eide (http://eide.org/) released under the MIT @@ -39,7 +42,9 @@ var ContextSensitive = Class.create({ this.submenus = $H(); this.triggers = []; - document.observe('contextmenu', this._rightClickHandler.bindAsEventListener(this)); + if (!Prototype.Browser.Opera) { + document.observe('contextmenu', this._rightClickHandler.bindAsEventListener(this)); + } document.observe('click', this._leftClickHandler.bindAsEventListener(this)); document.observe(Prototype.Browser.Gecko ? 'DOMMouseScroll' : 'mousescroll', this.close.bind(this)); }, @@ -134,6 +139,12 @@ var ContextSensitive = Class.create({ { var base, elt, elt_up, trigger; + if (this.operaCheck(e)) { + this._rightClickHandler(e, false); + e.stop(); + return; + } + // Check for a right click. FF on Linux triggers an onclick event even // w/a right click, so disregard. if (e.isRightClick()) { @@ -175,6 +186,14 @@ var ContextSensitive = Class.create({ }, /** + * Checks if the Opera right-click emulation is present. + */ + operaCheck: function(e) + { + return Prototype.Browser.Opera && e.shiftKey && e.ctrlKey; + }, + + /** * Called when a right click event occurs. */ _rightClickHandler: function(e, left) diff --git a/imp/js/DimpBase.js b/imp/js/DimpBase.js index fc3295568..f66ea528a 100644 --- a/imp/js/DimpBase.js +++ b/imp/js/DimpBase.js @@ -1635,7 +1635,7 @@ var DimpBase = { clickHandler: function(parentfunc, e) { - if (e.isRightClick()) { + if (e.isRightClick() || DimpCore.DMenu.operaCheck(e)) { return; } @@ -2681,7 +2681,11 @@ DimpBase._msgDragConfig = { d.selectIfNoDrag = false; // Handle selection first. - if (!args.right && (e.ctrlKey || e.metaKey)) { + if (DimpCore.DMenu.operaCheck(e)) { + if (!DimpBase.isSelected('domid', id)) { + DimpBase.msgSelect(id, { right: true }); + } + } else if (!args.right && (e.ctrlKey || e.metaKey)) { DimpBase.msgSelect(id, $H({ ctrl: true }).merge(args).toObject()); } else if (e.shiftKey) { DimpBase.msgSelect(id, $H({ shift: true }).merge(args).toObject()); @@ -2712,21 +2716,28 @@ DimpBase._folderDragConfig = { scroll: 'normalfolders', threshold: 5, onStart: function(d, e) { - $('msgBodyCover').clonePosition('msgBody').show(); + if (DimpCore.DMenu.operaCheck(e)) { + d.opera = true; + } else { + d.opera = false; + $('msgBodyCover').clonePosition('msgBody').show(); + } }, onDrag: function(d, e) { - if (!d.wasDragged) { + if (!d.opera && !d.wasDragged) { $('folderopts').hide(); $('dropbase').show(); d.ghost.removeClassName('on'); } }, onEnd: function(d, e) { - if (d.wasDragged) { - $('folderopts').show(); - $('dropbase').hide(); + if (!d.opera) { + if (d.wasDragged) { + $('folderopts').show(); + $('dropbase').hide(); + } + $('msgBodyCover').hide(); } - $('msgBodyCover').hide(); } }; diff --git a/imp/templates/index/index-dimp.inc b/imp/templates/index/index-dimp.inc index cb11a5eab..a02bb472a 100644 --- a/imp/templates/index/index-dimp.inc +++ b/imp/templates/index/index-dimp.inc @@ -231,7 +231,14 @@ function _simpleButton($id, $text, $image, $imagedir = null)