diff --git a/mail/extensions/smime/content/msgHdrViewSMIMEOverlay.js b/mail/extensions/smime/content/msgHdrViewSMIMEOverlay.js
index 8bb8b2318b77..aad4f2bb17e8 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 f3b37721088e..0a1e79c881db 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:
- If you have a smartcard, please insert it now.
- If you are using a new machine, or if you are using a new %brand% profile, you will need to restore your certificate and private key from a backup. Certificate backups usually end in ".p12".
diff --git a/mailnews/base/public/nsIMsgWindow.idl b/mailnews/base/public/nsIMsgWindow.idl
index 94af75c92fd1..3987370df105 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 125813d2659f..51051d703b17 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 8117bde45f0c..24ee6ca30060 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 95100dad56f8..6f350d128526 100644
--- a/mailnews/extensions/smime/resources/content/msgHdrViewSMIMEOverlay.xul
+++ b/mailnews/extensions/smime/resources/content/msgHdrViewSMIMEOverlay.xul
@@ -43,6 +43,11 @@
+
+
+
+
+
diff --git a/mailnews/extensions/smime/resources/locale/en-US/msgReadSMIMEOverlay.properties b/mailnews/extensions/smime/resources/locale/en-US/msgReadSMIMEOverlay.properties
index f3b37721088e..0a1e79c881db 100644
--- a/mailnews/extensions/smime/resources/locale/en-US/msgReadSMIMEOverlay.properties
+++ b/mailnews/extensions/smime/resources/locale/en-US/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:
- If you have a smartcard, please insert it now.
- If you are using a new machine, or if you are using a new %brand% profile, you will need to restore your certificate and private key from a backup. Certificate backups usually end in ".p12".
diff --git a/mailnews/news/src/nsNNTPProtocol.cpp b/mailnews/news/src/nsNNTPProtocol.cpp
index 09b0d42204e8..f4a4fc6df48f 100644
--- a/mailnews/news/src/nsNNTPProtocol.cpp
+++ b/mailnews/news/src/nsNNTPProtocol.cpp
@@ -2310,7 +2310,7 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommandResponse()
// call nsDocShell::Stop(STOP_NETWORK), which will eventually
// call nsNNTPProtocol::Cancel(), which will close the socket.
// we need to fix this, since the connection is still valid.
- rv = m_msgWindow->DisplayHTMLInMessagePane((const PRUnichar *)titleStr, errorHtml.get());
+ rv = m_msgWindow->DisplayHTMLInMessagePane((const PRUnichar *)titleStr, errorHtml.get(), PR_TRUE);
NS_ENSURE_SUCCESS(rv,rv);
}
// let's take the opportunity of removing the hdr from the db so we don't try to download