From aec689521b62ee2d63ea396afeea86bd701ecc7e Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 21 Oct 2016 15:18:11 +0200 Subject: [PATCH] Better detection of edit capability in file viewer window --- plugins/kolab_files/kolab_files.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/kolab_files/kolab_files.js b/plugins/kolab_files/kolab_files.js index 1de55348..5fb6ca6d 100644 --- a/plugins/kolab_files/kolab_files.js +++ b/plugins/kolab_files/kolab_files.js @@ -1175,9 +1175,12 @@ function kolab_files_frame_load(frame) rcmail.files_edit(); rcmail.enable_command('files-edit', (rcmail.file_editor && rcmail.file_editor.editable) - || (info && info.viewer && info.viewer.manticore)); + || (info && info.viewer && (info.viewer.manticore || info.viewer.wopi)) + || (file_api.file_type_supported(rcmail.env.file_data.type, rcmail.env.files_caps) & 4)); + rcmail.enable_command('files-print', (rcmail.file_editor && rcmail.file_editor.printable) || (info && /^image\//i.test(info.type))); + // detect Print button and check if it can be accessed try { if ($('#fileframe').contents().find('#print').length) @@ -1755,7 +1758,7 @@ rcube_webmail.prototype.files_edit = function(session) else if (session !== true) params.session = session; - if (this.file_editor && !session) { + if (this.file_editor && this.file_editor.editable && !session) { this.file_editor.enable(); this.enable_command('files-save', true); }