From c8a37e3c56f574926e37cf1e8801ff56c3d9d599 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Wed, 29 May 2013 12:34:33 +0000 Subject: [PATCH] attempt to harden splitter dock/undock against breaking, as there are other methods to dock the split bar (e.g.:doubleclick) --- mail/js/app.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mail/js/app.js b/mail/js/app.js index 08f6ef921f..83f1295e3f 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -20,6 +20,7 @@ app.mail = AppJS.extend( mail_selectedMails: [], mail_currentlyFocussed: '', + mail_previewAreaActive: true, // we start with the area active /** * Initialize javascript for this application @@ -144,6 +145,9 @@ app.mail = AppJS.extend( */ mail_disablePreviewArea: function(_value) { var splitter = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('mailSplitter'); + var splitterDN = splitter.getDOMNode(); + // check if DOM Node has class that contains docked; then we assume the bar docked, whatever our class var states + for (var i=0; i < splitterDN.childNodes[1].classList.length;i++) if (splitterDN.childNodes[1].classList[i].search(/docked/)>=0) this.mail_previewAreaActive = false; //etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('mailPreviewHeadersFrom').set_disabled(_value); //etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('mailPreviewHeadersTo').set_disabled(_value); //etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('mailPreviewHeadersDate').set_disabled(_value); @@ -151,11 +155,13 @@ app.mail = AppJS.extend( etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('mailPreview').set_disabled(_value); if (_value==true) { - splitter.dock(); + if (this.mail_previewAreaActive) splitter.dock(); + this.mail_previewAreaActive = false; } else { - splitter.undock(); + if (!this.mail_previewAreaActive) splitter.undock(); + this.mail_previewAreaActive = true; } },