diff options
author | Hugues Hiegel <hugues@hiegel.fr> | 2013-09-12 11:35:26 +0200 |
---|---|---|
committer | Hugues Hiegel <root@paranoid> | 2013-11-08 17:40:16 +0100 |
commit | 31de4bc5ebf9556817554ae9630ca06e92fd7218 (patch) | |
tree | f98afd42b6f4f818b3f4c489b2e6a7b3912dbb93 /plugins/copymessage/copymessage.js | |
parent | ef14bd0d8d58ae0f57aa1969e31a5373aa441dba (diff) |
Updates / Plugins
Diffstat (limited to 'plugins/copymessage/copymessage.js')
-rw-r--r-- | plugins/copymessage/copymessage.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/plugins/copymessage/copymessage.js b/plugins/copymessage/copymessage.js new file mode 100644 index 000000000..046edc073 --- /dev/null +++ b/plugins/copymessage/copymessage.js @@ -0,0 +1,40 @@ +/** + * CopyMessage plugin script + */ + +function rcmail_copyto(command, el, pos) { + if (rcmail.env.rcm_destfolder == rcmail.env.mailbox) + return; + + var prev_sel = null; + + // also select childs of (collapsed) threads + if (rcmail.env.uid) { + if (!rcmail.message_list.in_selection(rcmail.env.uid)) { + prev_sel = rcmail.message_list.get_selection(); + rcmail.message_list.select_row(rcmail.env.uid); + } + + if (rcmail.message_list.rows[rcmail.env.uid].has_children && !rcmail.message_list.rows[rcmail.env.uid].expanded) + rcmail.message_list.select_childs(rcmail.env.uid); + + rcmail.env.uid = null; + } + + rcmail.command('copy', rcmail.env.rcm_destfolder, $(el)); + + if (prev_sel) { + rcmail.message_list.clear_selection(); + + for (var i in prev_sel) + rcmail.message_list.select_row(prev_sel[i], CONTROL_KEY); + } + + delete rcmail.env.rcm_destfolder; +} + +$(document).ready(function(){ + if (window.rcm_contextmenu_register_command) { + rcm_contextmenu_register_command('copy', 'rcmail_copyto', $('#rcmContextCopy'), 'moreacts', 'after', true); + } +});
\ No newline at end of file |