Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes
nsMsgWatchedThreadsWithUnreadDBView Class Reference

#include <nsMsgSpecialViews.h>

Inheritance diagram for nsMsgWatchedThreadsWithUnreadDBView:
Inheritance graph
[legend]
Collaboration diagram for nsMsgWatchedThreadsWithUnreadDBView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_IMETHOD GetViewType (nsMsgViewTypeValue *aViewType)
NS_IMETHOD CloneDBView (nsIMessenger *aMessengerInstance, nsIMsgWindow *aMsgWindow, nsIMsgDBViewCommandUpdater *aCommandUpdater, nsIMsgDBView **_retval)
virtual const char * GetViewName (void)
virtual PRBool WantsThisThread (nsIMsgThread *threadHdr)
NS_IMETHOD Open (nsIMsgFolder *folder, nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder, nsMsgViewFlagsTypeValue viewFlags, PRInt32 *pCount)
NS_IMETHOD Close ()
virtual nsresult AddKeys (nsMsgKey *pKeys, PRInt32 *pFlags, const char *pLevels, nsMsgViewSortTypeValue sortType, PRInt32 numKeysToAdd)
NS_IMETHOD Sort (nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder)
NS_IMETHOD GetSupportsThreading (PRBool *aResult)
NS_IMETHOD OnParentChanged (nsMsgKey aKeyChanged, nsMsgKey oldParent, nsMsgKey newParent, nsIDBChangeListener *aInstigator)
NS_DECL_ISUPPORTS
NS_DECL_NSIMSGDBVIEW
NS_DECL_NSIDBCHANGELISTENER
NS_DECL_NSITREEVIEW
NS_DECL_NSIJUNKMAILCLASSIFICATIONLISTENER
nsMsgViewIndex 
GetInsertIndexHelper (nsIMsgDBHdr *msgHdr, nsMsgKeyArray *keys, nsMsgViewSortOrderValue sortOrder, nsMsgViewSortTypeValue sortType)
void open (in nsIMsgFolder folder, in nsMsgViewSortTypeValue sortType, in nsMsgViewSortOrderValue sortOrder, in nsMsgViewFlagsTypeValue viewFlags, out long count)
void openWithHdrs (in nsISimpleEnumerator aHeaders, in nsMsgViewSortTypeValue aSortType, in nsMsgViewSortOrderValue aSortOrder, in nsMsgViewFlagsTypeValue aViewFlags, out long aCount)
void close ()
void init (in nsIMessenger aMessengerInstance, in nsIMsgWindow aMsgWindow, in nsIMsgDBViewCommandUpdater aCommandUpdater)
void sort (in nsMsgViewSortTypeValue sortType, in nsMsgViewSortOrderValue sortOrder)
void doCommand (in nsMsgViewCommandTypeValue command)
void doCommandWithFolder (in nsMsgViewCommandTypeValue command, in nsIMsgFolder destFolder)
void getCommandStatus (in nsMsgViewCommandTypeValue command, out boolean selectable_p, out nsMsgViewCommandCheckStateValue selected_p)
void viewNavigate (in nsMsgNavigationTypeValue motion, out nsMsgKey resultId, out nsMsgViewIndex resultIndex, out nsMsgViewIndex threadIndex, in boolean wrap)
 this method will automatically expand the destination thread, if needs be.
boolean navigateStatus (in nsMsgNavigationTypeValue motion)
 Indicates if navigation of the passed motion type is valid.
nsMsgKey getKeyAt (in nsMsgViewIndex index)
nsIMsgFolder getFolderForViewIndex (in nsMsgViewIndex index)
string getURIForViewIndex (in nsMsgViewIndex index)
nsIMsgDBView cloneDBView (in nsIMessenger aMessengerInstance, in nsIMsgWindow aMsgWindow, in nsIMsgDBViewCommandUpdater aCommandUpdater)
void getURIsForSelection ([array, size_is(count)] out string uris, out unsigned long count)
void getIndicesForSelection ([array, size_is(count)] out nsMsgViewIndex indices, out unsigned long count)
void loadMessageByMsgKey (in nsMsgKey aMsgKey)
void loadMessageByViewIndex (in nsMsgViewIndex aIndex)
void loadMessageByUrl (in string aUrl)
void reloadMessage ()
void reloadMessageWithAllParts ()
void selectMsgByKey (in nsMsgKey key)
void onDeleteCompleted (in boolean succeeded)
nsMsgViewIndex findIndexFromKey (in nsMsgKey aMsgKey, in boolean aExpand)
void ExpandAndSelectThreadByIndex (in nsMsgViewIndex aIndex, in boolean aAugment)
void addColumnHandler (in AString aColumn, in nsIMsgCustomColumnHandler aHandler)
void removeColumnHandler (in AString aColumn)
nsIMsgCustomColumnHandler getColumnHandler (in AString aColumn)
void onHdrChange (in nsIMsgDBHdr aHdrChanged, in unsigned long aOldFlags, in unsigned long aNewFlags, in nsIDBChangeListener aInstigator)
void onHdrDeleted (in nsIMsgDBHdr aHdrChanged, in nsMsgKey aParentKey, in long aFlags, in nsIDBChangeListener aInstigator)
void onHdrAdded (in nsIMsgDBHdr aHdrChanged, in nsMsgKey aParentKey, in long aFlags, in nsIDBChangeListener aInstigator)
void onParentChanged (in nsMsgKey aKeyChanged, in nsMsgKey oldParent, in nsMsgKey newParent, in nsIDBChangeListener aInstigator)
void onAnnouncerGoingAway (in nsIDBChangeAnnouncer instigator)
void onReadChanged (in nsIDBChangeListener aInstigator)
void onJunkScoreChanged (in nsIDBChangeListener aInstigator)
void getRowProperties (in long index, in nsISupportsArray properties)
 An atomized list of properties for a given row.
void getCellProperties (in long row, in nsITreeColumn col, in nsISupportsArray properties)
 An atomized list of properties for a given cell.
void getColumnProperties (in nsITreeColumn col, in nsISupportsArray properties)
 Called to get properties to paint a column background.
boolean isContainer (in long index)
 Methods that can be used to test whether or not a twisty should be drawn, and if so, whether an open or closed twisty should be used.
boolean isContainerOpen (in long index)
boolean isContainerEmpty (in long index)
boolean isSeparator (in long index)
 isSeparator is used to determine if the row at index is a separator.
boolean isSorted ()
 Specifies if there is currently a sort on any column.
boolean canDrop (in long index, in long orientation)
 Methods used by the drag feedback code to determine if a drag is allowable at the current location.
void drop (in long row, in long orientation)
 Called when the user drops something on this view.
long getParentIndex (in long rowIndex)
 Methods used by the tree to draw thread lines in the tree.
boolean hasNextSibling (in long rowIndex, in long afterIndex)
 hasNextSibling is used to determine if the row at rowIndex has a nextSibling that occurs after the index specified by afterIndex.
long getLevel (in long index)
 The level is an integer value that represents the level of indentation.
AString getImageSrc (in long row, in nsITreeColumn col)
 The image path for a given cell.
long getProgressMode (in long row, in nsITreeColumn col)
AString getCellValue (in long row, in nsITreeColumn col)
 The value for a given cell.
AString getCellText (in long row, in nsITreeColumn col)
 The text for a given cell.
void setTree (in nsITreeBoxObject tree)
 Called during initialization to link the view to the front end box object.
void toggleOpenState (in long index)
 Called on the view when an item is opened or closed.
void cycleHeader (in nsITreeColumn col)
 Called on the view when a header is clicked.
void selectionChanged ()
 Should be called from a XUL onselect handler whenever the selection changes.
void cycleCell (in long row, in nsITreeColumn col)
 Called on the view when a cell in a non-selectable cycling column (e.g., unread/flag/etc.) is clicked.
boolean isEditable (in long row, in nsITreeColumn col)
 isEditable is called to ask the view if the cell contents are editable.
void setCellValue (in long row, in nsITreeColumn col, in AString value)
 setCellValue is called when the value of the cell has been set by the user.
void setCellText (in long row, in nsITreeColumn col, in AString value)
 setCellText is called when the contents of the cell have been edited by the user.
void performAction (in wstring action)
 A command API that can be used to invoke commands on the selection.
void performActionOnRow (in wstring action, in long row)
 A command API that can be used to invoke commands on a specific row.
void performActionOnCell (in wstring action, in long row, in nsITreeColumn col)
 A command API that can be used to invoke commands on a specific cell.
void onMessageClassified (in string aMsgURI, in nsMsgJunkStatus aClassification)

Public Attributes

readonly attribute
nsMsgViewTypeValue 
viewType
attribute nsMsgViewFlagsTypeValue viewFlags
attribute nsMsgViewSortTypeValue sortType
readonly attribute
nsMsgViewSortOrderValue 
sortOrder
readonly attribute nsMsgKey keyForFirstSelectedMessage
readonly attribute nsMsgViewIndex viewIndexForFirstSelectedMsg
readonly attribute nsIMsgFolder msgFolder
attribute nsIMsgFolder viewFolder
readonly attribute string URIForFirstSelectedMessage
readonly attribute nsIMsgDBHdr hdrForFirstSelectedMessage
readonly attribute unsigned long numSelected
readonly attribute nsMsgViewIndex msgToSelectAfterDelete
readonly attribute nsMsgViewIndex currentlyDisplayedMessage
attribute boolean suppressMsgDisplay
attribute boolean suppressCommandUpdating
readonly attribute nsIMsgDatabase db
readonly attribute boolean supportsThreading
attribute nsIMsgSearchSession searchSession
readonly attribute boolean removeRowOnMoveOrDelete
readonly attribute boolean usingLines
readonly attribute long rowCount
 The total number of rows in the tree (including the offscreen rows).
attribute nsITreeSelection selection
 The selection for this view.
const short DROP_BEFORE = -1
const short DROP_ON = 0
const short DROP_AFTER = 1
const short PROGRESS_NORMAL = 1
 The progress mode for a given cell.
const short PROGRESS_UNDETERMINED = 2
const short PROGRESS_NONE = 3

Protected Member Functions

virtual nsresult AddMsgToThreadNotInView (nsIMsgThread *threadHdr, nsIMsgDBHdr *msgHdr, PRBool ensureListed)
nsresult InitThreadedView (PRInt32 *pCount)
virtual nsresult OnNewHeader (nsIMsgDBHdr *newHdr, nsMsgKey aParentKey, PRBool ensureListed)
nsresult ListThreadIds (nsMsgKey *startMsg, PRBool unreadOnly, nsMsgKey *pOutput, PRInt32 *pFlags, char *pLevels, PRInt32 numToList, PRInt32 *pNumListed, PRInt32 *pTotalHeaders)
nsresult InitSort (nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder)
virtual nsresult SortThreads (nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder)
virtual void OnExtraFlagChanged (nsMsgViewIndex index, PRUint32 extraFlag)
virtual void OnHeaderAddedOrDeleted ()
void ClearPrevIdArray ()
virtual nsresult RemoveByIndex (nsMsgViewIndex index)
nsMsgViewIndex GetInsertInfoForNewHdr (nsIMsgDBHdr *newHdr, nsMsgViewIndex threadIndex, PRInt32 targetLevel)
nsresult FetchAuthor (nsIMsgDBHdr *aHdr, PRUnichar **aAuthorString)
nsresult FetchRecipients (nsIMsgDBHdr *aHdr, PRUnichar **aRecipientsString)
nsresult FetchSubject (nsIMsgDBHdr *aMsgHdr, PRUint32 aFlags, PRUnichar **aValue)
nsresult FetchDate (nsIMsgDBHdr *aHdr, PRUnichar **aDateString)
nsresult FetchStatus (PRUint32 aFlags, PRUnichar **aStatusString)
nsresult FetchSize (nsIMsgDBHdr *aHdr, PRUnichar **aSizeString)
nsresult FetchPriority (nsIMsgDBHdr *aHdr, PRUnichar **aPriorityString)
nsresult FetchLabel (nsIMsgDBHdr *aHdr, PRUnichar **aLabelString)
nsresult FetchTags (nsIMsgDBHdr *aHdr, PRUnichar **aTagString)
nsresult FetchKeywords (nsIMsgDBHdr *aHdr, char **keywordString)
nsresult FetchAccount (nsIMsgDBHdr *aHdr, PRUnichar **aAccount)
nsresult CycleThreadedColumn (nsIDOMElement *aElement)
nsresult SaveAndClearSelection (nsMsgKey *aCurrentMsgKey, nsMsgKeyArray *aMsgKeyArray)
nsresult RestoreSelection (nsMsgKey aCurrentmsgKey, nsMsgKeyArray *aMsgKeyArray)
nsresult AdjustRowCount (PRInt32 rowCountBeforeSort, PRInt32 rowCountAfterSort)
nsresult GetSelectedIndices (nsUInt32Array *selection)
nsresult GenerateURIForMsgKey (nsMsgKey aMsgKey, nsIMsgFolder *folder, char **aURI)
virtual nsresult AddHdr (nsIMsgDBHdr *msgHdr)
PRBool GetShowingIgnored ()
virtual nsMsgViewIndex GetInsertIndex (nsIMsgDBHdr *msgHdr)
nsMsgViewIndex GetIndexForThread (nsIMsgDBHdr *hdr)
virtual nsresult GetThreadContainingIndex (nsMsgViewIndex index, nsIMsgThread **thread)
virtual nsresult GetMsgHdrForViewIndex (nsMsgViewIndex index, nsIMsgDBHdr **msgHdr)
nsresult ToggleExpansion (nsMsgViewIndex index, PRUint32 *numChanged)
nsresult ExpandByIndex (nsMsgViewIndex index, PRUint32 *pNumExpanded)
nsresult CollapseByIndex (nsMsgViewIndex index, PRUint32 *pNumCollapsed)
nsresult ExpandAll ()
nsresult CollapseAll ()
nsresult ExpandAndSelectThread ()
nsresult GetThreadCount (nsMsgKey messageKey, PRUint32 *pThreadCount)
nsMsgViewIndex GetIndexOfFirstDisplayedKeyInThread (nsIMsgThread *threadHdr)
virtual nsresult GetFirstMessageHdrToDisplayInThread (nsIMsgThread *threadHdr, nsIMsgDBHdr **result)
virtual nsMsgViewIndex ThreadIndexOfMsg (nsMsgKey msgKey, nsMsgViewIndex msgIndex=nsMsgViewIndex_None, PRInt32 *pThreadCount=nsnull, PRUint32 *pFlags=nsnull)
virtual nsresult GetThreadContainingMsgHdr (nsIMsgDBHdr *msgHdr, nsIMsgThread **pThread)
nsMsgKey GetKeyOfFirstMsgInThread (nsMsgKey key)
PRInt32 CountExpandedThread (nsMsgViewIndex index)
virtual nsresult ExpansionDelta (nsMsgViewIndex index, PRInt32 *expansionDelta)
nsresult ReverseSort ()
nsresult ReverseThreads ()
nsresult SaveSortInfo (nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder)
nsresult PersistFolderInfo (nsIDBFolderInfo **dbFolderInfo)
void SetMRUTimeForFolder (nsIMsgFolder *folder)
nsMsgKey GetAt (nsMsgViewIndex index)
nsMsgViewIndex FindViewIndex (nsMsgKey key)
nsMsgViewIndex FindHdr (nsIMsgDBHdr *msgHdr)
virtual nsMsgViewIndex FindKey (nsMsgKey key, PRBool expand)
virtual nsresult GetDBForViewIndex (nsMsgViewIndex index, nsIMsgDatabase **db)
virtual nsresult GetFolders (nsISupportsArray **folders)
virtual nsresult GetFolderFromMsgURI (const char *aMsgURI, nsIMsgFolder **aFolder)
virtual nsresult ListIdsInThread (nsIMsgThread *threadHdr, nsMsgViewIndex viewIndex, PRUint32 *pNumListed)
nsresult ListUnreadIdsInThread (nsIMsgThread *threadHdr, nsMsgViewIndex startOfThreadViewIndex, PRUint32 *pNumListed)
nsMsgViewIndex FindParentInThread (nsMsgKey parentKey, nsMsgViewIndex startOfThreadViewIndex)
nsresult ListIdsInThreadOrder (nsIMsgThread *threadHdr, nsMsgKey parentKey, PRInt32 level, nsMsgViewIndex *viewIndex, PRUint32 *pNumListed)
PRInt32 GetSize (void)
void EnableChangeUpdates ()
void DisableChangeUpdates ()
void NoteChange (nsMsgViewIndex firstlineChanged, PRInt32 numChanged, nsMsgViewNotificationCodeValue changeType)
void NoteStartChange (nsMsgViewIndex firstlineChanged, PRInt32 numChanged, nsMsgViewNotificationCodeValue changeType)
void NoteEndChange (nsMsgViewIndex firstlineChanged, PRInt32 numChanged, nsMsgViewNotificationCodeValue changeType)
virtual nsresult ApplyCommandToIndices (nsMsgViewCommandTypeValue command, nsMsgViewIndex *indices, PRInt32 numIndices)
virtual nsresult ApplyCommandToIndicesWithFolder (nsMsgViewCommandTypeValue command, nsMsgViewIndex *indices, PRInt32 numIndices, nsIMsgFolder *destFolder)
virtual nsresult CopyMessages (nsIMsgWindow *window, nsMsgViewIndex *indices, PRInt32 numIndices, PRBool isMove, nsIMsgFolder *destFolder)
virtual nsresult DeleteMessages (nsIMsgWindow *window, nsMsgViewIndex *indices, PRInt32 numIndices, PRBool deleteStorage)
nsresult SetStringPropertyByIndex (nsMsgViewIndex index, const char *aProperty, const char *aValue)
nsresult SetAsJunkByIndex (nsIJunkMailPlugin *aJunkPlugin, nsMsgViewIndex aIndex, nsMsgJunkStatus aNewClassification)
nsresult ToggleReadByIndex (nsMsgViewIndex index)
nsresult SetReadByIndex (nsMsgViewIndex index, PRBool read)
nsresult SetThreadOfMsgReadByIndex (nsMsgViewIndex index, nsMsgKeyArray &keysMarkedRead, PRBool read)
nsresult SetFlaggedByIndex (nsMsgViewIndex index, PRBool mark)
nsresult SetLabelByIndex (nsMsgViewIndex index, nsMsgLabelValue label)
nsresult OrExtraFlag (nsMsgViewIndex index, PRUint32 orflag)
nsresult AndExtraFlag (nsMsgViewIndex index, PRUint32 andflag)
nsresult SetExtraFlag (nsMsgViewIndex index, PRUint32 extraflag)
nsresult ToggleWatched (nsMsgViewIndex *indices, PRInt32 numIndices)
nsresult SetThreadWatched (nsIMsgThread *thread, nsMsgViewIndex index, PRBool watched)
nsresult SetThreadIgnored (nsIMsgThread *thread, nsMsgViewIndex threadIndex, PRBool ignored)
nsresult DownloadForOffline (nsIMsgWindow *window, nsMsgViewIndex *indices, PRInt32 numIndices)
nsresult DownloadFlaggedForOffline (nsIMsgWindow *window)
nsMsgViewIndex GetThreadFromMsgIndex (nsMsgViewIndex index, nsIMsgThread **threadHdr)
nsresult GetFieldTypeAndLenForSort (nsMsgViewSortTypeValue sortType, PRUint16 *pMaxLen, eFieldType *pFieldType)
nsresult GetCollationKey (nsIMsgDBHdr *msgHdr, nsMsgViewSortTypeValue sortType, PRUint8 **result, PRUint32 *len, nsIMsgCustomColumnHandler *colHandler=nsnull)
nsresult GetLongField (nsIMsgDBHdr *msgHdr, nsMsgViewSortTypeValue sortType, PRUint32 *result, nsIMsgCustomColumnHandler *colHandler=nsnull)
nsresult GetStatusSortValue (nsIMsgDBHdr *msgHdr, PRUint32 *result)
nsresult GetLocationCollationKey (nsIMsgDBHdr *msgHdr, PRUint8 **result, PRUint32 *len)
nsresult NavigateFromPos (nsMsgNavigationTypeValue motion, nsMsgViewIndex startIndex, nsMsgKey *pResultKey, nsMsgViewIndex *pResultIndex, nsMsgViewIndex *pThreadIndex, PRBool wrap)
nsresult FindNextFlagged (nsMsgViewIndex startIndex, nsMsgViewIndex *pResultIndex)
nsresult FindFirstNew (nsMsgViewIndex *pResultIndex)
nsresult FindPrevUnread (nsMsgKey startKey, nsMsgKey *pResultKey, nsMsgKey *resultThreadId)
nsresult FindFirstFlagged (nsMsgViewIndex *pResultIndex)
nsresult FindPrevFlagged (nsMsgViewIndex startIndex, nsMsgViewIndex *pResultIndex)
nsresult MarkThreadOfMsgRead (nsMsgKey msgId, nsMsgViewIndex msgIndex, nsMsgKeyArray &idsMarkedRead, PRBool bRead)
nsresult MarkThreadRead (nsIMsgThread *threadHdr, nsMsgViewIndex threadIndex, nsMsgKeyArray &idsMarkedRead, PRBool bRead)
PRBool IsValidIndex (nsMsgViewIndex index)
nsresult ToggleIgnored (nsMsgViewIndex *indices, PRInt32 numIndices, nsMsgViewIndex *resultIndex, PRBool *resultToggleState)
PRBool OfflineMsgSelected (nsMsgViewIndex *indices, PRInt32 numIndices)
PRBool NonDummyMsgSelected (nsMsgViewIndex *indices, PRInt32 numIndices)
PRUnicharGetString (const PRUnichar *aStringName)
nsresult GetPrefLocalizedString (const char *aPrefName, nsString &aResult)
nsresult GetLabelPrefStringAndAtom (const char *aPrefName, nsString &aColor, nsIAtom **aColorAtom)
nsresult AppendKeywordProperties (const char *keywords, nsISupportsArray *properties, PRBool addSelectedTextProperty)
nsresult InitLabelStrings (void)
nsresult CopyDBView (nsMsgDBView *aNewMsgDBView, nsIMessenger *aMessengerInstance, nsIMsgWindow *aMsgWindow, nsIMsgDBViewCommandUpdater *aCmdUpdater)
void InitializeAtomsAndLiterals ()
virtual PRInt32 FindLevelInThread (nsIMsgDBHdr *msgHdr, nsMsgViewIndex startOfThread, nsMsgViewIndex viewIndex)
nsresult GetImapDeleteModel (nsIMsgFolder *folder)
nsresult UpdateDisplayMessage (nsMsgViewIndex viewPosition)
PRBool AdjustReadFlag (nsIMsgDBHdr *msgHdr, PRUint32 *msgFlags)
void FreeAll (nsVoidArray *ptrs)
void ClearHdrCache ()
nsIMsgCustomColumnHandlerGetColumnHandler (const PRUnichar *)
nsIMsgCustomColumnHandlerGetCurColumnHandlerFromDBInfo ()

