alecpl
2010-10-05 c288f9969e113cb7dbd38bf05167cc8e94e007ff
program/js/app.js
@@ -199,11 +199,13 @@
        if (this.env.trash_mailbox && this.env.mailbox != this.env.trash_mailbox)
          this.set_alttext('delete', 'movemessagetotrash');
        this.env.message_commands = ['show', 'reply', 'reply-all', 'forward', 'moveto', 'copy', 'delete',
          'open', 'mark', 'edit', 'viewsource', 'download', 'print', 'load-attachment', 'load-headers'];
        this.env.message_commands = ['show', 'reply', 'reply-all', 'reply-list', 'forward',
          'moveto', 'copy', 'delete', 'open', 'mark', 'edit', 'viewsource', 'download',
          'print', 'load-attachment', 'load-headers'];
        if (this.env.action=='show' || this.env.action=='preview') {
          this.enable_command(this.env.message_commands, this.env.uid);
          this.enable_command('reply-list', this.env.list_post);
          if (this.env.next_uid) {
            this.enable_command('nextmessage', 'lastmessage', true);
@@ -882,10 +884,19 @@
        break;
      case 'reply-all':
      case 'reply-list':
      case 'reply':
        var uid;
        if (uid = this.get_single_uid())
          this.goto_url('compose', '_reply_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)+(command=='reply-all' ? '&_all=1' : ''), true);
        if (uid = this.get_single_uid()) {
          var url = '_reply_uid='+uid+'&_mbox='+urlencode(this.env.mailbox);
          if (command == 'reply-all')
            // do reply-list, when list is detected and popup menu wasn't used
            url += '&_all=' + (!props && this.commands['reply-list'] ? 'list' : 'all');
          else if (command == 'reply-list')
            url += '&_all=list';
          this.goto_url('compose', url, true);
        }
        break;
      case 'forward':
@@ -1294,7 +1305,7 @@
      }
    }
    this.http_post('utils/save-pref', '_name=collapsed_folders&_value='+urlencode(this.env.collapsed_folders));
    this.http_post('save-pref', '_name=collapsed_folders&_value='+urlencode(this.env.collapsed_folders));
    this.set_unread_count_display(id, false);
  };
@@ -1366,9 +1377,16 @@
    var selected = list.get_single_selection() != null;
    this.enable_command(this.env.message_commands, selected);
    // Hide certain command buttons when Drafts folder is selected
    if (selected && this.env.mailbox == this.env.drafts_mailbox) {
      this.enable_command('reply', 'reply-all', 'forward', false);
    if (selected) {
      // Hide certain command buttons when Drafts folder is selected
      if (this.env.mailbox == this.env.drafts_mailbox)
        this.enable_command('reply', 'reply-all', 'reply-list', 'forward', false);
      // Disable reply-list when List-Post header is not set
      else {
        var msg = this.env.messages[list.get_single_selection()];
        if (!msg.ml)
          this.enable_command('reply-list', false);
      }
    }
    // Multi-message commands
    this.enable_command('delete', 'moveto', 'copy', 'mark', (list.selection.length > 0 ? true : false));
@@ -1465,7 +1483,7 @@
    if ((found = $.inArray('subject', this.env.coltypes)) >= 0)
      this.set_env('subject_col', found);
    this.http_post('utils/save-pref', { '_name':'list_cols', '_value':this.env.coltypes, '_session':'list_attrib/columns' });
    this.http_post('save-pref', { '_name':'list_cols', '_value':this.env.coltypes, '_session':'list_attrib/columns' });
  };
  this.check_droptarget = function(id)
@@ -1546,6 +1564,7 @@
      unread_children: flags.unread_children?flags.unread_children:0,
      parent_uid: flags.parent_uid?flags.parent_uid:0,
      selected: this.select_all_mode || this.message_list.in_selection(uid),
      ml: flags.ml?1:0,
      // flags from plugins
      flags: flags.extra_flags
    });
@@ -2749,9 +2768,8 @@
  this.init_address_input_events = function(obj)
  {
    var handler = function(e){ return ref.ksearch_keypress(e,this); };
    obj.bind((bw.safari || bw.ie ? 'keydown' : 'keypress'), handler);
    obj.attr('autocomplete', 'off');
    obj[bw.ie || bw.safari || bw.chrome ? 'keydown' : 'keypress'](function(e){ return ref.ksearch_keydown(e, this); })
      .attr('autocomplete', 'off');
  };
  // checks the input fields before sending a message
@@ -3248,8 +3266,9 @@
  this.sent_successfully = function(type, msg)
  {
    this.list_mailbox();
    this.display_message(msg, type, true);
    // before redirect we need to wait some time for Chrome (#1486177)
    window.setTimeout(function(){ ref.list_mailbox(); }, 500);
  };
@@ -3258,7 +3277,7 @@
  /*********************************************************/
  // handler for keyboard events on address-fields
  this.ksearch_keypress = function(e, obj)
  this.ksearch_keydown = function(e, obj)
  {
    if (this.ksearch_timer)
      clearTimeout(this.ksearch_timer);
@@ -3635,7 +3654,6 @@
    }
  };
  this.delete_contacts = function()
  {
    // exit if no mailbox specified or if selection is empty
@@ -3725,7 +3743,6 @@
    this.enable_command('export', (this.contact_list.rowcount > 0));
  };
  this.group_create = function()
  {
@@ -3860,7 +3877,7 @@
    if (li && (link = li.firstChild) && link.tagName.toLowerCase() == 'a')
      link.innerHTML = prop.name;
    this.env.contactfolders[key].name = this.env.contactgroups[key].name = name;
    this.env.contactfolders[key].name = this.env.contactgroups[key].name = prop.name;
    this.triggerEvent('group_update', { id:prop.id, source:prop.source, name:prop.name, li:li[0] });
  };
@@ -5017,6 +5034,8 @@
        if (this.env.action == 'show') {
          // re-enable commands on move/delete error
          this.enable_command(this.env.message_commands, true);
          if (!this.env.list_post)
            this.enable_command('reply-list', false);
        }
        else if (this.task == 'addressbook') {
          this.triggerEvent('listupdate', { folder:this.env.source, rowcount:this.contact_list.rowcount });