| | |
| | | { |
| | | this.env.spellcheck.spelling_state_observer = function(s){ ref.set_spellcheck_state(s); }; |
| | | this.set_spellcheck_state('ready'); |
| | | if (rcube_find_object('_is_html').value == '1') |
| | | this.display_spellcheck_controls(false); |
| | | } |
| | | if (this.env.drafts_mailbox) |
| | | this.enable_command('savedraft', true); |
| | |
| | | this.enable_command('select-all', 'select-none', 'expunge', true); |
| | | |
| | | if (this.env.messagecount |
| | | && (this.env.mailbox == this.env.trash_mailbox || this.env.mailbox == this.env.junk_mailbox |
| | | || this.env.mailbox.match('^' + RegExp.escape(this.env.trash_mailbox) + RegExp.escape(this.env.delimiter)) |
| | | || this.env.mailbox.match('^' + RegExp.escape(this.env.junk_mailbox) + RegExp.escape(this.env.delimiter)))) |
| | | && (this.env.mailbox == this.env.trash_mailbox || this.env.mailbox == this.env.junk_mailbox |
| | | || this.env.mailbox.match('^' + RegExp.escape(this.env.trash_mailbox) + RegExp.escape(this.env.delimiter)) |
| | | || this.env.mailbox.match('^' + RegExp.escape(this.env.junk_mailbox) + RegExp.escape(this.env.delimiter)))) |
| | | this.enable_command('purge', true); |
| | | |
| | | this.set_page_buttons(); |
| | |
| | | break; |
| | | |
| | | case 'spellcheck': |
| | | if (this.env.spellcheck && this.env.spellcheck.spellCheck && this.spellcheck_ready) |
| | | { |
| | | if (window.tinyMCE && tinyMCE.get('compose-body')) { |
| | | tinyMCE.execCommand('mceSpellCheck', true); |
| | | } |
| | | else if (this.env.spellcheck && this.env.spellcheck.spellCheck && this.spellcheck_ready) { |
| | | this.env.spellcheck.spellCheck(this.env.spellcheck.check_link); |
| | | this.set_spellcheck_state('checking'); |
| | | } |
| | | } |
| | | break; |
| | | |
| | | case 'savedraft': |
| | |
| | | |
| | | // start timer for message preview (wait for double click) |
| | | if (selected && this.env.contentframe && !list.multi_selecting) |
| | | this.preview_timer = window.setTimeout(function(){ ref.msglist_get_preview(); }, this.dblclick_time + 10); |
| | | this.preview_timer = window.setTimeout(function(){ ref.msglist_get_preview(); }, 200); |
| | | else if (this.env.contentframe) |
| | | this.show_contentframe(false); |
| | | }; |
| | |
| | | } |
| | | |
| | | // check for empty body |
| | | if ((!window.tinyMCE || !tinyMCE.get('compose-body')) |
| | | && input_message.value == '' |
| | | && !confirm(this.get_label('nobodywarning'))) |
| | | if ((!window.tinyMCE || !tinyMCE.get('compose-body')) && input_message.value == '' && !confirm(this.get_label('nobodywarning'))) |
| | | { |
| | | input_message.focus(); |
| | | return false; |
| | | } |
| | | else if (window.tinyMCE && tinyMCE.get('compose-body') |
| | | && !tinyMCE.get('compose-body').getContent() |
| | | && !confirm(this.get_label('nobodywarning'))) |
| | | else if (window.tinyMCE && tinyMCE.get('compose-body') && !tinyMCE.get('compose-body').getContent() && !confirm(this.get_label('nobodywarning'))) |
| | | { |
| | | tinyMCE.get('compose-body').focus(); |
| | | return false; |
| | |
| | | return true; |
| | | }; |
| | | |
| | | this.display_spellcheck_controls = function(vis) |
| | | { |
| | | if (this.env.spellcheck) { |
| | | this.env.spellcheck.check_link.style.visibility = vis ? 'visible' : 'hidden'; |
| | | this.env.spellcheck.switch_lan_pic.style.visibility = vis ? 'visible' : 'hidden'; |
| | | } |
| | | }; |
| | | |
| | | this.set_spellcheck_state = function(s) |
| | | { |
| | |
| | | |
| | | var id, frame, ref = this; |
| | | if (id = list.get_single_selection()) |
| | | this.preview_timer = window.setTimeout(function(){ ref.load_contact(id, 'show'); }, this.dblclick_time + 10); |
| | | this.preview_timer = window.setTimeout(function(){ ref.load_contact(id, 'show'); }, 200); |
| | | else if (this.env.contentframe) |
| | | this.show_contentframe(false); |
| | | |
| | | this.enable_command('edit', id?true:false); |
| | | this.enable_command('compose', list.selection.length > 0); |
| | | this.enable_command('edit', (id && this.env.address_sources && !this.env.address_sources[this.env.source].readonly) ? true : false); |
| | | this.enable_command('delete', list.selection.length && this.env.address_sources && !this.env.address_sources[this.env.source].readonly); |
| | | |
| | | return false; |
| | |
| | | { |
| | | |
| | | case 'delete': |
| | | if (this.task == 'addressbook') |
| | | { |
| | | var uid = this.contact_list.get_selection(); |
| | | this.enable_command('compose', (uid && this.contact_list.rows[uid])); |
| | | this.enable_command('delete', 'edit', (uid && this.contact_list.rows[uid] && this.env.address_sources && !this.env.address_sources[this.env.source].readonly)); |
| | | break; |
| | | } |
| | | case 'moveto': |
| | | if (this.env.action=='show') |
| | | this.command('list'); |
| | | else if (this.message_list) |
| | | this.message_list.init(); |
| | | |
| | | |
| | | case 'purge': |
| | | case 'expunge': |
| | | if (!this.env.messagecount) |
| | | if (!this.env.messagecount && this.task == 'mail') |
| | | { |
| | | // clear preview pane content |
| | | if (this.env.contentframe) |
| | |
| | | this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete', 'mark', 'viewsource', |
| | | 'print', 'load-attachment', 'purge', 'expunge', 'select-all', 'select-none', 'sort', false); |
| | | } |
| | | |
| | | break; |
| | | |
| | | case 'list': |
| | |
| | | |
| | | case 'check-recent': |
| | | case 'getunread': |
| | | this.enable_command('show', 'expunge', 'select-all', 'select-none', 'sort', (this.env.messagecount > 0)); |
| | | var mailboxtest = (this.env.mailbox == this.env.trash_mailbox || this.env.mailbox == this.env.junk_mailbox |
| | | if (this.task == 'mail') |
| | | { |
| | | this.enable_command('show', 'expunge', 'select-all', 'select-none', 'sort', (this.env.messagecount > 0)); |
| | | var mailboxtest = (this.env.mailbox == this.env.trash_mailbox || this.env.mailbox == this.env.junk_mailbox |
| | | || this.env.mailbox.match('^' + RegExp.escape(this.env.trash_mailbox) + RegExp.escape(this.env.delimiter)) |
| | | || this.env.mailbox.match('^' + RegExp.escape(this.env.junk_mailbox) + RegExp.escape(this.env.delimiter))) ? true : false; |
| | | |
| | | this.enable_command('purge', (this.env.messagecount && mailboxtest)); |
| | | |
| | | this.enable_command('purge', (this.env.messagecount && mailboxtest)); |
| | | } |
| | | break; |
| | | |
| | | } |