Static Protected Member Functions

static nsresult InitDisplayFormats ()

Protected Attributes

PRBool m_havePrevView
nsMsgKeyArray m_prevKeys
nsUInt32Array m_prevFlags
nsUint8Array m_prevLevels
nsCOMPtr< nsISimpleEnumeratorm_threadEnumerator
nsCOMPtr< nsITreeBoxObjectmTree
nsCOMPtr< nsITreeSelectionmTreeSelection
PRUint32 mNumSelectedRows
PRPackedBool mSuppressMsgDisplay
PRPackedBool mSuppressCommandUpdating
PRPackedBool mRemovingRow
PRPackedBool mCommandsNeedDisablingBecauseOfSelection
PRPackedBool mSuppressChangeNotification
PRPackedBool mGoForwardEnabled
PRPackedBool mGoBackEnabled
nsMsgKeyArray m_keys
nsUInt32Array m_flags
nsUint8Array m_levels
nsMsgImapDeleteModel mDeleteModel
nsCOMPtr< nsIMsgDBHdrm_cachedHdr
nsMsgKey m_cachedMsgKey
nsMsgKey m_currentlyDisplayedMsgKey
nsCString m_currentlyDisplayedMsgUri
nsMsgViewIndex m_currentlyDisplayedViewIndex
PRPackedBool m_deletingRows
PRPackedBool mIsNews
PRPackedBool mShowSizeInLines
PRPackedBool m_sortValid
PRUint8 m_saveRestoreSelectionDepth
nsCOMPtr< nsIMsgDatabasem_db
nsCOMPtr< nsIMsgFolderm_folder
nsCOMPtr< nsIMsgFolderm_viewFolder
nsCOMPtr< nsIAtommRedirectorTypeAtom
nsCOMPtr< nsIAtommMessageTypeAtom
nsMsgViewSortTypeValue m_sortType
nsMsgViewSortOrderValue m_sortOrder
nsMsgViewFlagsTypeValue m_viewFlags
nsCOMPtr< nsIDateTimeFormatmDateFormater
nsCOMPtr< nsIMsgHeaderParsermHeaderParser
nsCOMPtr< nsIMsgTagServicemTagService
nsCOMPtr< nsIMessengermMessengerInstance
nsCOMPtr< nsIMsgWindowmMsgWindow
nsCOMPtr
< nsIMsgDBViewCommandUpdater
mCommandUpdater
nsCOMPtr< nsIStringBundlemMessengerStringBundle
nsString mLabelPrefDescriptions [PREF_LABELS_MAX]
nsString mLabelPrefColors [PREF_LABELS_MAX]
PRUint32 mNumMessagesRemainingInBatch
nsMsgViewIndexmJunkIndices
PRUint32 mNumJunkIndices
nsUInt32Array mIndicesToNoteChange
nsCOMArray
< nsIMsgCustomColumnHandler
m_customColumnHandlers
nsStringArray m_customColumnHandlerIDs

Static Protected Attributes

static nsrefcnt gInstanceCount = 0
static nsIAtomkUnreadMsgAtom = nsnull
static nsIAtomkNewMsgAtom = nsnull
static nsIAtomkReadMsgAtom = nsnull
static nsIAtomkRepliedMsgAtom = nsnull
static nsIAtomkForwardedMsgAtom = nsnull
static nsIAtomkOfflineMsgAtom = nsnull
static nsIAtomkFlaggedMsgAtom = nsnull
static nsIAtomkImapDeletedMsgAtom = nsnull
static nsIAtomkAttachMsgAtom = nsnull
static nsIAtomkHasUnreadAtom = nsnull
static nsIAtomkWatchThreadAtom = nsnull
static nsIAtomkIgnoreThreadAtom = nsnull
static nsIAtomkHasImageAtom = nsnull
static PRUnicharkHighestPriorityString = nsnull
static PRUnicharkHighPriorityString = nsnull
static PRUnicharkLowestPriorityString = nsnull
static PRUnicharkLowPriorityString = nsnull
static PRUnicharkNormalPriorityString = nsnull
static nsIAtomkLabelColorWhiteAtom = nsnull
static nsIAtomkLabelColorBlackAtom = nsnull
static nsIAtomkJunkMsgAtom = nsnull
static nsIAtomkNotJunkMsgAtom = nsnull
static nsIAtomkDummyMsgAtom = nsnull
static PRUnicharkReadString = nsnull
static PRUnicharkRepliedString = nsnull
static PRUnicharkForwardedString = nsnull
static PRUnicharkNewString = nsnull
static PRUnicharkKiloByteString = nsnull
static nsIAtommLabelPrefColorAtoms [PREF_LABELS_MAX]

Detailed Description

Definition at line 58 of file nsMsgSpecialViews.h.


Member Function Documentation

void nsIMsgDBView::addColumnHandler ( in AString  aColumn,
in nsIMsgCustomColumnHandler  aHandler 
) [inherited]
nsresult nsMsgDBView::AddHdr ( nsIMsgDBHdr msgHdr) [protected, virtual, inherited]

Definition at line 4396 of file nsMsgDBView.cpp.

{
  PRUint32    flags = 0;
#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

  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);

  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;
  nsMsgViewIndex insertIndex = GetInsertIndex(msgHdr);
  if (insertIndex == nsMsgViewIndex_None)
  {
    // if unreadonly, level is 0 because we must be the only msg in the thread.
    PRInt32 levelToAdd = 0;
    
    if (m_sortOrder == nsMsgViewSortOrder::ascending)
    {
      m_keys.Add(msgKey);
      m_flags.Add(flags);
      m_levels.Add(levelToAdd);
      
      // the call to NoteChange() has to happen after we add the key
      // as NoteChange() will call RowCountChanged() which will call our GetRowCount()
      NoteChange(GetSize() - 1, 1, nsMsgViewNotificationCode::insertOrDelete);
    }
    else
    {
      m_keys.InsertAt(0, msgKey);
      m_flags.InsertAt(0, flags);
      m_levels.InsertAt(0, levelToAdd);
      
      // the call to NoteChange() has to happen after we insert the key
      // as NoteChange() will call RowCountChanged() which will call our GetRowCount()
      NoteChange(0, 1, nsMsgViewNotificationCode::insertOrDelete);
    }
    m_sortValid = PR_FALSE;
  }
  else
  {
    m_keys.InsertAt(insertIndex, msgKey);
    m_flags.InsertAt(insertIndex, flags);
    PRInt32 level = 0; 
    m_levels.InsertAt(insertIndex, level);
    
    // the call to NoteChange() has to happen after we add the key
    // as NoteChange() will call RowCountChanged() which will call our GetRowCount()
    NoteChange(insertIndex, 1, nsMsgViewNotificationCode::insertOrDelete);
  }
  OnHeaderAddedOrDeleted();
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgThreadedDBView::AddKeys ( nsMsgKey pKeys,
PRInt32 pFlags,
const char *  pLevels,
nsMsgViewSortTypeValue  sortType,
PRInt32  numKeysToAdd 
) [virtual, inherited]

Definition at line 236 of file nsMsgThreadedDBView.cpp.

