diff --git a/mailnews/base/src/nsMsgMessageDataSource.cpp b/mailnews/base/src/nsMsgMessageDataSource.cpp index 9262232efd5..8063d7a2d49 100644 --- a/mailnews/base/src/nsMsgMessageDataSource.cpp +++ b/mailnews/base/src/nsMsgMessageDataSource.cpp @@ -114,24 +114,6 @@ nsresult nsMsgMessageDataSource::Init() if(NS_FAILED(rv)) return rv; - nsILocaleFactory *localeFactory; - rv = nsComponentManager::FindFactory(kLocaleFactoryCID, (nsIFactory**)&localeFactory); - - if(NS_SUCCEEDED(rv) && localeFactory) - { - rv = localeFactory->GetApplicationLocale(getter_AddRefs(mApplicationLocale)); - NS_IF_RELEASE(localeFactory); - } - - if(NS_FAILED(rv)) - return rv; - - rv = nsComponentManager::CreateInstance(kDateTimeFormatCID, NULL, - nsCOMTypeInfo::GetIID(), getter_AddRefs(mDateTimeFormat)); - - if(NS_FAILED(rv)) - return rv; - NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv); if(NS_SUCCEEDED(rv)) mailSession->AddFolderListener(this); @@ -590,31 +572,9 @@ nsMsgMessageDataSource::createMessageDateNode(nsIMessage *message, LL_UI2L(intermediateResult, aLong); LL_MUL(aTime, intermediateResult, microSecondsPerSecond); - PRExplodedTime explode; - PR_ExplodeTime(aTime, PR_LocalTimeParameters, &explode); - - nsString dateString; - -/* ducarroz: FormatTMTime doesn't seems to work correctly on Mac and doen't work with PRExplodedTime! - I will use PR_FormatTime until FormatTMTime is fixed. - if(mDateTimeFormat) - rv = mDateTimeFormat->FormatTMTime(mApplicationLocale, kDateFormatShort, kTimeFormatNoSeconds, - (tm*)&explode, dateString); - //Ensure that we always have some string for the date. - if(!mDateTimeFormat || NS_FAILED(rv)) - { - dateString =""; - rv = NS_OK; - } - if(NS_SUCCEEDED(rv)) -*/ - char buffer[128]; - PR_FormatTime(buffer, sizeof(buffer), "%m/%d/%Y %I:%M %p", &explode); - dateString = buffer; - - rv = createNode(dateString, target); - return rv; + rv = createDateNode(aTime, target); + return rv; } nsresult diff --git a/mailnews/base/src/nsMsgMessageDataSource.h b/mailnews/base/src/nsMsgMessageDataSource.h index 0a9d817d61d..1033440dda7 100644 --- a/mailnews/base/src/nsMsgMessageDataSource.h +++ b/mailnews/base/src/nsMsgMessageDataSource.h @@ -37,8 +37,6 @@ private: nsIRDFService* mRDFService; nsIMsgHeaderParser *mHeaderParser; - nsCOMPtr mApplicationLocale; - nsCOMPtr mDateTimeFormat; public: diff --git a/mailnews/base/src/nsMsgRDFUtils.cpp b/mailnews/base/src/nsMsgRDFUtils.cpp index d01a691c839..226f5d526c4 100644 --- a/mailnews/base/src/nsMsgRDFUtils.cpp +++ b/mailnews/base/src/nsMsgRDFUtils.cpp @@ -114,6 +114,21 @@ nsresult createNode(PRUint32 value, nsIRDFNode **node) return rv; } +nsresult createDateNode(PRTime time, nsIRDFNode **node) +{ + *node = nsnull; + nsresult rv; + NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv); + if (NS_FAILED(rv)) return rv; + nsCOMPtr date; + rv = rdf->GetDateLiteral(time, getter_AddRefs(date)); + if(NS_SUCCEEDED(rv)) { + *node = date; + NS_IF_ADDREF(*node); + } + return rv; +} + nsresult GetTargetHasAssertion(nsIRDFDataSource *dataSource, nsIRDFResource* folderResource, nsIRDFResource *property,PRBool tv, nsIRDFNode *target,PRBool* hasAssertion) { diff --git a/mailnews/base/src/nsMsgRDFUtils.h b/mailnews/base/src/nsMsgRDFUtils.h index 2173495080f..996508b205c 100644 --- a/mailnews/base/src/nsMsgRDFUtils.h +++ b/mailnews/base/src/nsMsgRDFUtils.h @@ -75,6 +75,9 @@ nsresult createNode(nsString& str, nsIRDFNode **node); //Given a PRUint32, create an nsiIRDFNode. nsresult createNode(PRUint32 value, nsIRDFNode **node); +//Given a PRTime create an nsIRDFNode that is really a date literal. +nsresult createDateNode(PRTime time, nsIRDFNode **node); + //Has Assertion for a datasource that will just call GetTarget on property. When all of our //datasource derive from our datasource baseclass, this should be moved there and the first //parameter will no longer be needed.