Iterate over all drafts saved in localStorage when asking for restoring. Delege/Ignore buttons will display the next item, if any

pull/204/merge
Thomas Bruederli 10 years ago
parent f72815e1f9
commit b54731d869

@ -3375,9 +3375,35 @@ function rcube_webmail()
// check for locally stored compose data // check for locally stored compose data
if (window.localStorage) { 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]; key = index[i];
formdata = this.local_storage_get_item('compose.' + key, null, true); formdata = this.local_storage_get_item('compose.' + key, null, true);
if (!formdata) { if (!formdata) {
@ -3418,12 +3444,14 @@ function rcube_webmail()
click: function(){ click: function(){
ref.remove_compose_data(key); ref.remove_compose_data(key);
$(this).dialog('close'); $(this).dialog('close');
show_next(i);
} }
}, },
{ {
text: this.get_label('ignore'), text: this.get_label('ignore'),
click: function(){ click: function(){
$(this).dialog('close'); $(this).dialog('close');
show_next(i);
} }
}] }]
); );
@ -3432,22 +3460,6 @@ function rcube_webmail()
} }
} }
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) this.init_address_input_events = function(obj, props)
{ {
this.env.recipients_delimiter = this.env.recipients_separator + ' '; this.env.recipients_delimiter = this.env.recipients_separator + ' ';

Loading…
Cancel
Save