Mozilla Home
Privacy
Cookies
Legal
Bugzilla
Browse
Advanced Search
New Bug
Reports
Documentation
Log In
Log In with GitHub
or
Remember me
Browse
Advanced Search
New Bug
Reports
Documentation
Attachment 147546 Details for
Bug 112833
[patch]
Fixed ignore issues
112833.diff (text/plain), 13.35 KB, created by
neil@parkwaycc.co.uk
(
hide
)
Description:
Fixed ignore issues
Filename:
MIME Type:
Creator:
neil@parkwaycc.co.uk
Size:
13.35 KB
patch
obsolete
>Index: mail/base/content/mail3PaneWindowCommands.js >=================================================================== >RCS file: /cvsroot/mozilla/mail/base/content/mail3PaneWindowCommands.js,v >retrieving revision 1.17 >diff -p -u -d -r1.17 mail3PaneWindowCommands.js >--- mail/base/content/mail3PaneWindowCommands.js 17 Apr 2004 05:53:27 -0000 1.17 >+++ mail/base/content/mail3PaneWindowCommands.js 3 May 2004 15:19:15 -0000 >@@ -253,9 +253,9 @@ var DefaultController = > gDBView.getCommandStatus(nsMsgViewCommandType.junk, enabled, checkStatus); > return enabled.value; > case "cmd_killThread": >- return GetNumSelectedMessages() == 1; >+ return GetNumSelectedMessages() > 0; > case "cmd_watchThread": >- if ((GetNumSelectedMessages() == 1) && gDBView) >+ if (gDBView) > gDBView.getCommandStatus(nsMsgViewCommandType.toggleThreadWatched, enabled, checkStatus); > return enabled.value; > case "cmd_createFilterFromPopup": >Index: mailnews/base/resources/content/mail3PaneWindowCommands.js >=================================================================== >RCS file: /cvsroot/mozilla/mailnews/base/resources/content/mail3PaneWindowCommands.js,v >retrieving revision 1.133 >diff -p -u -d -r1.133 mail3PaneWindowCommands.js >--- mailnews/base/resources/content/mail3PaneWindowCommands.js 17 Apr 2004 18:32:16 -0000 1.133 >+++ mailnews/base/resources/content/mail3PaneWindowCommands.js 3 May 2004 15:19:16 -0000 >@@ -269,9 +269,9 @@ var DefaultController = > gDBView.getCommandStatus(nsMsgViewCommandType.junk, enabled, checkStatus); > return enabled.value; > case "cmd_killThread": >- return GetNumSelectedMessages() == 1; >+ return GetNumSelectedMessages() > 0; > case "cmd_watchThread": >- if ((GetNumSelectedMessages() == 1) && gDBView) >+ if (gDBView) > gDBView.getCommandStatus(nsMsgViewCommandType.toggleThreadWatched, enabled, checkStatus); > return enabled.value; > case "cmd_createFilterFromPopup": >Index: mailnews/base/src/nsMsgDBView.cpp >=================================================================== >RCS file: /cvsroot/mozilla/mailnews/base/src/nsMsgDBView.cpp,v >retrieving revision 1.177 >diff -p -u -d -r1.177 nsMsgDBView.cpp >--- mailnews/base/src/nsMsgDBView.cpp 19 Apr 2004 18:25:08 -0000 1.177 >+++ mailnews/base/src/nsMsgDBView.cpp 3 May 2004 15:19:23 -0000 >@@ -1205,12 +1205,6 @@ NS_IMETHODIMP nsMsgDBView::GetCellProper > if (flags & MSG_FLAG_ATTACHMENT) > properties->AppendElement(kAttachMsgAtom); > >- if (flags & MSG_FLAG_WATCHED) >- properties->AppendElement(kWatchThreadAtom); >- >- if (flags & MSG_FLAG_IGNORED) >- properties->AppendElement(kIgnoreThreadAtom); >- > if ((mDeleteModel == nsMsgImapDeleteModels::IMAPDelete) && (flags & MSG_FLAG_IMAP_DELETED)) > properties->AppendElement(kImapDeletedMsgAtom); > >@@ -1321,9 +1315,12 @@ NS_IMETHODIMP nsMsgDBView::GetCellProper > PRUint32 numUnreadChildren; > thread->GetNumUnreadChildren(&numUnreadChildren); > if (numUnreadChildren > 0) >- { >- properties->AppendElement(kHasUnreadAtom); >- } >+ properties->AppendElement(kHasUnreadAtom); >+ thread->GetFlags(&flags); >+ if (flags & MSG_FLAG_WATCHED) >+ properties->AppendElement(kWatchThreadAtom); >+ if (flags & MSG_FLAG_IGNORED) >+ properties->AppendElement(kIgnoreThreadAtom); > } > } > } >@@ -4245,24 +4242,25 @@ nsresult nsMsgDBView::AddHdr(nsIMsgDBHdr > #ifdef DEBUG_bienvenu > NS_ASSERTION((int) m_keys.GetSize() == m_flags.GetSize() && (int) m_keys.GetSize() == m_levels.GetSize(), "view arrays out of sync!"); > #endif >- msgHdr->GetFlags(&flags); >- if (flags & MSG_FLAG_IGNORED && !GetShowingIgnored()) >- return NS_OK; >- >+ >+ if (!GetShowingIgnored()) { >+ nsCOMPtr <nsIMsgThread> thread; >+ m_db->GetThreadContainingMsgHdr(msgHdr, getter_AddRefs(thread)); >+ if (thread) >+ { >+ thread->GetFlags(&flags); >+ if (flags & MSG_FLAG_IGNORED) >+ return NS_OK; >+ } >+ } >+ > nsMsgKey msgKey, threadId; > nsMsgKey threadParent; > msgHdr->GetMessageKey(&msgKey); > msgHdr->GetThreadId(&threadId); > msgHdr->GetThreadParent(&threadParent); > >- nsCOMPtr <nsIMsgThread> thread; >- m_db->GetThreadContainingMsgHdr(msgHdr, getter_AddRefs(thread)); >- if (thread) >- { >- PRUint32 threadFlags; >- thread->GetFlags(&threadFlags); >- flags |= threadFlags; >- } >+ msgHdr->GetFlags(&flags); > // ### this isn't quite right, is it? Should be checking that our thread parent key is none? > if (threadParent == nsMsgKey_None) > flags |= MSG_VIEW_FLAG_ISTHREAD; >@@ -4978,24 +4976,17 @@ nsresult nsMsgDBView::NavigateFromPos(ns > case nsMsgNavigationType::toggleThreadKilled: > { > PRBool resultKilled; >- >- if (startIndex == nsMsgViewIndex_None) >- { >- NS_ASSERTION(0,"startIndex == nsMsgViewIndex_None"); >- break; >- } >- threadIndex = ThreadIndexOfMsg(GetAt(startIndex), startIndex); >- ToggleIgnored(&startIndex, 1, &resultKilled); >+ nsUInt32Array selection; >+ GetSelectedIndices(&selection); >+ ToggleIgnored(selection.GetData(), selection.GetSize(), &threadIndex, &resultKilled); > if (resultKilled) > { >- if (threadIndex != nsMsgViewIndex_None) >- CollapseByIndex(threadIndex, nsnull); > return NavigateFromPos(nsMsgNavigationType::nextUnreadThread, threadIndex, pResultKey, pResultIndex, pThreadIndex, PR_TRUE); > } > else > { >- *pResultIndex = startIndex; >- *pResultKey = m_keys.GetAt(*pResultIndex); >+ *pResultIndex = nsMsgViewIndex_None; >+ *pResultKey = nsMsgKey_None; > return NS_OK; > } > } >@@ -5279,37 +5270,39 @@ > } > > >-nsresult nsMsgDBView::ToggleIgnored(nsMsgViewIndex * indices, PRInt32 numIndices, PRBool *resultToggleState) >+nsresult nsMsgDBView::ToggleIgnored(nsMsgViewIndex * indices, PRInt32 numIndices, nsMsgViewIndex *resultIndex, PRBool *resultToggleState) > { >- nsresult rv = NS_OK; > nsCOMPtr <nsIMsgThread> thread; >- >- if (numIndices == 1) >- { >- nsMsgViewIndex threadIndex = GetThreadFromMsgIndex(*indices, getter_AddRefs(thread)); >- if (thread) >- { >- rv = ToggleThreadIgnored(thread, threadIndex); >- if (resultToggleState) >- { >- PRUint32 threadFlags; >- thread->GetFlags(&threadFlags); >- *resultToggleState = (threadFlags & MSG_FLAG_IGNORED) ? PR_TRUE : PR_FALSE; >- } >- } >- } >- else >+ >+ // Ignored state is toggled based on the first selected thread >+ if (numIndices > 1) >+ NS_QuickSort(indices, numIndices, sizeof(nsMsgViewIndex), CompareViewIndices, nsnull); >+ nsMsgViewIndex threadIndex = GetThreadFromMsgIndex(indices[0], getter_AddRefs(thread)); >+ PRUint32 threadFlags; >+ thread->GetFlags(&threadFlags); >+ PRUint32 ignored = threadFlags & MSG_FLAG_IGNORED; >+ >+ // Process threads in reverse order >+ // Otherwise collapsing the threads will invalidate the indices >+ threadIndex = nsMsgViewIndex_None; >+ while (numIndices) > { >- if (numIndices > 1) >- NS_QuickSort(indices, numIndices, sizeof(nsMsgViewIndex), CompareViewIndices, nsnull); >- for (int curIndex = numIndices - 1; curIndex >= 0; curIndex--) >+ numIndices--; >+ if (indices[numIndices] < threadIndex) > { >- // here we need to build up the unique threads, and mark them ignored. >- nsMsgViewIndex threadIndex; >- threadIndex = GetThreadFromMsgIndex(*indices, getter_AddRefs(thread)); >+ threadIndex = GetThreadFromMsgIndex(indices[numIndices], getter_AddRefs(thread)); >+ thread->GetFlags(&threadFlags); >+ if ((threadFlags & MSG_FLAG_IGNORED) == ignored) >+ SetThreadIgnored(thread, threadIndex, !ignored); > } > } >- return rv; >+ >+ if (resultIndex) >+ *resultIndex = threadIndex; >+ if (resultToggleState) >+ *resultToggleState = !ignored; >+ >+ return NS_OK; > } > > nsMsgViewIndex nsMsgDBView::GetThreadFromMsgIndex(nsMsgViewIndex index, >@@ -5334,67 +5327,40 @@ > return threadIndex; > } > >-// ignore handling. >-nsresult nsMsgDBView::ToggleThreadIgnored(nsIMsgThread *thread, nsMsgViewIndex threadIndex) >- >+nsresult nsMsgDBView::ToggleWatched( nsMsgViewIndex* indices, PRInt32 numIndices) > { >- nsresult rv; >- if (!IsValidIndex(threadIndex)) >- return NS_MSG_INVALID_DBVIEW_INDEX; >- PRUint32 threadFlags; >- thread->GetFlags(&threadFlags); >- NS_ASSERTION((threadFlags & MSG_FLAG_IGNORED) == (m_flags[threadIndex] & MSG_FLAG_IGNORED), "thread flags and view flags out of sync"); >- rv = SetThreadIgnored(thread, threadIndex, !((threadFlags & MSG_FLAG_IGNORED) != 0)); >- return rv; >-} >+ nsCOMPtr <nsIMsgThread> thread; > >-nsresult nsMsgDBView::ToggleThreadWatched(nsIMsgThread *thread, nsMsgViewIndex index) >-{ >- nsresult rv; >- if (!IsValidIndex(index)) >- return NS_MSG_INVALID_DBVIEW_INDEX; >+ // Watched state is toggled based on the first selected thread >+ if (numIndices > 1) >+ NS_QuickSort(indices, numIndices, sizeof(nsMsgViewIndex), CompareViewIndices, nsnull); >+ nsMsgViewIndex threadIndex = GetThreadFromMsgIndex(indices[0], getter_AddRefs(thread)); > PRUint32 threadFlags; > thread->GetFlags(&threadFlags); >- rv = SetThreadWatched(thread, index, !((threadFlags & MSG_FLAG_WATCHED) != 0)); >- return rv; >-} >+ PRUint32 watched = threadFlags & MSG_FLAG_WATCHED; > >-nsresult nsMsgDBView::ToggleWatched( nsMsgViewIndex* indices, PRInt32 numIndices) >-{ >- nsresult rv; >- nsCOMPtr <nsIMsgThread> thread; >- >- if (numIndices == 1) >- { >- nsMsgViewIndex threadIndex = GetThreadFromMsgIndex(*indices, getter_AddRefs(thread)); >- if (threadIndex != nsMsgViewIndex_None) >- rv = ToggleThreadWatched(thread, threadIndex); >- } >- else >+ // Process threads in reverse order >+ // for consistency with ToggleIgnored >+ threadIndex = nsMsgViewIndex_None; >+ while (numIndices) > { >- if (numIndices > 1) >- NS_QuickSort(indices, numIndices, sizeof(nsMsgViewIndex), CompareViewIndices, nsnull); >- for (int curIndex = numIndices - 1; curIndex >= 0; curIndex--) >+ numIndices--; >+ if (indices[numIndices] < threadIndex) > { >- nsMsgViewIndex threadIndex; >- threadIndex = GetThreadFromMsgIndex(*indices, getter_AddRefs(thread)); >- // here we need to build up the unique threads, and mark them watched. >+ threadIndex = GetThreadFromMsgIndex(indices[numIndices], getter_AddRefs(thread)); >+ thread->GetFlags(&threadFlags); >+ if ((threadFlags & MSG_FLAG_WATCHED) == watched) >+ SetThreadWatched(thread, threadIndex, !watched); > } > } >+ > return NS_OK; > } > > nsresult nsMsgDBView::SetThreadIgnored(nsIMsgThread *thread, nsMsgViewIndex threadIndex, PRBool ignored) > { >- nsresult rv; >- > if (!IsValidIndex(threadIndex)) > return NS_MSG_INVALID_DBVIEW_INDEX; >- rv = m_db->MarkThreadIgnored(thread, m_keys[threadIndex], ignored, this); >- if (ignored) >- OrExtraFlag(threadIndex, MSG_FLAG_IGNORED); >- else >- AndExtraFlag(threadIndex, ~MSG_FLAG_IGNORED); > > NoteChange(threadIndex, 1, nsMsgViewNotificationCode::changed); > if (ignored) >@@ -5402,24 +5368,18 @@ nsresult nsMsgDBView::SetThreadIgnored(n > nsMsgKeyArray idsMarkedRead; > > MarkThreadRead(thread, threadIndex, idsMarkedRead, PR_TRUE); >+ CollapseByIndex(threadIndex, nsnull); > } >- return rv; >+ return m_db->MarkThreadIgnored(thread, m_keys[threadIndex], ignored, this); > } >+ > nsresult nsMsgDBView::SetThreadWatched(nsIMsgThread *thread, nsMsgViewIndex index, PRBool watched) > { >- nsresult rv; >- > if (!IsValidIndex(index)) > return NS_MSG_INVALID_DBVIEW_INDEX; >- rv = m_db->MarkThreadWatched(thread, m_keys[index], watched, this); >- >- if (watched) >- OrExtraFlag(index, MSG_FLAG_WATCHED); >- else >- AndExtraFlag(index, ~MSG_FLAG_WATCHED); > > NoteChange(index, 1, nsMsgViewNotificationCode::changed); >- return rv; >+ return m_db->MarkThreadWatched(thread, m_keys[index], watched, this); > } > > NS_IMETHODIMP nsMsgDBView::GetMsgFolder(nsIMsgFolder **aMsgFolder) >Index: mailnews/base/src/nsMsgDBView.h >=================================================================== >RCS file: /cvsroot/mozilla/mailnews/base/src/nsMsgDBView.h,v >retrieving revision 1.59 >diff -p -u -d -r1.59 nsMsgDBView.h >--- mailnews/base/src/nsMsgDBView.h 17 Apr 2004 18:32:19 -0000 1.59 >+++ mailnews/base/src/nsMsgDBView.h 3 May 2004 15:19:24 -0000 >@@ -264,8 +264,6 @@ protected: > virtual nsresult RemoveByIndex(nsMsgViewIndex index); > virtual void OnExtraFlagChanged(nsMsgViewIndex /*index*/, PRUint32 /*extraFlag*/) {} > virtual void OnHeaderAddedOrDeleted() {} >- nsresult ToggleThreadIgnored(nsIMsgThread *thread, nsMsgViewIndex threadIndex); >- nsresult ToggleThreadWatched(nsIMsgThread *thread, nsMsgViewIndex index); > nsresult ToggleWatched( nsMsgViewIndex* indices, PRInt32 numIndices); > nsresult SetThreadWatched(nsIMsgThread *thread, nsMsgViewIndex index, PRBool watched); > nsresult SetThreadIgnored(nsIMsgThread *thread, nsMsgViewIndex threadIndex, PRBool ignored);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Flags:
Bienvenu
: review+
mscott
: superreview+
Actions:
View
|
Diff
|
Review
Attachments on
bug 112833
:
136513
| 147546