mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-24 02:35:41 +00:00
make autosave of drafts not lock up compose window ui, 323351, sr=mscott
This commit is contained in:
parent
c9cfe8cc08
commit
2e4aad3389
@ -86,6 +86,7 @@ var gPromptService;
|
||||
var gLDAPPrefsService;
|
||||
var gWindowLocked;
|
||||
var gContentChanged;
|
||||
var gAutoSaving;
|
||||
var gCurrentIdentity;
|
||||
var defaultSaveOperation;
|
||||
var gSendOrSaveOperationInProgress;
|
||||
@ -146,6 +147,7 @@ function InitializeGlobalVariables()
|
||||
gCurrentIdentity = null;
|
||||
defaultSaveOperation = "draft";
|
||||
gSendOrSaveOperationInProgress = false;
|
||||
gAutoSaving = false;
|
||||
gCloseWindowAfterSave = false;
|
||||
gIsOffline = gIOService.offline;
|
||||
gSessionAdded = false;
|
||||
@ -286,7 +288,8 @@ var stateListener = {
|
||||
|
||||
if (aResult== Components.results.NS_OK)
|
||||
{
|
||||
SetContentAndBodyAsUnmodified();
|
||||
if (!gAutoSaving)
|
||||
SetContentAndBodyAsUnmodified();
|
||||
|
||||
if (gCloseWindowAfterSave)
|
||||
{
|
||||
@ -300,9 +303,16 @@ var stateListener = {
|
||||
}
|
||||
}
|
||||
MsgComposeCloseWindow(true);
|
||||
}
|
||||
}
|
||||
// else if we failed to save, and we're autosaving, need to re-mark the editor
|
||||
// as changed, so that we won't lose the changes.
|
||||
else if (gAutoSaving)
|
||||
{
|
||||
gMsgCompose.bodyModified = true;
|
||||
gContentChanged = true;
|
||||
}
|
||||
|
||||
gAutoSaving = false;
|
||||
gCloseWindowAfterSave = false;
|
||||
},
|
||||
|
||||
@ -1876,10 +1886,19 @@ function GenericSendMessage( msgType )
|
||||
var event = document.createEvent('Events');
|
||||
event.initEvent('compose-send-message', false, true);
|
||||
document.getElementById("msgcomposeWindow").dispatchEvent(event);
|
||||
|
||||
gWindowLocked = true;
|
||||
disableEditableFields();
|
||||
updateComposeItems();
|
||||
gAutoSaving = (msgType == nsIMsgCompDeliverMode.AutoSaveAsDraft);
|
||||
// disable the ui if we're not auto-saving
|
||||
if (!gAutoSaving)
|
||||
{
|
||||
gWindowLocked = true;
|
||||
disableEditableFields();
|
||||
updateComposeItems();
|
||||
}
|
||||
// if we're auto saving, mark the body as not changed here, and not
|
||||
// when the save is done, because the user might change it between now
|
||||
// and when the save is done.
|
||||
else
|
||||
SetContentAndBodyAsUnmodified();
|
||||
|
||||
var progress = Components.classes["@mozilla.org/messenger/progress;1"].createInstance(Components.interfaces.nsIMsgProgress);
|
||||
if (progress)
|
||||
|
Loading…
Reference in New Issue
Block a user