implement mru time for folders, part of folder views, 251296, sr=mscott

This commit is contained in:
bienvenu%nventure.com 2006-01-04 00:40:43 +00:00
parent 746b1f8110
commit 0dd6fb70ca
3 changed files with 28 additions and 7 deletions

View File

@ -59,6 +59,12 @@ class nsIMsgFolder;
*/
#define SUMMARY_SUFFIX ".msf"
/*
* These are folder property strings, which are used in several places.
*/
#define MRU_TIME_PROPERTY "MRUTime"
/* NS_ERROR_MODULE_MAILNEWS is defined in mozilla/xpcom/public/nsError.h */
/*

View File

@ -396,6 +396,12 @@ NS_IMETHODIMP nsMsgDBFolder::SetHasNewMessages(PRBool curNewMessages)
{
if (curNewMessages != mNewMessages)
{
// Only change mru time if we're going from doesn't have new to has new.
// technically, we should probably update mru time for every new message
// but we would pay a performance penalty for that. If the user
// opens the folder, the mrutime will get updated anyway.
if (curNewMessages)
SetMRUTime();
/** @params
* nsIAtom* property, PRBool oldValue, PRBool newValue
*/
@ -5201,3 +5207,12 @@ nsresult nsMsgDBFolder::GetMsgPreviewTextFromStream(nsIMsgDBHdr *msgHdr, nsIInpu
return rv;
}
void nsMsgDBFolder::SetMRUTime()
{
PRUint32 seconds;
PRTime2Seconds(PR_Now(), &seconds);
nsCAutoString nowStr;
nowStr.AppendInt(seconds);
SetStringProperty(MRU_TIME_PROPERTY, nowStr.get());
}

View File

@ -107,13 +107,13 @@ public:
nsresult GetMsgPreviewTextFromStream(nsIMsgDBHdr *msgHdr, nsIInputStream *stream);
protected:
// this is a little helper function that is not part of the public interface.
// we use it to get the IID of the incoming server for the derived folder.
// w/out a function like this we would have to implement GetServer in each
// derived folder class.
virtual const char* GetIncomingServerType() = 0;
// this is a little helper function that is not part of the public interface.
// we use it to get the IID of the incoming server for the derived folder.
// w/out a function like this we would have to implement GetServer in each
// derived folder class.
virtual const char* GetIncomingServerType() = 0;
virtual nsresult CreateBaseMessageURI(const char *aURI);
virtual nsresult CreateBaseMessageURI(const char *aURI);
// helper routine to parse the URI and update member variables
@ -161,7 +161,7 @@ protected:
virtual nsresult SpamFilterClassifyMessage(const char *aURI, nsIMsgWindow *aMsgWindow, nsIJunkMailPlugin *aJunkMailPlugin);
virtual nsresult SpamFilterClassifyMessages(const char **aURIArray, PRUint32 aURICount, nsIMsgWindow *aMsgWindow, nsIJunkMailPlugin *aJunkMailPlugin);
void SetMRUTime();
protected:
nsCOMPtr<nsIMsgDatabase> mDatabase;
nsCString mCharset;