From 6be8a29bfa135c9c29510e44ceb03cf1beacb9af Mon Sep 17 00:00:00 2001 From: "neil%parkwaycc.co.uk" Date: Sat, 17 Sep 2005 17:12:26 +0000 Subject: [PATCH] Bug 31685 Push secure icon to folder pane r+sr=bienvenu --- mailnews/base/src/nsMsgFolderDataSource.cpp | 5 +++++ mailnews/base/src/nsMsgFolderDataSource.h | 1 + mailnews/base/util/nsMsgIncomingServer.cpp | 20 +++++++++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/mailnews/base/src/nsMsgFolderDataSource.cpp b/mailnews/base/src/nsMsgFolderDataSource.cpp index f3a3a8e4059c..6ca07098e2d4 100644 --- a/mailnews/base/src/nsMsgFolderDataSource.cpp +++ b/mailnews/base/src/nsMsgFolderDataSource.cpp @@ -136,6 +136,7 @@ nsIAtom * nsMsgFolderDataSource::kNameAtom = nsnull; nsIAtom * nsMsgFolderDataSource::kSynchronizeAtom = nsnull; nsIAtom * nsMsgFolderDataSource::kOpenAtom = nsnull; nsIAtom * nsMsgFolderDataSource::kIsDeferredAtom = nsnull; +nsIAtom * nsMsgFolderDataSource::kIsSecureAtom = nsnull; nsIAtom * nsMsgFolderDataSource::kCanFileMessagesAtom = nsnull; nsIAtom * nsMsgFolderDataSource::kInVFEditSearchScopeAtom = nsnull; @@ -217,6 +218,7 @@ nsMsgFolderDataSource::nsMsgFolderDataSource() kSynchronizeAtom = NS_NewAtom("Synchronize"); kOpenAtom = NS_NewAtom("open"); kIsDeferredAtom = NS_NewAtom("isDeferred"); + kIsSecureAtom = NS_NewAtom("isSecure"); kCanFileMessagesAtom = NS_NewAtom("canFileMessages"); kInVFEditSearchScopeAtom = NS_NewAtom("inVFEditSearchScope"); @@ -306,6 +308,7 @@ nsMsgFolderDataSource::~nsMsgFolderDataSource (void) NS_RELEASE(kSynchronizeAtom); NS_RELEASE(kOpenAtom); NS_RELEASE(kIsDeferredAtom); + NS_RELEASE(kIsSecureAtom); NS_RELEASE(kCanFileMessagesAtom); NS_RELEASE(kInVFEditSearchScopeAtom); @@ -986,6 +989,8 @@ nsMsgFolderDataSource::OnItemBoolPropertyChanged(nsIRDFResource *resource, NotifyPropertyChanged(resource, kNC_Open, literalNode); else if (kIsDeferredAtom == property) NotifyPropertyChanged(resource, kNC_IsDeferred, literalNode, oldLiteralNode); + else if (kIsSecureAtom == property) + NotifyPropertyChanged(resource, kNC_IsSecure, literalNode, oldLiteralNode); else if (kCanFileMessagesAtom == property) NotifyPropertyChanged(resource, kNC_CanFileMessages, literalNode, oldLiteralNode); else if (kInVFEditSearchScopeAtom == property) diff --git a/mailnews/base/src/nsMsgFolderDataSource.h b/mailnews/base/src/nsMsgFolderDataSource.h index 6881eac36a61..d3b7f394997e 100644 --- a/mailnews/base/src/nsMsgFolderDataSource.h +++ b/mailnews/base/src/nsMsgFolderDataSource.h @@ -284,6 +284,7 @@ protected: static nsIAtom* kSynchronizeAtom; static nsIAtom* kOpenAtom; static nsIAtom* kIsDeferredAtom; + static nsIAtom* kIsSecureAtom; static nsrefcnt gFolderResourceRefCnt; static nsIAtom* kCanFileMessagesAtom; static nsIAtom* kInVFEditSearchScopeAtom; diff --git a/mailnews/base/util/nsMsgIncomingServer.cpp b/mailnews/base/util/nsMsgIncomingServer.cpp index 915e66d5dced..04c1f6b96478 100644 --- a/mailnews/base/util/nsMsgIncomingServer.cpp +++ b/mailnews/base/util/nsMsgIncomingServer.cpp @@ -1717,10 +1717,28 @@ nsMsgIncomingServer::GetSearchScope(nsMsgSearchScopeValue *searchScope) return NS_OK; } +NS_IMETHODIMP +nsMsgIncomingServer::GetIsSecure(PRBool* aIsSecure) +{ + return GetBoolValue("isSecure", aIsSecure); +} + +NS_IMETHODIMP +nsMsgIncomingServer::SetIsSecure(PRBool aIsSecure) +{ + PRBool isSecure; + GetBoolValue("isSecure", &isSecure); + if (isSecure != aIsSecure) { + SetBoolValue("isSecure", aIsSecure); + if (m_rootFolder) + m_rootFolder->NotifyBoolPropertyChanged(NS_NewAtom("isSecure"), isSecure, aIsSecure); + } + return NS_OK; +} + // use the convenience macros to implement the accessors NS_IMPL_SERVERPREF_STR(nsMsgIncomingServer, Username, "userName") NS_IMPL_SERVERPREF_STR(nsMsgIncomingServer, PrefPassword, "password") -NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, IsSecure, "isSecure") NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, UseSecAuth, "useSecAuth") NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, LogonFallback, "logon_fallback") NS_IMPL_SERVERPREF_INT(nsMsgIncomingServer, BiffMinutes, "check_time")