зеркало из https://github.com/mozilla/pjs.git
Fix for bug 82454(property enable/disable...) r=hwaara, sr=bienvenu, a=asa@mozilla.org
Fix for bug 78900(nsMsgWindow for download msg) r=bhuvan, sr=bienvenu, a=asa@mozilla.org Fixes for bugs 79865(Get Msgs offline dialog), & 79245, 79882, 82568. r=bhuvan, sr=sspitzer
This commit is contained in:
Родитель
038c325621
Коммит
4ef34e1cf9
|
@ -62,10 +62,6 @@ mailMessengerOverlay.xul
|
|||
mailMessengerComposeOverlay.xul
|
||||
mailOverlay.xul
|
||||
mailWidgets.xml
|
||||
sendMsgs.xul
|
||||
sendMsgs.js
|
||||
downloadMsgs.xul
|
||||
downloadMsgs.js
|
||||
msgSynchronize.xul
|
||||
msgSynchronize.js
|
||||
msgSelectOffline.xul
|
||||
|
|
|
@ -32,12 +32,15 @@ var gRDFNamespace = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
|||
|
||||
/* keep in sync with nsMsgFolderFlags.h */
|
||||
var MSG_FOLDER_FLAG_TRASH = 0x0100;
|
||||
var MSG_FOLDER_FLAG_SENTMAIL = 0x0200
|
||||
var MSG_FOLDER_FLAG_SENTMAIL = 0x0200;
|
||||
var MSG_FOLDER_FLAG_DRAFTS = 0x0400;
|
||||
var MSG_FOLDER_FLAG_QUEUE = 0x0800;
|
||||
var MSG_FOLDER_FLAG_TEMPLATES = 0x400000;
|
||||
|
||||
var gPrefs;
|
||||
var gOfflinePromptsBundle;
|
||||
var gPromptService;
|
||||
var gOfflineManager;
|
||||
|
||||
function OpenURL(url)
|
||||
{
|
||||
|
@ -847,73 +850,55 @@ function MailCheckBeforeOfflineChange()
|
|||
.getService(Components.interfaces.nsIIOService);
|
||||
|
||||
var goingOnline = ioService.offline;
|
||||
|
||||
offlineManager = Components.classes["@mozilla.org/messenger/offline-manager;1"].getService(Components.interfaces.nsIMsgOfflineManager);
|
||||
|
||||
var bundle = srGetStrBundle("chrome://communicator/locale/utilityOverlay.properties");
|
||||
var offlineManager = Components.classes["@mozilla.org/messenger/offline-manager;1"].getService(Components.interfaces.nsIMsgOfflineManager);
|
||||
var args = {result: 0};
|
||||
|
||||
messenger.SetWindow(window, msgWindow);
|
||||
|
||||
if (!gPrefs) GetPrefsService();
|
||||
InitServices();
|
||||
|
||||
var prefSendUnsentMessages = gPrefs.GetIntPref("offline.send.unsent_messages");
|
||||
var prefDownloadMessages = gPrefs.GetIntPref("offline.download.download_messages");
|
||||
|
||||
// dump("prefSendUnsentMessages" + prefSendUnsentMessages + "\n");
|
||||
// dump("prefDownloadMessages" + prefDownloadMessages + "\n");
|
||||
|
||||
if(goingOnline) {
|
||||
switch(prefSendUnsentMessages) {
|
||||
case 0:
|
||||
window.openDialog("chrome://messenger/content/sendMsgs.xul", "sendUnsentMessages",
|
||||
"centerscreen,chrome,modal,titlebar,resizable=no", args);
|
||||
if(args.result == 1) {
|
||||
offlineManager.goOnline(true, true, msgWindow);
|
||||
}
|
||||
else if(args.result == 2) {
|
||||
offlineManager.goOnline(false, true, msgWindow);
|
||||
}
|
||||
else if(args.result == 3) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
offlineManager.goOnline(true, true, msgWindow);
|
||||
break;
|
||||
case 2:
|
||||
offlineManager.goOnline(false, true, msgWindow);
|
||||
break;
|
||||
switch(prefSendUnsentMessages) {
|
||||
case 0:
|
||||
if(CheckForUnsentMessages()) {
|
||||
if(! PromptSendMessages())
|
||||
return false;
|
||||
}
|
||||
else
|
||||
gOfflineManager.goOnline(false /* sendUnsentMessages */,
|
||||
true /* playbackOfflineImapOperations */,
|
||||
msgWindow);
|
||||
break;
|
||||
case 1:
|
||||
gOfflineManager.goOnline(CheckForUnsentMessages() /* sendUnsentMessages */,
|
||||
true /* playbackOfflineImapOperations */,
|
||||
msgWindow);
|
||||
break;
|
||||
case 2:
|
||||
gOfflineManager.goOnline(false /* sendUnsentMessages */,
|
||||
true /* playbackOfflineImapOperations */,
|
||||
msgWindow);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// going offline
|
||||
switch(prefDownloadMessages) {
|
||||
case 0:
|
||||
window.openDialog("chrome://messenger/content/downloadMsgs.xul", "downloadMessages",
|
||||
"centerscreen,chrome,modal,titlebar,resizable=no", args);
|
||||
if(args.result == 1) {
|
||||
// download news, download mail, send unsent messages, go offline when done, msg window
|
||||
offlineManager.synchronizeForOffline(false, true, false, true, msgWindow);
|
||||
}
|
||||
else if(args.result == 2) {
|
||||
// download news, download mail, send unsent messages, go offline when done, msg window
|
||||
offlineManager.synchronizeForOffline(false, false, false, true, msgWindow);
|
||||
}
|
||||
else if(args.result == 3) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
// download news, download mail, send unsent messages, go offline when done, msg window
|
||||
offlineManager.synchronizeForOffline(false, true, false, true, msgWindow);
|
||||
break;
|
||||
case 2:
|
||||
// download news, download mail, send unsent messages, go offline when done, msg window
|
||||
offlineManager.synchronizeForOffline(false, false, false, true, msgWindow);
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch(prefDownloadMessages) {
|
||||
case 0:
|
||||
if(! PromptDownloadMessages()) return false;
|
||||
break;
|
||||
case 1:
|
||||
// download news, download mail, send unsent messages, go offline when done, msg window
|
||||
gOfflineManager.synchronizeForOffline(false, true, false, true, msgWindow);
|
||||
break;
|
||||
case 2:
|
||||
// download news, download mail, send unsent messages, go offline when done, msg window
|
||||
gOfflineManager.synchronizeForOffline(false, false, false, true, msgWindow);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function MsgSettingsOffline()
|
||||
|
@ -921,21 +906,180 @@ function MsgSettingsOffline()
|
|||
window.parent.MsgAccountManager();
|
||||
}
|
||||
|
||||
// Init PrefsService
|
||||
function GetPrefsService()
|
||||
{
|
||||
// Store the prefs object
|
||||
try {
|
||||
var prefsService = Components.classes["@mozilla.org/preferences;1"];
|
||||
if (prefsService)
|
||||
prefsService = prefsService.getService();
|
||||
if (prefsService)
|
||||
gPrefs = prefsService.QueryInterface(Components.interfaces.nsIPref);
|
||||
// Store the prefs object
|
||||
try {
|
||||
var prefsService = Components.classes["@mozilla.org/preferences;1"];
|
||||
if (prefsService)
|
||||
prefsService = prefsService.getService();
|
||||
if (prefsService)
|
||||
gPrefs = prefsService.QueryInterface(Components.interfaces.nsIPref);
|
||||
|
||||
if (!gPrefs)
|
||||
dump("failed to get prefs service!\n");
|
||||
}
|
||||
catch(ex) {
|
||||
dump("failed to get prefs service!\n");
|
||||
}
|
||||
if (!gPrefs)
|
||||
dump("failed to get prefs service!\n");
|
||||
}
|
||||
catch(ex) {
|
||||
dump("failed to get prefs service!\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Check for unsent messages
|
||||
function CheckForUnsentMessages()
|
||||
{
|
||||
var am = Components.classes["@mozilla.org/messenger/account-manager;1"]
|
||||
.getService(Components.interfaces.nsIMsgAccountManager);
|
||||
var msgSendlater = Components.classes["@mozilla.org/messengercompose/sendlater;1"]
|
||||
.getService(Components.interfaces.nsIMsgSendLater);
|
||||
var identitiesCount, allIdentities, currentIdentity, numMessages, msgFolder;
|
||||
|
||||
if(am) {
|
||||
allIdentities = am.allIdentities;
|
||||
identitiesCount = allIdentities.Count();
|
||||
for (var i = 0; i < identitiesCount; i++) {
|
||||
currentIdentity = allIdentities.QueryElementAt(i, Components.interfaces.nsIMsgIdentity);
|
||||
msgFolder = msgSendlater.getUnsentMessagesFolder(currentIdentity);
|
||||
if(msgFolder) {
|
||||
// if true, descends into all subfolders
|
||||
numMessages = msgFolder.getTotalMessages(false);
|
||||
if(numMessages > 0) return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Init nsIPromptService & strings.
|
||||
function InitPrompts()
|
||||
{
|
||||
if(!gPromptService) {
|
||||
gPromptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService();
|
||||
gPromptService = gPromptService.QueryInterface(Components.interfaces.nsIPromptService);
|
||||
}
|
||||
if (!gOfflinePromptsBundle)
|
||||
gOfflinePromptsBundle = document.getElementById("bundle_offlinePrompts");
|
||||
}
|
||||
|
||||
// prompt for sending messages while going online, and go online.
|
||||
function PromptSendMessages()
|
||||
{
|
||||
InitPrompts();
|
||||
InitServices();
|
||||
|
||||
if (gPromptService) {
|
||||
var buttonPressed = {value:0};
|
||||
var checkValue = {value:true};
|
||||
gPromptService.confirmEx(window,
|
||||
gOfflinePromptsBundle.getString('sendMessagesWindowTitle'),
|
||||
gOfflinePromptsBundle.getString('sendMessagesLabel'),
|
||||
(gPromptService.BUTTON_TITLE_IS_STRING * gPromptService.BUTTON_POS_0) +
|
||||
(gPromptService.BUTTON_TITLE_IS_STRING * gPromptService.BUTTON_POS_2) +
|
||||
(gPromptService.BUTTON_TITLE_IS_STRING * gPromptService.BUTTON_POS_1),
|
||||
gOfflinePromptsBundle.getString('sendMessagesSendButtonLabel'),
|
||||
gOfflinePromptsBundle.getString('sendMessagesCancelButtonLabel'),
|
||||
gOfflinePromptsBundle.getString('sendMessagesNoSendButtonLabel'),
|
||||
gOfflinePromptsBundle.getString('sendMessagesCheckboxLabel'),
|
||||
checkValue, buttonPressed);
|
||||
if(buttonPressed) {
|
||||
if(buttonPressed.value == 0) {
|
||||
if(checkValue.value)
|
||||
gPrefs.SetIntPref("offline.send.unsent_messages", 0);
|
||||
else
|
||||
gPrefs.SetIntPref("offline.send.unsent_messages", 1);
|
||||
|
||||
gOfflineManager.goOnline(true /* sendUnsentMessages */,
|
||||
true /* playbackOfflineImapOperations */,
|
||||
msgWindow);
|
||||
return true;
|
||||
}
|
||||
else if(buttonPressed.value == 1) {
|
||||
return false;
|
||||
}
|
||||
else if(buttonPressed.value == 2) {
|
||||
if(checkValue.value)
|
||||
gPrefs.SetIntPref("offline.send.unsent_messages", 0);
|
||||
else
|
||||
gPrefs.SetIntPref("offline.send.unsent_messages", 2);
|
||||
gOfflineManager.goOnline(false /* sendUnsentMessages */,
|
||||
true /* playbackOfflineImapOperations */,
|
||||
msgWindow);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// prompt for downlading messages while going offline, and synchronise
|
||||
function PromptDownloadMessages()
|
||||
{
|
||||
InitPrompts();
|
||||
InitServices();
|
||||
|
||||
if(gPromptService) {
|
||||
var buttonPressed = {value:0};
|
||||
var checkValue = {value:true};
|
||||
gPromptService.confirmEx(window,
|
||||
gOfflinePromptsBundle.getString('downloadMessagesWindowTitle'),
|
||||
gOfflinePromptsBundle.getString('downloadMessagesLabel'),
|
||||
(gPromptService.BUTTON_TITLE_IS_STRING * gPromptService.BUTTON_POS_0) +
|
||||
(gPromptService.BUTTON_TITLE_IS_STRING * gPromptService.BUTTON_POS_2) +
|
||||
(gPromptService.BUTTON_TITLE_IS_STRING * gPromptService.BUTTON_POS_1),
|
||||
gOfflinePromptsBundle.getString('downloadMessagesDownloadButtonLabel'),
|
||||
gOfflinePromptsBundle.getString('downloadMessagesCancelButtonLabel'),
|
||||
gOfflinePromptsBundle.getString('downloadMessagesNoDownloadButtonLabel'),
|
||||
gOfflinePromptsBundle.getString('downloadMessagesCheckboxLabel'),
|
||||
checkValue, buttonPressed);
|
||||
if(buttonPressed) {
|
||||
if(buttonPressed.value == 0) {
|
||||
if(checkValue.value)
|
||||
gPrefs.SetIntPref("offline.download.download_messages", 0);
|
||||
else
|
||||
gPrefs.SetIntPref("offline.download.download_messages", 1);
|
||||
// download news, download mail, send unsent messages, go offline when done, msg window
|
||||
gOfflineManager.synchronizeForOffline(false, true, false, true, msgWindow);
|
||||
return true;
|
||||
}
|
||||
else if(buttonPressed.value == 1) {
|
||||
return false;
|
||||
}
|
||||
else if(buttonPressed.value == 2) {
|
||||
if(checkValue.value)
|
||||
gPrefs.SetIntPref("offline.download.download_messages", 0);
|
||||
else
|
||||
gPrefs.SetIntPref("offline.download.download_messages", 2);
|
||||
// download news, download mail, send unsent messages, go offline when done, msg window
|
||||
gOfflineManager.synchronizeForOffline(false, false, false, true, msgWindow);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// online?
|
||||
function CheckOnline()
|
||||
{
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
return (!ioService.offline);
|
||||
}
|
||||
|
||||
// Init Pref Service & Offline Manager
|
||||
function InitServices()
|
||||
{
|
||||
if (!gPrefs)
|
||||
GetPrefsService();
|
||||
|
||||
if (!gOfflineManager)
|
||||
GetOfflineMgrService();
|
||||
}
|
||||
|
||||
// Init Offline Manager
|
||||
function GetOfflineMgrService()
|
||||
{
|
||||
if (!gOfflineManager) {
|
||||
gOfflineManager = Components.classes["@mozilla.org/messenger/offline-manager;1"]
|
||||
.getService(Components.interfaces.nsIMsgOfflineManager);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
var gMsgFolder;
|
||||
var gServerTypeFolder = null;
|
||||
var gPreselectedFolderURI = null;
|
||||
var gParentMsgWindow = null;
|
||||
|
||||
// services used
|
||||
var RDF;
|
||||
|
@ -71,6 +72,12 @@ function folderPropsOnLoad()
|
|||
dump("preselectfolder uri = "+gPreselectedFolderURI+'\n');
|
||||
dump("serverType = "+gServerTypeFolder+'\n');
|
||||
|
||||
if (window.arguments && window.arguments[0]) {
|
||||
if (window.arguments[0].msgWindow) {
|
||||
gParentMsgWindow = window.arguments[0].msgWindow;
|
||||
}
|
||||
}
|
||||
|
||||
// this hex value come from nsMsgFolderFlags.h
|
||||
var folderResource = RDF.GetResource(gPreselectedFolderURI);
|
||||
|
||||
|
@ -183,6 +190,6 @@ function getEnclosingContainer(startNode)
|
|||
function onOfflineFolderDownload()
|
||||
{
|
||||
// we need to create a progress window and pass that in as the second parameter here.
|
||||
gMsgFolder.downloadAllForOffline(null, null);
|
||||
gMsgFolder.downloadAllForOffline(null, gParentMsgWindow);
|
||||
}
|
||||
|
||||
|
|
|
@ -398,9 +398,9 @@ var DefaultController =
|
|||
case "cmd_close":
|
||||
return true;
|
||||
case "cmd_downloadFlagged":
|
||||
return(MailAreaHasFocus() && IsFolderSelected() && CheckOnline());
|
||||
return(CheckOnline());
|
||||
case "cmd_downloadSelected":
|
||||
return(MailAreaHasFocus() && IsFolderSelected() && CheckOnline());
|
||||
return(MailAreaHasFocus() && IsFolderSelected() && CheckOnline() && GetNumSelectedMessages() > 0);
|
||||
case "cmd_synchronizeOffline":
|
||||
return true;
|
||||
case "cmd_settingsOffline":
|
||||
|
@ -1074,14 +1074,6 @@ function is_collapsed(element)
|
|||
return (element.getAttribute('state') == 'collapsed');
|
||||
}
|
||||
|
||||
function CheckOnline()
|
||||
{
|
||||
var ioService = nsJSComponentManager.getServiceByID("{9ac9e770-18bc-11d3-9337-00104ba0fd40}", "nsIIOService");
|
||||
if(ioService.offline) return false;
|
||||
else return true;
|
||||
|
||||
}
|
||||
|
||||
function isCommandEnabled(cmd)
|
||||
{
|
||||
var selectedFolders = GetSelectedMsgFolders();
|
||||
|
|
|
@ -60,6 +60,7 @@ var gPaneConfig = null;
|
|||
|
||||
// for checking if the folder loaded is Draft or Unsent which msg is editable
|
||||
var gIsEditableMsgFolder = false;
|
||||
var gOfflineManager;
|
||||
|
||||
|
||||
function OnMailWindowUnload()
|
||||
|
@ -489,20 +490,36 @@ function HideAccountCentral()
|
|||
}
|
||||
|
||||
// Given the server, open the twisty and the set the selection
|
||||
// on inbox of that server
|
||||
// on inbox of that server.
|
||||
// prompt if offline.
|
||||
function OpenInboxForServer(server)
|
||||
{
|
||||
try {
|
||||
HideAccountCentral();
|
||||
OpenTwistyForServer(server);
|
||||
var inboxFolder = GetInboxFolder(server);
|
||||
var folderTree = GetFolderTree();
|
||||
var inboxFolderUri = document.getElementById(inboxFolder.URI);
|
||||
ChangeSelection(folderTree, inboxFolderUri);
|
||||
try {
|
||||
HideAccountCentral();
|
||||
OpenTwistyForServer(server);
|
||||
var inboxFolder = GetInboxFolder(server);
|
||||
var folderTree = GetFolderTree();
|
||||
var inboxFolderUri = document.getElementById(inboxFolder.URI);
|
||||
ChangeSelection(folderTree, inboxFolderUri);
|
||||
|
||||
if(CheckOnline()) {
|
||||
GetMessagesForInboxOnServer(server);
|
||||
}
|
||||
else {
|
||||
var option = PromptGetMessagesOffline();
|
||||
if(option == 0) {
|
||||
if (!gOfflineManager)
|
||||
GetOfflineMgrService();
|
||||
|
||||
gOfflineManager.goOnline(false /* sendUnsentMessages */,
|
||||
false /* playbackOfflineImapOperations */,
|
||||
msgWindow);
|
||||
GetMessagesForInboxOnServer(server);
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
dump("Error opening inbox for server -> " + ex + "\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
dump("Error opening inbox for server -> " + ex + "\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,10 @@
|
|||
*/
|
||||
|
||||
var gMessengerBundle;
|
||||
var gPromptService;
|
||||
var gOfflinePromptsBundle;
|
||||
var nsPrefBranch = null;
|
||||
var gOfflineManager;
|
||||
|
||||
// Disable the new account menu item if the account preference is locked.
|
||||
// Two other affected areas are the account central and the account manager
|
||||
|
@ -336,21 +339,33 @@ function GetInboxFolder(server)
|
|||
|
||||
function GetMessagesForInboxOnServer(server)
|
||||
{
|
||||
var inboxFolder = GetInboxFolder(server);
|
||||
if (!inboxFolder) return;
|
||||
var inboxFolder = GetInboxFolder(server);
|
||||
if (!inboxFolder) return;
|
||||
|
||||
var folders = new Array(1);
|
||||
folders[0] = inboxFolder;
|
||||
var folders = new Array(1);
|
||||
folders[0] = inboxFolder;
|
||||
|
||||
var compositeDataSource = GetCompositeDataSource("GetNewMessages");
|
||||
GetNewMessages(folders, compositeDataSource);
|
||||
var compositeDataSource = GetCompositeDataSource("GetNewMessages");
|
||||
GetNewMessages(folders, compositeDataSource);
|
||||
}
|
||||
|
||||
// if offline, prompt for getting messages
|
||||
function MsgGetMessage()
|
||||
{
|
||||
var folders = GetSelectedMsgFolders();
|
||||
var compositeDataSource = GetCompositeDataSource("GetNewMessages");
|
||||
GetNewMessages(folders, compositeDataSource);
|
||||
if(CheckOnline()) {
|
||||
GetFolderMessages();
|
||||
}
|
||||
else {
|
||||
var option = PromptGetMessagesOffline();
|
||||
if(option == 0) {
|
||||
if (!gOfflineManager)
|
||||
GetOfflineMgrService();
|
||||
gOfflineManager.goOnline(false /* sendUnsentMessages */,
|
||||
false /* playbackOfflineImapOperations */,
|
||||
msgWindow);
|
||||
GetFolderMessages();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function MsgGetMessagesForAllServers(defaultServer)
|
||||
|
@ -388,52 +403,73 @@ function MsgGetMessagesForAllServers(defaultServer)
|
|||
* Get messages for all those accounts which have the capability
|
||||
* of getting messages and have session password available i.e.,
|
||||
* curretnly logged in accounts.
|
||||
* if offline, prompt for getting messages.
|
||||
*/
|
||||
function MsgGetMessagesForAllAuthenticatedAccounts()
|
||||
{
|
||||
try
|
||||
{
|
||||
var allServers = accountManager.allServers;
|
||||
|
||||
for (var i=0;i<allServers.Count();i++)
|
||||
{
|
||||
var currentServer = allServers.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIncomingServer);
|
||||
var protocolinfo = Components.classes["@mozilla.org/messenger/protocol/info;1?type=" +
|
||||
currentServer.type].getService(Components.interfaces.nsIMsgProtocolInfo);
|
||||
if (protocolinfo.canGetMessages && currentServer.password)
|
||||
{
|
||||
// Get new messages now
|
||||
GetMessagesForInboxOnServer(currentServer);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
dump(ex + "\n");
|
||||
if(CheckOnline()) {
|
||||
GetMessagesForAllAuthenticatedAccounts();
|
||||
}
|
||||
else {
|
||||
var option = PromptGetMessagesOffline();
|
||||
if(option == 0) {
|
||||
if (!gOfflineManager)
|
||||
GetOfflineMgrService();
|
||||
gOfflineManager.goOnline(false /* sendUnsentMessages */,
|
||||
false /* playbackOfflineImapOperations */,
|
||||
msgWindow);
|
||||
GetMessagesForAllAuthenticatedAccounts();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get messages for the account selected from Menu dropdowns.
|
||||
* if offline, prompt for getting messages.
|
||||
*/
|
||||
function MsgGetMessagesForAccount(aEvent)
|
||||
{
|
||||
if (!aEvent)
|
||||
return;
|
||||
if (!aEvent)
|
||||
return;
|
||||
|
||||
var uri = aEvent.target.id;
|
||||
var server = GetServer(uri);
|
||||
GetMessagesForInboxOnServer(server);
|
||||
aEvent.preventBubble();
|
||||
if(CheckOnline()) {
|
||||
GetMessagesForAccount(aEvent);
|
||||
}
|
||||
else {
|
||||
var option = PromptGetMessagesOffline();
|
||||
if(option == 0) {
|
||||
if (!gOfflineManager)
|
||||
GetOfflineMgrService();
|
||||
gOfflineManager.goOnline(false /* sendUnsentMessages */,
|
||||
false /* playbackOfflineImapOperations */,
|
||||
msgWindow);
|
||||
GetMessagesForAccount(aEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if offline, prompt for getNextNMessages
|
||||
function MsgGetNextNMessages()
|
||||
{
|
||||
if(CheckOnline()) {
|
||||
var folder = GetFirstSelectedMsgFolder();
|
||||
if(folder)
|
||||
{
|
||||
GetNextNMessages(folder)
|
||||
if(folder)
|
||||
GetNextNMessages(folder);
|
||||
}
|
||||
else {
|
||||
var option = PromptGetMessagesOffline();
|
||||
if(option == 0) {
|
||||
if (!gOfflineManager)
|
||||
GetOfflineMgrService();
|
||||
gOfflineManager.goOnline(false /* sendUnsentMessages */,
|
||||
false /* playbackOfflineImapOperations */,
|
||||
msgWindow);
|
||||
var folder = GetFirstSelectedMsgFolder();
|
||||
if(folder) {
|
||||
GetNextNMessages(folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function MsgDeleteMessage(reallyDelete, fromToolbar)
|
||||
|
@ -898,12 +934,23 @@ function MsgStop()
|
|||
StopUrls();
|
||||
}
|
||||
|
||||
// if offline, prompt for sendUnsentMessages
|
||||
function MsgSendUnsentMsg()
|
||||
{
|
||||
var folder = GetFirstSelectedMsgFolder();
|
||||
if(folder) {
|
||||
SendUnsentMessages(folder);
|
||||
if(CheckOnline()) {
|
||||
SendFolderUnsentMessages();
|
||||
}
|
||||
else {
|
||||
var option = PromptSendMessagesOffline();
|
||||
if(option == 0) {
|
||||
if (!gOfflineManager)
|
||||
GetOfflineMgrService();
|
||||
gOfflineManager.goOnline(false /* sendUnsentMessages */,
|
||||
false /* playbackOfflineImapOperations */,
|
||||
msgWindow);
|
||||
SendFolderUnsentMessages();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function PrintEnginePrint()
|
||||
|
@ -917,9 +964,9 @@ function PrintEnginePrint()
|
|||
}
|
||||
|
||||
printEngineWindow = window.openDialog("chrome://messenger/content/msgPrintEngine.xul",
|
||||
"",
|
||||
"chrome,dialog=no,all",
|
||||
numMessages, messageList, statusFeedback);
|
||||
"",
|
||||
"chrome,dialog=no,all",
|
||||
numMessages, messageList, statusFeedback);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1110,17 +1157,130 @@ function SpaceHit()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function IsOfflineSettingsEnabled()
|
||||
{
|
||||
var selectedFolders = GetSelectedMsgFolders();
|
||||
var selectedFolders = GetSelectedMsgFolders();
|
||||
|
||||
if (selectedFolders && (selectedFolders.length == 1))
|
||||
return selectedFolders[0].supportsOffline;
|
||||
|
||||
return false;
|
||||
if (selectedFolders && (selectedFolders.length == 1))
|
||||
return selectedFolders[0].supportsOffline;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// init nsIPromptService and strings
|
||||
function InitPrompts()
|
||||
{
|
||||
if(!gPromptService) {
|
||||
gPromptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService();
|
||||
gPromptService = gPromptService.QueryInterface(Components.interfaces.nsIPromptService);
|
||||
}
|
||||
if (!gOfflinePromptsBundle)
|
||||
gOfflinePromptsBundle = document.getElementById("bundle_offlinePrompts");
|
||||
}
|
||||
|
||||
// prompt for getting messages when offline
|
||||
function PromptGetMessagesOffline()
|
||||
{
|
||||
InitPrompts();
|
||||
if (gPromptService) {
|
||||
var buttonPressed = {value:0};
|
||||
var checkValue = {value:false};
|
||||
gPromptService.confirmEx(window,
|
||||
gOfflinePromptsBundle.getString('getMessagesOfflineWindowTitle'),
|
||||
gOfflinePromptsBundle.getString('getMessagesOfflineLabel'),
|
||||
(gPromptService.BUTTON_TITLE_IS_STRING * gPromptService.BUTTON_POS_0) +
|
||||
(gPromptService.BUTTON_TITLE_CANCEL * gPromptService.BUTTON_POS_1),
|
||||
gOfflinePromptsBundle.getString('getMessagesOfflineGoButtonLabel'),
|
||||
null, null, null, checkValue, buttonPressed);
|
||||
if(buttonPressed) {
|
||||
return buttonPressed.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// prompt for sending messages when offline
|
||||
function PromptSendMessagesOffline()
|
||||
{
|
||||
InitPrompts();
|
||||
if (gPromptService) {
|
||||
var buttonPressed = {value:0};
|
||||
var checkValue= {value:false};
|
||||
gPromptService.confirmEx(window,
|
||||
gOfflinePromptsBundle.getString('sendMessagesOfflineWindowTitle'),
|
||||
gOfflinePromptsBundle.getString('sendMessagesOfflineLabel'),
|
||||
(gPromptService.BUTTON_TITLE_IS_STRING * gPromptService.BUTTON_POS_0) +
|
||||
(gPromptService.BUTTON_TITLE_CANCEL * gPromptService.BUTTON_POS_1),
|
||||
gOfflinePromptsBundle.getString('sendMessagesOfflineGoButtonLabel'),
|
||||
null, null, null, checkValue, buttonPressed);
|
||||
if(buttonPressed) {
|
||||
return buttonPressed.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// gets called from MsgGetMessage()
|
||||
function GetFolderMessages()
|
||||
{
|
||||
var folders = GetSelectedMsgFolders();
|
||||
var compositeDataSource = GetCompositeDataSource("GetNewMessages");
|
||||
GetNewMessages(folders, compositeDataSource);
|
||||
}
|
||||
|
||||
// gets called from MsgSendUnsentMsg()
|
||||
function SendFolderUnsentMessages()
|
||||
{
|
||||
var am = Components.classes["@mozilla.org/messenger/account-manager;1"]
|
||||
.getService(Components.interfaces.nsIMsgAccountManager);
|
||||
var msgSendlater = Components.classes["@mozilla.org/messengercompose/sendlater;1"]
|
||||
.getService(Components.interfaces.nsIMsgSendLater);
|
||||
var identitiesCount, allIdentities, currentIdentity, numMessages, msgFolder;
|
||||
|
||||
if(am) {
|
||||
allIdentities = am.allIdentities;
|
||||
identitiesCount = allIdentities.Count();
|
||||
for (var i = 0; i < identitiesCount; i++) {
|
||||
currentIdentity = allIdentities.QueryElementAt(i, Components.interfaces.nsIMsgIdentity);
|
||||
msgFolder = msgSendlater.getUnsentMessagesFolder(currentIdentity);
|
||||
if(msgFolder) {
|
||||
// if true, descends into all subfolders
|
||||
numMessages = msgFolder.getTotalMessages(false);
|
||||
if(numMessages > 0)
|
||||
messenger.SendUnsentMessages(currentIdentity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// gets called from MsgGetMessagesForAllAuthenticatedAccounts()
|
||||
function GetMessagesForAllAuthenticatedAccounts()
|
||||
{
|
||||
try {
|
||||
var allServers = accountManager.allServers;
|
||||
for (var i=0;i<allServers.Count();i++) {
|
||||
var currentServer = allServers.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIncomingServer);
|
||||
var protocolinfo = Components.classes["@mozilla.org/messenger/protocol/info;1?type=" +
|
||||
currentServer.type].getService(Components.interfaces.nsIMsgProtocolInfo);
|
||||
if (protocolinfo.canGetMessages && currentServer.password) {
|
||||
// Get new messages now
|
||||
GetMessagesForInboxOnServer(currentServer);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(ex) {
|
||||
dump(ex + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
// gets called from MsgGetMessagesForAccount(aEvent)
|
||||
function GetMessagesForAccount(aEvent)
|
||||
{
|
||||
var uri = aEvent.target.id;
|
||||
var server = GetServer(uri);
|
||||
GetMessagesForInboxOnServer(server);
|
||||
aEvent.preventBubble();
|
||||
}
|
||||
|
||||
|
||||
function CommandUpdate_UndoRedo()
|
||||
{
|
||||
ShowMenuItem("menu_undo", true);
|
||||
|
|
|
@ -49,6 +49,7 @@ Rights Reserved.
|
|||
|
||||
<stringbundleset id="stringbundleset">
|
||||
<stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
|
||||
<stringbundle id="bundle_offlinePrompts" src="chrome://messenger/locale/offline.properties"/>
|
||||
<stringbundle id="bundle_viewZoom"/>
|
||||
<stringbundle id="findBundle" src="chrome://global/locale/finddialog.properties"/>
|
||||
</stringbundleset>
|
||||
|
|
|
@ -75,10 +75,6 @@ CHROME_CONTENT = \
|
|||
.\mailWidgets.xml \
|
||||
.\folderProps.xul \
|
||||
.\folderProps.js \
|
||||
.\sendMsgs.xul \
|
||||
.\sendMsgs.js \
|
||||
.\downloadMsgs.xul \
|
||||
.\downloadMsgs.js \
|
||||
.\msgSynchronize.xul \
|
||||
.\msgSynchronize.js \
|
||||
.\msgSelectOffline.xul \
|
||||
|
|
|
@ -53,6 +53,7 @@ Rights Reserved.
|
|||
<stringbundleset id="stringbundleset">
|
||||
<stringbundle id="bundle_brand" src="chrome://global/locale/brand.properties"/>
|
||||
<stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
|
||||
<stringbundle id="bundle_offlinePrompts" src="chrome://messenger/locale/offline.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
<resourcebundle id="resource_bundle_messenger" />
|
||||
|
|
|
@ -259,7 +259,7 @@ function MsgFolderProperties()
|
|||
"",
|
||||
"chrome,centerscreen,titlebar,modal",
|
||||
{preselectedURI:preselectedURI, serverType:serverType,
|
||||
title:windowTitle,
|
||||
msgWindow:msgWindow, title:windowTitle,
|
||||
okCallback:FolderProperties,
|
||||
tabID:"", tabIndex:0, name:name});
|
||||
}
|
||||
|
|
|
@ -14,6 +14,5 @@ mailTasksOverlay.dtd
|
|||
mailNavigatorOverlay.dtd
|
||||
mailEditorOverlay.dtd
|
||||
mailOverlay.dtd
|
||||
sendMsgs.dtd
|
||||
downloadMsgs.dtd
|
||||
msgSynchronize.dtd
|
||||
offline.properties
|
||||
|
|
|
@ -42,9 +42,8 @@ CHROME_L10N = \
|
|||
.\mailEditorOverlay.dtd \
|
||||
.\mailOverlay.dtd \
|
||||
.\folderProps.dtd \
|
||||
.\sendMsgs.dtd \
|
||||
.\downloadMsgs.dtd \
|
||||
.\msgSynchronize.dtd \
|
||||
.\offline.properties \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
# LOCALIZATION NOTE :
|
||||
# do not localize "\n". use "\n" to make the text fit nicely in the dialog.
|
||||
|
||||
#
|
||||
# Download Messages Prompt
|
||||
#
|
||||
downloadMessagesWindowTitle=Work Offline
|
||||
|
||||
# LOCALIZATION NOTE :
|
||||
# do not localize "\n". use "\n" to make the text fit nicely in the dialog.
|
||||
downloadMessagesLabel=Do you want to download messages \nfor offline use before you go offline?\n\n
|
||||
|
||||
downloadMessagesCheckboxLabel=Always ask me when I go offline
|
||||
downloadMessagesDownloadButtonLabel=Download
|
||||
downloadMessagesNoDownloadButtonLabel=Don't Download
|
||||
downloadMessagesCancelButtonLabel=Cancel
|
||||
|
||||
#
|
||||
# Send Messages Prompt
|
||||
#
|
||||
sendMessagesWindowTitle=Work Online
|
||||
|
||||
# LOCALIZATION NOTE :
|
||||
# do not localize "\n". use "\n" to make the text fit nicely in the dialog.
|
||||
sendMessagesLabel=Would you like to send the messages \nin your Unsent Messages folder once you are online?\n\n
|
||||
sendMessagesCheckboxLabel=Always ask me when I go online
|
||||
sendMessagesSendButtonLabel=Send
|
||||
sendMessagesNoSendButtonLabel=Don't Send
|
||||
sendMessagesCancelButtonLabel=Cancel
|
||||
|
||||
#
|
||||
# GetMessages Offline Prompt
|
||||
#
|
||||
getMessagesOfflineWindowTitle=Get Messages
|
||||
|
||||
# LOCALIZATION NOTE :
|
||||
# do not localize "\n". use "\n" to make the text fit nicely in the dialog.
|
||||
getMessagesOfflineLabel=You are currently offline. Would you like \nto go online to get your new messages?\n\n
|
||||
getMessagesOfflineGoButtonLabel=Go online
|
||||
getMessagesOfflineCancelButtonLabel=Cancel
|
||||
|
||||
#
|
||||
# Send Messages Offline Prompt
|
||||
#
|
||||
sendMessagesOfflineWindowTitle=Send Messages
|
||||
|
||||
# LOCALIZATION NOTE :
|
||||
# do not localize "\n". use "\n" to make the text fit nicely in the dialog.
|
||||
sendMessagesOfflineLabel=You are currently offline. Would you like \nto go online and send your unsent messages?\n\n
|
||||
sendMessagesOfflineGoButtonLabel=Go online
|
||||
sendMessagesOfflineCancelButtonLabel=Cancel
|
|
@ -40,5 +40,5 @@ interface nsIMsgSendLater : nsIStreamListener
|
|||
attribute nsIMsgWindow msgWindow;
|
||||
void RemoveListener(in nsIMsgSendLaterListener aListener);
|
||||
void AddListener(in nsIMsgSendLaterListener aListener);
|
||||
void GetUnsentMessagesFolder(in nsIMsgIdentity userIdentity, out nsIMsgFolder folder);
|
||||
nsIMsgFolder getUnsentMessagesFolder(in nsIMsgIdentity userIdentity);
|
||||
};
|
||||
|
|
|
@ -133,10 +133,6 @@ messenger.jar:
|
|||
content/messenger/mailMessengerComposeOverlay.xul (base/resources/content/mailMessengerComposeOverlay.xul)
|
||||
content/messenger/mailOverlay.xul (base/resources/content/mailOverlay.xul)
|
||||
content/messenger/mailWidgets.xml (base/resources/content/mailWidgets.xml)
|
||||
content/messenger/sendMsgs.xul (base/resources/content/sendMsgs.xul)
|
||||
content/messenger/sendMsgs.js (base/resources/content/sendMsgs.js)
|
||||
content/messenger/downloadMsgs.xul (base/resources/content/downloadMsgs.xul)
|
||||
content/messenger/downloadMsgs.js (base/resources/content/downloadMsgs.js)
|
||||
content/messenger/platformMailnewsOverlay.xul (base/resources/content/win/platformMailnewsOverlay.xul)
|
||||
content/messenger/SearchDialog.xul (base/search/resources/content/SearchDialog.xul)
|
||||
content/messenger/SearchOptions.xul (base/search/resources/content/SearchOptions.xul)
|
||||
|
@ -206,8 +202,7 @@ en-US.jar:
|
|||
locale/en-US/messenger/mailEditorOverlay.dtd (base/resources/locale/en-US/mailEditorOverlay.dtd)
|
||||
locale/en-US/messenger/mailOverlay.dtd (base/resources/locale/en-US/mailOverlay.dtd)
|
||||
locale/en-US/messenger/msgSynchronize.dtd (base/resources/locale/en-US/msgSynchronize.dtd)
|
||||
locale/en-US/messenger/sendMsgs.dtd (base/resources/locale/en-US/sendMsgs.dtd)
|
||||
locale/en-US/messenger/downloadMsgs.dtd (base/resources/locale/en-US/downloadMsgs.dtd)
|
||||
locale/en-US/messenger/offline.properties (base/resources/locale/en-US/offline.properties)
|
||||
locale/en-US/messenger/SearchDialog.dtd (base/search/resources/locale/en-US/SearchDialog.dtd)
|
||||
locale/en-US/messenger/SearchOptions.dtd (base/search/resources/locale/en-US/SearchOptions.dtd)
|
||||
locale/en-US/messenger/FilterListDialog.dtd (base/search/resources/locale/en-US/FilterListDialog.dtd)
|
||||
|
|
Загрузка…
Ссылка в новой задаче