thomascube
2008-08-22 26f5b0935ef4d8bc01e2b8581f7d7ed3c4508fc2
program/js/app.js
@@ -195,6 +195,8 @@
            {
            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);
@@ -204,9 +206,9 @@
          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();
@@ -855,11 +857,13 @@
        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':
@@ -1185,7 +1189,7 @@
    // 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);
    };
@@ -1899,16 +1903,12 @@
      }
    // 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;
@@ -1917,6 +1917,13 @@
    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)
    {
@@ -2453,12 +2460,12 @@
      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;
@@ -3643,15 +3650,22 @@
      {
      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)
@@ -3660,7 +3674,6 @@
       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':
@@ -3668,13 +3681,15 @@
      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;
      }