Thomas Bruederli
2014-07-20 b54731d8695d33e437cb593df4af12c10a068a1a
Iterate over all drafts saved in localStorage when asking for restoring. Delege/Ignore buttons will display the next item, if any
1 files modified
48 ■■■■■ changed files
program/js/app.js 48 ●●●●● patch | view | raw | blame | history
program/js/app.js
@@ -3375,9 +3375,35 @@
    // check for locally stored compose data
    if (window.localStorage) {
      var key, formdata, index = this.local_storage_get_item('compose.index', []);
      this.compose_restore_dialog(0, html_mode)
    }
      for (i = 0; i < index.length; i++) {
    if (input_to.val() == '')
      input_to.focus();
    else if (input_subject.val() == '')
      input_subject.focus();
    else if (input_message)
      input_message.focus();
    this.env.compose_focus_elem = document.activeElement;
    // get summary of all field values
    this.compose_field_hash(true);
    // start the auto-save timer
    this.auto_save_start();
  };
  this.compose_restore_dialog = function(j, html_mode)
  {
    var i, key, formdata, index = this.local_storage_get_item('compose.index', []);
    var show_next = function(i) {
      if (++i < index.length)
        ref.compose_restore_dialog(i, html_mode)
    }
    for (i = j || 0; i < index.length; i++) {
        key = index[i];
        formdata = this.local_storage_get_item('compose.' + key, null, true);
        if (!formdata) {
@@ -3418,12 +3444,14 @@
              click: function(){
                ref.remove_compose_data(key);
                $(this).dialog('close');
              show_next(i);
              }
            },
            {
              text: this.get_label('ignore'),
              click: function(){
                $(this).dialog('close');
              show_next(i);
              }
            }]
          );
@@ -3431,22 +3459,6 @@
        }
      }
    }
    if (input_to.val() == '')
      input_to.focus();
    else if (input_subject.val() == '')
      input_subject.focus();
    else if (input_message)
      input_message.focus();
    this.env.compose_focus_elem = document.activeElement;
    // get summary of all field values
    this.compose_field_hash(true);
    // start the auto-save timer
    this.auto_save_start();
  };
  this.init_address_input_events = function(obj, props)
  {