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 | Private Member Functions | Static Private Attributes
nsMsgDBView Class Reference

#include <nsMsgDBView.h>

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

List of all members.

Public Member Functions

 nsMsgDBView ()
virtual ~nsMsgDBView ()
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 const char * GetViewName (void)
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 PRBool WantsThisThread (nsIMsgThread *thread)
virtual nsresult AddHdr (nsIMsgDBHdr *msgHdr)
PRBool GetShowingIgnored ()
virtual nsresult OnNewHeader (nsIMsgDBHdr *aNewHdr, nsMsgKey parentKey, PRBool ensureListed)
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)
virtual nsresult RemoveByIndex (nsMsgViewIndex index)
virtual void OnExtraFlagChanged (nsMsgViewIndex, PRUint32)
virtual void OnHeaderAddedOrDeleted ()
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

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]

Private Member Functions

PRBool ServerSupportsFilterAfterTheFact ()
nsresult PerformActionsOnJunkMsgs ()
nsresult DetermineActionsForJunkMsgs (PRBool *movingJunkMessages, PRBool *markingJunkMessagesRead, nsIMsgFolder **junkTargetFolder)

Static Private Attributes

static nsDateFormatSelector m_dateFormatDefault = kDateFormatShort
static nsDateFormatSelector m_dateFormatThisWeek = kDateFormatShort
static nsDateFormatSelector m_dateFormatToday = kDateFormatNone

Detailed Description

Definition at line 93 of file nsMsgDBView.h.


Constructor & Destructor Documentation

Definition at line 131 of file nsMsgDBView.cpp.


Member Function Documentation

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

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:

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

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]

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]

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]

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]

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]

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.

Definition at line 4763 of file nsMsgDBView.cpp.

Here is the caller graph for this function:

nsIMsgDBView nsIMsgDBView::cloneDBView ( in nsIMessenger  aMessengerInstance,
in nsIMsgWindow  aMsgWindow,
in nsIMsgDBViewCommandUpdater  aCommandUpdater 
) [inherited]
void nsIMsgDBView::close ( ) [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]

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]

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]

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:

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.

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]

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:

nsresult nsMsgDBView::DetermineActionsForJunkMsgs ( PRBool movingJunkMessages,
PRBool markingJunkMessagesRead,
nsIMsgFolder **  junkTargetFolder 
) [private]

Definition at line 2936 of file nsMsgDBView.cpp.

{
  // there are two possible actions which may be performed
  // on messages marked as spam: marking as read and moving
  // somewhere...

  *movingJunkMessages = false;
  *markingJunkMessagesRead = false;
  
  // ... the 'somewhere', junkTargetFolder, can be a folder,
  // but if it remains null we'll delete the messages
  
  *junkTargetFolder = nsnull;

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

  nsCOMPtr<nsIMsgIncomingServer> server;
  rv = folder->GetServer(getter_AddRefs(server));
  NS_ENSURE_SUCCESS(rv, rv);
    
  nsCOMPtr <nsISpamSettings> spamSettings;
  rv = server->GetSpamSettings(getter_AddRefs(spamSettings));
  NS_ENSURE_SUCCESS(rv, rv);
  
  // if the spam system is completely disabled we won't do anything
  // question: is this a valid choice?
  PRInt32 spamLevel;
  (void)spamSettings->GetLevel(&spamLevel);
  if (!spamLevel)
    return NS_OK;
    
  // When the user explicitly marks a message as junk, we can mark it as read,
  // too. This is independent of the "markAsReadOnSpam" pref, which applies
  // only to automatically-classified messages.
  // Note that this behaviour should match the one in the front end for marking
  // as junk via toolbar/context menu.
  nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
  if (NS_SUCCEEDED(rv))
  {
    prefBranch->GetBoolPref("mailnews.ui.junk.manualMarkAsJunkMarksRead",
                            markingJunkMessagesRead);
  }

  // now let's determine whether we'll be taking the second action,
  // the move / deletion (and also determine which of these two)
   
  PRBool manualMark; 
  (void)spamSettings->GetManualMark(&manualMark);
  if (!manualMark)
    return NS_OK;
  
  PRInt32 manualMarkMode;
  (void)spamSettings->GetManualMarkMode(&manualMarkMode);
  NS_ASSERTION(manualMarkMode == nsISpamSettings::MANUAL_MARK_MODE_MOVE
            || manualMarkMode == nsISpamSettings::MANUAL_MARK_MODE_DELETE,
            "bad manual mark mode");
  
  // the folder must allow us to execute the move (or the deletion)
  PRUint32 folderFlags;
  folder->GetFlags(&folderFlags);
  
  if (manualMarkMode == nsISpamSettings::MANUAL_MARK_MODE_MOVE) 
  {
    // if this is a junk folder
    // (not only "the" junk folder for this account)
    // don't do the move
    if (folderFlags & MSG_FOLDER_FLAG_JUNK)
      return NS_OK;
    
    nsXPIDLCString spamFolderURI;
    rv = spamSettings->GetSpamFolderURI(getter_Copies(spamFolderURI));
    NS_ENSURE_SUCCESS(rv,rv);
    
    NS_ASSERTION(!spamFolderURI.IsEmpty(), "spam folder URI is empty, can't move");
    if (!spamFolderURI.IsEmpty()) 
    {
      //nsCOMPtr<nsIMsgFolder> destFolder;
      rv = GetExistingFolder(spamFolderURI.get(), junkTargetFolder);
      NS_ENSURE_SUCCESS(rv,rv);

      *movingJunkMessages = true;
    }
    return NS_OK;
  }
  
  // at this point manualMarkMode == nsISpamSettings::MANUAL_MARK_MODE_DELETE)

  // if this is in the trash, let's not delete
  if (folderFlags & MSG_FOLDER_FLAG_TRASH)
    return NS_OK;

  return folder->GetCanDeleteMessages(movingJunkMessages);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 4774 of file nsMsgDBView.cpp.

Here is the caller graph for this function:

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]

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|.

