1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
window.rcmail && window.rcmail.addEventListener('init', function () {
if (rcmail.env.task === 'settings'
&& rcmail.env.action === 'plugin.inbox_keys') {
if (rcmail.gui_objects.keyslist) {
rcmail.inbox_keys_list = new rcube_list_widget(
rcmail.gui_objects.keyslist,
{multiselect: true, draggable: false, keyboard: true});
rcmail.inbox_keys_list
.addEventListener('select', rcmail.inbox_keys_select)
.addEventListener('keypress',
list => rcmail.list_keypress(list, {del: 'plugin.inbox_keys_delete'}))
.init()
.focus();
}
rcmail.register_command('plugin.inbox_keys_generate', rcmail.inbox_keys_generate);
rcmail.register_command('plugin.inbox_keys_import', rcmail.inbox_keys_import);
rcmail.register_command('plugin.inbox_keys_delete', rcmail.inbox_keys_delete);
}
});
rcube_webmail.prototype.inbox_keys_select = function (list) {
this.enable_command('plugin.inbox_keys_delete', list.get_selection().length > 0);
};
rcube_webmail.prototype.inbox_keys_generate = function () {
this.inbox_keys_reload('&_action=plugin.inbox_keys_generate');
};
rcube_webmail.prototype.inbox_keys_import = function () {
this.inbox_keys_reload('&_action=plugin.inbox_keys_import');
};
rcube_webmail.prototype.inbox_keys_delete = function () {
var keys = this.inbox_keys_list.get_selection();
if (!keys.length) return;
this.confirm_dialog(
this.get_label('inbox_settings.confirm_delete_key'),
'delete',
function (_evt, ref) {
var lock = ref.display_message(
ref.get_label('inbox_settings.deleting_key', 'loading'));
ref.http_post('plugin.inbox_keys_delete', {keys}, lock);
// TODO: maybe reload
});
};
rcube_webmail.prototype.inbox_keys_reload = function(url) {
var win;
if (win = this.get_frame_window(this.env.contentframe)) {
if (!url) {
if (win.location && win.location.href.indexOf(this.env.blankpage) < 0) {
win.location.href = this.env.blankpage;
}
if (this.env.frame_lock) {
this.set_busy(false, null, this.env.frame_lock);
}
return;
}
this.env.frame_lock = this.set_busy(true, 'loading');
win.location.href = this.env.comm_path + '&_framed=1' + url;
}
};
|