diff --git a/mailnews/base/public/nsIMsgStatusFeedback.idl b/mailnews/base/public/nsIMsgStatusFeedback.idl index d6fecebde4e..aee7e365dad 100644 --- a/mailnews/base/public/nsIMsgStatusFeedback.idl +++ b/mailnews/base/public/nsIMsgStatusFeedback.idl @@ -37,13 +37,13 @@ #include "nsISupports.idl" -[scriptable, uuid(FD1321EC-C84E-4939-B26B-8CFC676C8333)] +[scriptable, uuid(AACBFA34-8D29-4A08-9283-A8E5B3AB067F)] interface nsIMsgStatusFeedback : nsISupports { - void showStatusString(in wstring status); + void showStatusString(in AString aStatus); void startMeteors(); void stopMeteors(); - void showProgress(in long percent); - void setStatusString(in wstring status); // will be displayed until next user action + void showProgress(in long aPercent); + void setStatusString(in AString aStatus); // will be displayed until next user action /* aStatusFeedback: a wrapped JS status feedback object */ void setWrappedStatusFeedback(in nsIMsgStatusFeedback aStatusFeedback); diff --git a/mailnews/base/src/nsMsgFolderCompactor.cpp b/mailnews/base/src/nsMsgFolderCompactor.cpp index ee98d409b84..fa8f50a1450 100644 --- a/mailnews/base/src/nsMsgFolderCompactor.cpp +++ b/mailnews/base/src/nsMsgFolderCompactor.cpp @@ -266,7 +266,7 @@ nsresult nsFolderCompactState::ShowStatusMsg(const nsString& aMsg) { m_window->GetStatusFeedback(getter_AddRefs(statusFeedback)); if (statusFeedback && !aMsg.IsEmpty()) - return statusFeedback->SetStatusString (aMsg.get()); + return statusFeedback->SetStatusString(aMsg); } return NS_OK; } diff --git a/mailnews/base/src/nsMsgOfflineManager.cpp b/mailnews/base/src/nsMsgOfflineManager.cpp index 4b082092757..f5f7438df96 100644 --- a/mailnews/base/src/nsMsgOfflineManager.cpp +++ b/mailnews/base/src/nsMsgOfflineManager.cpp @@ -401,7 +401,7 @@ NS_IMETHODIMP nsMsgOfflineManager::OnProgress(PRUint32 aCurrentMessage, PRUint32 NS_IMETHODIMP nsMsgOfflineManager::OnStatus(const PRUnichar *aMsg) { if (m_statusFeedback && aMsg) - return m_statusFeedback->ShowStatusString (aMsg); + return m_statusFeedback->ShowStatusString(nsDependentString(aMsg)); else return NS_OK; } diff --git a/mailnews/base/src/nsMsgPrintEngine.cpp b/mailnews/base/src/nsMsgPrintEngine.cpp index fb78294862d..2f29a67c25d 100644 --- a/mailnews/base/src/nsMsgPrintEngine.cpp +++ b/mailnews/base/src/nsMsgPrintEngine.cpp @@ -590,7 +590,7 @@ nsMsgPrintEngine::SetStatusMessage(const nsString& aMsgString) if ( (!mFeedback) || (aMsgString.IsEmpty()) ) return NS_OK; - mFeedback->ShowStatusString(aMsgString.get()); + mFeedback->ShowStatusString(aMsgString); return NS_OK; } diff --git a/mailnews/base/src/nsMsgProgress.cpp b/mailnews/base/src/nsMsgProgress.cpp index 8a0a3a6af6e..e79b220f390 100644 --- a/mailnews/base/src/nsMsgProgress.cpp +++ b/mailnews/base/src/nsMsgProgress.cpp @@ -298,14 +298,14 @@ nsresult nsMsgProgress::ReleaseListeners() return rv; } -NS_IMETHODIMP nsMsgProgress::ShowStatusString(const PRUnichar *status) +NS_IMETHODIMP nsMsgProgress::ShowStatusString(const nsAString& aStatus) { - return OnStatusChange(nsnull, nsnull, NS_OK, status); + return OnStatusChange(nsnull, nsnull, NS_OK, PromiseFlatString(aStatus).get()); } -NS_IMETHODIMP nsMsgProgress::SetStatusString(const PRUnichar *status) +NS_IMETHODIMP nsMsgProgress::SetStatusString(const nsAString& aStatus) { - return OnStatusChange(nsnull, nsnull, NS_OK, status); + return OnStatusChange(nsnull, nsnull, NS_OK, PromiseFlatString(aStatus).get()); } /* void startMeteors (); */ @@ -367,5 +367,5 @@ NS_IMETHODIMP nsMsgProgress::OnStatus(nsIRequest *request, nsISupports* ctxt, nsString str; rv = sbs->FormatStatusMessage(aStatus, aStatusArg, getter_Copies(str)); NS_ENSURE_SUCCESS(rv, rv); - return ShowStatusString(str.get()); + return ShowStatusString(str); } diff --git a/mailnews/base/src/nsMsgStatusFeedback.cpp b/mailnews/base/src/nsMsgStatusFeedback.cpp index fb610163582..38a65c75fe2 100644 --- a/mailnews/base/src/nsMsgStatusFeedback.cpp +++ b/mailnews/base/src/nsMsgStatusFeedback.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * @@ -60,17 +60,17 @@ nsMsgStatusFeedback::nsMsgStatusFeedback() : m_lastPercent(0) { - LL_I2L(m_lastProgressTime, 0); + LL_I2L(m_lastProgressTime, 0); - nsresult rv; - nsCOMPtr bundleService = - do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); + nsresult rv; + nsCOMPtr bundleService = + do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); - if (NS_SUCCEEDED(rv)) - bundleService->CreateBundle("chrome://messenger/locale/messenger.properties", - getter_AddRefs(mBundle)); + if (NS_SUCCEEDED(rv)) + bundleService->CreateBundle("chrome://messenger/locale/messenger.properties", + getter_AddRefs(mBundle)); - m_msgLoadedAtom = do_GetAtom("msgLoaded"); + m_msgLoadedAtom = do_GetAtom("msgLoaded"); } nsMsgStatusFeedback::~nsMsgStatusFeedback() @@ -82,11 +82,11 @@ NS_IMPL_THREADSAFE_ADDREF(nsMsgStatusFeedback) NS_IMPL_THREADSAFE_RELEASE(nsMsgStatusFeedback) NS_INTERFACE_MAP_BEGIN(nsMsgStatusFeedback) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMsgStatusFeedback) - NS_INTERFACE_MAP_ENTRY(nsIMsgStatusFeedback) - NS_INTERFACE_MAP_ENTRY(nsIProgressEventSink) - NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener) - NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMsgStatusFeedback) + NS_INTERFACE_MAP_ENTRY(nsIMsgStatusFeedback) + NS_INTERFACE_MAP_ENTRY(nsIProgressEventSink) + NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener) + NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_END ////////////////////////////////////////////////////////////////////////////////// @@ -133,7 +133,7 @@ nsMsgStatusFeedback::OnStateChange(nsIWebProgress* aWebProgress, rv = mBundle->GetStringFromName(NS_LITERAL_STRING("documentLoading").get(), getter_Copies(loadingDocument)); if (NS_SUCCEEDED(rv)) - ShowStatusString(loadingDocument.get()); + ShowStatusString(loadingDocument); } else if (aProgressStateFlags & STATE_STOP) { @@ -192,7 +192,7 @@ nsMsgStatusFeedback::OnStateChange(nsIWebProgress* aWebProgress, rv = mBundle->GetStringFromName(NS_LITERAL_STRING("documentDone").get(), getter_Copies(documentDone)); if (NS_SUCCEEDED(rv)) - ShowStatusString(documentDone.get()); + ShowStatusString(documentDone); } } return NS_OK; @@ -225,54 +225,54 @@ nsMsgStatusFeedback::OnSecurityChange(nsIWebProgress *aWebProgress, NS_IMETHODIMP -nsMsgStatusFeedback::ShowStatusString(const PRUnichar *status) +nsMsgStatusFeedback::ShowStatusString(const nsAString& aStatus) { nsCOMPtr jsStatusFeedback(do_QueryReferent(mJSStatusFeedbackWeak)); if (jsStatusFeedback) - jsStatusFeedback->ShowStatusString(status); - return NS_OK; -} - -NS_IMETHODIMP -nsMsgStatusFeedback::SetStatusString(const PRUnichar *status) -{ - nsCOMPtr jsStatusFeedback(do_QueryReferent(mJSStatusFeedbackWeak)); - nsCOMPtr xulBrowserWindow = do_QueryInterface(jsStatusFeedback); - if (xulBrowserWindow) - xulBrowserWindow->SetJSDefaultStatus(nsDependentString(status)); + jsStatusFeedback->ShowStatusString(aStatus); return NS_OK; } NS_IMETHODIMP -nsMsgStatusFeedback::ShowProgress(PRInt32 percentage) +nsMsgStatusFeedback::SetStatusString(const nsAString& aStatus) +{ + nsCOMPtr jsStatusFeedback(do_QueryReferent(mJSStatusFeedbackWeak)); + nsCOMPtr xulBrowserWindow = do_QueryInterface(jsStatusFeedback); + if (xulBrowserWindow) + xulBrowserWindow->SetJSDefaultStatus(aStatus); + return NS_OK; +} + +NS_IMETHODIMP +nsMsgStatusFeedback::ShowProgress(PRInt32 aPercentage) { // if the percentage hasn't changed...OR if we are going from 0 to 100% in one step // then don't bother....just fall out.... - if (percentage == m_lastPercent || (m_lastPercent == 0 && percentage >= 100)) - return NS_OK; + if (aPercentage == m_lastPercent || (m_lastPercent == 0 && aPercentage >= 100)) + return NS_OK; - m_lastPercent = percentage; + m_lastPercent = aPercentage; - PRInt64 nowMS; - LL_I2L(nowMS, 0); - if (percentage < 100) // always need to do 100% - { - int64 minIntervalBetweenProgress; + PRInt64 nowMS; + LL_I2L(nowMS, 0); + if (aPercentage < 100) // always need to do 100% + { + int64 minIntervalBetweenProgress; - LL_I2L(minIntervalBetweenProgress, 250); - int64 diffSinceLastProgress; - LL_I2L(nowMS, PR_IntervalToMilliseconds(PR_IntervalNow())); - LL_SUB(diffSinceLastProgress, nowMS, m_lastProgressTime); // r = a - b - LL_SUB(diffSinceLastProgress, diffSinceLastProgress, minIntervalBetweenProgress); // r = a - b - if (!LL_GE_ZERO(diffSinceLastProgress)) - return NS_OK; - } + LL_I2L(minIntervalBetweenProgress, 250); + int64 diffSinceLastProgress; + LL_I2L(nowMS, PR_IntervalToMilliseconds(PR_IntervalNow())); + LL_SUB(diffSinceLastProgress, nowMS, m_lastProgressTime); // r = a - b + LL_SUB(diffSinceLastProgress, diffSinceLastProgress, minIntervalBetweenProgress); // r = a - b + if (!LL_GE_ZERO(diffSinceLastProgress)) + return NS_OK; + } - m_lastProgressTime = nowMS; + m_lastProgressTime = nowMS; nsCOMPtr jsStatusFeedback(do_QueryReferent(mJSStatusFeedbackWeak)); if (jsStatusFeedback) - jsStatusFeedback->ShowProgress(percentage); - return NS_OK; + jsStatusFeedback->ShowProgress(aPercentage); + return NS_OK; } NS_IMETHODIMP @@ -318,5 +318,5 @@ NS_IMETHODIMP nsMsgStatusFeedback::OnStatus(nsIRequest *request, nsISupports* ct nsString str; rv = sbs->FormatStatusMessage(aStatus, aStatusArg, getter_Copies(str)); NS_ENSURE_SUCCESS(rv, rv); - return ShowStatusString(str.get()); + return ShowStatusString(str); } diff --git a/mailnews/base/src/nsMsgStatusFeedback.h b/mailnews/base/src/nsMsgStatusFeedback.h index 26e3db371db..4f3df4b63c3 100644 --- a/mailnews/base/src/nsMsgStatusFeedback.h +++ b/mailnews/base/src/nsMsgStatusFeedback.h @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * diff --git a/mailnews/compose/src/nsSmtpProtocol.cpp b/mailnews/compose/src/nsSmtpProtocol.cpp index ded331dbf72..d66ce1accba 100644 --- a/mailnews/compose/src/nsSmtpProtocol.cpp +++ b/mailnews/compose/src/nsSmtpProtocol.cpp @@ -452,7 +452,7 @@ void nsSmtpProtocol::UpdateStatus(PRInt32 aStatusID) void nsSmtpProtocol::UpdateStatusWithString(const PRUnichar * aStatusString) { if (m_statusFeedback && aStatusString) - m_statusFeedback->ShowStatusString(aStatusString); + m_statusFeedback->ShowStatusString(nsDependentString(aStatusString)); } ///////////////////////////////////////////////////////////////////////////////////////////// diff --git a/mailnews/imap/src/nsImapMailFolder.cpp b/mailnews/imap/src/nsImapMailFolder.cpp index 482ec3c5afe..201ba3dd6a1 100644 --- a/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mailnews/imap/src/nsImapMailFolder.cpp @@ -6898,7 +6898,7 @@ nsImapMailFolder::CopyStreamMessage(nsIMsgDBHdr* message, m_copyState->m_msgWindow->GetStatusFeedback(getter_AddRefs(statusFeedback)); if (statusFeedback) { - statusFeedback->ShowStatusString(progressText.get()); + statusFeedback->ShowStatusString(progressText); PRInt32 percent; percent = (100 * m_copyState->m_curIndex) / (PRInt32) m_copyState->m_totalCount; statusFeedback->ShowProgress(percent); diff --git a/mailnews/local/src/nsLocalMailFolder.cpp b/mailnews/local/src/nsLocalMailFolder.cpp index e91c78833b0..9e888780a5f 100644 --- a/mailnews/local/src/nsLocalMailFolder.cpp +++ b/mailnews/local/src/nsLocalMailFolder.cpp @@ -3260,7 +3260,7 @@ nsresult nsMsgLocalMailFolder::DisplayMoveCopyStatusMsg() return NS_OK; mCopyState->m_lastProgressTime = nowMS; - mCopyState->m_statusFeedback->ShowStatusString(finalString.get()); + mCopyState->m_statusFeedback->ShowStatusString(finalString); mCopyState->m_statusFeedback->ShowProgress(mCopyState->m_curCopyIndex * 100 / mCopyState->m_totalMsgCount); } } diff --git a/mailnews/local/src/nsParseMailbox.cpp b/mailnews/local/src/nsParseMailbox.cpp index d080924c099..bc1fb945215 100644 --- a/mailnews/local/src/nsParseMailbox.cpp +++ b/mailnews/local/src/nsParseMailbox.cpp @@ -275,7 +275,7 @@ void nsMsgMailboxParser::UpdateStatusText (PRUint32 stringID) } else bundle->GetStringFromID(stringID, getter_Copies(finalString)); - m_statusFeedback->ShowStatusString(finalString.get()); + m_statusFeedback->ShowStatusString(finalString); } } diff --git a/mailnews/local/src/nsPop3Protocol.cpp b/mailnews/local/src/nsPop3Protocol.cpp index d7786960ae8..e69d0981de4 100644 --- a/mailnews/local/src/nsPop3Protocol.cpp +++ b/mailnews/local/src/nsPop3Protocol.cpp @@ -3057,7 +3057,7 @@ nsPop3Protocol::SendRetr() getter_Copies(finalString)); NS_ASSERTION(NS_SUCCEEDED(rv), "couldn't format string"); if (m_statusFeedback) - m_statusFeedback->ShowStatusString(finalString.get()); + m_statusFeedback->ShowStatusString(finalString); } status = SendData(m_url, cmd); diff --git a/mailnews/news/src/nsNNTPNewsgroupList.cpp b/mailnews/news/src/nsNNTPNewsgroupList.cpp index 20afbbdab0a..4da7b3b2b64 100644 --- a/mailnews/news/src/nsNNTPNewsgroupList.cpp +++ b/mailnews/news/src/nsNNTPNewsgroupList.cpp @@ -1096,7 +1096,7 @@ nsNNTPNewsgroupList::SetProgressStatus(const PRUnichar *message) mailnewsUrl->GetStatusFeedback(getter_AddRefs(feedback)); if (feedback) { - feedback->ShowStatusString(message); + feedback->ShowStatusString(nsDependentString(message)); } } } diff --git a/mailnews/news/src/nsNNTPProtocol.cpp b/mailnews/news/src/nsNNTPProtocol.cpp index 1a5131adb82..681fd844c9c 100644 --- a/mailnews/news/src/nsNNTPProtocol.cpp +++ b/mailnews/news/src/nsNNTPProtocol.cpp @@ -3149,7 +3149,7 @@ PRInt32 nsNNTPProtocol::ReadNewsList(nsIInputStream * inputStream, PRUint32 leng formatStrings, 3, getter_Copies(statusString)); - rv = msgStatusFeedback->ShowStatusString(statusString.get()); + rv = msgStatusFeedback->ShowStatusString(statusString); if (NS_FAILED(rv)) { PR_Free(lineToFree); return rv; diff --git a/mailnews/news/src/nsNewsDownloader.cpp b/mailnews/news/src/nsNewsDownloader.cpp index 424b82a0216..cc7d471b339 100644 --- a/mailnews/news/src/nsNewsDownloader.cpp +++ b/mailnews/news/src/nsNewsDownloader.cpp @@ -245,7 +245,7 @@ nsresult nsNewsDownloader::ShowProgress(const PRUnichar *progressString, PRInt32 } if (m_statusFeedback) { - m_statusFeedback->ShowStatusString(progressString); + m_statusFeedback->ShowStatusString(nsDependentString(progressString)); if (percent != m_lastPercent) { m_statusFeedback->ShowProgress(percent);