Definition at line 4769 of file nsMsgDBView.cpp.

Here is the caller graph for this function:

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:

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

Definition at line 840 of file nsMsgDBView.cpp.

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

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]

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:

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]

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]

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]

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]

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]

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.

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:

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]

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 
)

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:

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]
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]

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]

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]

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]

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]

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]

Definition at line 204 of file nsMsgDBView.h.

Here is the caller graph for this function:

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

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]

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]

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:

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

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]

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]

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:

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* nsMsgDBView::GetViewName ( void  ) [inline, protected, virtual]
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]

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:

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:

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:

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.

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]

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]

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 nsMsgDBView::ListUnreadIdsInThread ( nsIMsgThread threadHdr,
nsMsgViewIndex  startOfThreadViewIndex,
PRUint32 pNumListed 
) [protected]

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]

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]

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]

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]

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]

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]

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]

Definition at line 4803 of file nsMsgDBView.cpp.

{
}

Here is the caller graph for this function:

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

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]
virtual void nsMsgDBView::OnExtraFlagChanged ( nsMsgViewIndex  ,
PRUint32   
) [inline, protected, virtual]

Reimplemented in nsMsgThreadedDBView.

Definition at line 281 of file nsMsgDBView.h.

{}

Here is the caller 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]
virtual void nsMsgDBView::OnHeaderAddedOrDeleted ( ) [inline, protected, virtual]

Reimplemented in nsMsgThreadedDBView.

Definition at line 282 of file nsMsgDBView.h.

{}     

Here is the caller graph for this function:

nsresult nsMsgDBView::OnNewHeader ( nsIMsgDBHdr aNewHdr,
nsMsgKey  parentKey,
PRBool  ensureListed 
) [protected, virtual]

Reimplemented in nsMsgQuickSearchDBView, nsMsgGroupView, nsMsgSearchDBView, nsMsgXFVirtualFolderDBView, and nsMsgThreadedDBView.

Definition at line 4212 of file nsMsgDBView.cpp.

{
    nsresult rv = NS_OK;
    // views can override this behaviour, which is to append to view.
    // This is the mail behaviour, but threaded views will want
    // to insert in order...
    if (newHdr)
       rv = AddHdr(newHdr);
    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]
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]

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.

Definition at line 2861 of file nsMsgDBView.cpp.

