summaryrefslogtreecommitdiff
path: root/program/js/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'program/js/app.js')
-rw-r--r--program/js/app.js51
1 files changed, 41 insertions, 10 deletions
diff --git a/program/js/app.js b/program/js/app.js
index e818955bd..7d3f0c55d 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -654,7 +654,7 @@ function rcube_webmail()
// check input before leaving compose step
if (this.task == 'mail' && this.env.action == 'compose' && $.inArray(command, this.env.compose_commands) < 0 && !this.env.server_error) {
- if (this.cmp_hash != this.compose_field_hash() && !confirm(this.get_label('notsentwarning')))
+ if (!this.env.is_sent && this.cmp_hash != this.compose_field_hash() && !confirm(this.get_label('notsentwarning')))
return false;
// remove copy from local storage if compose screen is left intentionally
@@ -1115,7 +1115,7 @@ function rcube_webmail()
break;
case 'send':
- if (!props.nocheck && !this.check_compose_input(command))
+ if (!props.nocheck && !this.env.is_sent && !this.check_compose_input(command))
break;
// Reset the auto-save timer
@@ -1608,7 +1608,8 @@ function rcube_webmail()
this.folder_collapsed = function(node)
{
- var prefname = this.env.task == 'addressbook' ? 'collapsed_abooks' : 'collapsed_folders';
+ var prefname = this.env.task == 'addressbook' ? 'collapsed_abooks' : 'collapsed_folders',
+ old = this.env[prefname];
if (node.collapsed) {
this.env[prefname] = this.env[prefname] + '&'+urlencode(node.id)+'&';
@@ -1624,7 +1625,8 @@ function rcube_webmail()
}
if (!this.drag_active) {
- this.command('save-pref', { name: prefname, value: this.env[prefname] });
+ if (old !== this.env[prefname])
+ this.command('save-pref', { name: prefname, value: this.env[prefname] });
if (this.env.unread_counts)
this.set_unread_count_display(node.id, false);
@@ -3489,15 +3491,35 @@ function rcube_webmail()
.attr({ 'autocomplete': 'off', 'aria-autocomplete': 'list', 'aria-expanded': 'false', 'role': 'combobox' });
};
- this.submit_messageform = function(draft)
+ this.submit_messageform = function(draft, saveonly)
{
var form = this.gui_objects.messageform;
if (!form)
return;
+ // the message has been sent but not saved, ask the user what to do
+ if (!saveonly && this.env.is_sent) {
+ return this.show_popup_dialog(this.get_label('messageissent'), '',
+ [{
+ text: this.get_label('save'),
+ 'class': 'mainaction',
+ click: function() {
+ ref.submit_messageform(false, true);
+ $(this).dialog('close');
+ }
+ },
+ {
+ text: this.get_label('cancel'),
+ click: function() {
+ $(this).dialog('close');
+ }
+ }]
+ );
+ }
+
// all checks passed, send message
- var msgid = this.set_busy(true, draft ? 'savingmessage' : 'sendingmessage'),
+ var msgid = this.set_busy(true, draft || saveonly ? 'savingmessage' : 'sendingmessage'),
lang = this.spellcheck_lang(),
files = [];
@@ -3511,6 +3533,10 @@ function rcube_webmail()
form.action = this.add_url(form.action, '_lang', lang);
form.action = this.add_url(form.action, '_framed', 1);
+ if (saveonly) {
+ form.action = this.add_url(form.action, '_saveonly', 1);
+ }
+
// register timer to notify about connection timeout
this.submit_timer = setTimeout(function(){
ref.set_busy(false, null, msgid);
@@ -4358,13 +4384,14 @@ function rcube_webmail()
};
// action executed after mail is sent
- this.sent_successfully = function(type, msg, folders)
+ this.sent_successfully = function(type, msg, folders, save_error)
{
this.display_message(msg, type);
this.compose_skip_unsavedcheck = true;
if (this.env.extwin) {
- this.lock_form(this.gui_objects.messageform);
+ if (!save_error)
+ this.lock_form(this.gui_objects.messageform);
var filter = {task: 'mail', action: ''},
rc = this.opener(false, filter) || this.opener(true, filter);
@@ -4377,12 +4404,16 @@ function rcube_webmail()
}
}
- setTimeout(function() { window.close(); }, 1000);
+ if (!save_error)
+ setTimeout(function() { window.close(); }, 1000);
}
- else {
+ else if (!save_error) {
// before redirect we need to wait some time for Chrome (#1486177)
setTimeout(function() { ref.list_mailbox(); }, 500);
}
+
+ if (save_error)
+ this.env.is_sent = true;
};