add offline msg display r=sspitzer, sr=,mscott 41751

This commit is contained in:
bienvenu%netscape.com 2001-01-13 15:31:30 +00:00
Родитель d4501f4b46
Коммит aaf3888a41
5 изменённых файлов: 54 добавлений и 15 удалений

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

@ -181,6 +181,8 @@ interface nsIMsgIncomingServer : nsISupports {
wstring toString();
void displayOfflineMsg(in nsIMsgWindow aWindow);
/* used for comparing nsIMsgIncomingServers */
boolean equals(in nsIMsgIncomingServer server);

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

@ -121,3 +121,15 @@ addressbook.throbber.url=http://www.mozilla.org/
mailnews.send_default_charset=ISO-8859-1
mailnews.view_default_charset=ISO-8859-1
# offline msg
nocachedbodybody =The body of this message has not been downloaded from \n\
the server for reading offline. To read this message, \n\
you must reconnect to the network, choose Offline from \n\
the File menu and then select Work Online.\n\
In the future, you can select which messages or folders to read offline. To do \n\
this, choose Offline from the file menu and then select Synchronize. You can \n\
adjust the Disk Space preference to prevent the downloading of large messages.
# LOCALIZATION NOTES(nocachedbodytitle): Do not translate "<TITLE>" or "</TITLE>" in the line below
nocachedbodytitle=<TITLE>Go Online to View This Message</TITLE>\n\

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

@ -48,6 +48,7 @@
#include "nsIPrompt.h"
#include "nsIWalletService.h"
#include "nsINetSupportDialogService.h"
#include "nsIStringBundle.h"
#include "nsIRDFService.h"
#include "nsRDFCID.h"
@ -1094,6 +1095,33 @@ NS_IMETHODIMP nsMsgIncomingServer::SetRetentionSettings(nsIMsgRetentionSettings
return NS_OK;
}
#define BASE_MSGS_URL "chrome://messenger/locale/messenger.properties"
NS_IMETHODIMP nsMsgIncomingServer::DisplayOfflineMsg(nsIMsgWindow *aMsgWindow)
{
nsresult rv;
nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIStringBundle> bundle;
rv = bundleService->CreateBundle(BASE_MSGS_URL, nsnull,
getter_AddRefs(bundle));
NS_ENSURE_SUCCESS(rv, rv);
if (bundle)
{
nsXPIDLString errorMsgTitle;
nsXPIDLString errorMsgBody;
bundle->GetStringFromName(NS_LITERAL_STRING("nocachedbodybody"), getter_Copies(errorMsgBody));
bundle->GetStringFromName(NS_LITERAL_STRING("nocachedbodytitle"), getter_Copies(errorMsgTitle));
if (aMsgWindow)
return aMsgWindow->DisplayHTMLInMessagePane(errorMsgTitle, errorMsgBody);
else
return NS_ERROR_FAILURE;
}
return rv;
}
// use the convenience macros to implement the accessors
NS_IMPL_SERVERPREF_STR(nsMsgIncomingServer, Username, "userName");

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

@ -331,18 +331,3 @@
## @loc None
5058=Deleting this folder is not undoable and will delete all of the messages it contains. Are you sure you still want to delete this folder?
## @name IMAP_HTML_NO_CACHED_BODY_TITLE
## @loc None
5059=<TITLE>Go Online to View This Message</TITLE>\n\
## @name IMAP_HTML_NO_CACHED_BODY_BODY
## @loc None
5060=The body of this message has not been downloaded from \n\
the server for reading offline. To read this message, \n\
you must reconnect to the network, choose Offline from \n\
the File menu and then select Work Online.\n\
In the future, you can select which messages or folders to read offline. To do \n\
this, choose Offline from the file menu and then select Synchronize. You can \n\
adjust the Disk Space preference to prevent the downloading of large messages.

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

@ -221,8 +221,20 @@ nsNntpService::DisplayMessage(const char* aMessageURI, nsISupports * aDisplayCon
folder->ShouldStoreMsgOffline(key, &shouldStoreMsgOffline);
folder->HasMsgOffline(key, &hasMsgOffline);
msgUrl->SetMsgIsInLocalCache(hasMsgOffline);
if (WeAreOffline())
{
if (!hasMsgOffline)
{
nsCOMPtr<nsIMsgIncomingServer> server;
rv = folder->GetServer(getter_AddRefs(server));
if (server)
return server->DisplayOfflineMsg(aMsgWindow);
}
}
}
newsFolder->SetSaveArticleOffline(shouldStoreMsgOffline);
}
// now is where our behavior differs....if the consumer is the docshell then we want to