{
  PRBool movingJunkMessages,markingJunkMessagesRead;
  nsCOMPtr <nsIMsgFolder> junkTargetFolder;

  // question: is it possible for the junk mail move/mark as read
  // options to change after we've handled some of the batches but
  // before we've handled the last one? if so, we can decide when
  // handling each batch whether to save its indices or forget
  // them, and then perform the known action when handling the 
  // last batch; however if the options can change between batches
  // we may have to remember in separate arrays the indices to
  // mark as read and the indices to move
  //
  // for now, we assume the options do not change between batches
  //
  
  nsresult rv = DetermineActionsForJunkMsgs(&movingJunkMessages, &markingJunkMessagesRead, getter_AddRefs(junkTargetFolder));
  NS_ENSURE_SUCCESS(rv,rv);
       
  // nothing to do, bail out
  if (!(movingJunkMessages || markingJunkMessagesRead))
    return NS_OK;

  NS_ASSERTION( (mNumJunkIndices > 0), "no indices of marked-as-junk messages to act on");

  if (mNumJunkIndices > 1)
    NS_QuickSort(mJunkIndices, mNumJunkIndices, sizeof(nsMsgViewIndex), CompareViewIndices, nsnull);

  if (markingJunkMessagesRead)
  {
    // notes on marking junk as read:
    // 1. there are 2 occasions on which junk messages are marked as 
    //    read: after a manual marking (here and in the front end) and after
    //    automatic classification by the bayesian filter (see code for local
    //    mail folders and for imap mail folders). The server-specific
    //    markAsReadOnSpam pref only applies to the latter, the former is
    //    controlled by "mailnews.ui.junk.manualMarkAsJunkMarksRead".
    // 2. even though move/delete on manual mark may be
    //    turned off, we might still need to mark as read

    NoteStartChange(nsMsgViewNotificationCode::none, 0, 0);
    rv = ApplyCommandToIndices(nsMsgViewCommandType::markMessagesRead, mJunkIndices, mNumJunkIndices);
    NoteEndChange(nsMsgViewNotificationCode::none, 0, 0);
    NS_ASSERTION(NS_SUCCEEDED(rv), "marking marked-as-junk messages as read failed");
  }
  if (movingJunkMessages) 
  {
    // check if one of the messages to be junked is actually selected
    // if more than one message being junked, one must be selected.
    // if no tree selection at all, must be in stand-alone message window.
    PRBool junkedMsgSelected = mNumJunkIndices > 1 || !mTreeSelection;
    for (nsMsgViewIndex junkIndex = 0; !junkedMsgSelected && junkIndex < mNumJunkIndices; junkIndex++)
      mTreeSelection->IsSelected(mJunkIndices[junkIndex], &junkedMsgSelected);

    // if a junked msg is selected, tell the FE to call SetNextMessageAfterDelete() because a delete is coming
    if (junkedMsgSelected && mCommandUpdater)
    {
      rv = mCommandUpdater->UpdateNextMessageAfterDelete();
      NS_ENSURE_SUCCESS(rv,rv);
    }
  
    NoteStartChange(nsMsgViewNotificationCode::none, 0, 0);
    if (junkTargetFolder) 
      rv = ApplyCommandToIndicesWithFolder(nsMsgViewCommandType::moveMessages, mJunkIndices, mNumJunkIndices, junkTargetFolder);
    else
      rv = ApplyCommandToIndices(nsMsgViewCommandType::deleteMsg, mJunkIndices, mNumJunkIndices);
    NoteEndChange(nsMsgViewNotificationCode::none, 0, 0);

    NS_ASSERTION(NS_SUCCEEDED(rv), "move or deletion of marked-as-junk messages failed");
  }
  return rv;
}

Here is the call graph for this function:

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

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:

nsresult nsMsgDBView::RemoveByIndex ( nsMsgViewIndex  index) [protected, virtual]

Reimplemented in nsMsgSearchDBView, and nsMsgThreadedDBView.

Definition at line 2556 of file nsMsgDBView.cpp.

{
  if (!IsValidIndex(index))
    return NS_MSG_INVALID_DBVIEW_INDEX;
  m_keys.RemoveAt(index);
  m_flags.RemoveAt(index);
  m_levels.RemoveAt(index);

  // the call to NoteChange() has to happen after we remove the key
  // as NoteChange() will call RowCountChanged() which will call our GetRowCount()
  if (!m_deletingRows)
    NoteChange(index, -1, nsMsgViewNotificationCode::insertOrDelete); // an example where view is not the listener - D&D messages
  
  return NS_OK;
}

