auto save of drafts, seamonkey fe changes, sr=mscott 16360

This commit is contained in:
bienvenu%nventure.com 2005-01-19 16:29:13 +00:00
Родитель bc46aa161e
Коммит 906fd156f4
1 изменённых файлов: 22 добавлений и 0 удалений

Просмотреть файл

@ -117,6 +117,8 @@ var gReceiptOptionChanged;
var gAttachVCardOptionChanged;
var gMailSession;
var gAutoSaveInterval;
var gAutoSaveTimeout;
const kComposeAttachDirPrefName = "mail.compose.attach.dir";
@ -249,6 +251,8 @@ var gComposeRecyclingListener = {
var event = document.createEvent('Events');
event.initEvent('compose-window-close', false, true);
document.getElementById("msgcomposeWindow").dispatchEvent(event);
if (gAutoSaveTimeout)
clearTimeout(gAutoSaveTimeout);
},
onReopen: function(params) {
@ -1374,6 +1378,12 @@ function ComposeStartup(recycled, aParams)
}
}
}
gAutoSaveInterval = sPrefs.getBoolPref("mail.compose.autosave")
? sPrefs.getIntPref("mail.compose.autosaveinterval") * 60000
: 0;
if (gAutoSaveInterval)
gAutoSaveTimeout = setTimeout("AutoSave()", gAutoSaveInterval);
}
// The new, nice, simple way of getting notified when a new editor has been created
@ -1489,6 +1499,8 @@ function ComposeUnload()
RemoveDirectorySettingsObserver(gCurrentAutocompleteDirectory);
if (gMsgCompose)
gMsgCompose.UnregisterStateListener(stateListener);
if (gAutoSaveTimeout)
clearTimeout(gAutoSaveTimeout);
}
function SetDocumentCharacterSet(aCharset)
@ -1749,6 +1761,7 @@ function GenericSendMessage( msgType )
msgType == nsIMsgCompDeliverMode.Later ||
msgType == nsIMsgCompDeliverMode.Save ||
msgType == nsIMsgCompDeliverMode.SaveAsDraft ||
msgType == nsIMsgCompDeliverMode.AutoSaveAsDraft ||
msgType == nsIMsgCompDeliverMode.SaveAsTemplate)
{
var fallbackCharset = new Object;
@ -3020,3 +3033,12 @@ function loadHTMLMsgPrefs() {
}
function AutoSave()
{
dump("in autosave\n");
if (gMsgCompose.editor && (gContentChanged || gMsgCompose.bodyModified))
GenericSendMessage(nsIMsgCompDeliverMode.AutoSaveAsDraft);
gAutoSaveTimeout = setTimeout("AutoSave()", gAutoSaveInterval);
}