From b0a6d26043a09105d889876feefda88c0336ab13 Mon Sep 17 00:00:00 2001 From: "scott%scott-macgregor.org" Date: Wed, 28 Jul 2004 05:56:10 +0000 Subject: [PATCH] Bug #253359 --> use a generic message type atom so we can dynamically style the thread pane with servers that are application extensions (such as rss) without hard coding the server types in nsMsgDBView sr=bienvenu --- mailnews/base/src/nsMsgDBView.cpp | 13 ++++++++----- mailnews/base/src/nsMsgDBView.h | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/mailnews/base/src/nsMsgDBView.cpp b/mailnews/base/src/nsMsgDBView.cpp index 78b399a9a439..28226b4f1090 100644 --- a/mailnews/base/src/nsMsgDBView.cpp +++ b/mailnews/base/src/nsMsgDBView.cpp @@ -85,7 +85,6 @@ nsIAtom * nsMsgDBView::kRepliedMsgAtom = nsnull; nsIAtom * nsMsgDBView::kForwardedMsgAtom = nsnull; nsIAtom * nsMsgDBView::kOfflineMsgAtom = nsnull; nsIAtom * nsMsgDBView::kFlaggedMsgAtom = nsnull; -nsIAtom * nsMsgDBView::kNewsMsgAtom = nsnull; nsIAtom * nsMsgDBView::kImapDeletedMsgAtom = nsnull; nsIAtom * nsMsgDBView::kAttachMsgAtom = nsnull; nsIAtom * nsMsgDBView::kHasUnreadAtom = nsnull; @@ -172,7 +171,6 @@ void nsMsgDBView::InitializeAtomsAndLiterals() kForwardedMsgAtom = NS_NewAtom("forwarded"); kOfflineMsgAtom = NS_NewAtom("offline"); kFlaggedMsgAtom = NS_NewAtom("flagged"); - kNewsMsgAtom = NS_NewAtom("news"); kImapDeletedMsgAtom = NS_NewAtom("imapdeleted"); kAttachMsgAtom = NS_NewAtom("attach"); kHasUnreadAtom = NS_NewAtom("hasUnread"); @@ -220,7 +218,6 @@ nsMsgDBView::~nsMsgDBView() NS_IF_RELEASE(kForwardedMsgAtom); NS_IF_RELEASE(kOfflineMsgAtom); NS_IF_RELEASE(kFlaggedMsgAtom); - NS_IF_RELEASE(kNewsMsgAtom); NS_IF_RELEASE(kImapDeletedMsgAtom); NS_IF_RELEASE(kAttachMsgAtom); NS_IF_RELEASE(kHasUnreadAtom); @@ -1256,8 +1253,8 @@ NS_IMETHODIMP nsMsgDBView::GetCellProperties(PRInt32 aRow, nsITreeColumn *col, n if (mRedirectorTypeAtom) properties->AppendElement(mRedirectorTypeAtom); - if (mIsNews) - properties->AppendElement(kNewsMsgAtom); + if (mMessageTypeAtom) + properties->AppendElement(mMessageTypeAtom); nsXPIDLCString imageSize; msgHdr->GetStringProperty("imageSize", getter_Copies(imageSize)); @@ -1811,6 +1808,12 @@ NS_IMETHODIMP nsMsgDBView::Open(nsIMsgFolder *folder, nsMsgViewSortTypeValue sor mRedirectorTypeAtom = do_GetAtom(redirectorType.get()); mIsNews = !strcmp("nntp",type.get()); + + if (type.IsEmpty()) + mMessageTypeAtom = nsnull; + else // special case nntp --> news since we'll break themes if we try to be consistent + mMessageTypeAtom = do_GetAtom(mIsNews ? "news" : type.get()); + GetImapDeleteModel(nsnull); if (mIsNews) diff --git a/mailnews/base/src/nsMsgDBView.h b/mailnews/base/src/nsMsgDBView.h index dc0794f8cfbd..609042117f12 100644 --- a/mailnews/base/src/nsMsgDBView.h +++ b/mailnews/base/src/nsMsgDBView.h @@ -115,7 +115,6 @@ protected: static nsIAtom* kForwardedMsgAtom; static nsIAtom* kOfflineMsgAtom; static nsIAtom* kFlaggedMsgAtom; - static nsIAtom* kNewsMsgAtom; static nsIAtom* kImapDeletedMsgAtom; static nsIAtom* kAttachMsgAtom; static nsIAtom* kHasUnreadAtom; @@ -341,6 +340,7 @@ protected: nsCOMPtr m_db; nsCOMPtr m_folder; nsCOMPtr mRedirectorTypeAtom; + nsCOMPtr mMessageTypeAtom; // news, rss, mail, etc. nsMsgViewSortTypeValue m_sortType; nsMsgViewSortOrderValue m_sortOrder; nsMsgViewFlagsTypeValue m_viewFlags;