From 5b8edcfdb1d503c62cf4e2109dda895e8d1c9270 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 10 Nov 2017 11:13:12 +0100 Subject: [PATCH] Fix previewPane doesn't work for expand & hide --- mail/js/app.js | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/mail/js/app.js b/mail/js/app.js index 15f02808ff..1c49cb3455 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -167,9 +167,10 @@ app.classes.mail = AppJS.extend( }); var nm = this.et2.getWidgetById(this.nm_index); this.mail_isMainWindow = true; - var previewPane = this.egw.preference('previewPane', 'mail'); - this.mail_disablePreviewArea(previewPane !== 'fixed' && previewPane !== 'vertical' && previewPane == true); - if (previewPane == 'vertical' || previewPane != true) nm.header.right_div.addClass('vertical_splitter'); + + // Set preview pane state + this.mail_disablePreviewArea(!this.getPreviewPaneState()); + //Get initial folder status this.mail_refreshFolderStatus(undefined,undefined,false); @@ -945,7 +946,7 @@ app.classes.mail = AppJS.extend( $preview_iframe.css ('top', $preview_iframe.position().top - offset + 10); }, 50); }; - var previewPane = this.egw.preference('previewPane', 'mail'); + // Show / hide 'Select something' in preview var blank = this.et2.getWidgetById('blank'); if(blank) @@ -957,7 +958,7 @@ app.classes.mail = AppJS.extend( // If there is content to show recalculate the size set_prev_iframe_top(); } - else if (previewPane == 'fixed' || previewPane == 'vertical' || previewPane != true) + else if (this.getPreviewPaneState()) { if(blank) { @@ -5999,5 +6000,35 @@ app.classes.mail = AppJS.extend( template: egw.webserverUrl+'/mail/templates/default/smimeCertAddToContact.xet?1', resizable: false }, et2_dialog._create_parent('mail')); + }, + + /** + * get preview pane state base on selected preference. + * + * It also set a right css class for vertical state. + * + * @returns {Boolean} returns true for visible Pane and false for hiding + */ + getPreviewPaneState: function () + { + var previewPane = this.egw.preference('previewPane', 'mail'); + var nm = this.et2.getWidgetById(this.nm_index); + var state = false; + switch (previewPane) + { + case true: + case '1': + case 'hide': + case 'expand': + state = false; + break; + case 'fixed': + state = true; + break; + default: // default is vertical + state = true; + nm.header.right_div.addClass('vertical_splitter'); + } + return state; } });