/* Enigma Plugin */ window.rcmail && rcmail.addEventListener('init', function(evt) { if (rcmail.env.task == 'settings') { if (rcmail.gui_objects.keyslist) { rcmail.keys_list = new rcube_list_widget(rcmail.gui_objects.keyslist, {multiselect:true, draggable:false, keyboard:true}); rcmail.keys_list .addEventListener('select', function(o) { rcmail.enigma_keylist_select(o); }) .addEventListener('keypress', function(o) { rcmail.enigma_keylist_keypress(o); }) .init() .focus(); rcmail.enigma_list(); rcmail.register_command('firstpage', function(props) { return rcmail.enigma_list_page('first'); }); rcmail.register_command('previouspage', function(props) { return rcmail.enigma_list_page('previous'); }); rcmail.register_command('nextpage', function(props) { return rcmail.enigma_list_page('next'); }); rcmail.register_command('lastpage', function(props) { return rcmail.enigma_list_page('last'); }); } if (rcmail.env.action == 'plugin.enigmakeys') { rcmail.register_command('search', function(props) {return rcmail.enigma_search(props); }, true); rcmail.register_command('reset-search', function(props) {return rcmail.enigma_search_reset(props); }, true); rcmail.register_command('plugin.enigma-import', function() { rcmail.enigma_import(); }, true); rcmail.register_command('plugin.enigma-import-search', function() { rcmail.enigma_import_search(); }, true); rcmail.register_command('plugin.enigma-key-export', function() { rcmail.enigma_export(); }); rcmail.register_command('plugin.enigma-key-export-selected', function() { rcmail.enigma_export(true); }); rcmail.register_command('plugin.enigma-key-import', function() { rcmail.enigma_key_import(); }, true); rcmail.register_command('plugin.enigma-key-import-search', function() { rcmail.enigma_key_import_search(); }, true); rcmail.register_command('plugin.enigma-key-delete', function(props) { return rcmail.enigma_delete(); }); rcmail.register_command('plugin.enigma-key-create', function(props) { return rcmail.enigma_key_create(); }, true); rcmail.register_command('plugin.enigma-key-save', function(props) { return rcmail.enigma_key_create_save(); }, true); rcmail.addEventListener('responseafterplugin.enigmakeys', function() { rcmail.enable_command('plugin.enigma-key-export', rcmail.env.rowcount > 0); rcmail.triggerEvent('listupdate', {list: rcmail.keys_list, rowcount: rcmail.env.rowcount}); }); if (rcmail.gui_objects.importform) { // make sure Enter key in search input starts searching // instead of submitting the form $('#rcmimportsearch').keydown(function(e) { if (e.which == 13) { rcmail.enigma_import_search(); return false; } }); } } } else if (rcmail.env.task == 'mail') { if (rcmail.env.action == 'compose') { rcmail.addEventListener('beforesend', function(props) { rcmail.enigma_beforesend_handler(props); }) .addEventListener('beforesavedraft', function(props) { rcmail.enigma_beforesavedraft_handler(props); }); $('input,label', $('#enigmamenu')).mouseup(function(e) { // don't close the menu on mouse click inside e.stopPropagation(); }); $('a.button.enigma').prop('tabindex', $('#messagetoolbar > a:first').prop('tabindex')); } $.each(['encrypt', 'sign'], function() { if (rcmail.env['enigma_force_' + this]) $('[name="_enigma_' + this + '"]').prop('checked', true); }); if (rcmail.env.enigma_password_request) { rcmail.enigma_password_request(rcmail.env.enigma_password_request); } } }); /*********************************************************/ /********* Enigma Settings/Keys/Certs UI *********/ /*********************************************************/ // Display key(s) import form rcube_webmail.prototype.enigma_key_import = function() { var dialog = $('