{
  PRInt32     numAdded = 0;
  // Allocate enough space first to avoid memory allocation/deallocation.
  m_keys.AllocateSpace(numKeysToAdd+m_keys.GetSize());
  m_flags.AllocateSpace(numKeysToAdd+m_flags.GetSize());
  m_levels.AllocateSpace(numKeysToAdd+m_levels.GetSize());
  for (PRInt32 i = 0; i < numKeysToAdd; i++)
  {
    PRInt32 threadFlag = pFlags[i];
    PRInt32 flag = threadFlag;
    
    // skip ignored threads.
    if ((threadFlag & MSG_FLAG_IGNORED) && !(m_viewFlags & nsMsgViewFlagsType::kShowIgnored))
      continue;
    // by default, make threads collapsed, unless we're in only viewing new msgs
    
    if (flag & MSG_VIEW_FLAG_HASCHILDREN)
      flag |= MSG_FLAG_ELIDED;
    // should this be persistent? Doesn't seem to need to be.
    flag |= MSG_VIEW_FLAG_ISTHREAD;
    m_keys.Add(pKeys[i]);
    m_flags.Add(flag);
    m_levels.Add(pLevels[i]);
    numAdded++;
    // we expand as we build the view, which allows us to insert at the end of the key array,
    // instead of the middle, and is much faster.
    if ((!(m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay) || m_viewFlags & nsMsgViewFlagsType::kExpandAll) && flag & MSG_FLAG_ELIDED)
       ExpandByIndex(m_keys.GetSize() - 1, NULL);
  }
  return numAdded;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgWatchedThreadsWithUnreadDBView::AddMsgToThreadNotInView ( nsIMsgThread threadHdr,
nsIMsgDBHdr msgHdr,
PRBool  ensureListed 
) [protected, virtual]

Reimplemented from nsMsgThreadedDBView.

Definition at line 133 of file nsMsgSpecialViews.cpp.

{
  nsresult rv = NS_OK;
  PRUint32 threadFlags;
  PRUint32 msgFlags;
  msgHdr->GetFlags(&msgFlags);
  threadHdr->GetFlags(&threadFlags);
  if (threadFlags & MSG_FLAG_WATCHED)
  {
    nsCOMPtr <nsIMsgDBHdr> parentHdr;
    GetFirstMessageHdrToDisplayInThread(threadHdr, getter_AddRefs(parentHdr));
    if (parentHdr && (ensureListed || !(msgFlags & MSG_FLAG_READ)))
    {
      PRUint32 numChildren;
      threadHdr->GetNumChildren(&numChildren);
      rv = AddHdr(parentHdr);
      if (numChildren > 1)
      {
        nsMsgKey key;
        parentHdr->GetMessageKey(&key);
        nsMsgViewIndex viewIndex = FindViewIndex(key);
        if (viewIndex != nsMsgViewIndex_None)
          OrExtraFlag(viewIndex, MSG_FLAG_ELIDED | MSG_VIEW_FLAG_ISTHREAD | MSG_VIEW_FLAG_HASCHILDREN | MSG_FLAG_WATCHED);
      }
    }
  }
  return rv;
}

Here is the call graph for this function:

PRBool nsMsgDBView::AdjustReadFlag ( nsIMsgDBHdr msgHdr,
PRUint32 msgFlags 
) [protected, inherited]

Definition at line 4943 of file nsMsgDBView.cpp.

{
  PRBool isRead = PR_FALSE;
  nsMsgKey msgKey;
  msgHdr->GetMessageKey(&msgKey);
  m_db->IsRead(msgKey, &isRead);
    // just make sure flag is right in db.
#ifdef DEBUG_bienvenu
  NS_ASSERTION(isRead == (*msgFlags & MSG_FLAG_READ != 0), "msgFlags out of sync");
#endif
  if (isRead)
    *msgFlags |= MSG_FLAG_READ;
  else
    *msgFlags &= ~MSG_FLAG_READ;
  m_db->MarkHdrRead(msgHdr, isRead, nsnull);
  return isRead;
}

Here is the caller graph for this function:

nsresult nsMsgDBView::AdjustRowCount ( PRInt32  rowCountBeforeSort,
PRInt32  rowCountAfterSort 
) [protected, inherited]

Definition at line 5840 of file nsMsgDBView.cpp.

{
  PRInt32 rowChange = rowCountAfterSort - rowCountBeforeSort;

  if (rowChange) 
  {
    // this is not safe to use when you have a selection
    // RowCountChanged() will call AdjustSelection()
    PRUint32 numSelected = 0;
    GetNumSelected(&numSelected);
    NS_ASSERTION(numSelected == 0, "it is not save to call AdjustRowCount() when you have a selection");

    if (mTree)
      mTree->RowCountChanged(0, rowChange);
  }
  return NS_OK;
}

Here is the caller graph for this function:

nsresult nsMsgDBView::AndExtraFlag ( nsMsgViewIndex  index,
PRUint32  andflag 
) [protected, inherited]

Definition at line 5420 of file nsMsgDBView.cpp.

{
  PRUint32    flag;
  if (!IsValidIndex(index))
    return NS_MSG_INVALID_DBVIEW_INDEX;
  flag = m_flags[index];
  flag &= andflag;
  m_flags[index] = flag;
  OnExtraFlagChanged(index, flag);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::AppendKeywordProperties ( const char *  keywords,
nsISupportsArray properties,
PRBool  addSelectedTextProperty 
) [protected, inherited]

Definition at line 321 of file nsMsgDBView.cpp.

{
  // get the top most keyword's color and append that as a property.
  nsresult rv;
  if (!mTagService)
  {
    mTagService = do_GetService(NS_MSGTAGSERVICE_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, rv);
  }
  
  nsCString topKey;
  rv = mTagService->GetTopKey(keywords, topKey);
  NS_ENSURE_SUCCESS(rv, rv);
  if (topKey.IsEmpty())
    return NS_OK;
  
  nsCString color;
  rv = mTagService->GetColorForKey(topKey, color);
  if (NS_SUCCEEDED(rv) && !color.IsEmpty())
  {
    if (addSelectedTextProperty)
      properties->AppendElement(color.EqualsLiteral(LABEL_COLOR_WHITE_STRING) 
        ? kLabelColorBlackAtom
        : kLabelColorWhiteAtom);  
    color.Replace(0, 1, NS_LITERAL_CSTRING(LABEL_COLOR_STRING));
    nsCOMPtr <nsIAtom> keywordAtom = do_GetAtom(color.get());
    properties->AppendElement(keywordAtom);
  }
  return rv;
}

Here is the call graph for this function:

nsresult nsMsgDBView::ApplyCommandToIndices ( nsMsgViewCommandTypeValue  command,
nsMsgViewIndex indices,
PRInt32  numIndices 
) [protected, virtual, inherited]

Definition at line 2375 of file nsMsgDBView.cpp.

{
  NS_ASSERTION(numIndices >= 0, "nsMsgDBView::ApplyCommandToIndices(): "
               "numIndices is negative!");

  if (numIndices == 0) 
      return NS_OK; // return quietly, just in case

  nsCOMPtr<nsIMsgFolder> folder;
  nsresult rv = GetFolderForViewIndex(indices[0], getter_AddRefs(folder));

  if (command == nsMsgViewCommandType::deleteMsg)
    return DeleteMessages(mMsgWindow, indices, numIndices, PR_FALSE);
  if (command == nsMsgViewCommandType::deleteNoTrash)
    return DeleteMessages(mMsgWindow, indices, numIndices, PR_TRUE);

  nsMsgKeyArray imapUids;
  nsCOMPtr <nsIMsgImapMailFolder> imapFolder = do_QueryInterface(folder);
  PRBool thisIsImapFolder = (imapFolder != nsnull);
  nsCOMPtr<nsIJunkMailPlugin> junkPlugin;

  // if this is a junk command, start a batch or add to an existing one. 
  //  
  if (    command == nsMsgViewCommandType::junk
       || command == nsMsgViewCommandType::unjunk ) 
  {
    // get the folder from the first item; we assume that
    // all messages in the view are from the same folder (no
    // more junk status column in the 'search messages' dialog
    // like in earlier versions...)
     //
     NS_ENSURE_SUCCESS(rv, rv);

     nsCOMPtr<nsIMsgIncomingServer> server;
     rv = folder->GetServer(getter_AddRefs(server));
     NS_ENSURE_SUCCESS(rv, rv);

    if (command == nsMsgViewCommandType::junk)
    {
      // append this batch of junk message indices to the
      // array of junk message indices to be acted upon
      // once OnMessageClassified() is run for the last message
      //
      // note: although message classification is done
      // asynchronously, it is not done in a different thread,
      // so the manipulations of mJunkIndices here and in
      // OnMessageClassified() cannot interrupt each other
      //
      mNumJunkIndices += numIndices;
      mJunkIndices = (nsMsgViewIndex *)nsMemory::Realloc(mJunkIndices, mNumJunkIndices * sizeof(nsMsgViewIndex));
      memcpy(mJunkIndices + (mNumJunkIndices - numIndices), indices, numIndices * sizeof(nsMsgViewIndex));
    }
   
    nsCOMPtr<nsIMsgFilterPlugin> filterPlugin;
    rv = server->GetSpamFilterPlugin(getter_AddRefs(filterPlugin));
    NS_ENSURE_SUCCESS(rv, rv);

    junkPlugin = do_QueryInterface(filterPlugin, &rv);
    NS_ENSURE_SUCCESS(rv, rv);

    // note that if we aren't starting a batch we are
    // actually coalescing the batch of messages this
    // function was called for with the previous
    // batch(es)
    mNumMessagesRemainingInBatch += numIndices;
  }
         
  folder->EnableNotifications(nsIMsgFolder::allMessageCountNotifications, PR_FALSE, PR_TRUE /*dbBatching*/);

  for (int32 i = 0; i < numIndices; i++)
  {
    if (thisIsImapFolder && command != nsMsgViewCommandType::markThreadRead)
      imapUids.Add(GetAt(indices[i]));
    
    switch (command)
    {
    case nsMsgViewCommandType::markMessagesRead:
      rv = SetReadByIndex(indices[i], PR_TRUE);
      break;
    case nsMsgViewCommandType::markMessagesUnread:
      rv = SetReadByIndex(indices[i], PR_FALSE);
      break;
    case nsMsgViewCommandType::toggleMessageRead:
      rv = ToggleReadByIndex(indices[i]);
      break;
    case nsMsgViewCommandType::flagMessages:
      rv = SetFlaggedByIndex(indices[i], PR_TRUE);
      break;
    case nsMsgViewCommandType::unflagMessages:
      rv = SetFlaggedByIndex(indices[i], PR_FALSE);
      break;
    case nsMsgViewCommandType::markThreadRead:
      rv = SetThreadOfMsgReadByIndex(indices[i], imapUids, PR_TRUE);
      break;
    case nsMsgViewCommandType::junk:
      rv = SetAsJunkByIndex(junkPlugin.get(), indices[i],
                             nsIJunkMailPlugin::JUNK);
      break;
    case nsMsgViewCommandType::unjunk:
    rv = SetAsJunkByIndex(junkPlugin.get(), indices[i], 
                             nsIJunkMailPlugin::GOOD);
      break;
    case nsMsgViewCommandType::undeleteMsg:
      break; // this is completely handled in the imap code below.
    default:
      NS_ASSERTION(PR_FALSE, "unhandled command");
      break;
    }
  }

  folder->EnableNotifications(nsIMsgFolder::allMessageCountNotifications, PR_TRUE, PR_TRUE /*dbBatching*/);

  if (thisIsImapFolder)
  {
    imapMessageFlagsType flags = kNoImapMsgFlag;
    PRBool addFlags = PR_FALSE;
    PRBool isRead = PR_FALSE;
    
    switch (command)
    {
    case nsMsgViewCommandType::markThreadRead:
    case nsMsgViewCommandType::markMessagesRead:
      flags |= kImapMsgSeenFlag;
      addFlags = PR_TRUE;
      break;
    case nsMsgViewCommandType::markMessagesUnread:
      flags |= kImapMsgSeenFlag;
      addFlags = PR_FALSE;
      break;
    case nsMsgViewCommandType::toggleMessageRead:
      {
        flags |= kImapMsgSeenFlag;
        m_db->IsRead(GetAt(indices[0]), &isRead);
        if (isRead)
          addFlags = PR_TRUE;
        else
          addFlags = PR_FALSE;
      }
      break;
    case nsMsgViewCommandType::flagMessages:
      flags |= kImapMsgFlaggedFlag;
      addFlags = PR_TRUE;
      break;
    case nsMsgViewCommandType::unflagMessages:
      flags |= kImapMsgFlaggedFlag;
      addFlags = PR_FALSE;
      break;
    case nsMsgViewCommandType::undeleteMsg:
      flags = kImapMsgDeletedFlag;
      addFlags = PR_FALSE;
      break;
    case nsMsgViewCommandType::junk:
        return imapFolder->StoreCustomKeywords(mMsgWindow,
                    "Junk",
                    "NonJunk",
                    imapUids.GetArray(), imapUids.GetSize(),
                    nsnull);
    case nsMsgViewCommandType::unjunk:
        return imapFolder->StoreCustomKeywords(mMsgWindow,
                    "NonJunk",
                    "Junk",
                    imapUids.GetArray(), imapUids.GetSize(),
                    nsnull);

    default:
      break;
    }
    
    if (flags != kNoImapMsgFlag)   // can't get here without thisIsImapThreadPane == TRUE
      imapFolder->StoreImapFlags(flags, addFlags, imapUids.GetArray(), imapUids.GetSize(), nsnull);
    
  }
   
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::ApplyCommandToIndicesWithFolder ( nsMsgViewCommandTypeValue  command,
nsMsgViewIndex indices,
PRInt32  numIndices,
nsIMsgFolder destFolder 
) [protected, virtual, inherited]

Reimplemented in nsMsgSearchDBView.

Definition at line 2348 of file nsMsgDBView.cpp.

{
  nsresult rv = NS_OK;

  NS_ENSURE_ARG_POINTER(destFolder);

  switch (command) {
    case nsMsgViewCommandType::copyMessages:
        NS_ASSERTION(!(m_folder == destFolder), "The source folder and the destination folder are the same");
        if (m_folder != destFolder)
          rv = CopyMessages(mMsgWindow, indices, numIndices, PR_FALSE /* isMove */, destFolder);
        break;
    case nsMsgViewCommandType::moveMessages:
        NS_ASSERTION(!(m_folder == destFolder), "The source folder and the destination folder are the same");
        if (m_folder != destFolder)
          rv = CopyMessages(mMsgWindow, indices, numIndices, PR_TRUE  /* isMove */, destFolder);
        break;
    default:
        NS_ASSERTION(PR_FALSE, "unhandled command");
        rv = NS_ERROR_UNEXPECTED;
        break;
    }
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

boolean nsITreeView::canDrop ( in long  index,
in long  orientation 
) [inherited]

Methods used by the drag feedback code to determine if a drag is allowable at the current location.

To get the behavior where drops are only allowed on items, such as the mailNews folder pane, always return false when the orientation is not DROP_ON.

void nsMsgDBView::ClearHdrCache ( ) [protected, inherited]

Definition at line 4763 of file nsMsgDBView.cpp.

Here is the caller graph for this function:

void nsMsgThreadedDBView::ClearPrevIdArray ( ) [protected, inherited]

Definition at line 542 of file nsMsgThreadedDBView.cpp.

{
  m_prevKeys.RemoveAll();
  m_prevLevels.RemoveAll();
  m_prevFlags.RemoveAll();
  m_havePrevView = PR_FALSE;
}

Here is the caller graph for this function:

NS_IMETHODIMP nsMsgWatchedThreadsWithUnreadDBView::CloneDBView ( nsIMessenger aMessengerInstance,
nsIMsgWindow aMsgWindow,
nsIMsgDBViewCommandUpdater aCommandUpdater,
nsIMsgDBView **  _retval 
)

Reimplemented from nsMsgThreadedDBView.

Definition at line 163 of file nsMsgSpecialViews.cpp.

{
  nsMsgWatchedThreadsWithUnreadDBView* newMsgDBView;
  NS_NEWXPCOM(newMsgDBView, nsMsgWatchedThreadsWithUnreadDBView);

  if (!newMsgDBView)
    return NS_ERROR_OUT_OF_MEMORY;

  nsresult rv = CopyDBView(newMsgDBView, aMessengerInstance, aMsgWindow, aCmdUpdater);
  NS_ENSURE_SUCCESS(rv,rv);

  NS_IF_ADDREF(*_retval = newMsgDBView);
  return NS_OK;
}

Here is the call graph for this function:

nsIMsgDBView nsIMsgDBView::cloneDBView ( in nsIMessenger  aMessengerInstance,
in nsIMsgWindow  aMsgWindow,
in nsIMsgDBViewCommandUpdater  aCommandUpdater 
) [inherited]

Reimplemented in nsMsgGroupView.

Definition at line 119 of file nsMsgThreadedDBView.cpp.

{
  return nsMsgDBView::Close();
}
void nsIMsgDBView::close ( ) [inherited]
nsresult nsMsgDBView::CollapseAll ( ) [protected, inherited]

Definition at line 4155 of file nsMsgDBView.cpp.

{
  for (PRInt32 i = 0; i < GetSize(); i++)
  {
    PRUint32 numExpanded;
    PRUint32 flags = m_flags[i];
    if (!(flags & MSG_FLAG_ELIDED) && (flags & MSG_VIEW_FLAG_HASCHILDREN))
      CollapseByIndex(i, &numExpanded);
  }
  return NS_OK;
}

Here is the call graph for this function:

nsresult nsMsgDBView::CollapseByIndex ( nsMsgViewIndex  index,
PRUint32 pNumCollapsed 
) [protected, inherited]

Definition at line 4167 of file nsMsgDBView.cpp.

{
  nsMsgKey           firstIdInThread;
  nsresult    rv;
  PRInt32     flags = m_flags[index];
  PRInt32     threadCount = 0;
  
  if (flags & MSG_FLAG_ELIDED || !(m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay) || !(flags & MSG_VIEW_FLAG_HASCHILDREN))
    return NS_OK;
  flags  |= MSG_FLAG_ELIDED;
  
  if (index > m_keys.GetSize())
    return NS_MSG_MESSAGE_NOT_FOUND;
  
  firstIdInThread = m_keys[index];
  nsCOMPtr <nsIMsgDBHdr> msgHdr;
  rv = m_db->GetMsgHdrForKey(firstIdInThread, getter_AddRefs(msgHdr));
  if (NS_FAILED(rv) || msgHdr == nsnull)
  {
    NS_ASSERTION(PR_FALSE, "error collapsing thread");
    return NS_MSG_MESSAGE_NOT_FOUND;
  }
  
  m_flags[index] = flags;
  NoteChange(index, 1, nsMsgViewNotificationCode::changed);
  
  rv = ExpansionDelta(index, &threadCount);
  if (NS_SUCCEEDED(rv))
  {
    PRInt32 numRemoved = threadCount; // don't count first header in thread
    NoteStartChange(index + 1, -numRemoved, nsMsgViewNotificationCode::insertOrDelete);
    // start at first id after thread.
    for (int i = 1; i <= threadCount && index + 1 < m_keys.GetSize(); i++)
    {
      m_keys.RemoveAt(index + 1);
      m_flags.RemoveAt(index + 1);
      m_levels.RemoveAt(index + 1);
    }
    if (pNumCollapsed != nsnull)
      *pNumCollapsed = numRemoved; 
    NoteEndChange(index + 1, -numRemoved, nsMsgViewNotificationCode::insertOrDelete);
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::CopyDBView ( nsMsgDBView aNewMsgDBView,
nsIMessenger aMessengerInstance,
nsIMsgWindow aMsgWindow,
nsIMsgDBViewCommandUpdater aCmdUpdater 
) [protected, inherited]

Reimplemented in nsMsgXFVirtualFolderDBView, and nsMsgSearchDBView.

Definition at line 5952 of file nsMsgDBView.cpp.

{
  NS_ENSURE_ARG_POINTER(aNewMsgDBView);

  aNewMsgDBView->mMsgWindow = aMsgWindow;
  if (aMsgWindow)
    aMsgWindow->SetOpenFolder(m_viewFolder? m_viewFolder : m_folder);
  aNewMsgDBView->mMessengerInstance = aMessengerInstance;
  aNewMsgDBView->mCommandUpdater = aCmdUpdater;
  aNewMsgDBView->m_folder = m_folder;
  aNewMsgDBView->m_viewFlags = m_viewFlags;
  aNewMsgDBView->m_sortOrder = m_sortOrder;
  aNewMsgDBView->m_sortType = m_sortType;
  aNewMsgDBView->m_sortValid = m_sortValid;
  aNewMsgDBView->m_db = m_db;
  aNewMsgDBView->mDateFormater = mDateFormater;
  if (m_db)
    aNewMsgDBView->m_db->AddListener(aNewMsgDBView);
  aNewMsgDBView->mIsNews = mIsNews;
  aNewMsgDBView->mShowSizeInLines = mShowSizeInLines;
  aNewMsgDBView->mHeaderParser = mHeaderParser;
  aNewMsgDBView->mDeleteModel = mDeleteModel;
  aNewMsgDBView->m_flags.CopyArray(m_flags);
  aNewMsgDBView->m_levels.CopyArray(m_levels);
  aNewMsgDBView->m_keys.CopyArray(m_keys);

  return NS_OK;
}

Here is the caller graph for this function:

nsresult nsMsgDBView::CopyMessages ( nsIMsgWindow window,
nsMsgViewIndex indices,
PRInt32  numIndices,
PRBool  isMove,
nsIMsgFolder destFolder 
) [protected, virtual, inherited]

Reimplemented in nsMsgSearchDBView.

Definition at line 2310 of file nsMsgDBView.cpp.

{
  if (m_deletingRows)
  {
    NS_ASSERTION(PR_FALSE, "Last move did not complete");
    return NS_OK;
  }
  
  m_deletingRows = isMove && mDeleteModel != nsMsgImapDeleteModels::IMAPDelete;

  nsresult rv;
  NS_ENSURE_ARG_POINTER(destFolder);
  nsCOMPtr<nsISupportsArray> messageArray;
  NS_NewISupportsArray(getter_AddRefs(messageArray));
  for (nsMsgViewIndex index = 0; index < (nsMsgViewIndex) numIndices; index++) 
  {
    nsMsgKey key;
    nsMsgViewIndex viewIndex = indices[index];
    if (viewIndex == nsMsgViewIndex_None)
      continue;
    key = m_keys.GetAt(viewIndex);
    nsCOMPtr <nsIMsgDBHdr> msgHdr;
    rv = m_db->GetMsgHdrForKey(key, getter_AddRefs(msgHdr));
    if (NS_SUCCEEDED(rv) && msgHdr)
    {
      messageArray->AppendElement(msgHdr);
      // if we are deleting rows, save off the keys
      if (m_deletingRows)
        mIndicesToNoteChange.Add(indices[index]);
    }
  }
  
  nsCOMPtr<nsIMsgCopyService> copyService = do_GetService(NS_MSGCOPYSERVICE_CONTRACTID, &rv);
  NS_ENSURE_SUCCESS(rv, rv);
  return copyService->CopyMessages(m_folder /* source folder */, messageArray, destFolder, isMove, nsnull /* listener */, window, PR_TRUE /*allowUndo*/);
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsMsgDBView::CountExpandedThread ( nsMsgViewIndex  index) [protected, inherited]

Definition at line 3943 of file nsMsgDBView.cpp.

{
  PRInt32 numInThread = 0;
  nsMsgViewIndex startOfThread = index;
  while ((PRInt32) startOfThread >= 0 && m_levels[startOfThread] != 0)
    startOfThread--;
  nsMsgViewIndex threadIndex = startOfThread;
  do
  {
    threadIndex++;
    numInThread++;
  }
  while ((PRInt32) threadIndex < m_levels.GetSize() && m_levels[threadIndex] != 0);
  
  return numInThread;
}

Here is the caller graph for this function:

void nsITreeView::cycleCell ( in long  row,
in nsITreeColumn  col 
) [inherited]

Called on the view when a cell in a non-selectable cycling column (e.g., unread/flag/etc.) is clicked.

Called on the view when a header is clicked.

nsresult nsMsgDBView::CycleThreadedColumn ( nsIDOMElement aElement) [protected, inherited]

Definition at line 846 of file nsMsgDBView.cpp.

{
  nsAutoString currentView;

  // toggle threaded/unthreaded mode
  aElement->GetAttribute(NS_LITERAL_STRING("currentView"), currentView);
  if (currentView.EqualsLiteral("threaded"))
  {
    aElement->SetAttribute(NS_LITERAL_STRING("currentView"), NS_LITERAL_STRING("unthreaded"));

  }
  else
  {
     aElement->SetAttribute(NS_LITERAL_STRING("currentView"), NS_LITERAL_STRING("threaded"));
     // we must be unthreaded view. create a threaded view and replace ourself.

  }

  // i think we need to create a new view and switch it in this circumstance since
  // we are toggline between threaded and non threaded mode.


  return NS_OK;
}
nsresult nsMsgDBView::DeleteMessages ( nsIMsgWindow window,
nsMsgViewIndex indices,
PRInt32  numIndices,
PRBool  deleteStorage 
) [protected, virtual, inherited]

Reimplemented in nsMsgSearchDBView.

Definition at line 2572 of file nsMsgDBView.cpp.

{
  if (m_deletingRows)  
  {
    NS_WARNING("Last delete did not complete");
    return NS_OK;
  }

  if (mDeleteModel != nsMsgImapDeleteModels::IMAPDelete)
    m_deletingRows = PR_TRUE;

  nsresult rv;
  nsCOMPtr<nsISupportsArray> messageArray;
  NS_NewISupportsArray(getter_AddRefs(messageArray));
  for (nsMsgViewIndex index = 0; index < (nsMsgViewIndex) numIndices; index++)
  {
    if (m_flags[indices[index]] & MSG_VIEW_FLAG_DUMMY)
      continue;
    nsMsgKey key = m_keys.GetAt(indices[index]);
    nsCOMPtr <nsIMsgDBHdr> msgHdr;
    rv = m_db->GetMsgHdrForKey(key, getter_AddRefs(msgHdr));
    if (NS_SUCCEEDED(rv) && msgHdr)
    {
      messageArray->AppendElement(msgHdr);
      // if we are deleting rows, save off the keys
      if (m_deletingRows)
        mIndicesToNoteChange.Add(indices[index]);
    }
  }
  
  rv = m_folder->DeleteMessages(messageArray, window, deleteStorage, PR_FALSE, nsnull, PR_TRUE /*allow Undo*/ );
  if (NS_FAILED(rv))
    m_deletingRows = PR_FALSE;
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsMsgDBView::DisableChangeUpdates ( ) [protected, inherited]

Definition at line 4774 of file nsMsgDBView.cpp.

Here is the caller graph for this function:

nsresult nsMsgDBView::DownloadFlaggedForOffline ( nsIMsgWindow window) [protected, inherited]

Definition at line 2631 of file nsMsgDBView.cpp.

{
  nsresult rv = NS_OK;
  nsCOMPtr<nsISupportsArray> messageArray;
  NS_NewISupportsArray(getter_AddRefs(messageArray));
  nsCOMPtr <nsISimpleEnumerator> enumerator;
  rv = m_db->EnumerateMessages(getter_AddRefs(enumerator));
  if (NS_SUCCEEDED(rv) && enumerator)
  {
    PRBool hasMore;
    
    while (NS_SUCCEEDED(rv = enumerator->HasMoreElements(&hasMore)) && (hasMore == PR_TRUE)) 
    {
      nsCOMPtr <nsIMsgDBHdr> pHeader;
      rv = enumerator->GetNext(getter_AddRefs(pHeader));
      NS_ASSERTION(NS_SUCCEEDED(rv), "nsMsgDBEnumerator broken");
      if (pHeader && NS_SUCCEEDED(rv))
      {
        PRUint32 flags;
        pHeader->GetFlags(&flags);
        if ((flags & MSG_FLAG_MARKED) && !(flags & MSG_FLAG_OFFLINE))
          messageArray->AppendElement(pHeader);
      }
    }
  }
  m_folder->DownloadMessagesForOffline(messageArray, window);
  return rv;
}

Here is the call graph for this function:

nsresult nsMsgDBView::DownloadForOffline ( nsIMsgWindow window,
nsMsgViewIndex indices,
PRInt32  numIndices 
) [protected, inherited]

Definition at line 2608 of file nsMsgDBView.cpp.

{
  nsresult rv = NS_OK;
  nsCOMPtr<nsISupportsArray> messageArray;
  NS_NewISupportsArray(getter_AddRefs(messageArray));
  for (nsMsgViewIndex index = 0; index < (nsMsgViewIndex) numIndices; index++)
  {
    nsMsgKey key = m_keys.GetAt(indices[index]);
    nsCOMPtr <nsIMsgDBHdr> msgHdr;
    rv = m_db->GetMsgHdrForKey(key, getter_AddRefs(msgHdr));
    NS_ENSURE_SUCCESS(rv,rv);
    if (msgHdr)
    {
      PRUint32 flags;
      msgHdr->GetFlags(&flags);
      if (!(flags & MSG_FLAG_OFFLINE))
        messageArray->AppendElement(msgHdr);
    }
  }
  m_folder->DownloadMessagesForOffline(messageArray, window);
  return rv;
}

Here is the call graph for this function:

void nsITreeView::drop ( in long  row,
in long  orientation 
) [inherited]

Called when the user drops something on this view.

The |orientation| param specifies before/on/after the given |row|.

void nsMsgDBView::EnableChangeUpdates ( ) [protected, inherited]

Definition at line 4769 of file nsMsgDBView.cpp.

Here is the caller graph for this function:

nsresult nsMsgDBView::ExpandAll ( ) [protected, inherited]

Definition at line 4090 of file nsMsgDBView.cpp.

{
  if (mTree)
    mTree->BeginUpdateBatch();
  for (PRInt32 i = GetSize() - 1; i >= 0; i--) 
  {
    PRUint32 numExpanded;
    PRUint32 flags = m_flags[i];
    if (flags & MSG_FLAG_ELIDED)
      ExpandByIndex(i, &numExpanded);
  }
  if (mTree)
    mTree->EndUpdateBatch();
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::ExpandAndSelectThread ( ) [protected, inherited]

Definition at line 4019 of file nsMsgDBView.cpp.

{
    nsresult rv;

    NS_ASSERTION(mTreeSelection, "no tree selection");
    if (!mTreeSelection) return NS_ERROR_UNEXPECTED;

    PRInt32 index;
    rv = mTreeSelection->GetCurrentIndex(&index);
    NS_ENSURE_SUCCESS(rv,rv);

    rv = ExpandAndSelectThreadByIndex(index, PR_FALSE);
    NS_ENSURE_SUCCESS(rv,rv);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::ExpandByIndex ( nsMsgViewIndex  index,
PRUint32 pNumExpanded 
) [protected, inherited]

Definition at line 4111 of file nsMsgDBView.cpp.

{
  PRUint32                  flags = m_flags[index];
  nsMsgKey           firstIdInThread;
  //nsMsgKey        startMsg = nsMsgKey_None;
  nsresult           rv = NS_OK;
  PRUint32                  numExpanded = 0;
  
  NS_ASSERTION(flags & MSG_FLAG_ELIDED, "can't expand an already expanded thread");
  flags &= ~MSG_FLAG_ELIDED;
  
  if ((PRUint32) index > m_keys.GetSize())
    return NS_MSG_MESSAGE_NOT_FOUND;
  
  firstIdInThread = m_keys[index];
  nsCOMPtr <nsIMsgDBHdr> msgHdr;
  nsCOMPtr <nsIMsgThread> pThread;
  m_db->GetMsgHdrForKey(firstIdInThread, getter_AddRefs(msgHdr));
  if (msgHdr == nsnull)
  {
    NS_ASSERTION(PR_FALSE, "couldn't find message to expand");
    return NS_MSG_MESSAGE_NOT_FOUND;
  }
  rv = GetThreadContainingMsgHdr(msgHdr, getter_AddRefs(pThread));
  NS_ENSURE_SUCCESS(rv, rv);
  m_flags[index] = flags;
  NoteChange(index, 1, nsMsgViewNotificationCode::changed);
  if (m_viewFlags & nsMsgViewFlagsType::kUnreadOnly)
  {
    if (flags & MSG_FLAG_READ)
      m_levels.Add(0);      // keep top level hdr in thread, even though read.
    rv = ListUnreadIdsInThread(pThread,  index, &numExpanded);
  }
  else
    rv = ListIdsInThread(pThread,  index, &numExpanded);
  
  NoteStartChange(index + 1, numExpanded, nsMsgViewNotificationCode::insertOrDelete);
  
  NoteEndChange(index + 1, numExpanded, nsMsgViewNotificationCode::insertOrDelete);
  if (pNumExpanded != nsnull)
    *pNumExpanded = numExpanded;
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::ExpansionDelta ( nsMsgViewIndex  index,
PRInt32 expansionDelta 
) [protected, virtual, inherited]

Reimplemented in nsMsgQuickSearchDBView.

Definition at line 3962 of file nsMsgDBView.cpp.

{
       PRUint32 numChildren;
       nsresult      rv;

       *expansionDelta = 0;
       if ( index > ((nsMsgViewIndex) m_keys.GetSize()))
              return NS_MSG_MESSAGE_NOT_FOUND;
       char   flags = m_flags[index];

       if (!(m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay))
              return NS_OK;

       // The client can pass in the key of any message
       // in a thread and get the expansion delta for the thread.

       if (!(m_viewFlags & nsMsgViewFlagsType::kUnreadOnly))
       {
              rv = GetThreadCount(m_keys[index], &numChildren);
              NS_ENSURE_SUCCESS(rv, rv);
       }
       else
       {
              numChildren = CountExpandedThread(index);
       }

       if (flags & MSG_FLAG_ELIDED)
              *expansionDelta = numChildren - 1;
       else
              *expansionDelta = - (PRInt32) (numChildren - 1);

       return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::FetchAccount ( nsIMsgDBHdr aHdr,
PRUnichar **  aAccount 
) [protected, inherited]

Definition at line 382 of file nsMsgDBView.cpp.

{
  nsXPIDLCString accountKey;

  nsresult rv = aHdr->GetAccountKey(getter_Copies(accountKey));

  // Cache the account manager?
  nsCOMPtr <nsIMsgAccountManager> accountManager = do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
  NS_ENSURE_SUCCESS(rv,rv);
  nsCOMPtr <nsIMsgAccount> account;
  if (accountKey.IsEmpty())
  {
  }
  else
  {
    rv = accountManager->GetAccount(accountKey, getter_AddRefs(account));
  }
  if (account)
  {
    nsCOMPtr <nsIMsgIncomingServer> server;
    account->GetIncomingServer(getter_AddRefs(server));
    if (server)
      server->GetPrettyName(aAccount);
  }
  else
  {
    *aAccount = ToNewUnicode(accountKey);
  }
  
  if (!*aAccount)
    *aAccount = nsCRT::strdup(NS_LITERAL_STRING("").get());
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::FetchAuthor ( nsIMsgDBHdr aHdr,
PRUnichar **  aAuthorString 
) [protected, inherited]

Definition at line 356 of file nsMsgDBView.cpp.

{
  nsXPIDLString unparsedAuthor;
  if (!mHeaderParser)
    mHeaderParser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID);

  nsresult rv = aHdr->GetMime2DecodedAuthor(getter_Copies(unparsedAuthor));
  
  // *sigh* how sad, we need to convert our beautiful unicode string to utf8 
  // so we can extract the name part of the address...then convert it back to 
  // unicode again.
  if (mHeaderParser)
  {
    nsXPIDLCString name;
    rv = mHeaderParser->ExtractHeaderAddressName("UTF-8", NS_ConvertUCS2toUTF8(unparsedAuthor).get(), getter_Copies(name));
    if (NS_SUCCEEDED(rv) && (const char*)name)
    {
      *aSenderString = nsCRT::strdup(NS_ConvertUTF8toUCS2(name).get());
      return NS_OK;
    }
  }
  // if we got here then just return the original string
  *aSenderString = nsCRT::strdup(unparsedAuthor);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::FetchDate ( nsIMsgDBHdr aHdr,
PRUnichar **  aDateString 
) [protected, inherited]

Definition at line 462 of file nsMsgDBView.cpp.

{
  PRTime dateOfMsg;
  PRTime dateOfMsgLocal;
  nsAutoString formattedDateString;

  if (!mDateFormater)
    mDateFormater = do_CreateInstance(kDateTimeFormatCID);

  NS_ENSURE_TRUE(mDateFormater, NS_ERROR_FAILURE);
  nsresult rv = aHdr->GetDate(&dateOfMsg);

  PRTime currentTime = PR_Now();
  PRExplodedTime explodedCurrentTime;
  PR_ExplodeTime(currentTime, PR_LocalTimeParameters, &explodedCurrentTime);
  PRExplodedTime explodedMsgTime;
  PR_ExplodeTime(dateOfMsg, PR_LocalTimeParameters, &explodedMsgTime);

  // if the message is from today, don't show the date, only the time. (i.e. 3:15 pm)
  // if the message is from the last week, show the day of the week.   (i.e. Mon 3:15 pm)
  // in all other cases, show the full date (03/19/01 3:15 pm)

  nsDateFormatSelector dateFormat = m_dateFormatDefault;
  if (explodedCurrentTime.tm_year == explodedMsgTime.tm_year &&
      explodedCurrentTime.tm_month == explodedMsgTime.tm_month &&
      explodedCurrentTime.tm_mday == explodedMsgTime.tm_mday)
  {
    // same day...
    dateFormat = m_dateFormatToday;
  } 
  // the following chunk of code causes us to show a day instead of a number if the message was received
  // within the last 7 days. i.e. Mon 5:10pm.
  // The concrete format used is dependent on a preference setting (see InitDisplayFormats), but the default
  // is the format described above.
  else if (LL_CMP(currentTime, >, dateOfMsg))
  {
    // some constants for calculation
    static PRInt64 microSecondsPerSecond;
    static PRInt64 secondsPerDay;
    static PRInt64 microSecondsPerDay;
    static PRInt64 microSecondsPer6Days;

    static PRBool bGotConstants = PR_FALSE;
    if ( !bGotConstants )
    {
      // seeds
      LL_I2L  ( microSecondsPerSecond,  PR_USEC_PER_SEC );
      LL_UI2L ( secondsPerDay,          60 * 60 * 24 );
    
      // derivees
      LL_MUL( microSecondsPerDay,   secondsPerDay,      microSecondsPerSecond );
      LL_MUL( microSecondsPer6Days, microSecondsPerDay, 6 );

      bGotConstants = PR_TRUE;
    }

    // setting the time variables to local time
    PRInt64 GMTLocalTimeShift;
    LL_ADD( GMTLocalTimeShift, explodedCurrentTime.tm_params.tp_gmt_offset, explodedCurrentTime.tm_params.tp_dst_offset );
    LL_MUL( GMTLocalTimeShift, GMTLocalTimeShift, microSecondsPerSecond );
    LL_ADD( currentTime, currentTime, GMTLocalTimeShift );
    LL_ADD( dateOfMsgLocal, dateOfMsg, GMTLocalTimeShift );
           
    // the most recent midnight, counting from current time
    PRInt64 todaysMicroSeconds, mostRecentMidnight;
    LL_MOD( todaysMicroSeconds, currentTime, microSecondsPerDay );
    LL_SUB( mostRecentMidnight, currentTime, todaysMicroSeconds );

    // most recent midnight minus 6 days
    PRInt64 mostRecentWeek;
    LL_SUB( mostRecentWeek, mostRecentMidnight, microSecondsPer6Days );

    // was the message sent during the last week?
    if ( LL_CMP( dateOfMsgLocal, >=, mostRecentWeek ) )
    { // yes ....
      dateFormat = m_dateFormatThisWeek;
    }
  }

  if (NS_SUCCEEDED(rv)) 
    rv = mDateFormater->FormatPRTime(nsnull /* nsILocale* locale */,
                                      dateFormat,
                                      kTimeFormatNoSeconds,
                                      dateOfMsg,
                                      formattedDateString);

  if (NS_SUCCEEDED(rv))
    *aDateString = ToNewUnicode(formattedDateString);
  
  return rv;
}

Here is the call graph for this function:

nsresult nsMsgDBView::FetchKeywords ( nsIMsgDBHdr aHdr,
char **  keywordString 
) [protected, inherited]

Definition at line 645 of file nsMsgDBView.cpp.

{
  nsresult rv = NS_OK;
  if (!mTagService)
  {
    mTagService = do_GetService(NS_MSGTAGSERVICE_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, rv);
  }
  nsMsgLabelValue label = 0;

  rv = aHdr->GetLabel(&label);
  nsXPIDLCString keywords;
  aHdr->GetStringProperty("keywords", getter_Copies(keywords));
  if (label > 0)
  {
    nsCAutoString labelStr("$label");
    labelStr.Append((char) (label + '0'));
    if (!FindInReadable(labelStr, keywords, nsCaseInsensitiveCStringComparator()))
    {
      if (!keywords.IsEmpty())
        keywords.Append(' ');
      keywords.Append(labelStr);
    }
  }
  *keywordString = ToNewCString(keywords);
  return (*keywordString) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}

Here is the call graph for this function:

nsresult nsMsgDBView::FetchLabel ( nsIMsgDBHdr aHdr,
PRUnichar **  aLabelString 
) [protected, inherited]

Definition at line 715 of file nsMsgDBView.cpp.

{
  nsresult rv = NS_OK;
  nsMsgLabelValue label = 0;

  NS_ENSURE_ARG_POINTER(aHdr);  
  NS_ENSURE_ARG_POINTER(aLabelString);  

  rv = aHdr->GetLabel(&label);
  NS_ENSURE_SUCCESS(rv, rv);

  // we don't care if label is not between 1 and PREF_LABELS_MAX inclusive.
  if ((label < 1) || (label > PREF_LABELS_MAX))
  {
    *aLabelString = nsnull;
    return NS_OK;
  }

  // We need to subtract 1 because mLabelPrefDescriptions is 0 based.
  if(!mLabelPrefDescriptions[label - 1].IsEmpty())
  {
    *aLabelString = nsCRT::strdup(mLabelPrefDescriptions[label - 1].get());
    if (!*aLabelString)
       return NS_ERROR_OUT_OF_MEMORY;
  }
  return NS_OK;
}

Here is the caller graph for this function:

nsresult nsMsgDBView::FetchPriority ( nsIMsgDBHdr aHdr,
PRUnichar **  aPriorityString 
) [protected, inherited]

Definition at line 613 of file nsMsgDBView.cpp.

{
  nsMsgPriorityValue priority = nsMsgPriority::notSet;
  const PRUnichar * priorityString = nsnull;
  aHdr->GetPriority(&priority);

  switch (priority)
  {
  case nsMsgPriority::highest:
    priorityString = kHighestPriorityString;
    break;
  case nsMsgPriority::high:
    priorityString = kHighPriorityString;
    break;
  case nsMsgPriority::low:
    priorityString = kLowPriorityString;
    break;
  case nsMsgPriority::lowest:
    priorityString = kLowestPriorityString;
    break;
  case nsMsgPriority::normal:
    priorityString = kNormalPriorityString;
    break;
  default:
    break;
  }

  *aPriorityString = (priorityString) ? nsCRT::strdup(priorityString) : nsnull;

  return NS_OK;
}

Here is the caller graph for this function:

nsresult nsMsgDBView::FetchRecipients ( nsIMsgDBHdr aHdr,
PRUnichar **  aRecipientsString 
) [protected, inherited]

Definition at line 417 of file nsMsgDBView.cpp.

{
  nsXPIDLString unparsedRecipients;
  if (!mHeaderParser)
    mHeaderParser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID);

  nsresult rv = aHdr->GetMime2DecodedRecipients(getter_Copies(unparsedRecipients));
  
  // *sigh* how sad, we need to convert our beautiful unicode string to utf8 
  // so we can extract the name part of the address...then convert it back to 
  // unicode again.
  if (mHeaderParser)
  {
    nsXPIDLCString names;
    rv = mHeaderParser->ExtractHeaderAddressNames("UTF-8", NS_ConvertUCS2toUTF8(unparsedRecipients).get(), getter_Copies(names));
    if (NS_SUCCEEDED(rv) && (const char*)names)
    {
      *aRecipientsString = nsCRT::strdup(NS_ConvertUTF8toUCS2(names).get());
      return NS_OK;
    }
  }
  // if we got here then just return the original string
  *aRecipientsString = nsCRT::strdup(unparsedRecipients);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::FetchSize ( nsIMsgDBHdr aHdr,
PRUnichar **  aSizeString 
) [protected, inherited]

Definition at line 575 of file nsMsgDBView.cpp.

{
  nsAutoString formattedSizeString;
  PRUint32 msgSize = 0;
  
  // for news, show the line count, not the size if the user wants so
  if (mShowSizeInLines)
  {
    aHdr->GetLineCount(&msgSize);
    formattedSizeString.AppendInt(msgSize);
  }
  else 
  {
    PRUint32 flags = 0;

    aHdr->GetFlags(&flags);
    if (flags & MSG_FLAG_PARTIAL)
      aHdr->GetUint32Property("onlineSize", &msgSize);

    if (msgSize == 0)
      aHdr->GetMessageSize(&msgSize);
    
    if(msgSize < 1024)
      msgSize = 1024;
    
    PRUint32 sizeInKB = msgSize/1024;
    
    // kKiloByteString is a localized string that we use to get the right
    // format to add on the "KB" or equivalent
    nsTextFormatter::ssprintf(formattedSizeString,
                              kKiloByteString,
                              sizeInKB);
  }
  
  *aSizeString = ToNewUnicode(formattedSizeString);
  return (*aSizeString) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}

Here is the call graph for this function:

nsresult nsMsgDBView::FetchStatus ( PRUint32  aFlags,
PRUnichar **  aStatusString 
) [protected, inherited]

Definition at line 554 of file nsMsgDBView.cpp.

{
  const PRUnichar * statusString = nsnull;
  
  if(aFlags & MSG_FLAG_REPLIED)
    statusString = kRepliedString;
  else if(aFlags & MSG_FLAG_FORWARDED)
    statusString = kForwardedString;
  else if(aFlags & MSG_FLAG_NEW)
    statusString = kNewString;
  else if(aFlags & MSG_FLAG_READ)
    statusString = kReadString;
  
  if (statusString)
    *aStatusString = nsCRT::strdup(statusString);
  else 
    *aStatusString = nsnull;
  
  return NS_OK;
}

Here is the caller graph for this function:

nsresult nsMsgDBView::FetchSubject ( nsIMsgDBHdr aMsgHdr,
PRUint32  aFlags,
PRUnichar **  aValue 
) [protected, inherited]

Definition at line 443 of file nsMsgDBView.cpp.

{
  if (aFlags & MSG_FLAG_HAS_RE)
  {
    nsXPIDLString subject;
    aMsgHdr->GetMime2DecodedSubject(getter_Copies(subject));
    nsAutoString reSubject;
    reSubject.AssignLiteral("Re: ");
    reSubject.Append(subject);
    *aValue = ToNewUnicode(reSubject);
  }
  else
    aMsgHdr->GetMime2DecodedSubject(aValue);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::FetchTags ( nsIMsgDBHdr aHdr,
PRUnichar **  aTagString 
) [protected, inherited]

Definition at line 673 of file nsMsgDBView.cpp.

{
  nsresult rv = NS_OK;
  if (!mTagService)
  {
    mTagService = do_GetService(NS_MSGTAGSERVICE_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, rv);
  }

  nsXPIDLString tags;
  nsXPIDLCString keywords;
  aHdr->GetStringProperty("keywords", getter_Copies(keywords));

  nsMsgLabelValue label = 0;
  rv = aHdr->GetLabel(&label);  
  if (label > 0)
  {
    nsCAutoString labelStr("$label");
    labelStr.Append((char) (label + '0'));
    if (!FindInReadable(labelStr, keywords, nsCaseInsensitiveCStringComparator()))
      FetchLabel(aHdr, getter_Copies(tags));
  }

  nsCStringArray keywordsArray;
  keywordsArray.ParseString(keywords.get(), " ");
  nsAutoString tag;

  for (PRInt32 i = 0; i < keywordsArray.Count(); i++)
  {
    rv = mTagService->GetTagForKey(*(keywordsArray[i]), tag);
    if (NS_SUCCEEDED(rv) && !tag.IsEmpty())
    {
      if (!tags.IsEmpty())
        tags.Append((PRUnichar) ' ');
      tags.Append(tag);
    }
  }

  *aTagString = ToNewUnicode(tags);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::FindFirstFlagged ( nsMsgViewIndex pResultIndex) [protected, inherited]

Definition at line 5372 of file nsMsgDBView.cpp.

{
    return FindNextFlagged(0, pResultIndex);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::FindFirstNew ( nsMsgViewIndex pResultIndex) [protected, inherited]

Definition at line 5321 of file nsMsgDBView.cpp.

{
  if (m_db) 
  {
    nsMsgKey firstNewKey = nsMsgKey_None;
    m_db->GetFirstNew(&firstNewKey);
    *pResultIndex = (firstNewKey != nsMsgKey_None)
        ? FindKey(firstNewKey, PR_TRUE) : nsMsgViewIndex_None;
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsMsgViewIndex nsMsgDBView::FindHdr ( nsIMsgDBHdr msgHdr) [protected, inherited]

Definition at line 3886 of file nsMsgDBView.cpp.

{
  nsMsgKey msgKey;
  msgHdr->GetMessageKey(&msgKey);
  return FindViewIndex(msgKey);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsMsgViewIndex nsIMsgDBView::findIndexFromKey ( in nsMsgKey  aMsgKey,
in boolean  aExpand 
) [inherited]
nsMsgViewIndex nsMsgDBView::FindKey ( nsMsgKey  key,
PRBool  expand 
) [protected, virtual, inherited]

Definition at line 3901 of file nsMsgDBView.cpp.

{
  nsMsgViewIndex retIndex = nsMsgViewIndex_None;
  retIndex = (nsMsgViewIndex) (m_keys.FindIndex(key));
  // for dummy headers, try to expand if the caller says so. And if the thread is
  // expanded, ignore the dummy header and return the real header index.
  if (retIndex != nsMsgViewIndex_None && m_flags[retIndex] & MSG_VIEW_FLAG_DUMMY &&  !(m_flags[retIndex] & MSG_FLAG_ELIDED))
    return (nsMsgViewIndex) m_keys.FindIndex(key, retIndex + 1);
  if (key != nsMsgKey_None && (retIndex == nsMsgViewIndex_None || m_flags[retIndex] & MSG_VIEW_FLAG_DUMMY)
    && expand && m_db)
  {
    nsMsgKey threadKey = GetKeyOfFirstMsgInThread(key);
    if (threadKey != nsMsgKey_None)
    {
      nsMsgViewIndex threadIndex = FindKey(threadKey, PR_FALSE);
      if (threadIndex != nsMsgViewIndex_None)
      {
        PRUint32 flags = m_flags[threadIndex];
        if ((flags & MSG_FLAG_ELIDED) && NS_SUCCEEDED(ExpandByIndex(threadIndex, nsnull))
          || (flags & MSG_VIEW_FLAG_DUMMY))
          retIndex = (nsMsgViewIndex) m_keys.FindIndex(key, threadIndex + 1);
      }
    }
  }
  return retIndex;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsMsgDBView::FindLevelInThread ( nsIMsgDBHdr msgHdr,
nsMsgViewIndex  startOfThread,
nsMsgViewIndex  viewIndex 
) [protected, virtual, inherited]

Reimplemented in nsMsgGroupView.

Definition at line 4584 of file nsMsgDBView.cpp.

{
  nsCOMPtr <nsIMsgDBHdr> curMsgHdr = msgHdr;
  nsMsgKey msgKey;
  msgHdr->GetMessageKey(&msgKey);

  // look through the ancestors of the passed in msgHdr in turn, looking for them in the view, up to the start of
  // the thread. If we find an ancestor, then our level is one greater than the level of the ancestor.
  while (curMsgHdr)
  {
    nsMsgKey parentKey;
    curMsgHdr->GetThreadParent(&parentKey);
    if (parentKey == nsMsgKey_None)
      break;

    // scan up to find view index of ancestor, if any
    for (nsMsgViewIndex indexToTry = viewIndex; indexToTry && indexToTry-- >= startOfThread;)
    {
      if (m_keys[indexToTry] == parentKey)
        return m_levels[indexToTry] + 1;
    }

    // if msgHdr's key is its parentKey, we'll loop forever, so protect
    // against that corruption.
    if (msgKey == parentKey || NS_FAILED(m_db->GetMsgHdrForKey(parentKey, getter_AddRefs(curMsgHdr))))
    {
      NS_ERROR("msgKey == parentKey, or GetMsgHdrForKey failed, this used to be an infinte loop condition");
      curMsgHdr = nsnull;
    }
    else
    {
      // need to update msgKey so the check for a msgHdr with matching 
      // key+parentKey will work after first time through loop
      curMsgHdr->GetMessageKey(&msgKey);
    }
  }
  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::FindNextFlagged ( nsMsgViewIndex  startIndex,
nsMsgViewIndex pResultIndex 
) [protected, inherited]

Definition at line 5298 of file nsMsgDBView.cpp.

{
    nsMsgViewIndex lastIndex = (nsMsgViewIndex) GetSize() - 1;
    nsMsgViewIndex curIndex;

    *pResultIndex = nsMsgViewIndex_None;

    if (GetSize() > 0) 
    {
        for (curIndex = startIndex; curIndex <= lastIndex; curIndex++) 
        {
            PRUint32 flags = m_flags.GetAt(curIndex);
            if (flags & MSG_FLAG_MARKED) 
            {
                *pResultIndex = curIndex;
                break;
            }
        }
    }

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsMsgViewIndex nsMsgDBView::FindParentInThread ( nsMsgKey  parentKey,
nsMsgViewIndex  startOfThreadViewIndex 
) [protected, inherited]

Definition at line 4473 of file nsMsgDBView.cpp.

{
  nsCOMPtr<nsIMsgDBHdr> msgHdr;
  while (parentKey != nsMsgKey_None)
  {
    nsMsgViewIndex parentIndex = m_keys.FindIndex(parentKey, startOfThreadViewIndex);
    if (parentIndex != nsMsgViewIndex_None)
      return parentIndex;

    if (NS_FAILED(m_db->GetMsgHdrForKey(parentKey, getter_AddRefs(msgHdr))))
      break;

    msgHdr->GetThreadParent(&parentKey);
  }

  return startOfThreadViewIndex;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::FindPrevFlagged ( nsMsgViewIndex  startIndex,
nsMsgViewIndex pResultIndex 
) [protected, inherited]

Definition at line 5377 of file nsMsgDBView.cpp.

{
    nsMsgViewIndex curIndex;

    *pResultIndex = nsMsgViewIndex_None;

    if (GetSize() > 0 && IsValidIndex(startIndex)) 
    {
        curIndex = startIndex;
        do 
        {
            if (curIndex != 0)
                curIndex--;

            PRUint32 flags = m_flags.GetAt(curIndex);
            if (flags & MSG_FLAG_MARKED) 
            {
                *pResultIndex = curIndex;
                break;
            }
        }
        while (curIndex != 0);
    }
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::FindPrevUnread ( nsMsgKey  startKey,
nsMsgKey pResultKey,
nsMsgKey resultThreadId 
) [protected, inherited]

Definition at line 5333 of file nsMsgDBView.cpp.

{
    nsMsgViewIndex startIndex = FindViewIndex(startKey);
    nsMsgViewIndex curIndex = startIndex;
    nsresult rv = NS_MSG_MESSAGE_NOT_FOUND;

    if (startIndex == nsMsgViewIndex_None)
        return NS_MSG_MESSAGE_NOT_FOUND;

    *pResultKey = nsMsgKey_None;
    if (resultThreadId)
        *resultThreadId = nsMsgKey_None;

    for (; (int) curIndex >= 0 && (*pResultKey == nsMsgKey_None); curIndex--) 
    {
        PRUint32 flags = m_flags.GetAt(curIndex);

        if (curIndex != startIndex && flags & MSG_VIEW_FLAG_ISTHREAD && flags & MSG_FLAG_ELIDED) 
        {
            NS_ASSERTION(0,"fix this");
            //nsMsgKey threadId = m_keys.GetAt(curIndex);
            //rv = m_db->GetUnreadKeyInThread(threadId, pResultKey, resultThreadId);
            if (NS_SUCCEEDED(rv) && (*pResultKey != nsMsgKey_None))
                break;
        }
        if (!(flags & (MSG_FLAG_READ | MSG_VIEW_FLAG_DUMMY)) && (curIndex != startIndex)) 
        {
            *pResultKey = m_keys.GetAt(curIndex);
            rv = NS_OK;
            break;
        }
    }
    // found unread message but we don't know the thread
    NS_ASSERTION(!(*pResultKey != nsMsgKey_None && resultThreadId && *resultThreadId == nsMsgKey_None),
      "fix this");
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsMsgViewIndex nsMsgDBView::FindViewIndex ( nsMsgKey  key) [inline, protected, inherited]

Definition at line 237 of file nsMsgDBView.h.

                                     {return FindKey(key, PR_FALSE);}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsMsgDBView::FreeAll ( nsVoidArray ptrs) [protected, inherited]

Definition at line 3765 of file nsMsgDBView.cpp.

{
  PRInt32 i;
  PRInt32 count = (PRInt32) ptrs->Count();
  if (count == 0) 
    return;

  for (i=(count - 1);i>=0;i--) 
    PR_Free((void *) ptrs->ElementAt(i));
  ptrs->Clear();
}
nsresult nsMsgDBView::GenerateURIForMsgKey ( nsMsgKey  aMsgKey,
nsIMsgFolder folder,
char **  aURI 
) [protected, inherited]

Definition at line 840 of file nsMsgDBView.cpp.

{
  NS_ENSURE_ARG(folder);
  return(folder->GenerateMessageURI(aMsgKey, aURI));
}
nsMsgKey nsMsgDBView::GetAt ( nsMsgViewIndex  index) [protected, inherited]

Definition at line 3893 of file nsMsgDBView.cpp.

{
  if (index >= m_keys.GetSize() || index == nsMsgViewIndex_None)
    return nsMsgKey_None;
  else
    return(m_keys.GetAt(index));
}

Here is the caller graph for this function:

void nsITreeView::getCellProperties ( in long  row,
in nsITreeColumn  col,
in nsISupportsArray  properties 
) [inherited]

An atomized list of properties for a given cell.

Each property, x, that the view gives back will cause the pseudoclass :moz-tree-cell-x to be matched on the ::moz-tree-cell pseudoelement.

AString nsITreeView::getCellText ( in long  row,
in nsITreeColumn  col 
) [inherited]

The text for a given cell.

If a column consists only of an image, then the empty string is returned.

AString nsITreeView::getCellValue ( in long  row,
in nsITreeColumn  col 
) [inherited]

The value for a given cell.

This method is only called for columns of type other than |text|.

nsresult nsMsgDBView::GetCollationKey ( nsIMsgDBHdr msgHdr,
nsMsgViewSortTypeValue  sortType,
PRUint8 **  result,
PRUint32 len,
nsIMsgCustomColumnHandler colHandler = nsnull 
) [protected, inherited]

Definition at line 3432 of file nsMsgDBView.cpp.

{
  nsresult rv;
  NS_ENSURE_ARG_POINTER(msgHdr);
  NS_ENSURE_ARG_POINTER(result);

  switch (sortType)
  {
    case nsMsgViewSortType::bySubject:
        rv = msgHdr->GetSubjectCollationKey(result, len);
        break;
    case nsMsgViewSortType::byLocation:
        rv = GetLocationCollationKey(msgHdr, result, len);
        break;
    case nsMsgViewSortType::byRecipient:
        rv = msgHdr->GetRecipientsCollationKey(result, len);
        break;
    case nsMsgViewSortType::byAuthor:
        rv = msgHdr->GetAuthorCollationKey(result, len);
        break;
    case nsMsgViewSortType::byAccount:
    case nsMsgViewSortType::byTags:
      {
        nsXPIDLString str;
        nsCOMPtr <nsIMsgDatabase> dbToUse = m_db;
    
        if (!dbToUse) // probably search view
          GetDBForViewIndex(0, getter_AddRefs(dbToUse));

        rv = (sortType == nsMsgViewSortType::byAccount)
            ? FetchAccount(msgHdr, getter_Copies(str))
            : FetchTags(msgHdr, getter_Copies(str));

        if (NS_SUCCEEDED(rv) && dbToUse)
          rv = dbToUse->CreateCollationKey(str, result, len);
      }
      break;
    case nsMsgViewSortType::byCustom:
      if (colHandler != nsnull)
      {
        nsAutoString strKey;
        rv = colHandler->GetSortStringForRow(msgHdr, strKey);
        NS_ASSERTION(NS_SUCCEEDED(rv),"failed to get sort string for custom row");
        nsAutoString strTemp(strKey);
        
        rv = m_db->CreateCollationKey(strKey, result, len);
      } 
      else
      {
        NS_ASSERTION(PR_FALSE,"should not be here (Sort Type: byCustom (String), but no custom handler)");
        //rv = NS_ERROR_UNEXPECTED;
      }
      break;
    default:
        rv = NS_ERROR_UNEXPECTED;
        break;
    }

    // bailing out with failure will stop the sort and leave us in
    // a bad state.  try to continue on, instead
    NS_ASSERTION(NS_SUCCEEDED(rv),"failed to get the collation key");
    if (NS_FAILED(rv))
    {
        *result = nsnull;
        *len = 0;
    }
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsMsgDBView::GetColumnHandler ( const PRUnichar colID) [protected, inherited]

Definition at line 1576 of file nsMsgDBView.cpp.

{
  nsIMsgCustomColumnHandler* columnHandler = nsnull;

  PRInt32 index = m_customColumnHandlerIDs.IndexOf(nsDependentString(colID));
  
  if (index > -1)
    columnHandler = m_customColumnHandlers[index];
  
  return columnHandler;
}  

Here is the caller graph for this function:

Called to get properties to paint a column background.

For shading the sort column, etc.

Definition at line 1556 of file nsMsgDBView.cpp.

{
  if (!m_db)
    return nsnull;  
    
  nsresult rv;
  
  nsCOMPtr<nsIDBFolderInfo>  dbInfo;
  
  m_db->GetDBFolderInfo(getter_AddRefs(dbInfo));
  
  if (!dbInfo)
    return nsnull;
  
  nsAutoString colID;
  rv = dbInfo->GetProperty("customSortCol", colID);            

  return GetColumnHandler(colID.get());
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::GetDBForViewIndex ( nsMsgViewIndex  index,
nsIMsgDatabase **  db 
) [protected, virtual, inherited]

Reimplemented in nsMsgSearchDBView.

Definition at line 1479 of file nsMsgDBView.cpp.

{
  NS_IF_ADDREF(*db = m_db);
  return NS_OK;
}

Here is the caller graph for this function:

nsresult nsMsgDBView::GetFieldTypeAndLenForSort ( nsMsgViewSortTypeValue  sortType,
PRUint16 pMaxLen,
eFieldType pFieldType 
) [protected, inherited]

Definition at line 3235 of file nsMsgDBView.cpp.

{
    NS_ENSURE_ARG_POINTER(pMaxLen);
    NS_ENSURE_ARG_POINTER(pFieldType);

    switch (sortType) 
    {
        case nsMsgViewSortType::bySubject:
            *pFieldType = kCollationKey;
            *pMaxLen = kMaxSubjectKey;
            break;
        case nsMsgViewSortType::byAccount:
        case nsMsgViewSortType::byTags:
        case nsMsgViewSortType::byLocation:
            *pFieldType = kCollationKey;
            *pMaxLen = kMaxLocationKey;
            break;
        case nsMsgViewSortType::byRecipient:
            *pFieldType = kCollationKey;
            *pMaxLen = kMaxRecipientKey;
            break;
        case nsMsgViewSortType::byAuthor:
            *pFieldType = kCollationKey;
            *pMaxLen = kMaxAuthorKey;
            break;
        case nsMsgViewSortType::byDate:
        case nsMsgViewSortType::byPriority:
        case nsMsgViewSortType::byThread:
        case nsMsgViewSortType::byId:
        case nsMsgViewSortType::bySize:
        case nsMsgViewSortType::byFlagged:
        case nsMsgViewSortType::byUnread:
        case nsMsgViewSortType::byStatus:
        case nsMsgViewSortType::byJunkStatus:
        case nsMsgViewSortType::byAttachments:
            *pFieldType = kU32;
            *pMaxLen = 0;
            break;
        case nsMsgViewSortType::byCustom:
        {        
          nsIMsgCustomColumnHandler* colHandler = GetCurColumnHandlerFromDBInfo();
          
          if (colHandler != nsnull)
          {
            PRBool isString;
            colHandler->IsString(&isString);
            
            if (isString)
            {
              *pFieldType = kCollationKey;
              *pMaxLen = kMaxRecipientKey; //80 - do we need a seperate k?
            } 
            else
            {
              *pFieldType = kU32;
              *pMaxLen = 0;
            }
          }
          break;
        }
        default:
            return NS_ERROR_UNEXPECTED;
    }

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::GetFirstMessageHdrToDisplayInThread ( nsIMsgThread threadHdr,
nsIMsgDBHdr **  result 
) [protected, virtual, inherited]

Reimplemented in nsMsgQuickSearchDBView.

Definition at line 3797 of file nsMsgDBView.cpp.

{
  nsresult rv;
  
  if (m_viewFlags & nsMsgViewFlagsType::kUnreadOnly)
    rv = threadHdr->GetFirstUnreadChild(result);
  else
    rv = threadHdr->GetChildHdrAt(0, result);
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::GetFolderFromMsgURI ( const char *  aMsgURI,
nsIMsgFolder **  aFolder 
) [protected, virtual, inherited]

Reimplemented in nsMsgSearchDBView.

Definition at line 2820 of file nsMsgDBView.cpp.

{
  NS_IF_ADDREF(*aFolder = m_folder);
  return NS_OK;
}
nsresult nsMsgDBView::GetFolders ( nsISupportsArray **  folders) [protected, virtual, inherited]

Reimplemented in nsMsgSearchDBView.

Definition at line 5832 of file nsMsgDBView.cpp.

{
    NS_ENSURE_ARG_POINTER(aFolders);
    *aFolders = nsnull;

    return NS_OK;
}

Here is the caller graph for this function:

AString nsITreeView::getImageSrc ( in long  row,
in nsITreeColumn  col 
) [inherited]

The image path for a given cell.

For defining an icon for a cell. If the empty string is returned, the :moz-tree-image pseudoelement will be used.

nsresult nsMsgDBView::GetImapDeleteModel ( nsIMsgFolder folder) [protected, inherited]

Definition at line 5858 of file nsMsgDBView.cpp.

{
   nsresult rv = NS_OK;
   nsCOMPtr <nsIMsgIncomingServer> server;
   if (folder) //for the search view 
     folder->GetServer(getter_AddRefs(server));
   else if (m_folder)
     m_folder->GetServer(getter_AddRefs(server));
   nsCOMPtr<nsIImapIncomingServer> imapServer = do_QueryInterface(server, &rv);
   if (NS_SUCCEEDED(rv) && imapServer )
     imapServer->GetDeleteModel(&mDeleteModel);       
   return rv;
}

Here is the call graph for this function:

nsMsgViewIndex nsMsgDBView::GetIndexForThread ( nsIMsgDBHdr hdr) [protected, inherited]

Definition at line 4234 of file nsMsgDBView.cpp.

{
  nsMsgViewIndex retIndex = nsMsgViewIndex_None;
  nsMsgViewIndex prevInsertIndex = nsMsgViewIndex_None;
  nsMsgKey insertKey;
  hdr->GetMessageKey(&insertKey);
  
  if (m_sortOrder == nsMsgViewSortOrder::ascending)
  {
    // loop backwards looking for top level message with id > id of header we're inserting 
    // and put new header before found header, or at end.
    for (PRInt32 i = GetSize() - 1; i >= 0; i--) 
    {
      if (m_levels[i] == 0)
      {
        if (insertKey < m_keys.GetAt(i))
          prevInsertIndex = i;
        else if (insertKey >= m_keys.GetAt(i))
        {
          retIndex = (prevInsertIndex == nsMsgViewIndex_None) ? nsMsgViewIndex_None : i + 1;
          if (prevInsertIndex == nsMsgViewIndex_None)
          {
            retIndex = nsMsgViewIndex_None;
          }
          else
          {
            for (retIndex = i + 1; retIndex < (nsMsgViewIndex)GetSize(); retIndex++)
            {
              if (m_levels[retIndex] == 0)
                break;
            }
          }
          break;
        }
        
      }
    }
  }
  else
  {
    // loop forwards looking for top level message with id < id of header we're inserting and put 
    // new header before found header, or at beginning.
    for (PRInt32 i = 0; i < GetSize(); i++) 
    {
      if (!m_levels[i])
      {
        if (insertKey > m_keys.GetAt(i))
        {
          retIndex = i;
          break;
        }
      }
    }
  }
  return retIndex;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3777 of file nsMsgDBView.cpp.

{
  nsMsgViewIndex  retIndex = nsMsgViewIndex_None;
  PRUint32        childIndex = 0;
  // We could speed up the unreadOnly view by starting our search with the first
  // unread message in the thread. Sometimes, that will be wrong, however, so
  // let's skip it until we're sure it's necessary.
  //   (m_viewFlags & nsMsgViewFlagsType::kUnreadOnly) 
  //          ? threadHdr->GetFirstUnreadKey(m_db) : threadHdr->GetChildAt(0);
  PRUint32 numThreadChildren;
  threadHdr->GetNumChildren(&numThreadChildren);
  while (retIndex == nsMsgViewIndex_None && childIndex < numThreadChildren)
  {
    nsMsgKey childKey;
    threadHdr->GetChildKeyAt(childIndex++, &childKey);
    retIndex = FindViewIndex(childKey);
  }
  return retIndex;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIMsgDBView::getIndicesForSelection ( [array, size_is(count)] out nsMsgViewIndex  indices,
out unsigned long  count 
) [inherited]
nsMsgViewIndex nsMsgDBView::GetInsertIndex ( nsIMsgDBHdr msgHdr) [protected, virtual, inherited]

Definition at line 4383 of file nsMsgDBView.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsMsgViewIndex nsMsgDBView::GetInsertIndexHelper ( nsIMsgDBHdr msgHdr,
nsMsgKeyArray *  keys,
nsMsgViewSortOrderValue  sortOrder,
nsMsgViewSortTypeValue  sortType 
) [inherited]

Definition at line 4291 of file nsMsgDBView.cpp.

{
  nsMsgViewIndex highIndex = keys->GetSize();
  nsMsgViewIndex lowIndex = 0;
  IdKeyPtr EntryInfo1, EntryInfo2;
  EntryInfo1.key = nsnull;
  EntryInfo2.key = nsnull;
  void *comparisonContext = nsnull;
  
  nsresult rv;
  PRUint16    maxLen;
  eFieldType fieldType;
  rv = GetFieldTypeAndLenForSort(sortType, &maxLen, &fieldType);
  const void *pValue1 = &EntryInfo1, *pValue2 = &EntryInfo2;
  
  int (* PR_CALLBACK comparisonFun) (const void *pItem1, const void *pItem2, void *privateData)=nsnull;
  int retStatus = 0;
  msgHdr->GetMessageKey(&EntryInfo1.id);
  
  //check if a custom column handler exists. If it does then grab it and pass it in 
  //to either GetCollationKey or GetLongField
  nsIMsgCustomColumnHandler* colHandler = GetCurColumnHandlerFromDBInfo();
  
  switch (fieldType)
  {
    case kCollationKey:
      rv = GetCollationKey(msgHdr, sortType, &EntryInfo1.key, &EntryInfo1.dword, colHandler);
      NS_ASSERTION(NS_SUCCEEDED(rv),"failed to create collation key");
      comparisonFun = FnSortIdKeyPtr;
      comparisonContext = m_db.get();
      break;
    case kU32:
      if (sortType == nsMsgViewSortType::byId) 
        EntryInfo1.dword = EntryInfo1.id;
      else
        GetLongField(msgHdr, sortType, &EntryInfo1.dword, colHandler);
      comparisonFun = FnSortIdDWord;
      break;
    default:
      return highIndex;
  }
  while (highIndex > lowIndex)
  {
    nsMsgViewIndex tryIndex = (lowIndex + highIndex - 1) / 2;
    EntryInfo2.id = keys->GetAt(tryIndex);
    nsCOMPtr <nsIMsgDBHdr> tryHdr;
    nsCOMPtr <nsIMsgDatabase> db;
    GetDBForViewIndex(tryIndex, getter_AddRefs(db));
    if (db)
      rv = db->GetMsgHdrForKey(EntryInfo2.id, getter_AddRefs(tryHdr));
    if (!tryHdr)
      break;
    if (fieldType == kCollationKey)
    {
      PR_FREEIF(EntryInfo2.key);
      rv = GetCollationKey(tryHdr, sortType, &EntryInfo2.key, &EntryInfo2.dword, colHandler);
      NS_ASSERTION(NS_SUCCEEDED(rv),"failed to create collation key");
    }
    else if (fieldType == kU32)
    {
      if (sortType == nsMsgViewSortType::byId) {
        EntryInfo2.dword = EntryInfo2.id;
      }
      else {
        GetLongField(tryHdr, sortType, &EntryInfo2.dword, colHandler);
      }
    }
    retStatus = (*comparisonFun)(&pValue1, &pValue2, comparisonContext);
    if (retStatus == 0)
    {
      highIndex = tryIndex;
      break;
    }
    if (sortOrder == nsMsgViewSortOrder::descending)    //switch retStatus based on sort order
      retStatus = ~retStatus;
    
    if (retStatus < 0)
    {
      highIndex = tryIndex;
    }
    else
    {
      lowIndex = tryIndex + 1;
    }
  }
  
  PR_Free(EntryInfo1.key);
  PR_Free(EntryInfo2.key);
  return highIndex;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsMsgViewIndex nsMsgThreadedDBView::GetInsertInfoForNewHdr ( nsIMsgDBHdr newHdr,
nsMsgViewIndex  threadIndex,
PRInt32  targetLevel 
) [protected, inherited]

Definition at line 707 of file nsMsgThreadedDBView.cpp.

{
  PRUint32 viewSize = GetSize();
  while (++parentIndex < viewSize)
  {
    // loop until we find a message at a level less than or equal to the parent level
    if (m_levels[parentIndex] < targetLevel)
      break;
  }
  return parentIndex;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsMsgKey nsMsgDBView::GetKeyOfFirstMsgInThread ( nsMsgKey  key) [protected, inherited]

Definition at line 3860 of file nsMsgDBView.cpp.

{
  nsCOMPtr <nsIMsgThread> pThread;
  nsCOMPtr <nsIMsgDBHdr> msgHdr;
  nsresult rv = m_db->GetMsgHdrForKey(key, getter_AddRefs(msgHdr));
  NS_ENSURE_SUCCESS(rv, rv);
  rv = GetThreadContainingMsgHdr(msgHdr, getter_AddRefs(pThread));
  NS_ENSURE_SUCCESS(rv, rv);
  nsMsgKey    firstKeyInThread = nsMsgKey_None;
  
  NS_ASSERTION(pThread, "error getting msg from thread");
  if (!pThread)
    return firstKeyInThread;
  
  // ### dmb UnreadOnly - this is wrong. But didn't seem to matter in 4.x
  pThread->GetChildKeyAt(0, &firstKeyInThread);
  return firstKeyInThread;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::GetLabelPrefStringAndAtom ( const char *  aPrefName,
nsString aColor,
nsIAtom **  aColorAtom 
) [protected, inherited]
long nsITreeView::getLevel ( in long  index) [inherited]

The level is an integer value that represents the level of indentation.

It is multiplied by the width specified in the :moz-tree-indentation pseudoelement to compute the exact indendation.

nsresult nsMsgDBView::GetLocationCollationKey ( nsIMsgDBHdr msgHdr,
PRUint8 **  result,
PRUint32 len 
) [protected, inherited]

Definition at line 3504 of file nsMsgDBView.cpp.

{
    nsCOMPtr <nsIMsgFolder> folder;

    nsresult rv = msgHdr->GetFolder(getter_AddRefs(folder));
    NS_ENSURE_SUCCESS(rv,rv);

    if (!folder)
      return NS_ERROR_NULL_POINTER;

    nsCOMPtr <nsIMsgDatabase> dbToUse;
    rv = folder->GetMsgDatabase(nsnull, getter_AddRefs(dbToUse));
    NS_ENSURE_SUCCESS(rv,rv);

    nsXPIDLString locationString; 
    rv = folder->GetPrettiestName(getter_Copies(locationString));
    NS_ENSURE_SUCCESS(rv,rv);

    rv = dbToUse->CreateCollationKey(locationString, result, len);
    NS_ENSURE_SUCCESS(rv,rv);

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::GetLongField ( nsIMsgDBHdr msgHdr,
nsMsgViewSortTypeValue  sortType,
PRUint32 result,
nsIMsgCustomColumnHandler colHandler = nsnull 
) [protected, inherited]

Definition at line 3339 of file nsMsgDBView.cpp.

{
  nsresult rv;
  NS_ENSURE_ARG_POINTER(msgHdr);
  NS_ENSURE_ARG_POINTER(result);

  PRBool isRead;
  PRUint32 bits;

  switch (sortType) 
  {
    case nsMsgViewSortType::bySize:
      rv = (mShowSizeInLines) ? msgHdr->GetLineCount(result) : msgHdr->GetMessageSize(result);
      break;
    case nsMsgViewSortType::byPriority: 
        nsMsgPriorityValue priority;
        rv = msgHdr->GetPriority(&priority);

        // treat "none" as "normal" when sorting.
        if (priority == nsMsgPriority::none)
            priority = nsMsgPriority::normal;

        // we want highest priority to have lowest value
        // so ascending sort will have highest priority first.
        *result = nsMsgPriority::highest - priority;
        break;
    case nsMsgViewSortType::byStatus:
        rv = GetStatusSortValue(msgHdr,result);
        break;
    case nsMsgViewSortType::byFlagged:
        bits = 0;
        rv = msgHdr->GetFlags(&bits);
        *result = !(bits & MSG_FLAG_MARKED);  //make flagged come out on top.
        break;
    case nsMsgViewSortType::byUnread:
        rv = msgHdr->GetIsRead(&isRead);
        if (NS_SUCCEEDED(rv)) 
            *result = !isRead;
        break;
    case nsMsgViewSortType::byJunkStatus:
      {
        nsXPIDLCString junkScoreStr;
        rv = msgHdr->GetStringProperty("junkscore", getter_Copies(junkScoreStr));
        // unscored messages should come before messages that are scored
        // junkScoreStr is "", and "0" - "100"
        // normalize to 0 - 101
        *result = junkScoreStr.IsEmpty() ? (0) : atoi(junkScoreStr.get()) + 1;
      }
      break;
          case nsMsgViewSortType::byAttachments:
        bits = 0;
        rv = msgHdr->GetFlags(&bits);
        *result = !(bits & MSG_FLAG_ATTACHMENT);
                break;
    case nsMsgViewSortType::byDate:
      // when sorting threads by date, we want the date of the newest msg
      // in the thread
      if (m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay 
        && ! (m_viewFlags & nsMsgViewFlagsType::kGroupBySort))
      {
        nsCOMPtr <nsIMsgThread> thread;
        rv = m_db->GetThreadContainingMsgHdr(msgHdr, getter_AddRefs(thread));
        NS_ENSURE_SUCCESS(rv, rv);
        thread->GetNewestMsgDate(result);
      }
      else
        rv = msgHdr->GetDateInSeconds(result);
      break;
    case nsMsgViewSortType::byCustom:
      if (colHandler != nsnull)
      {
        colHandler->GetSortLongForRow(msgHdr, result);
        rv = NS_OK;
      } 
      else 
      {
        NS_ASSERTION(PR_FALSE, "should not be here (Sort Type: byCustom (Long), but no custom handler)");
        rv = NS_ERROR_UNEXPECTED;
      }
      break;
    case nsMsgViewSortType::byId:
        // handled by caller, since caller knows the key
    default:
        NS_ASSERTION(0,"should not be here");
        rv = NS_ERROR_UNEXPECTED;
        break;
    }
    
    NS_ENSURE_SUCCESS(rv,rv);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::GetMsgHdrForViewIndex ( nsMsgViewIndex  index,
nsIMsgDBHdr **  msgHdr 
) [protected, virtual, inherited]

Reimplemented in nsMsgSearchDBView.

Definition at line 1448 of file nsMsgDBView.cpp.

{
  nsresult rv = NS_OK;
  nsMsgKey key = m_keys.GetAt(index);
  if (key == nsMsgKey_None || !m_db)
    return NS_MSG_INVALID_DBVIEW_INDEX;
  
  if (key == m_cachedMsgKey)
  {
    *msgHdr = m_cachedHdr;
    NS_IF_ADDREF(*msgHdr);
  }
  else
  {
    rv = m_db->GetMsgHdrForKey(key, msgHdr);
    if (NS_SUCCEEDED(rv))
    {
      m_cachedHdr = *msgHdr;
      m_cachedMsgKey = key;
    }
  }

  return rv;
}

Here is the caller graph for this function:

long nsITreeView::getParentIndex ( in long  rowIndex) [inherited]

Methods used by the tree to draw thread lines in the tree.

getParentIndex is used to obtain the index of a parent row. If there is no parent row, getParentIndex returns -1.

nsresult nsMsgDBView::GetPrefLocalizedString ( const char *  aPrefName,
nsString aResult 
) [protected, inherited]

Definition at line 304 of file nsMsgDBView.cpp.

{
  nsresult rv = NS_OK;
  nsCOMPtr<nsIPrefBranch> prefBranch;
  nsCOMPtr<nsIPrefLocalizedString> pls;
  nsXPIDLString ucsval;

  prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
  NS_ENSURE_SUCCESS(rv, rv);

  rv = prefBranch->GetComplexValue(aPrefName, NS_GET_IID(nsIPrefLocalizedString), getter_AddRefs(pls));
  NS_ENSURE_SUCCESS(rv, rv);
  pls->ToString(getter_Copies(ucsval));
  aResult = ucsval.get();
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

long nsITreeView::getProgressMode ( in long  row,
in nsITreeColumn  col 
) [inherited]
void nsITreeView::getRowProperties ( in long  index,
in nsISupportsArray  properties 
) [inherited]

An atomized list of properties for a given row.

Each property, x, that the view gives back will cause the pseudoclass :moz-tree-row-x to be matched on the pseudoelement ::moz-tree-row.

nsresult nsMsgDBView::GetSelectedIndices ( nsUInt32Array *  selection) [protected, inherited]

Definition at line 1103 of file nsMsgDBView.cpp.

{
  if (mTreeSelection)
  {
    PRInt32 selectionCount; 
    nsresult rv = mTreeSelection->GetRangeCount(&selectionCount);
    for (PRInt32 i = 0; i < selectionCount; i++)
    {
      PRInt32 startRange;
      PRInt32 endRange;
      rv = mTreeSelection->GetRangeAt(i, &startRange, &endRange);
      NS_ENSURE_SUCCESS(rv, NS_OK); 
      PRInt32 viewSize = GetSize();
      if (startRange >= 0 && startRange < viewSize)
      {
        for (PRInt32 rangeIndex = startRange; rangeIndex <= endRange && rangeIndex < viewSize; rangeIndex++)
          selection->Add(rangeIndex);
      }
    }
  }
  else
  {
    // if there is no tree selection object then we must be in stand alone message mode.
    // in that case the selected indices are really just the current message key.
    nsMsgViewIndex viewIndex = FindViewIndex(m_currentlyDisplayedMsgKey);
    if (viewIndex != nsMsgViewIndex_None)
      selection->Add(viewIndex);
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsMsgDBView::GetShowingIgnored ( ) [inline, protected, inherited]

Definition at line 204 of file nsMsgDBView.h.

Here is the caller graph for this function:

PRInt32 nsMsgDBView::GetSize ( void  ) [inline, protected, inherited]

Definition at line 249 of file nsMsgDBView.h.

{return(m_keys.GetSize());}

Here is the caller graph for this function:

nsresult nsMsgDBView::GetStatusSortValue ( nsIMsgDBHdr msgHdr,
PRUint32 result 
) [protected, inherited]

Definition at line 3304 of file nsMsgDBView.cpp.

{
  NS_ENSURE_ARG_POINTER(msgHdr);
  NS_ENSURE_ARG_POINTER(result);

  PRUint32 messageFlags;
  nsresult rv = msgHdr->GetFlags(&messageFlags);
  NS_ENSURE_SUCCESS(rv,rv);

  if (messageFlags & MSG_FLAG_NEW) 
  {
    // happily, new by definition stands alone
    *result = 0;
    return NS_OK;
  }

  switch (messageFlags & MSG_STATUS_MASK) 
  {
    case MSG_FLAG_REPLIED:
        *result = 2;
        break;
    case MSG_FLAG_FORWARDED|MSG_FLAG_REPLIED:
        *result = 1;
        break;
    case MSG_FLAG_FORWARDED:
        *result = 3;
        break;
    default:
        *result = (messageFlags & MSG_FLAG_READ) ? 4 : 5;
        break;
    }

    return NS_OK;
}

Here is the caller graph for this function:

PRUnichar * nsMsgDBView::GetString ( const PRUnichar aStringName) [protected, inherited]

Definition at line 281 of file nsMsgDBView.cpp.

{
  nsresult    res = NS_OK;
  PRUnichar   *ptrv = nsnull;
  
  if (!mMessengerStringBundle)
  {
    static const char propertyURL[] = MESSENGER_STRING_URL;
    nsCOMPtr<nsIStringBundleService> sBundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &res);
    if (NS_SUCCEEDED(res) && sBundleService) 
      res = sBundleService->CreateBundle(propertyURL, getter_AddRefs(mMessengerStringBundle));
  }
  
  if (mMessengerStringBundle)
    res = mMessengerStringBundle->GetStringFromName(aStringName, &ptrv);
  
  if ( NS_SUCCEEDED(res) && (ptrv) )
    return ptrv;
  else
    return nsCRT::strdup(aStringName);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 872 of file nsMsgThreadedDBView.cpp.

nsresult nsMsgDBView::GetThreadContainingIndex ( nsMsgViewIndex  index,
nsIMsgThread **  thread 
) [protected, virtual, inherited]

Definition at line 4223 of file nsMsgDBView.cpp.

{
  nsCOMPtr <nsIMsgDBHdr> msgHdr;

  NS_ENSURE_TRUE(m_db, NS_ERROR_NULL_POINTER);

  nsresult rv = m_db->GetMsgHdrForKey(m_keys[index], getter_AddRefs(msgHdr));
  NS_ENSURE_SUCCESS(rv, rv);
  return GetThreadContainingMsgHdr(msgHdr, resultThread);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::GetThreadContainingMsgHdr ( nsIMsgDBHdr msgHdr,
nsIMsgThread **  pThread 
) [protected, virtual, inherited]

Reimplemented in nsMsgGroupView.

Definition at line 4106 of file nsMsgDBView.cpp.

{
  return m_db->GetThreadContainingMsgHdr(msgHdr, pThread);
}

Here is the caller graph for this function:

nsresult nsMsgDBView::GetThreadCount ( nsMsgKey  messageKey,
PRUint32 pThreadCount 
) [protected, inherited]

Definition at line 3928 of file nsMsgDBView.cpp.

{
  nsresult rv = NS_MSG_MESSAGE_NOT_FOUND;
  nsCOMPtr <nsIMsgDBHdr> msgHdr;
  rv = m_db->GetMsgHdrForKey(messageKey, getter_AddRefs(msgHdr));
  NS_ENSURE_SUCCESS(rv, rv);
  nsCOMPtr <nsIMsgThread> pThread;
  rv = GetThreadContainingMsgHdr(msgHdr, getter_AddRefs(pThread));
  if (NS_SUCCEEDED(rv) && pThread != nsnull)
    rv = pThread->GetNumChildren(pThreadCount);
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsMsgViewIndex nsMsgDBView::GetThreadFromMsgIndex ( nsMsgViewIndex  index,
nsIMsgThread **  threadHdr 
) [protected, inherited]

Definition at line 5477 of file nsMsgDBView.cpp.

{
  nsMsgKey        msgKey = GetAt(index);
  nsMsgViewIndex  threadIndex;
  
  NS_ENSURE_ARG(threadHdr);
  nsresult rv = GetThreadContainingIndex(index, threadHdr);
  NS_ENSURE_SUCCESS(rv,nsMsgViewIndex_None);
  
  if (*threadHdr == nsnull)
    return nsMsgViewIndex_None;
  
  nsMsgKey threadKey;
  (*threadHdr)->GetThreadKey(&threadKey);
  if (msgKey !=threadKey)
    threadIndex = GetIndexOfFirstDisplayedKeyInThread(*threadHdr);
  else
    threadIndex = index;
  return threadIndex;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIMsgDBView::getURIsForSelection ( [array, size_is(count)] out string  uris,
out unsigned long  count 
) [inherited]
virtual const char* nsMsgWatchedThreadsWithUnreadDBView::GetViewName ( void  ) [inline, virtual]

Reimplemented from nsMsgThreadedDBView.

Definition at line 63 of file nsMsgSpecialViews.h.

{return "WatchedThreadsWithUnreadView"; }

Reimplemented from nsMsgThreadedDBView.

Definition at line 111 of file nsMsgSpecialViews.cpp.

boolean nsITreeView::hasNextSibling ( in long  rowIndex,
in long  afterIndex 
) [inherited]

hasNextSibling is used to determine if the row at rowIndex has a nextSibling that occurs after the index specified by afterIndex.

Code that is forced to march down the view looking at levels can optimize the march by starting at afterIndex+1.

void nsIMsgDBView::init ( in nsIMessenger  aMessengerInstance,
in nsIMsgWindow  aMsgWindow,
in nsIMsgDBViewCommandUpdater  aCommandUpdater 
) [inherited]
nsresult nsMsgDBView::InitDisplayFormats ( ) [static, protected, inherited]

Definition at line 6027 of file nsMsgDBView.cpp.

{
  m_dateFormatDefault   = kDateFormatShort;
  m_dateFormatThisWeek  = kDateFormatShort;
  m_dateFormatToday     = kDateFormatNone;

  nsresult rv = NS_OK;
  nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
  NS_ENSURE_SUCCESS(rv,rv);
  nsCOMPtr<nsIPrefBranch> dateFormatPrefs;
  rv = prefs->GetBranch("mail.ui.display.dateformat.", getter_AddRefs(dateFormatPrefs));
  NS_ENSURE_SUCCESS(rv,rv);

  getDateFormatPref( dateFormatPrefs, "default", m_dateFormatDefault );
  getDateFormatPref( dateFormatPrefs, "thisweek", m_dateFormatThisWeek );
  getDateFormatPref( dateFormatPrefs, "today", m_dateFormatToday );
  return rv;
}

Here is the call graph for this function:

void nsMsgDBView::InitializeAtomsAndLiterals ( ) [protected, inherited]

Definition at line 173 of file nsMsgDBView.cpp.

{
  kUnreadMsgAtom = NS_NewAtom("unread");
  kNewMsgAtom = NS_NewAtom("new");
  kReadMsgAtom = NS_NewAtom("read");
  kRepliedMsgAtom = NS_NewAtom("replied");
  kForwardedMsgAtom = NS_NewAtom("forwarded");
  kOfflineMsgAtom = NS_NewAtom("offline");
  kFlaggedMsgAtom = NS_NewAtom("flagged");
  kImapDeletedMsgAtom = NS_NewAtom("imapdeleted");
  kAttachMsgAtom = NS_NewAtom("attach");
  kHasUnreadAtom = NS_NewAtom("hasUnread");
  kWatchThreadAtom = NS_NewAtom("watch");
  kIgnoreThreadAtom = NS_NewAtom("ignore");
  kHasImageAtom = NS_NewAtom("hasimage");
  kJunkMsgAtom = NS_NewAtom("junk");
  kNotJunkMsgAtom = NS_NewAtom("notjunk");
  kDummyMsgAtom = NS_NewAtom("dummy");
#ifdef SUPPORT_PRIORITY_COLORS
  kHighestPriorityAtom = NS_NewAtom("priority-highest");
  kHighPriorityAtom = NS_NewAtom("priority-high");
  kLowestPriorityAtom = NS_NewAtom("priority-lowest");
  kLowPriorityAtom = NS_NewAtom("priority-low");
#endif

  // priority strings
  kHighestPriorityString = GetString(NS_LITERAL_STRING("priorityHighest").get());
  kHighPriorityString = GetString(NS_LITERAL_STRING("priorityHigh").get());
  kLowestPriorityString = GetString(NS_LITERAL_STRING("priorityLowest").get());
  kLowPriorityString = GetString(NS_LITERAL_STRING("priorityLow").get());
  kNormalPriorityString = GetString(NS_LITERAL_STRING("priorityNormal").get());

  kLabelColorWhiteAtom = NS_NewAtom("lc-white");
  kLabelColorBlackAtom = NS_NewAtom("lc-black");

  kReadString = GetString(NS_LITERAL_STRING("read").get());
  kRepliedString = GetString(NS_LITERAL_STRING("replied").get());
  kForwardedString = GetString(NS_LITERAL_STRING("forwarded").get());
  kNewString = GetString(NS_LITERAL_STRING("new").get());
  
  kKiloByteString = GetString(NS_LITERAL_STRING("kiloByteAbbreviation").get());
}

Here is the call graph for this function:

nsresult nsMsgDBView::InitLabelStrings ( void  ) [protected, inherited]

Definition at line 266 of file nsMsgDBView.cpp.

{
  nsresult rv = NS_OK;
  nsCString prefString;

  for(PRInt32 i = 0; i < PREF_LABELS_MAX; i++)
  {
    prefString.Assign(PREF_LABELS_DESCRIPTION);
    prefString.AppendInt(i + 1);
    rv = GetPrefLocalizedString(prefString.get(), mLabelPrefDescriptions[i]);
  }
  return rv;
}

Here is the call graph for this function:

nsresult nsMsgThreadedDBView::InitSort ( nsMsgViewSortTypeValue  sortType,
nsMsgViewSortOrderValue  sortOrder 
) [protected, inherited]

Definition at line 550 of file nsMsgThreadedDBView.cpp.

{
  if (sortType == nsMsgViewSortType::byThread)
  {
    nsMsgDBView::Sort(nsMsgViewSortType::byId, sortOrder); // sort top level threads by id.
    m_sortType = nsMsgViewSortType::byThread;
    m_viewFlags |= nsMsgViewFlagsType::kThreadedDisplay;
    m_viewFlags &= ~nsMsgViewFlagsType::kGroupBySort;
    SetViewFlags(m_viewFlags); // persist the view flags.
    //        m_db->SetSortInfo(m_sortType, sortOrder);
  }
//  else
//    m_viewFlags &= ~nsMsgViewFlagsType::kThreadedDisplay;
  
  // by default, the unread only view should have all threads expanded.
  if ((m_viewFlags & (nsMsgViewFlagsType::kUnreadOnly|nsMsgViewFlagsType::kExpandAll)) 
      && (m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay))
    ExpandAll();
  if (! (m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay))
    ExpandAll(); // for now, expand all and do a flat sort.
  
  Sort(sortType, sortOrder);
  if (sortType != nsMsgViewSortType::byThread)   // forget prev view, since it has everything expanded.
    ClearPrevIdArray();
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgThreadedDBView::InitThreadedView ( PRInt32 pCount) [protected, inherited]

Definition at line 124 of file nsMsgThreadedDBView.cpp.

{
  nsresult rv;
  
  m_keys.RemoveAll();
  m_flags.RemoveAll();
  m_levels.RemoveAll(); 
  m_prevKeys.RemoveAll();
  m_prevFlags.RemoveAll();
  m_prevLevels.RemoveAll();
  m_havePrevView = PR_FALSE;
  nsresult getSortrv = NS_OK; // ### TODO m_db->GetSortInfo(&sortType, &sortOrder);
  
  // list all the ids into m_keys.
  nsMsgKey startMsg = 0; 
  do
  {
    const PRInt32 kIdChunkSize = 400;
    PRInt32                 numListed = 0;
    nsMsgKey  idArray[kIdChunkSize];
    PRInt32          flagArray[kIdChunkSize];
    char             levelArray[kIdChunkSize];
    
    rv = ListThreadIds(&startMsg, (m_viewFlags & nsMsgViewFlagsType::kUnreadOnly) != 0, idArray, flagArray, 
      levelArray, kIdChunkSize, &numListed, nsnull);
    if (NS_SUCCEEDED(rv))
    {
      PRInt32 numAdded = AddKeys(idArray, flagArray, levelArray, m_sortType, numListed);
      if (pCount)
        *pCount += numAdded;
    }
    
  } while (NS_SUCCEEDED(rv) && startMsg != nsMsgKey_None);
  
  if (NS_SUCCEEDED(getSortrv))
  {
    rv = InitSort(m_sortType, m_sortOrder);
    SaveSortInfo(m_sortType, m_sortOrder);

  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

boolean nsITreeView::isContainer ( in long  index) [inherited]

Methods that can be used to test whether or not a twisty should be drawn, and if so, whether an open or closed twisty should be used.

Here is the caller graph for this function:

boolean nsITreeView::isContainerEmpty ( in long  index) [inherited]
boolean nsITreeView::isContainerOpen ( in long  index) [inherited]
boolean nsITreeView::isEditable ( in long  row,
in nsITreeColumn  col 
) [inherited]

isEditable is called to ask the view if the cell contents are editable.

A value of true will result in the tree popping up a text field when the user tries to inline edit the cell.

boolean nsITreeView::isSeparator ( in long  index) [inherited]

isSeparator is used to determine if the row at index is a separator.

A value of true will result in the tree drawing a horizontal separator. The tree uses the ::moz-tree-separator pseudoclass to draw the separator.

boolean nsITreeView::isSorted ( ) [inherited]

Specifies if there is currently a sort on any column.

Used mostly by dragdrop to affect drop feedback.

PRBool nsMsgDBView::IsValidIndex ( nsMsgViewIndex  index) [protected, inherited]

Definition at line 5403 of file nsMsgDBView.cpp.

{
    return ((index >=0) && (index < (nsMsgViewIndex) m_keys.GetSize()));
}

Here is the caller graph for this function:

nsresult nsMsgDBView::ListIdsInThread ( nsIMsgThread threadHdr,
nsMsgViewIndex  viewIndex,
PRUint32 pNumListed 
) [protected, virtual, inherited]

Reimplemented in nsMsgQuickSearchDBView.

Definition at line 4540 of file nsMsgDBView.cpp.

{
  NS_ENSURE_ARG(threadHdr);
  // these children ids should be in thread order.
  PRUint32 i;
  nsMsgViewIndex viewIndex = startOfThreadViewIndex + 1;
  *pNumListed = 0;

  // ### need to rework this when we implemented threading in group views.
  if (m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay && ! (m_viewFlags & nsMsgViewFlagsType::kGroupBySort))
  {
    nsMsgKey parentKey = m_keys[startOfThreadViewIndex];

    return ListIdsInThreadOrder(threadHdr, parentKey, 1, &viewIndex, pNumListed);
  }
  // if we're not threaded, just list em out in db order

  PRUint32 numChildren;
  threadHdr->GetNumChildren(&numChildren);
  for (i = 1; i < numChildren; i++)
  {
    nsCOMPtr <nsIMsgDBHdr> msgHdr;
    threadHdr->GetChildHdrAt(i, getter_AddRefs(msgHdr));
    if (msgHdr != nsnull)
    {
      nsMsgKey msgKey;
      PRUint32 msgFlags, newFlags;
      msgHdr->GetMessageKey(&msgKey);
      msgHdr->GetFlags(&msgFlags);
      AdjustReadFlag(msgHdr, &msgFlags);
      m_keys.InsertAt(viewIndex, msgKey);
      m_flags.InsertAt(viewIndex, msgFlags & ~MSG_VIEW_FLAGS);
      // here, we're either flat, or we're grouped - in either case, level is 1
      m_levels.InsertAt(viewIndex, 1);
      // turn off thread or elided bit if they got turned on (maybe from new only view?)
      if (i > 0)     
        msgHdr->AndFlags(~(MSG_VIEW_FLAG_ISTHREAD | MSG_FLAG_ELIDED), &newFlags);
      (*pNumListed)++;
      viewIndex++;
    }
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::ListIdsInThreadOrder ( nsIMsgThread threadHdr,
nsMsgKey  parentKey,
PRInt32  level,
nsMsgViewIndex viewIndex,
PRUint32 pNumListed 
) [protected, inherited]

Definition at line 4491 of file nsMsgDBView.cpp.

{
  nsresult rv = NS_OK;
  nsCOMPtr <nsISimpleEnumerator> msgEnumerator;
  threadHdr->EnumerateMessages(parentKey, getter_AddRefs(msgEnumerator));
  PRUint32 numChildren;
  (void) threadHdr->GetNumChildren(&numChildren);

  // skip the first one.
  PRBool hasMore;
  nsCOMPtr <nsISupports> supports;
  nsCOMPtr <nsIMsgDBHdr> msgHdr;
  while (NS_SUCCEEDED(rv) && NS_SUCCEEDED(rv = msgEnumerator->HasMoreElements(&hasMore)) && hasMore)
  {
    rv = msgEnumerator->GetNext(getter_AddRefs(supports));
    if (NS_SUCCEEDED(rv) && supports)
    {
      msgHdr = do_QueryInterface(supports);
      nsMsgKey msgKey;
      PRUint32 msgFlags, newFlags;
      msgHdr->GetMessageKey(&msgKey);
      msgHdr->GetFlags(&msgFlags);
      AdjustReadFlag(msgHdr, &msgFlags);
      m_keys.InsertAt(*viewIndex, msgKey);
      // ### TODO - how about hasChildren flag?
      m_flags.InsertAt(*viewIndex, msgFlags & ~MSG_VIEW_FLAGS);
      // ### TODO this is going to be tricky - might use enumerators
      m_levels.InsertAt(*viewIndex, level); 
      // turn off thread or elided bit if they got turned on (maybe from new only view?)
      msgHdr->AndFlags(~(MSG_VIEW_FLAG_ISTHREAD | MSG_FLAG_ELIDED), &newFlags);
      (*pNumListed)++;
      (*viewIndex)++;
      if (*pNumListed > numChildren)
      {
        NS_ASSERTION(PR_FALSE, "thread corrupt in db");
        // if we've listed more messages than are in the thread, then the db
        // is corrupt, and we should invalidate it.
        // we'll use this rv to indicate there's something wrong with the db
        // though for now it probably won't get paid attention to.
        m_db->SetSummaryValid(PR_FALSE);
        rv = NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE;
        break;
      }
      rv = ListIdsInThreadOrder(threadHdr, msgKey, level + 1, viewIndex, pNumListed);
    }
  }
  return rv; // we don't want to return the rv from the enumerator when it reaches the end, do we?
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgThreadedDBView::ListThreadIds ( nsMsgKey startMsg,
PRBool  unreadOnly,
nsMsgKey pOutput,
PRInt32 pFlags,
char *  pLevels,
PRInt32  numToList,
PRInt32 pNumListed,
PRInt32 pTotalHeaders 
) [protected, inherited]

Definition at line 396 of file nsMsgThreadedDBView.cpp.

{
  nsresult rv = NS_OK;
  // N.B..don't ret before assigning numListed to *pNumListed
  PRInt32     numListed = 0;
  
  if (*startMsg > 0)
  {
    NS_ASSERTION(m_threadEnumerator != nsnull, "where's our iterator?");     // for now, we'll just have to rely on the caller leaving
    // the iterator in the right place.
  }
  else
  {
    NS_ASSERTION(m_db, "no db");
    if (!m_db) return NS_ERROR_UNEXPECTED;
    rv = m_db->EnumerateThreads(getter_AddRefs(m_threadEnumerator));
    NS_ENSURE_SUCCESS(rv, rv);
  }
  
  PRBool hasMore = PR_FALSE;
  
  nsCOMPtr <nsIMsgThread> threadHdr ;
  PRInt32     threadsRemoved = 0;
  for (numListed = 0; numListed < numToList
    && NS_SUCCEEDED(rv = m_threadEnumerator->HasMoreElements(&hasMore)) && (hasMore == PR_TRUE);)
  {
    nsCOMPtr <nsISupports> supports;
    rv = m_threadEnumerator->GetNext(getter_AddRefs(supports));
    if (NS_FAILED(rv))
    {
      threadHdr = nsnull;
      break;
    }
    threadHdr = do_QueryInterface(supports);
    if (!threadHdr)
      break;
    nsCOMPtr <nsIMsgDBHdr> msgHdr;
    PRUint32 numChildren;
    if (unreadOnly)
      threadHdr->GetNumUnreadChildren(&numChildren);
    else
      threadHdr->GetNumChildren(&numChildren);
    PRUint32 threadFlags;
    threadHdr->GetFlags(&threadFlags);
    if (numChildren != 0)   // not empty thread
    {
      PRInt32 unusedRootIndex;
      if (pTotalHeaders)
        *pTotalHeaders += numChildren;
      if (unreadOnly)
        rv = threadHdr->GetFirstUnreadChild(getter_AddRefs(msgHdr));
      else
        rv = threadHdr->GetRootHdr(&unusedRootIndex, getter_AddRefs(msgHdr));
      if (NS_SUCCEEDED(rv) && msgHdr != nsnull && WantsThisThread(threadHdr))
      {
        PRUint32 msgFlags;
        PRUint32 newMsgFlags;
        nsMsgKey msgKey;
        msgHdr->GetMessageKey(&msgKey);
        msgHdr->GetFlags(&msgFlags);
        // turn off high byte of msg flags - used for view flags.
        msgFlags &= ~MSG_VIEW_FLAGS;
        pOutput[numListed] = msgKey;
        pLevels[numListed] = 0;
        // turn off these flags on msg hdr - they belong in thread
        msgHdr->AndFlags(~(MSG_FLAG_WATCHED | MSG_FLAG_IGNORED), &newMsgFlags);
        AdjustReadFlag(msgHdr, &msgFlags);
        // try adding in MSG_VIEW_FLAG_ISTHREAD flag for unreadonly view.
        pFlags[numListed] = msgFlags | MSG_VIEW_FLAG_ISTHREAD | threadFlags;
        if (numChildren > 1)
          pFlags[numListed] |= MSG_VIEW_FLAG_HASCHILDREN;
        
        numListed++;
      }
      else
        NS_ASSERTION(NS_SUCCEEDED(rv) && msgHdr, "couldn't get header for some reason");
    }
    else if (threadsRemoved < 10 && !(threadFlags & (MSG_FLAG_WATCHED | MSG_FLAG_IGNORED)))
    {
      // ### remove thread.
      threadsRemoved++;     // don't want to remove all empty threads first time
      // around as it will choke preformance for upgrade.
#ifdef DEBUG_bienvenu
      printf("removing empty non-ignored non-watched thread\n");
#endif
    }
  }
  
  if (hasMore && threadHdr)
  {
    threadHdr->GetThreadKey(startMsg);
  }
  else
  {
    *startMsg = nsMsgKey_None;
    nsCOMPtr <nsIDBChangeListener> dbListener = do_QueryInterface(m_threadEnumerator);
    // this is needed to make the thread enumerator release its reference to the db.
    if (dbListener)
      dbListener->OnAnnouncerGoingAway(nsnull);
    m_threadEnumerator = nsnull;
  }
  *pNumListed = numListed;
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::ListUnreadIdsInThread ( nsIMsgThread threadHdr,
nsMsgViewIndex  startOfThreadViewIndex,
PRUint32 pNumListed 
) [protected, inherited]

Definition at line 4623 of file nsMsgDBView.cpp.

{
  NS_ENSURE_ARG(threadHdr);
  // these children ids should be in thread order.
  nsMsgViewIndex viewIndex = startOfThreadViewIndex + 1;
  *pNumListed = 0;
  nsMsgKey topLevelMsgKey = m_keys[startOfThreadViewIndex];

  PRUint32 numChildren;
  threadHdr->GetNumChildren(&numChildren);
  PRUint32 i;
  for (i = 0; i < numChildren; i++)
  {
    nsCOMPtr <nsIMsgDBHdr> msgHdr;
    threadHdr->GetChildHdrAt(i, getter_AddRefs(msgHdr));
    if (msgHdr != nsnull)
    {
      nsMsgKey msgKey;
      PRUint32 msgFlags;
      msgHdr->GetMessageKey(&msgKey);
      msgHdr->GetFlags(&msgFlags);
      PRBool isRead = AdjustReadFlag(msgHdr, &msgFlags);
      // determining the level is going to be tricky, since we're not storing the
      // level in the db anymore. It will mean looking up the view for each of the
      // ancestors of the current msg until we find one in the view. I guess we could
      // check each ancestor to see if it's unread before looking for it in the view.
      if (!isRead)
      {
        PRUint8 levelToAdd;
        // just make sure flag is right in db.
        m_db->MarkHdrRead(msgHdr, PR_FALSE, nsnull);
        if (msgKey != topLevelMsgKey)
        {
          m_keys.InsertAt(viewIndex, msgKey);
          m_flags.InsertAt(viewIndex, msgFlags);
          levelToAdd = FindLevelInThread(msgHdr, startOfThreadViewIndex, viewIndex);
          m_levels.InsertAt(viewIndex, levelToAdd);
          viewIndex++;
          (*pNumListed)++;
        }
      }
    }
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::MarkThreadOfMsgRead ( nsMsgKey  msgId,
nsMsgViewIndex  msgIndex,
nsMsgKeyArray &  idsMarkedRead,
PRBool  bRead 
) [protected, inherited]

Definition at line 4886 of file nsMsgDBView.cpp.

{
    nsCOMPtr <nsIMsgThread> threadHdr;
    nsresult rv = GetThreadContainingIndex(msgIndex, getter_AddRefs(threadHdr));
    NS_ENSURE_SUCCESS(rv, rv);

    nsMsgViewIndex threadIndex;

    NS_ASSERTION(threadHdr, "threadHdr is null");
    if (!threadHdr) 
        return NS_MSG_MESSAGE_NOT_FOUND;

    nsCOMPtr <nsIMsgDBHdr> firstHdr;
    threadHdr->GetChildAt(0, getter_AddRefs(firstHdr));
    nsMsgKey firstHdrId;
    firstHdr->GetMessageKey(&firstHdrId);
    if (msgId != firstHdrId)
        threadIndex = GetIndexOfFirstDisplayedKeyInThread(threadHdr);
    else
        threadIndex = msgIndex;
    return MarkThreadRead(threadHdr, threadIndex, idsMarkedRead, bRead);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::MarkThreadRead ( nsIMsgThread threadHdr,
nsMsgViewIndex  threadIndex,
nsMsgKeyArray &  idsMarkedRead,
PRBool  bRead 
) [protected, inherited]

Definition at line 4909 of file nsMsgDBView.cpp.

{
    PRBool threadElided = PR_TRUE;
    if (threadIndex != nsMsgViewIndex_None)
        threadElided = (m_flags.GetAt(threadIndex) & MSG_FLAG_ELIDED);

    PRUint32 numChildren;
    threadHdr->GetNumChildren(&numChildren);
    for (PRInt32 childIndex = 0; childIndex < (PRInt32) numChildren ; childIndex++)
    {
        nsCOMPtr <nsIMsgDBHdr> msgHdr;
        threadHdr->GetChildHdrAt(childIndex, getter_AddRefs(msgHdr));
        NS_ASSERTION(msgHdr, "msgHdr is null");
        if (!msgHdr) 
            continue;

        PRBool isRead;

        nsMsgKey hdrMsgId;
        msgHdr->GetMessageKey(&hdrMsgId);
        m_db->IsRead(hdrMsgId, &isRead);

        if (isRead != bRead) 
        {
            // MarkHdrRead will change the unread count on the thread
            m_db->MarkHdrRead(msgHdr, bRead, nsnull);
            // insert at the front.  should we insert at the end?
            idsMarkedRead.InsertAt(0, hdrMsgId);
        }
    }

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::NavigateFromPos ( nsMsgNavigationTypeValue  motion,
nsMsgViewIndex  startIndex,
nsMsgKey pResultKey,
nsMsgViewIndex pResultIndex,
nsMsgViewIndex pThreadIndex,
PRBool  wrap 
) [protected, inherited]

Definition at line 4987 of file nsMsgDBView.cpp.

{
    nsresult rv = NS_OK;
    nsMsgKey resultThreadKey;
    nsMsgViewIndex curIndex;
    nsMsgViewIndex lastIndex = (GetSize() > 0) ? (nsMsgViewIndex) GetSize() - 1 : nsMsgViewIndex_None;
    nsMsgViewIndex threadIndex = nsMsgViewIndex_None;

    // if there aren't any messages in the view, bail out.
    if (GetSize() <= 0) 
    {
      *pResultIndex = nsMsgViewIndex_None;
      *pResultKey = nsMsgKey_None;
      return NS_OK;
    }

    switch (motion) 
    {
        case nsMsgNavigationType::firstMessage:
            *pResultIndex = 0;
            *pResultKey = m_keys.GetAt(0);
            break;
        case nsMsgNavigationType::nextMessage:
            // return same index and id on next on last message
            *pResultIndex = PR_MIN(startIndex + 1, lastIndex);
            *pResultKey = m_keys.GetAt(*pResultIndex);
            break;
        case nsMsgNavigationType::previousMessage:
            *pResultIndex = (startIndex != nsMsgViewIndex_None && startIndex > 0) ? startIndex - 1 : 0;
            *pResultKey = m_keys.GetAt(*pResultIndex);
            break;
        case nsMsgNavigationType::lastMessage:
            *pResultIndex = lastIndex;
            *pResultKey = m_keys.GetAt(*pResultIndex);
            break;
        case nsMsgNavigationType::firstFlagged:
            rv = FindFirstFlagged(pResultIndex);
            if (IsValidIndex(*pResultIndex))
                *pResultKey = m_keys.GetAt(*pResultIndex);
            break;
        case nsMsgNavigationType::nextFlagged:
            rv = FindNextFlagged(startIndex + 1, pResultIndex);
            if (IsValidIndex(*pResultIndex))
                *pResultKey = m_keys.GetAt(*pResultIndex);
            break;
        case nsMsgNavigationType::previousFlagged:
            rv = FindPrevFlagged(startIndex, pResultIndex);
            if (IsValidIndex(*pResultIndex))
                *pResultKey = m_keys.GetAt(*pResultIndex);
            break;
        case nsMsgNavigationType::firstNew:
            rv = FindFirstNew(pResultIndex);
            if (IsValidIndex(*pResultIndex))
                *pResultKey = m_keys.GetAt(*pResultIndex);
            break;
        case nsMsgNavigationType::firstUnreadMessage:
            startIndex = nsMsgViewIndex_None;        // note fall thru - is this motion ever used?
        case nsMsgNavigationType::nextUnreadMessage:
            for (curIndex = (startIndex == nsMsgViewIndex_None) ? 0 : startIndex; curIndex <= lastIndex && lastIndex != nsMsgViewIndex_None; curIndex++) {
                PRUint32 flags = m_flags.GetAt(curIndex);

                // don't return start index since navigate should move
                if (!(flags & (MSG_FLAG_READ | MSG_VIEW_FLAG_DUMMY)) && (curIndex != startIndex)) 
                {
                    *pResultIndex = curIndex;
                    *pResultKey = m_keys.GetAt(*pResultIndex);
                    break;
                }
                // check for collapsed thread with new children
                if ((m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay) && flags & MSG_VIEW_FLAG_ISTHREAD && flags & MSG_FLAG_ELIDED) {
                    nsCOMPtr <nsIMsgThread> threadHdr;
                    GetThreadContainingIndex(curIndex, getter_AddRefs(threadHdr));
                    NS_ENSURE_SUCCESS(rv, rv);

                    NS_ASSERTION(threadHdr, "threadHdr is null");
                    if (!threadHdr)
                        continue;
                    PRUint32 numUnreadChildren;
                    threadHdr->GetNumUnreadChildren(&numUnreadChildren);
                    if (numUnreadChildren > 0) 
                    {
                        PRUint32 numExpanded;
                        ExpandByIndex(curIndex, &numExpanded);
                        lastIndex += numExpanded;
                        if (pThreadIndex)
                            *pThreadIndex = curIndex;
                    }
                }
            }
            if (curIndex > lastIndex) 
            {
                // wrap around by starting at index 0.
                if (wrap) 
                {
                    nsMsgKey startKey = GetAt(startIndex);

                    rv = NavigateFromPos(nsMsgNavigationType::nextUnreadMessage, nsMsgViewIndex_None, pResultKey, pResultIndex, pThreadIndex, PR_FALSE);

                    if (*pResultKey == startKey) 
                    {   
                        // wrapped around and found start message!
                        *pResultIndex = nsMsgViewIndex_None;
                        *pResultKey = nsMsgKey_None;
                    }
                }
                else
                {
                    *pResultIndex = nsMsgViewIndex_None;
                    *pResultKey = nsMsgKey_None;
                }
            }
            break;
        case nsMsgNavigationType::previousUnreadMessage:
            if (startIndex == nsMsgViewIndex_None) 
              break;
            rv = FindPrevUnread(m_keys.GetAt(startIndex), pResultKey,
                                &resultThreadKey);
            if (NS_SUCCEEDED(rv)) 
            {
                *pResultIndex = FindViewIndex(*pResultKey);
                if (*pResultKey != resultThreadKey && (m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay)) 
                {
                    threadIndex  = ThreadIndexOfMsg(*pResultKey, nsMsgViewIndex_None);
                    if (*pResultIndex == nsMsgViewIndex_None) 
                    {
                        nsCOMPtr <nsIMsgThread> threadHdr;
                        nsCOMPtr <nsIMsgDBHdr> msgHdr;
                        rv = m_db->GetMsgHdrForKey(*pResultKey, getter_AddRefs(msgHdr));
                        NS_ENSURE_SUCCESS(rv, rv);
                        rv = GetThreadContainingMsgHdr(msgHdr, getter_AddRefs(threadHdr));
                        NS_ENSURE_SUCCESS(rv, rv);

                        NS_ASSERTION(threadHdr, "threadHdr is null");
                        if (threadHdr) 
                            break;
                        PRUint32 numUnreadChildren;
                        threadHdr->GetNumUnreadChildren(&numUnreadChildren);
                        if (numUnreadChildren > 0) 
                        {
                            PRUint32 numExpanded;
                            ExpandByIndex(threadIndex, &numExpanded);
                        }
                        *pResultIndex = FindViewIndex(*pResultKey);
                    }
                }
                if (pThreadIndex)
                    *pThreadIndex = threadIndex;
            }
            break;
        case nsMsgNavigationType::lastUnreadMessage:
            break;
        case nsMsgNavigationType::nextUnreadThread:
            if (startIndex != nsMsgViewIndex_None)
              ApplyCommandToIndices(nsMsgViewCommandType::markThreadRead, &startIndex, 1);

            return NavigateFromPos(nsMsgNavigationType::nextUnreadMessage, startIndex, pResultKey, pResultIndex, pThreadIndex, PR_TRUE);
        case nsMsgNavigationType::toggleThreadKilled:
            {
                PRBool resultKilled;
                nsUInt32Array selection;
                GetSelectedIndices(&selection);
                ToggleIgnored(selection.GetData(), selection.GetSize(), &threadIndex, &resultKilled);
                if (resultKilled) 
                {
                    return NavigateFromPos(nsMsgNavigationType::nextUnreadThread, threadIndex, pResultKey, pResultIndex, pThreadIndex, PR_TRUE);
                }
                else 
                {
                    *pResultIndex = nsMsgViewIndex_None;
                    *pResultKey = nsMsgKey_None;
                    return NS_OK;
                }
            }
          // check where navigate says this will take us. If we have the message in the view,
          // return it. Otherwise, return an error.
      case nsMsgNavigationType::back:
      case nsMsgNavigationType::forward:
        {
          nsXPIDLCString folderUri, msgUri;
          nsXPIDLCString viewFolderUri;
          nsCOMPtr<nsIMsgFolder> curFolder = m_viewFolder ? m_viewFolder : m_folder;
          curFolder->GetURI(getter_Copies(viewFolderUri));
          PRInt32 relPos = (motion == nsMsgNavigationType::forward) 
            ? 1 : (m_currentlyDisplayedMsgKey != nsMsgKey_None) ? -1 : 0;
          PRInt32 curPos;
          nsresult rv = mMessengerInstance->GetFolderUriAtNavigatePos(relPos, getter_Copies(folderUri));
          NS_ENSURE_SUCCESS(rv, rv);
          if (folderUri.Equals(viewFolderUri))
          {
            nsCOMPtr <nsIMsgDBHdr> msgHdr;
            nsresult rv = mMessengerInstance->GetMsgUriAtNavigatePos(relPos, getter_Copies(msgUri));
            NS_ENSURE_SUCCESS(rv, rv);
            mMessengerInstance->MsgHdrFromURI(msgUri.get(), getter_AddRefs(msgHdr));
            if (msgHdr)
            {
              mMessengerInstance->GetNavigatePos(&curPos);
              curPos += relPos;
              *pResultIndex = FindHdr(msgHdr);
              mMessengerInstance->SetNavigatePos(curPos);
              msgHdr->GetMessageKey(pResultKey);
              return NS_OK;
            }
          }
          *pResultIndex = nsMsgViewIndex_None;
          *pResultKey = nsMsgKey_None;
          break;
          
        }
        default:
            NS_ASSERTION(0, "unsupported motion");
            break;
    }
    return NS_OK;
}

Here is the call graph for this function:

Indicates if navigation of the passed motion type is valid.

PRBool nsMsgDBView::NonDummyMsgSelected ( nsMsgViewIndex indices,
PRInt32  numIndices 
) [protected, inherited]

Definition at line 5765 of file nsMsgDBView.cpp.

{
  for (nsMsgViewIndex index = 0; index < (nsMsgViewIndex) numIndices; index++)
  {
    PRUint32 flags = m_flags.GetAt(indices[index]);
    if (!(flags & MSG_VIEW_FLAG_DUMMY))
      return PR_TRUE;
  }
  return PR_FALSE;
}
void nsMsgDBView::NoteChange ( nsMsgViewIndex  firstlineChanged,
PRInt32  numChanged,
nsMsgViewNotificationCodeValue  changeType 
) [protected, inherited]

Definition at line 4779 of file nsMsgDBView.cpp.

{
  if (mTree && !mSuppressChangeNotification)
  {
    switch (changeType)
    {
    case nsMsgViewNotificationCode::changed:
      mTree->InvalidateRange(firstLineChanged, firstLineChanged + numChanged - 1);
      break;
    case nsMsgViewNotificationCode::insertOrDelete:
      if (numChanged < 0)
        mRemovingRow = PR_TRUE;
      // the caller needs to have adjusted m_keys before getting here, since
      // RowCountChanged() will call our GetRowCount()
      mTree->RowCountChanged(firstLineChanged, numChanged);
      mRemovingRow = PR_FALSE;
    case nsMsgViewNotificationCode::all:
      ClearHdrCache();
      break;
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsMsgDBView::NoteEndChange ( nsMsgViewIndex  firstlineChanged,
PRInt32  numChanged,
nsMsgViewNotificationCodeValue  changeType 
) [protected, inherited]

Definition at line 4807 of file nsMsgDBView.cpp.

{
  // send the notification now.
  NoteChange(firstlineChanged, numChanged, changeType);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsMsgDBView::NoteStartChange ( nsMsgViewIndex  firstlineChanged,
PRInt32  numChanged,
nsMsgViewNotificationCodeValue  changeType 
) [protected, inherited]

Definition at line 4803 of file nsMsgDBView.cpp.

{
}

Here is the caller graph for this function:

PRBool nsMsgDBView::OfflineMsgSelected ( nsMsgViewIndex indices,
PRInt32  numIndices 
) [protected, inherited]

Definition at line 5750 of file nsMsgDBView.cpp.

{
  nsCOMPtr <nsIMsgLocalMailFolder> localFolder = do_QueryInterface(m_folder);
  if (localFolder)
    return PR_TRUE;

  for (nsMsgViewIndex index = 0; index < (nsMsgViewIndex) numIndices; index++)
  {
    PRUint32 flags = m_flags.GetAt(indices[index]);
    if ((flags & MSG_FLAG_OFFLINE))
      return PR_TRUE;
  }
  return PR_FALSE;
}

Here is the call graph for this function:

void nsIMsgDBView::onDeleteCompleted ( in boolean  succeeded) [inherited]
void nsMsgThreadedDBView::OnExtraFlagChanged ( nsMsgViewIndex  index,
PRUint32  extraFlag 
) [protected, virtual, inherited]

Reimplemented from nsMsgDBView.

Definition at line 502 of file nsMsgThreadedDBView.cpp.

{
  if (IsValidIndex(index))
  {
    if (m_havePrevView)
    {
      nsMsgKey keyChanged = m_keys[index];
      nsMsgViewIndex prevViewIndex = m_prevKeys.FindIndex(keyChanged);
      if (prevViewIndex != nsMsgViewIndex_None)
      {
        PRUint32 prevFlag = m_prevFlags.GetAt(prevViewIndex);
        // don't want to change the elided bit, or has children or is thread
        if (prevFlag & MSG_FLAG_ELIDED)
          extraFlag |= MSG_FLAG_ELIDED;
        else
          extraFlag &= ~MSG_FLAG_ELIDED;
        if (prevFlag & MSG_VIEW_FLAG_ISTHREAD)
          extraFlag |= MSG_VIEW_FLAG_ISTHREAD;
        else
          extraFlag &= ~MSG_VIEW_FLAG_ISTHREAD;
        if (prevFlag & MSG_VIEW_FLAG_HASCHILDREN)
          extraFlag |= MSG_VIEW_FLAG_HASCHILDREN;
        else
          extraFlag &= ~MSG_VIEW_FLAG_HASCHILDREN;
        m_prevFlags.SetAt(prevViewIndex, extraFlag);    // will this be right?
      }
    }
  }
  // we don't really know what's changed, but to be on the safe side, set the sort invalid
  // so that reverse sort will pick it up.
  if (m_sortType == nsMsgViewSortType::byStatus || m_sortType == nsMsgViewSortType::byFlagged || 
    m_sortType == nsMsgViewSortType::byUnread || m_sortType == nsMsgViewSortType::byPriority)
    m_sortValid = PR_FALSE;
}

Here is the call graph for this function:

void nsIDBChangeListener::onHdrAdded ( in nsIMsgDBHdr  aHdrChanged,
in nsMsgKey  aParentKey,
in long  aFlags,
in nsIDBChangeListener  aInstigator 
) [inherited]
void nsIDBChangeListener::onHdrChange ( in nsIMsgDBHdr  aHdrChanged,
in unsigned long  aOldFlags,
in unsigned long  aNewFlags,
in nsIDBChangeListener  aInstigator 
) [inherited]
void nsIDBChangeListener::onHdrDeleted ( in nsIMsgDBHdr  aHdrChanged,
in nsMsgKey  aParentKey,
in long  aFlags,
in nsIDBChangeListener  aInstigator 
) [inherited]
void nsMsgThreadedDBView::OnHeaderAddedOrDeleted ( ) [protected, virtual, inherited]

Reimplemented from nsMsgDBView.

Definition at line 537 of file nsMsgThreadedDBView.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgThreadedDBView::OnNewHeader ( nsIMsgDBHdr newHdr,
nsMsgKey  aParentKey,
PRBool  ensureListed 
) [protected, virtual, inherited]

Reimplemented from nsMsgDBView.

Reimplemented in nsMsgQuickSearchDBView, and nsMsgGroupView.

Definition at line 577 of file nsMsgThreadedDBView.cpp.

{
  nsresult rv = NS_OK;
  nsMsgKey newKey;
  newHdr->GetMessageKey(&newKey);

  // views can override this behaviour, which is to append to view.
  // This is the mail behaviour, but threaded views want
  // to insert in order...
  if (newHdr)
  {
    PRUint32 msgFlags;
    newHdr->GetFlags(&msgFlags);
    if ((m_viewFlags & nsMsgViewFlagsType::kUnreadOnly) && !ensureListed && (msgFlags & MSG_FLAG_READ))
      return NS_OK;
    // Currently, we only add the header in a threaded view if it's a thread.
    // We used to check if this was the first header in the thread, but that's
    // a bit harder in the unreadOnly view. But we'll catch it below.

    // for search view we don't support threaded display so just add it to the view.   
    if (!(m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay)) // || msgHdr->GetMessageKey() == m_messageDB->GetKeyOfFirstMsgInThread(msgHdr->GetMessageKey()))
      rv = AddHdr(newHdr);
    else      // need to find the thread we added this to so we can change the hasnew flag
      // added message to existing thread, but not to view
    {  // Fix flags on thread header.
      PRInt32 threadCount;
      PRUint32 threadFlags;
      nsMsgViewIndex threadIndex = ThreadIndexOfMsg(newKey, nsMsgViewIndex_None, &threadCount, &threadFlags);
      if (threadIndex != nsMsgViewIndex_None)
      {
        PRUint32     flags = m_flags[threadIndex];
        if (!(flags & MSG_VIEW_FLAG_HASCHILDREN))
        {
          flags |= MSG_VIEW_FLAG_HASCHILDREN | MSG_VIEW_FLAG_ISTHREAD;
          if (!(m_viewFlags & nsMsgViewFlagsType::kUnreadOnly))
            flags |= MSG_FLAG_ELIDED;
          m_flags[threadIndex] = flags;
        }
        if (!(flags & MSG_FLAG_ELIDED))   // thread is expanded
        {                                                      // insert child into thread
          // levels of other hdrs may have changed!
          PRUint32   newFlags = msgFlags;
          PRInt32 level = 0;
          nsMsgViewIndex insertIndex = threadIndex;
          if (aParentKey == nsMsgKey_None)
          {
            newFlags |= MSG_VIEW_FLAG_ISTHREAD | MSG_VIEW_FLAG_HASCHILDREN;
          }
          else
          {
            nsMsgViewIndex parentIndex = FindParentInThread(aParentKey, threadIndex);
            level = m_levels[parentIndex] + 1;
            insertIndex = GetInsertInfoForNewHdr(newHdr, parentIndex, level);
          }
          m_keys.InsertAt(insertIndex, newKey);
          m_flags.InsertAt(insertIndex, newFlags, 1);
          m_levels.InsertAt(insertIndex, level);

          // the call to NoteChange() has to happen after we add the key
          // as NoteChange() will call RowCountChanged() which will call our GetRowCount()
          NoteChange(insertIndex, 1, nsMsgViewNotificationCode::insertOrDelete);

          if (aParentKey == nsMsgKey_None)
          {
            // this header is the new king! try collapsing the existing thread,
            // removing it, installing this header as king, and expanding it.
            CollapseByIndex(threadIndex, nsnull);
            // call base class, so child won't get promoted.
            // nsMsgDBView::RemoveByIndex(threadIndex); 
            ExpandByIndex(threadIndex, nsnull);
          }
        }
        else if (aParentKey == nsMsgKey_None)
        {
          // if we have a collapsed thread which just got a new
          // top of thread, change the keys array.
          m_keys.SetAt(threadIndex, newKey);
        }
        // note change, to update the parent thread's unread and total counts
        NoteChange(threadIndex, 1, nsMsgViewNotificationCode::changed);
      }
      else // adding msg to thread that's not in view.
      {
        nsCOMPtr <nsIMsgThread> threadHdr;
        m_db->GetThreadContainingMsgHdr(newHdr, getter_AddRefs(threadHdr));
        if (threadHdr)
        {
          AddMsgToThreadNotInView(threadHdr, newHdr, ensureListed);
        }
      }
    }
  }
  else
    rv = NS_MSG_MESSAGE_NOT_FOUND;
  return rv;
}

Here is the call graph for this function:

void nsIDBChangeListener::onParentChanged ( in nsMsgKey  aKeyChanged,
in nsMsgKey  oldParent,
in nsMsgKey  newParent,
in nsIDBChangeListener  aInstigator 
) [inherited]
NS_IMETHODIMP nsMsgThreadedDBView::OnParentChanged ( nsMsgKey  aKeyChanged,
nsMsgKey  oldParent,
nsMsgKey  newParent,
nsIDBChangeListener aInstigator 
) [inherited]

Definition at line 675 of file nsMsgThreadedDBView.cpp.

{
  // we need to adjust the level of the hdr whose parent changed, and invalidate that row,
  // iff we're in threaded mode.
  if (PR_FALSE && m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay)
  {
    nsMsgViewIndex childIndex = FindViewIndex(aKeyChanged);
    if (childIndex != nsMsgViewIndex_None)
    {
      nsMsgViewIndex parentIndex = FindViewIndex(newParent);
      PRInt32 newParentLevel = (parentIndex == nsMsgViewIndex_None) ? -1 : m_levels[parentIndex];
      nsMsgViewIndex oldParentIndex = FindViewIndex(oldParent);
      PRInt32 oldParentLevel = (oldParentIndex != nsMsgViewIndex_None || newParent == nsMsgKey_None) 
        ? m_levels[oldParentIndex] : -1 ;
      PRInt32 levelChanged = m_levels[childIndex];
      PRInt32 parentDelta = oldParentLevel - newParentLevel;
      m_levels[childIndex] = (newParent == nsMsgKey_None) ? 0 : newParentLevel + 1;
      if (parentDelta > 0)
      {
        for (nsMsgViewIndex viewIndex = childIndex + 1; viewIndex < GetSize() && m_levels[viewIndex] > levelChanged;  viewIndex++)
        {
          m_levels[viewIndex] = m_levels[viewIndex] - parentDelta;
          NoteChange(viewIndex, 1, nsMsgViewNotificationCode::changed);
        }
      }
      NoteChange(childIndex, 1, nsMsgViewNotificationCode::changed);
    }
  }
  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsMsgThreadedDBView::Open ( nsIMsgFolder folder,
nsMsgViewSortTypeValue  sortType,
nsMsgViewSortOrderValue  sortOrder,
nsMsgViewFlagsTypeValue  viewFlags,
PRInt32 pCount 
) [inherited]

Reimplemented in nsMsgQuickSearchDBView, and nsMsgGroupView.

Definition at line 60 of file nsMsgThreadedDBView.cpp.

{
  nsresult rv = nsMsgDBView::Open(folder, sortType, sortOrder, viewFlags, pCount);
  NS_ENSURE_SUCCESS(rv, rv);

  if (!m_db)
    return NS_ERROR_NULL_POINTER;
  // Preset msg hdr cache size for performance reason.
  PRInt32 totalMessages, unreadMessages;
  nsCOMPtr <nsIDBFolderInfo> dbFolderInfo;
  PersistFolderInfo(getter_AddRefs(dbFolderInfo));
  NS_ENSURE_SUCCESS(rv, rv);
  // save off sort type and order, view type and flags
  dbFolderInfo->GetNumUnreadMessages(&unreadMessages);
  dbFolderInfo->GetNumMessages(&totalMessages);
  if (m_viewFlags & nsMsgViewFlagsType::kUnreadOnly)
  { 
    // Set unread msg size + extra entries to avoid reallocation on new mail.
    totalMessages = (PRUint32)unreadMessages+MSGHDR_CACHE_LOOK_AHEAD_SIZE;  
  }
  else
  {
    if (totalMessages > MSGHDR_CACHE_MAX_SIZE) 
      totalMessages = MSGHDR_CACHE_MAX_SIZE;        // use max default
    else if (totalMessages > 0)
      totalMessages += MSGHDR_CACHE_LOOK_AHEAD_SIZE;// allocate extra entries to avoid reallocation on new mail.
  }
  // if total messages is 0, then we probably don't have any idea how many headers are in the db
  // so we have no business setting the cache size.
  if (totalMessages > 0)
    m_db->SetMsgHdrCacheSize((PRUint32)totalMessages);
  
  if (pCount)
    *pCount = 0;
  rv = InitThreadedView(pCount);

  // this is a hack, but we're trying to find a way to correct
  // incorrect total and unread msg counts w/o paying a big
  // performance penalty. So, if we're not threaded, just add
  // up the total and unread messages in the view and see if that
  // matches what the db totals say. Except ignored threads are
  // going to throw us off...hmm. Unless we just look at the
  // unread counts which is what mostly tweaks people anyway...
  PRInt32 unreadMsgsInView = 0;
  if (!(m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay))
  {
    for (PRInt32 i = 0; i < m_flags.GetSize(); i++)
    {
      if (! (m_flags.GetAt(i) & MSG_FLAG_READ))
        unreadMsgsInView++;
    }
    if (unreadMessages != unreadMsgsInView)
      m_db->SyncCounts();
  }
  m_db->SetMsgHdrCacheSize(MSGHDR_CACHE_DEFAULT_SIZE);

  return rv;
}

Here is the call graph for this function:

void nsIMsgDBView::open ( in nsIMsgFolder  folder,
in nsMsgViewSortTypeValue  sortType,
in nsMsgViewSortOrderValue  sortOrder,
in nsMsgViewFlagsTypeValue  viewFlags,
out long  count 
) [inherited]
void nsIMsgDBView::openWithHdrs ( in nsISimpleEnumerator  aHeaders,
in nsMsgViewSortTypeValue  aSortType,
in nsMsgViewSortOrderValue  aSortOrder,
in nsMsgViewFlagsTypeValue  aViewFlags,
out long  aCount 
) [inherited]
nsresult nsMsgDBView::OrExtraFlag ( nsMsgViewIndex  index,
PRUint32  orflag 
) [protected, inherited]

Definition at line 5408 of file nsMsgDBView.cpp.

{
  PRUint32    flag;
  if (!IsValidIndex(index))
    return NS_MSG_INVALID_DBVIEW_INDEX;
  flag = m_flags[index];
  flag |= orflag;
  m_flags[index] = flag;
  OnExtraFlagChanged(index, flag);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsITreeView::performAction ( in wstring  action) [inherited]

A command API that can be used to invoke commands on the selection.

The tree will automatically invoke this method when certain keys are pressed. For example, when the DEL key is pressed, performAction will be called with the "delete" string.

void nsITreeView::performActionOnCell ( in wstring  action,
in long  row,
in nsITreeColumn  col 
) [inherited]

A command API that can be used to invoke commands on a specific cell.

void nsITreeView::performActionOnRow ( in wstring  action,
in long  row 
) [inherited]

A command API that can be used to invoke commands on a specific row.

nsresult nsMsgDBView::PersistFolderInfo ( nsIDBFolderInfo **  dbFolderInfo) [protected, inherited]

Definition at line 4841 of file nsMsgDBView.cpp.

{
  nsresult rv = m_db->GetDBFolderInfo(dbFolderInfo);
  NS_ENSURE_SUCCESS(rv, rv);
  // save off sort type and order, view type and flags
  (*dbFolderInfo)->SetSortType(m_sortType);
  (*dbFolderInfo)->SetSortOrder(m_sortOrder);
  (*dbFolderInfo)->SetViewFlags(m_viewFlags);
  nsMsgViewTypeValue viewType;
  GetViewType(&viewType);
  (*dbFolderInfo)->SetViewType(viewType);
  return rv;
}

Here is the caller graph for this function: