diff --git a/mail/extensions/smime/content/msgHdrViewSMIMEOverlay.js b/mail/extensions/smime/content/msgHdrViewSMIMEOverlay.js index 8bb8b2318b7..aad4f2bb17e 100644 --- a/mail/extensions/smime/content/msgHdrViewSMIMEOverlay.js +++ b/mail/extensions/smime/content/msgHdrViewSMIMEOverlay.js @@ -44,6 +44,9 @@ var gStatusBar = null; var gEncryptedURIService = null; var gMyLastEncryptedURI = null; +var gSMIMEBundle = null; +//var gBrandBundle; -- defined in mailWindow.js + // manipulates some globals from msgReadSMIMEOverlay.js const nsICMSMessageErrors = Components.interfaces.nsICMSMessageErrors; @@ -121,6 +124,26 @@ var smimeHeaderSink = gMyLastEncryptedURI = GetLoadedMessage(); gEncryptedURIService.rememberEncrypted(gMyLastEncryptedURI); } + + if (nsICMSMessageErrors.SUCCESS != aEncryptionStatus) + { + var brand = gBrandBundle.getString("brandShortName"); + var title = gSMIMEBundle.getString("CantDecryptTitle").replace(/%brand%/g,brand); + var body = gSMIMEBundle.getString("CantDecryptBody").replace(/%brand%/g,brand); + + // insert our message + msgWindow.displayHTMLInMessagePane(title, + "\n"+ + "\n"+ + "



\n"+ + "\n"+ + "
\n"+ + "
\n"+ + title+"

\n"+ + body+"\n"+ + "
", false); + + } }, QueryInterface : function(iid) @@ -164,8 +187,22 @@ function onSMIMEStartHeaders() function onSMIMEEndHeaders() {} +function onSmartCardChange() +{ + // only reload encrypted windows + if (gMyLastEncryptedURI && gEncryptionStatus != -1) { + ReloadMessage(); + } +} + function msgHdrViewSMIMEOnLoad(event) { + window.crypto.enableSmartCardEvents = true; + document.addEventListener("smartcard-insert", onSmartCardChange, false); + document.addEventListener("smartcard-remove", onSmartCardChange, false); + if (!gSMIMEBundle) + gSMIMEBundle = document.getElementById("bundle_read_smime"); + // we want to register our security header sink as an opaque nsISupports // on the msgHdrSink used by mail..... msgWindow.msgHeaderSink.securityInfo = smimeHeaderSink; @@ -189,6 +226,9 @@ function msgHdrViewSMIMEOnLoad(event) function msgHdrViewSMIMEOnUnload(event) { + window.crypto.enableSmartCardEvents = false; + document.removeEventListener("smartcard-insert", onSmartCardChange, false); + document.removeEventListener("smartcard-remove", onSmartCardChange, false); forgetEncryptedURI(); } diff --git a/mail/locales/en-US/chrome/messenger-smime/msgReadSMIMEOverlay.properties b/mail/locales/en-US/chrome/messenger-smime/msgReadSMIMEOverlay.properties index f3b37721088..0a1e79c881d 100644 --- a/mail/locales/en-US/chrome/messenger-smime/msgReadSMIMEOverlay.properties +++ b/mail/locales/en-US/chrome/messenger-smime/msgReadSMIMEOverlay.properties @@ -1 +1,7 @@ ImapOnDemand=The displayed message has been digitally signed, but not all its attachments have been downloaded yet. Therefore, the signature cannot be validated. Click OK to download the complete message and validate the signature. +# +#NOTE To translater, anything between %..% and <..> should not be translated. +# the former will be replaced by java script, and the latter is HTML formatting. +# +CantDecryptTitle=%brand% cannot decrypt this message +CantDecryptBody=The sender encrypted this message to you using one of your digital certificates, however %brand% was not able to find this certificate and corresponding private key.
Possible solutions:
diff --git a/mailnews/base/public/nsIMsgWindow.idl b/mailnews/base/public/nsIMsgWindow.idl index 94af75c92fd..3987370df10 100644 --- a/mailnews/base/public/nsIMsgWindow.idl +++ b/mailnews/base/public/nsIMsgWindow.idl @@ -60,7 +60,7 @@ interface nsIMsgMessagePaneController : nsISupports { }; -[scriptable, uuid(BD85A416-5433-11d3-8AC5-0060B0FC04D2)] +[scriptable, uuid(BCE0AB71-11FF-428E-9EDC-69ABAD73b697)] interface nsIMsgWindow : nsISupports { attribute nsIMsgMessagePaneController messagePaneController; @@ -69,7 +69,7 @@ interface nsIMsgWindow : nsISupports { attribute nsITransactionManager transactionManager; attribute nsIMsgFolder openFolder; attribute nsIDocShell rootDocShell; - void displayHTMLInMessagePane(in wstring title, in wstring body); + void displayHTMLInMessagePane(in wstring title, in wstring body, in boolean clearMsgHdr); readonly attribute nsIPrompt promptDialog; attribute string mailCharacterSet; diff --git a/mailnews/base/src/nsMsgWindow.cpp b/mailnews/base/src/nsMsgWindow.cpp index 125813d2659..51051d703b1 100644 --- a/mailnews/base/src/nsMsgWindow.cpp +++ b/mailnews/base/src/nsMsgWindow.cpp @@ -502,11 +502,11 @@ NS_IMETHODIMP nsMsgWindow::GetPromptDialog(nsIPrompt **aPrompt) } NS_IMETHODIMP -nsMsgWindow::DisplayHTMLInMessagePane(const PRUnichar *title, const PRUnichar *body) +nsMsgWindow::DisplayHTMLInMessagePane(const PRUnichar *title, const PRUnichar *body, PRBool clearMsgHdr) { nsresult rv; - if (mMsgPaneController) + if (clearMsgHdr && mMsgPaneController) mMsgPaneController->ClearMsgPane(); nsString htmlStr; diff --git a/mailnews/base/util/nsMsgIncomingServer.cpp b/mailnews/base/util/nsMsgIncomingServer.cpp index 8117bde45f0..24ee6ca3006 100644 --- a/mailnews/base/util/nsMsgIncomingServer.cpp +++ b/mailnews/base/util/nsMsgIncomingServer.cpp @@ -1676,7 +1676,7 @@ NS_IMETHODIMP nsMsgIncomingServer::DisplayOfflineMsg(nsIMsgWindow *aMsgWindow) bundle->GetStringFromName(NS_LITERAL_STRING("nocachedbodybody").get(), getter_Copies(errorMsgBody)); bundle->GetStringFromName(NS_LITERAL_STRING("nocachedbodytitle").get(), getter_Copies(errorMsgTitle)); if (aMsgWindow) - return aMsgWindow->DisplayHTMLInMessagePane(errorMsgTitle, errorMsgBody); + return aMsgWindow->DisplayHTMLInMessagePane(errorMsgTitle, errorMsgBody, PR_TRUE); else return NS_ERROR_FAILURE; diff --git a/mailnews/extensions/smime/resources/content/msgHdrViewSMIMEOverlay.xul b/mailnews/extensions/smime/resources/content/msgHdrViewSMIMEOverlay.xul index 95100dad56f..6f350d12852 100644 --- a/mailnews/extensions/smime/resources/content/msgHdrViewSMIMEOverlay.xul +++ b/mailnews/extensions/smime/resources/content/msgHdrViewSMIMEOverlay.xul @@ -43,6 +43,11 @@