Here is the call graph for this function:

void nsIMsgDBView::removeColumnHandler ( in AString  aColumn) [inherited]
nsresult nsMsgDBView::RestoreSelection ( nsMsgKey  aCurrentmsgKey,
nsMsgKeyArray *  aMsgKeyArray 
) [protected]

Definition at line 790 of file nsMsgDBView.cpp.

{
  // we don't do anything on nested Save / Restore calls.
  m_saveRestoreSelectionDepth--;
  if (m_saveRestoreSelectionDepth)
    return NS_OK;

  if (!mTreeSelection)  // don't assert.
    return NS_OK;
  
  // turn our message keys into corresponding view indices
  PRInt32 arraySize = aMsgKeyArray->GetSize();
  nsMsgViewIndex     currentViewPosition = nsMsgViewIndex_None;
  nsMsgViewIndex     newViewPosition = nsMsgViewIndex_None;

  // if we are threaded, we need to do a little more work
  // we need to find (and expand) all the threads that contain messages 
  // that we had selected before.
  if (m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay)
  {
    for (PRInt32 index = 0; index < arraySize; index ++) 
    {
      FindKey(aMsgKeyArray->GetAt(index), PR_TRUE /* expand */);
    }
  }

  for (PRInt32 index = 0; index < arraySize; index ++)
  {
    newViewPosition = FindKey(aMsgKeyArray->GetAt(index), PR_FALSE);  
    // add the index back to the selection.
    mTreeSelection->ToggleSelect(newViewPosition);
  }

  // make sure the currentView was preserved....
  if (aCurrentMsgKey != nsMsgKey_None)
    currentViewPosition = FindKey(aCurrentMsgKey, PR_TRUE);

  if (mTree)
    mTreeSelection->SetCurrentIndex(currentViewPosition);
      
  // make sure the current message is once again visible in the thread pane
  // so we don't have to go search for it in the thread pane
  if (mTree && currentViewPosition != nsMsgViewIndex_None)
    mTree->EnsureRowIsVisible(currentViewPosition);

  // unfreeze selection.
  mTreeSelection->SetSelectEventsSuppressed(PR_FALSE);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3109 of file nsMsgDBView.cpp.

{
    PRUint32 num = GetSize();
       
    nsCOMPtr <nsISupportsArray> folders;
    GetFolders(getter_AddRefs(folders));

    // go up half the array swapping values
    for (PRUint32 i = 0; i < (num / 2); i++) 
    {
        // swap flags
        PRUint32 end = num - i - 1;
        PRUint32 tempFlags = m_flags.GetAt(i);
        m_flags.SetAt(i, m_flags.GetAt(end));
        m_flags.SetAt(end, tempFlags);

        // swap keys
        nsMsgKey tempKey = m_keys.GetAt(i);
        m_keys.SetAt(i, m_keys.GetAt(end));
        m_keys.SetAt(end, tempKey);

        if (folders)
        {
            // swap folders -- 
            // needed when search is done across multiple folders
            nsCOMPtr<nsISupports> tmpSupports = dont_AddRef(folders->ElementAt(i));
            nsCOMPtr<nsISupports> endSupports = dont_AddRef(folders->ElementAt(end));
            folders->SetElementAt(i, endSupports);
            folders->SetElementAt(end, tmpSupports);
        }
        // no need to swap elements in m_levels, 
        // since we won't call ReverseSort() if we
        // are in threaded mode, so m_levels are all the same.
    }

    return NS_OK;
}

Here is the call graph for this function:

Definition at line 3035 of file nsMsgDBView.cpp.

{
    nsUInt32Array *newFlagArray = new nsUInt32Array;
    if (!newFlagArray) 
        return NS_ERROR_OUT_OF_MEMORY;
    nsMsgKeyArray *newKeyArray = new nsMsgKeyArray;
    if (!newKeyArray) 
    {
        delete newFlagArray;
        return NS_ERROR_OUT_OF_MEMORY;
    }
    nsUint8Array *newLevelArray = new nsUint8Array;
    if (!newLevelArray) 
    {
        delete newFlagArray;
        delete newKeyArray;
        return NS_ERROR_OUT_OF_MEMORY;
    }

    PRInt32 sourceIndex, destIndex;
    PRInt32 viewSize = GetSize();

    newKeyArray->SetSize(m_keys.GetSize());
    newFlagArray->SetSize(m_flags.GetSize());
    newLevelArray->SetSize(m_levels.GetSize());

    for (sourceIndex = 0, destIndex = viewSize - 1; sourceIndex < viewSize;) 
    {
        PRInt32 endThread;  // find end of current thread.
        PRBool inExpandedThread = PR_FALSE;
        for (endThread = sourceIndex; endThread < viewSize; endThread++) 
        {
            PRUint32 flags = m_flags.GetAt(endThread);
            if (!inExpandedThread && (flags & (MSG_VIEW_FLAG_ISTHREAD|MSG_VIEW_FLAG_HASCHILDREN)) && !(flags & MSG_FLAG_ELIDED))
                inExpandedThread = PR_TRUE;
            else if (flags & MSG_VIEW_FLAG_ISTHREAD) 
            {
                if (inExpandedThread)
                    endThread--;
                break;
            }
        }

        if (endThread == viewSize)
            endThread--;
        PRInt32 saveEndThread = endThread;
        while (endThread >= sourceIndex)
        {
            newKeyArray->SetAt(destIndex, m_keys.GetAt(endThread));
            newFlagArray->SetAt(destIndex, m_flags.GetAt(endThread));
            newLevelArray->SetAt(destIndex, m_levels.GetAt(endThread));
            endThread--;
            destIndex--;
        }
        sourceIndex = saveEndThread + 1;
    }
    // this copies the contents of both arrays - it would be cheaper to
    // just assign the new data ptrs to the old arrays and "forget" the new
    // arrays' data ptrs, so they won't be freed when the arrays are deleted.
    m_keys.RemoveAll();
    m_flags.RemoveAll();
    m_levels.RemoveAll();
    m_keys.InsertAt(0, newKeyArray);
    m_flags.InsertAt(0, newFlagArray);
    m_levels.InsertAt(0, newLevelArray);

    // if we swizzle data pointers for these arrays, this won't be right.
    delete newFlagArray;
    delete newKeyArray;
    delete newLevelArray;

    return NS_OK;
}

Here is the call graph for this function:

nsresult nsMsgDBView::SaveAndClearSelection ( nsMsgKey aCurrentMsgKey,
nsMsgKeyArray *  aMsgKeyArray 
) [protected]

Definition at line 747 of file nsMsgDBView.cpp.

{
  // we don't do anything on nested Save / Restore calls.
  m_saveRestoreSelectionDepth++;
  if (m_saveRestoreSelectionDepth != 1)
    return NS_OK;
  
  if (!mTreeSelection || !mTree)
    return NS_OK;

  // first, freeze selection.
  mTreeSelection->SetSelectEventsSuppressed(PR_TRUE);

  // second, save the current index.
  if (aCurrentMsgKey)
  {
    PRInt32 currentIndex;
    if (NS_SUCCEEDED(mTreeSelection->GetCurrentIndex(&currentIndex)) && currentIndex >= 0 && currentIndex < GetSize())
      *aCurrentMsgKey = m_keys.GetAt(currentIndex);
    else
      *aCurrentMsgKey = nsMsgKey_None;
  }
  
  // third, get an array of view indices for the selection.
  nsUInt32Array selection;
  GetSelectedIndices(&selection);
  PRInt32 numIndices = selection.GetSize();

  // now store the msg key for each selected item.
  nsMsgKey msgKey;
  for (PRInt32 index = 0; index < numIndices; index++)
  {
    msgKey = m_keys.GetAt(selection.GetAt(index));
    aMsgKeyArray->Add(msgKey);
  }

  // clear the selection, we'll manually restore it later.
  if (mTreeSelection)
    mTreeSelection->ClearSelection();

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3528 of file nsMsgDBView.cpp.

{
  if (m_viewFolder)
  {
    nsCOMPtr <nsIDBFolderInfo> folderInfo;
    nsCOMPtr <nsIMsgDatabase> db;
    nsresult rv = m_viewFolder->GetDBFolderInfoAndDB(getter_AddRefs(folderInfo), getter_AddRefs(db));
    if (NS_SUCCEEDED(rv) && folderInfo)
    {
      // save off sort type and order, view type and flags
      folderInfo->SetSortType(sortType);
      folderInfo->SetSortOrder(sortOrder);
    }
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Should be called from a XUL onselect handler whenever the selection changes.

Definition at line 2207 of file nsMsgDBView.cpp.

{
  if (!m_folder)  // cross folder virtual folders might not have a folder set.
    return PR_FALSE; 

  // can't manually run news filters yet
  if (mIsNews)
    return PR_FALSE;

  nsCOMPtr <nsIMsgIncomingServer> server;
  nsresult rv = m_folder->GetServer(getter_AddRefs(server));
  if (NS_FAILED(rv))
    return PR_FALSE; // unexpected

  // filter after the fact is implement using search
  // so if you can't search, you can't filter after the fact
  PRBool canSearch;
  rv = server->GetCanSearchMessages(&canSearch);
  if (NS_FAILED(rv))
    return PR_FALSE; // unexpected

  return canSearch;
}

Here is the call graph for this function:

nsresult nsMsgDBView::SetAsJunkByIndex ( nsIJunkMailPlugin aJunkPlugin,
nsMsgViewIndex  aIndex,
nsMsgJunkStatus  aNewClassification 
) [protected]

Definition at line 2751 of file nsMsgDBView.cpp.

{
    // get the message header (need this to get string properties)
    //
    nsCOMPtr <nsIMsgDBHdr> msgHdr;
    nsresult rv = GetMsgHdrForViewIndex(aIndex, getter_AddRefs(msgHdr));
    NS_ENSURE_SUCCESS(rv, rv);

    // get the old junk score
    //
    nsXPIDLCString junkScoreStr;
    rv = msgHdr->GetStringProperty("junkscore", getter_Copies(junkScoreStr));

    // and the old origin
    //
    nsXPIDLCString oldOriginStr;
    rv = msgHdr->GetStringProperty("junkscoreorigin", 
                                   getter_Copies(oldOriginStr));

    // if this was not classified by the user, say so
    //
    nsMsgJunkStatus oldUserClassification;
    if (oldOriginStr.get()[0] != 'u') {
        oldUserClassification = nsIJunkMailPlugin::UNCLASSIFIED;
    } else {
        // otherwise, pass the actual user classification
        //
        if (junkScoreStr.IsEmpty()) {
            oldUserClassification = nsIJunkMailPlugin::UNCLASSIFIED;
        } else if (atoi(junkScoreStr) > 50) {
            oldUserClassification = nsIJunkMailPlugin::JUNK;
        } else {
            oldUserClassification = nsIJunkMailPlugin::GOOD;
        }
    }

    // get the URI for this message so we can pass it to the plugin
    //
    nsXPIDLCString uri;
    rv = GetURIForViewIndex(aIndex, getter_Copies(uri));
    NS_ENSURE_SUCCESS(rv, rv);

    // tell the plugin about this change, so that it can (potentially)
    // adjust its database appropriately
    //
    rv = aJunkPlugin->SetMessageClassification(
        uri, oldUserClassification, aNewClassification, mMsgWindow, this);
    NS_ENSURE_SUCCESS(rv, rv);

    // this routine is only reached if the user someone touched the UI
    // and told us the junk status of this message.
    // Set origin first so that listeners on the junkscore will
    // know the correct origin.
    rv = SetStringPropertyByIndex(aIndex, "junkscoreorigin", "user");
    NS_ASSERTION(NS_SUCCEEDED(rv), "SetStringPropertyByIndex failed");

    // set the junk score on the message itself
    // 
    rv = SetStringPropertyByIndex(
        aIndex, "junkscore", 
        aNewClassification == nsIJunkMailPlugin::JUNK ? "100" : "0");
    NS_ENSURE_SUCCESS(rv, rv);

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsITreeView::setCellText ( in long  row,
in nsITreeColumn  col,
in AString  value 
) [inherited]

setCellText is called when the contents of the cell have been edited by the user.

void nsITreeView::setCellValue ( in long  row,
in nsITreeColumn  col,
in AString  value 
) [inherited]

setCellValue is called when the value of the cell has been set by the user.

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

nsresult nsMsgDBView::SetExtraFlag ( nsMsgViewIndex  index,
PRUint32  extraflag 
) [protected]

Definition at line 5432 of file nsMsgDBView.cpp.

{
  if (!IsValidIndex(