r=bienvenu. Fix for 16966. Can now mark a thread read.

This commit is contained in:
putterman%netscape.com 2000-03-14 05:34:42 +00:00
Родитель d73ea85b91
Коммит 9ad79e2641
10 изменённых файлов: 85 добавлений и 1 удалений

Просмотреть файл

@ -27,6 +27,8 @@
#include "nsIRDFCompositeDataSource.idl"
#include "nsIMsgWindow.idl"
#include "nsIMsgIdentity.idl"
#include "nsIMsgThread.idl"
#include "nsIMsgFolder.idl"
%{C++
#include "nsIDOMWindow.h"
@ -77,7 +79,9 @@ interface nsIMessenger : nsISupports {
void MarkMessageFlagged(in nsIRDFCompositeDataSource database,
in nsIRDFResource message,
in boolean markFlagged);
void markThreadRead(in nsIRDFCompositeDataSource database,
in nsIMsgFolder folder,
in nsIMsgThread thread);
void NewFolder(in nsIRDFCompositeDataSource database,
in nsIRDFResource parentFolder,
in wstring name);

Просмотреть файл

@ -298,6 +298,7 @@ interface nsIMsgFolder : nsIFolder {
void markMessagesRead(in nsISupportsArray messages, in boolean markRead);
void markAllMessagesRead();
void markMessagesFlagged(in nsISupportsArray messages, in boolean markFlagged);
void markThreadRead(in nsIMsgThread thread);
nsIMsgDatabase getMsgDatabase(in nsIMsgWindow msgWindow);
nsIMsgFolder getChildWithURI(in string uri, in boolean deep);

Просмотреть файл

@ -957,6 +957,39 @@ nsMessenger::MarkAllMessagesRead(nsIRDFCompositeDataSource *database,
return rv;
}
NS_IMETHODIMP
nsMessenger::MarkThreadRead(nsIRDFCompositeDataSource *database,
nsIMsgFolder *folder, nsIMsgThread *thread)
{
nsresult rv=NS_OK;
nsCOMPtr<nsISupportsArray> folderArray;
nsCOMPtr<nsISupportsArray> argumentArray;
if(!folder || !database || !thread)
return NS_ERROR_NULL_POINTER;
if(NS_FAILED(NS_NewISupportsArray(getter_AddRefs(folderArray))))
return NS_ERROR_OUT_OF_MEMORY;
if(NS_FAILED(NS_NewISupportsArray(getter_AddRefs(argumentArray))))
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIRDFResource> folderResource = do_QueryInterface(folder);
if(folder)
{
folderArray->AppendElement(folderResource);
}
nsCOMPtr<nsISupports> threadSupports = do_QueryInterface(thread);
if(threadSupports)
argumentArray->AppendElement(threadSupports);
DoCommand(database, NC_RDF_MARKTHREADREAD, folderArray, argumentArray);
return rv;
}
NS_IMETHODIMP
nsMessenger::MarkMessageFlagged(nsIRDFCompositeDataSource *database,
nsIRDFResource *messageResource,

Просмотреть файл

@ -82,6 +82,7 @@ nsIRDFResource* nsMsgFolderDataSource::kNC_GetNewMessages= nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_Copy= nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_Move= nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_MarkAllMessagesRead= nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_MarkThreadRead= nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_Compact= nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_Rename= nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_EmptyTrash= nsnull;
@ -139,6 +140,7 @@ nsMsgFolderDataSource::~nsMsgFolderDataSource (void)
NS_RELEASE2(kNC_Copy, refcnt);
NS_RELEASE2(kNC_Move, refcnt);
NS_RELEASE2(kNC_MarkAllMessagesRead, refcnt);
NS_RELEASE2(kNC_MarkThreadRead, refcnt);
NS_RELEASE2(kNC_Compact, refcnt);
NS_RELEASE2(kNC_Rename, refcnt);
NS_RELEASE2(kNC_EmptyTrash, refcnt);
@ -195,6 +197,7 @@ nsresult nsMsgFolderDataSource::Init()
rdf->GetResource(NC_RDF_MOVE, &kNC_Move);
rdf->GetResource(NC_RDF_MARKALLMESSAGESREAD,
&kNC_MarkAllMessagesRead);
rdf->GetResource(NC_RDF_MARKTHREADREAD, &kNC_MarkThreadRead);
rdf->GetResource(NC_RDF_COMPACT, &kNC_Compact);
rdf->GetResource(NC_RDF_RENAME, &kNC_Rename);
rdf->GetResource(NC_RDF_EMPTYTRASH, &kNC_EmptyTrash);
@ -570,6 +573,7 @@ nsMsgFolderDataSource::GetAllCommands(nsIRDFResource* source,
cmds->AppendElement(kNC_Copy);
cmds->AppendElement(kNC_Move);
cmds->AppendElement(kNC_MarkAllMessagesRead);
cmds->AppendElement(kNC_MarkThreadRead);
cmds->AppendElement(kNC_Compact);
cmds->AppendElement(kNC_Rename);
cmds->AppendElement(kNC_EmptyTrash);
@ -611,6 +615,7 @@ nsMsgFolderDataSource::IsCommandEnabled(nsISupportsArray/*<nsIRDFResource>*/* aS
(aCommand == kNC_Move) ||
(aCommand == kNC_GetNewMessages) ||
(aCommand == kNC_MarkAllMessagesRead) ||
(aCommand == kNC_MarkThreadRead) ||
(aCommand == kNC_Compact) ||
(aCommand == kNC_Rename) ||
(aCommand == kNC_EmptyTrash) ))
@ -668,6 +673,10 @@ nsMsgFolderDataSource::DoCommand(nsISupportsArray/*<nsIRDFResource>*/* aSources,
{
rv = folder->MarkAllMessagesRead();
}
else if((aCommand == kNC_MarkThreadRead))
{
rv = DoMarkThreadRead(folder, aArguments);
}
else if ((aCommand == kNC_Compact))
{
rv = folder->Compact();
@ -1521,6 +1530,18 @@ nsresult nsMsgFolderDataSource::DoNewFolder(nsIMsgFolder *folder, nsISupportsArr
return rv;
}
nsresult nsMsgFolderDataSource::DoMarkThreadRead(nsIMsgFolder *folder, nsISupportsArray *arguments)
{
nsresult rv = NS_OK;
nsCOMPtr<nsISupports> elem = getter_AddRefs(arguments->ElementAt(0));
nsCOMPtr<nsIMsgThread> thread = do_QueryInterface(elem);
if(thread)
{
rv = folder->MarkThreadRead(thread);
}
return rv;
}
nsresult nsMsgFolderDataSource::DoFolderAssert(nsIMsgFolder *folder, nsIRDFResource *property, nsIRDFNode *target)
{
nsresult rv = NS_ERROR_FAILURE;

Просмотреть файл

@ -154,6 +154,8 @@ protected:
nsresult DoNewFolder(nsIMsgFolder *folder,
nsISupportsArray *arguments);
nsresult DoMarkThreadRead(nsIMsgFolder *folder, nsISupportsArray *arguments);
nsresult DoFolderAssert(nsIMsgFolder *folder, nsIRDFResource *property, nsIRDFNode *target);
nsresult DoFolderHasAssertion(nsIMsgFolder *folder, nsIRDFResource *property, nsIRDFNode *target,
@ -209,6 +211,7 @@ protected:
static nsIRDFResource* kNC_Copy;
static nsIRDFResource* kNC_Move;
static nsIRDFResource* kNC_MarkAllMessagesRead;
static nsIRDFResource* kNC_MarkThreadRead;
static nsIRDFResource* kNC_Compact;
static nsIRDFResource* kNC_Rename;
static nsIRDFResource* kNC_EmptyTrash;

Просмотреть файл

@ -81,6 +81,7 @@ typedef struct _nsMsgRDFNotification {
#define NC_RDF_COPY NC_NAMESPACE_URI "Copy"
#define NC_RDF_MOVE NC_NAMESPACE_URI "Move"
#define NC_RDF_MARKALLMESSAGESREAD NC_NAMESPACE_URI "MarkAllMessagesRead"
#define NC_RDF_MARKTHREADREAD NC_NAMESPACE_URI "MarkThreadRead"
#define NC_RDF_COMPACT NC_NAMESPACE_URI "Compact"
#define NC_RDF_RENAME NC_NAMESPACE_URI "Rename"
#define NC_RDF_EMPTYTRASH NC_NAMESPACE_URI "EmptyTrash"

Просмотреть файл

@ -848,6 +848,16 @@ nsMsgDBFolder::MarkAllMessagesRead(void)
return rv;
}
NS_IMETHODIMP nsMsgDBFolder::MarkThreadRead(nsIMsgThread *thread)
{
nsresult rv = GetDatabase(nsnull);
if(NS_SUCCEEDED(rv))
return mDatabase->MarkThreadRead(thread, nsnull, nsnull);
return rv;
}
NS_IMETHODIMP
nsMsgDBFolder::OnStartRunningUrl(nsIURI *aUrl)
{

Просмотреть файл

@ -72,6 +72,8 @@ public:
NS_IMETHOD ManyHeadersToDownload(PRBool *_retval);
NS_IMETHOD MarkAllMessagesRead(void);
NS_IMETHOD MarkThreadRead(nsIMsgThread *thread);
NS_IMETHOD Shutdown(PRBool shutdownChildren);
NS_IMETHOD ForceDBClosed();

Просмотреть файл

@ -1904,6 +1904,13 @@ nsMsgFolder::MarkAllMessagesRead(void)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMsgFolder::MarkThreadRead(nsIMsgThread *thread)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMsgFolder::CopyMessages(nsIMsgFolder* srcFolder,
nsISupportsArray *messages,

Просмотреть файл

@ -152,6 +152,8 @@ public:
NS_IMETHOD MarkMessagesRead(nsISupportsArray *messages, PRBool markRead);
NS_IMETHOD MarkAllMessagesRead(void);
NS_IMETHOD MarkMessagesFlagged(nsISupportsArray *messages, PRBool markFlagged);
NS_IMETHOD MarkThreadRead(nsIMsgThread *thread);
NS_IMETHOD GetChildWithURI(const char *uri, PRBool deep, nsIMsgFolder **_retval);
// end NS_DECL_NSIMSGFOLDER