From e095efae99f37dae7161f5d2440e538a4cba74f8 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 26 Jul 2014 20:12:25 +0200 Subject: [PATCH] Enable Print button if PDF viewer is loaded into an iframe --- plugins/kolab_files/kolab_files.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/kolab_files/kolab_files.js b/plugins/kolab_files/kolab_files.js index c520395c..a525c395 100644 --- a/plugins/kolab_files/kolab_files.js +++ b/plugins/kolab_files/kolab_files.js @@ -705,6 +705,13 @@ kolab_files_frame_load = function(frame) rcmail.enable_command('files-print', (rcmail.file_editor && rcmail.file_editor.printable) || (rcmail.env.file_data && /^image\//i.test(rcmail.env.file_data.type))); + + // detect Print button and check if it can be accessed + try { + if ($('#fileframe').contents().find('#print').length) + rcmail.enable_command('files-print', true); + } + catch(e) {}; }; @@ -866,6 +873,13 @@ rcube_webmail.prototype.files_print = function() win.print(); } } + else { + // e.g. Print button in PDF viewer + try { + $('#fileframe').contents().find('#print').click(); + } + catch(e) {}; + } }; rcube_webmail.prototype.files_set_quota = function(p)