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
nsMsgXFVirtualFolderDBView Class Reference

#include <nsMsgXFVirtualFolderDBView.h>

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

List of all members.

Public Member Functions

 nsMsgXFVirtualFolderDBView ()
virtual ~nsMsgXFVirtualFolderDBView ()
NS_IMETHOD SetSearchSession (nsIMsgSearchSession *aSearchSession)
virtual
NS_DECL_NSIMSGSEARCHNOTIFY
const char * 
GetViewName (void)
NS_IMETHOD Open (nsIMsgFolder *folder, nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder, nsMsgViewFlagsTypeValue viewFlags, PRInt32 *pCount)
NS_IMETHOD CloneDBView (nsIMessenger *aMessengerInstance, nsIMsgWindow *aMsgWindow, nsIMsgDBViewCommandUpdater *aCmdUpdater, nsIMsgDBView **_retval)
NS_IMETHOD CopyDBView (nsMsgDBView *aNewMsgDBView, nsIMessenger *aMessengerInstance, nsIMsgWindow *aMsgWindow, nsIMsgDBViewCommandUpdater *aCmdUpdater)
NS_IMETHOD Close ()
NS_IMETHOD GetViewType (nsMsgViewTypeValue *aViewType)
NS_IMETHOD DoCommand (nsMsgViewCommandTypeValue command)
virtual nsresult OnNewHeader (nsIMsgDBHdr *newHdr, nsMsgKey parentKey, PRBool ensureListed)
virtual nsresult InsertHdrFromFolder (nsIMsgDBHdr *msgHdr, nsISupports *folder)
NS_IMETHOD GetMsgFolder (nsIMsgFolder **aMsgFolder)
void UpdateCacheAndViewForPrevSearchedFolders (nsIMsgFolder *curSearchFolder)
void UpdateCacheAndViewForFolder (nsIMsgFolder *folder, nsMsgKey *newHits, PRUint32 numNewHits)
void RemovePendingDBListeners ()
NS_IMETHOD Sort (nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder)
NS_IMETHOD DoCommandWithFolder (nsMsgViewCommandTypeValue command, nsIMsgFolder *destFolder)
NS_IMETHOD GetHdrForFirstSelectedMessage (nsIMsgDBHdr **hdr)
NS_IMETHOD GetCellText (PRInt32 aRow, nsITreeColumn *aCol, nsAString &aValue)
virtual nsresult GetMsgHdrForViewIndex (nsMsgViewIndex index, nsIMsgDBHdr **msgHdr)
NS_IMETHOD GetFolderForViewIndex (nsMsgViewIndex index, nsIMsgFolder **folder)
NS_IMETHOD OnAnnouncerGoingAway (nsIDBChangeAnnouncer *instigator)
virtual nsresult GetFolders (nsISupportsArray **aFolders)
virtual nsresult GetFolderFromMsgURI (const char *aMsgURI, nsIMsgFolder **aFolder)
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)
void OnStartCopy ()
 Notify the observer that the message has started to be copied.
void OnProgress (in PRUint32 aProgress, in PRUint32 aProgressMax)
 Notify the observer that progress as occurred for the message copy aProgress - aProgressMax -.
void SetMessageKey (in PRUint32 aKey)
 Setting newly created message key.
void GetMessageId (in nsCString aMessageId)
 Getting the file message message ID.
void OnStopCopy (in nsresult aStatus)
 Notify the observer that the message copied operation has completed.
void onSearchHit (in nsIMsgDBHdr header, in nsIMsgFolder folder)
void onSearchDone (in nsresult status)
void onNewSearch ()

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

nsresult FetchLocation (PRInt32 aRow, PRUnichar **aLocationString)
virtual nsresult AddHdrFromFolder (nsIMsgDBHdr *msgHdr, nsISupports *folder)
virtual nsresult GetDBForViewIndex (nsMsgViewIndex index, nsIMsgDatabase **db)
virtual nsresult RemoveByIndex (nsMsgViewIndex index)
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 GetFoldersAndHdrsForSelection (nsMsgViewIndex *indices, PRInt32 numIndices)
nsresult GroupSearchResultsByFolder ()
nsresult PartitionSelectionByFolder (nsMsgViewIndex *indices, PRInt32 numIndices, nsUInt32Array **indexArrays, PRInt32 *numArrays)
virtual nsresult ApplyCommandToIndicesWithFolder (nsMsgViewCommandTypeValue command, nsMsgViewIndex *indices, PRInt32 numIndices, nsIMsgFolder *destFolder)
nsresult ProcessRequestsInOneFolder (nsIMsgWindow *window)
nsresult ProcessRequestsInAllFolders (nsIMsgWindow *window)
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 nsMsgViewIndex GetInsertIndex (nsIMsgDBHdr *msgHdr)
nsMsgViewIndex GetIndexForThread (nsIMsgDBHdr *hdr)
virtual nsresult GetThreadContainingIndex (nsMsgViewIndex index, nsIMsgThread **thread)
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 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)
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 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)
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

PRUint32 m_cachedFolderArrayIndex
nsCOMArray< nsIMsgFolderm_foldersSearchingOver
nsCOMArray< nsIMsgDBHdrm_hdrHits
nsCOMPtr< nsIMsgFolderm_curFolderGettingHits
PRUint32 m_curFolderStartKeyIndex
PRBool m_curFolderHasCachedHits
PRBool m_doingSearch
nsWeakPtr m_searchSession
nsCOMPtr< nsISupportsArraym_folders
nsCOMPtr< nsISupportsArraym_hdrsForEachFolder
nsCOMPtr< nsISupportsArraym_copyListenerList
nsCOMPtr< nsISupportsArraym_uniqueFoldersSelected
PRInt32 mCurIndex
nsMsgViewIndexmIndicesForChainedDeleteAndFile
PRInt32 mTotalIndices
nsCOMArray< nsIMsgDatabasem_dbToUseList
nsMsgViewCommandTypeValue mCommand
nsCOMPtr< nsIMsgFoldermDestFolder
nsCOMPtr< nsITreeBoxObjectmTree
nsCOMPtr< nsITreeSelectionmTreeSelection
PRUint32 mNumSelectedRows
PRPackedBool mSuppressMsgDisplay
PRPackedBool mSuppressCommandUpdating
PRPackedBool mRemovingRow
PRPackedBool mCommandsNeedDisablingBecauseOfSelection
PRPackedBool mSuppressChangeNotification
PRPackedBool mGoForwardEnabled
PRPackedBool mGoBackEnabled
nsMsgKeyArray m_keys
nsUInt32Array m_flags
nsUint8Array m_levels
nsMsgImapDeleteModel mDeleteModel
nsCOMPtr< nsIMsgDBHdrm_cachedHdr
nsMsgKey m_cachedMsgKey
nsMsgKey m_currentlyDisplayedMsgKey
nsCString m_currentlyDisplayedMsgUri
nsMsgViewIndex m_currentlyDisplayedViewIndex
PRPackedBool m_deletingRows
PRPackedBool mIsNews
PRPackedBool mShowSizeInLines
PRPackedBool m_sortValid
PRUint8 m_saveRestoreSelectionDepth
nsCOMPtr< nsIMsgDatabasem_db
nsCOMPtr< nsIMsgFolderm_folder
nsCOMPtr< nsIMsgFolderm_viewFolder
nsCOMPtr< nsIAtommRedirectorTypeAtom
nsCOMPtr< nsIAtommMessageTypeAtom
nsMsgViewSortTypeValue m_sortType
nsMsgViewSortOrderValue m_sortOrder
nsMsgViewFlagsTypeValue m_viewFlags
nsCOMPtr< nsIDateTimeFormatmDateFormater
nsCOMPtr< nsIMsgHeaderParsermHeaderParser
nsCOMPtr< nsIMsgTagServicemTagService
nsCOMPtr< nsIMessengermMessengerInstance
nsCOMPtr< nsIMsgWindowmMsgWindow
nsCOMPtr
< nsIMsgDBViewCommandUpdater
mCommandUpdater
nsCOMPtr< nsIStringBundlemMessengerStringBundle
nsString mLabelPrefDescriptions [PREF_LABELS_MAX]
nsString mLabelPrefColors [PREF_LABELS_MAX]
PRUint32 mNumMessagesRemainingInBatch
nsMsgViewIndexmJunkIndices
PRUint32 mNumJunkIndices
nsUInt32Array mIndicesToNoteChange
nsCOMArray
< nsIMsgCustomColumnHandler
m_customColumnHandlers
nsStringArray m_customColumnHandlerIDs

Static Protected Attributes

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

Detailed Description

Definition at line 47 of file nsMsgXFVirtualFolderDBView.h.


Constructor & Destructor Documentation

Definition at line 60 of file nsMsgXFVirtualFolderDBView.cpp.

{      
}

Member Function Documentation

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

Definition at line 4396 of file nsMsgDBView.cpp.

{
  PRUint32    flags = 0;
#ifdef DEBUG_bienvenu
  NS_ASSERTION((int) m_keys.GetSize() == m_flags.GetSize() && (int) m_keys.GetSize() == m_levels.GetSize(), "view arrays out of sync!");
#endif

  if (!GetShowingIgnored()) 
  {
    nsCOMPtr <nsIMsgThread> thread;
    m_db->GetThreadContainingMsgHdr(msgHdr, getter_AddRefs(thread));
    if (thread)
    {
      thread->GetFlags(&flags);
      if (flags & MSG_FLAG_IGNORED)
        return NS_OK;
    }
  }

  nsMsgKey msgKey, threadId;
  nsMsgKey threadParent;
  msgHdr->GetMessageKey(&msgKey);
  msgHdr->GetThreadId(&threadId);
  msgHdr->GetThreadParent(&threadParent);

  msgHdr->GetFlags(&flags);
  // ### this isn't quite right, is it? Should be checking that our thread parent key is none?
  if (threadParent == nsMsgKey_None) 
    flags |= MSG_VIEW_FLAG_ISTHREAD;
  nsMsgViewIndex insertIndex = GetInsertIndex(msgHdr);
  if (insertIndex == nsMsgViewIndex_None)
  {
    // if unreadonly, level is 0 because we must be the only msg in the thread.
    PRInt32 levelToAdd = 0;
    
    if (m_sortOrder == nsMsgViewSortOrder::ascending)
    {
      m_keys.Add(msgKey);
      m_flags.Add(flags);
      m_levels.Add(levelToAdd);
      
      // the call to NoteChange() has to happen after we add the key
      // as NoteChange() will call RowCountChanged() which will call our GetRowCount()
      NoteChange(GetSize() - 1, 1, nsMsgViewNotificationCode::insertOrDelete);
    }
    else
    {
      m_keys.InsertAt(0, msgKey);
      m_flags.InsertAt(0, flags);
      m_levels.InsertAt(0, levelToAdd);
      
      // the call to NoteChange() has to happen after we insert the key
      // as NoteChange() will call RowCountChanged() which will call our GetRowCount()
      NoteChange(0, 1, nsMsgViewNotificationCode::insertOrDelete);
    }
    m_sortValid = PR_FALSE;
  }
  else
  {
    m_keys.InsertAt(insertIndex, msgKey);
    m_flags.InsertAt(insertIndex, flags);
    PRInt32 level = 0; 
    m_levels.InsertAt(insertIndex, level);
    
    // the call to NoteChange() has to happen after we add the key
    // as NoteChange() will call RowCountChanged() which will call our GetRowCount()
    NoteChange(insertIndex, 1, nsMsgViewNotificationCode::insertOrDelete);
  }
  OnHeaderAddedOrDeleted();
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgSearchDBView::AddHdrFromFolder ( nsIMsgDBHdr msgHdr,
nsISupports *  folder 
) [protected, virtual, inherited]

Definition at line 193 of file nsMsgSearchDBView.cpp.

{
  m_folders->AppendElement(folder);
  nsMsgKey msgKey;
  PRUint32 msgFlags;
  msgHdr->GetMessageKey(&msgKey);
  // nsMsgKey_None means it's not a valid hdr.
  if (msgKey != nsMsgKey_None)
  {
    msgHdr->GetFlags(&msgFlags);
    m_keys.Add(msgKey);
    m_levels.Add(0);
    m_flags.Add(msgFlags);
    
    // this needs to be called after we add the key, since RowCountChanged() will call our GetRowCount()
    if (mTree)
      mTree->RowCountChanged(GetSize() - 1, 1);
  }
  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, inherited]

Definition at line 4943 of file nsMsgDBView.cpp.

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

Here is the caller graph for this function:

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

Definition at line 5840 of file nsMsgDBView.cpp.

{
  PRInt32 rowChange = rowCountAfterSort - rowCountBeforeSort;

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

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

Here is the caller graph for this function:

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

Definition at line 5420 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 321 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

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

Definition at line 2375 of file nsMsgDBView.cpp.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from nsMsgDBView.

Definition at line 466 of file nsMsgSearchDBView.cpp.

{
  mCommand = command;
  mDestFolder = destFolder;
  return nsMsgDBView::ApplyCommandToIndicesWithFolder(command, indices, numIndices, destFolder);
}
boolean nsITreeView::canDrop ( in long  index,
in long  orientation 
) [inherited]

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

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

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

Definition at line 4763 of file nsMsgDBView.cpp.

Here is the caller graph for this function:

NS_IMETHODIMP nsMsgXFVirtualFolderDBView::CloneDBView ( nsIMessenger aMessengerInstance,
nsIMsgWindow aMsgWindow,
nsIMsgDBViewCommandUpdater aCmdUpdater,
nsIMsgDBView **  _retval 
)

Definition at line 87 of file nsMsgXFVirtualFolderDBView.cpp.

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

  if (!newMsgDBView)
    return NS_ERROR_OUT_OF_MEMORY;

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

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

Here is the call graph for this function:

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

Reimplemented from nsMsgSearchDBView.

Definition at line 80 of file nsMsgXFVirtualFolderDBView.cpp.

Here is the call graph for this function:

void nsIMsgDBView::close ( ) [inherited]
nsresult nsMsgDBView::CollapseAll ( ) [protected, inherited]

Definition at line 4155 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

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

Definition at line 4167 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsMsgXFVirtualFolderDBView::CopyDBView ( nsMsgDBView aNewMsgDBView,
nsIMessenger aMessengerInstance,
nsIMsgWindow aMsgWindow,
nsIMsgDBViewCommandUpdater aCmdUpdater 
)

Reimplemented from nsMsgSearchDBView.

Definition at line 104 of file nsMsgXFVirtualFolderDBView.cpp.

{
  nsMsgSearchDBView::CopyDBView(aNewMsgDBView, aMessengerInstance, aMsgWindow, aCmdUpdater);

  nsMsgXFVirtualFolderDBView* newMsgDBView = (nsMsgXFVirtualFolderDBView *) aNewMsgDBView;

  newMsgDBView->m_viewFolder = m_viewFolder;
  newMsgDBView->m_searchSession = m_searchSession;

  PRInt32 scopeCount;
  nsCOMPtr <nsIMsgSearchSession> searchSession = do_QueryReferent(m_searchSession);
  nsCOMPtr<nsIMsgDBService> msgDBService = do_GetService(NS_MSGDB_SERVICE_CONTRACTID);
  searchSession->CountSearchScopes(&scopeCount);
  for (PRInt32 i = 0; i < scopeCount; i++)
  {
    nsMsgSearchScopeValue scopeId;
    nsCOMPtr<nsIMsgFolder> searchFolder;
    searchSession->GetNthSearchScope(i, &scopeId, getter_AddRefs(searchFolder));
    if (searchFolder)
    {
      nsCOMPtr<nsIMsgDatabase> searchDB;
      nsXPIDLCString searchUri;
      m_viewFolder->GetURI(getter_Copies(searchUri));
      nsresult rv = searchFolder->GetMsgDatabase(nsnull, getter_AddRefs(searchDB));
      if (NS_SUCCEEDED(rv) && searchDB)
      {
        if (msgDBService)
          msgDBService->RegisterPendingListener(searchFolder, newMsgDBView);
      }
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from nsMsgDBView.

Definition at line 358 of file nsMsgSearchDBView.cpp.

{
    nsresult rv;
    GetFoldersAndHdrsForSelection(indices, numIndices);

    rv = ProcessRequestsInOneFolder(window);

    return rv;
}

Here is the call graph for this function:

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

Definition at line 3943 of file nsMsgDBView.cpp.

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

Here is the caller graph for this function:

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

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

Called on the view when a header is clicked.

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

Definition at line 846 of file nsMsgDBView.cpp.

{
  nsAutoString currentView;

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

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

  }

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


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

Reimplemented from nsMsgDBView.

Definition at line 344 of file nsMsgSearchDBView.cpp.

{
    nsresult rv;
    GetFoldersAndHdrsForSelection(indices, numIndices);
    if (mDeleteModel != nsMsgImapDeleteModels::MoveToTrash)
      deleteStorage = PR_TRUE;
    if (!deleteStorage)
      rv = ProcessRequestsInOneFolder(window);
    else
      rv = ProcessRequestsInAllFolders(window);
    return rv;
}

Here is the call graph for this function:

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

Definition at line 4774 of file nsMsgDBView.cpp.

Here is the caller graph for this function:

Reimplemented from nsMsgSearchDBView.

Definition at line 458 of file nsMsgXFVirtualFolderDBView.cpp.

Definition at line 294 of file nsMsgSearchDBView.cpp.

{
    mCommand = command;
    mDestFolder = destFolder;

    return nsMsgDBView::DoCommandWithFolder(command, destFolder);
}
nsresult nsMsgDBView::DownloadFlaggedForOffline ( nsIMsgWindow window) [protected, inherited]

Definition at line 2631 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

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

Definition at line 2608 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

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

Called when the user drops something on this view.

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

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

Definition at line 4769 of file nsMsgDBView.cpp.

Here is the caller graph for this function:

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

Definition at line 4090 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 4019 of file nsMsgDBView.cpp.

{
    nsresult rv;

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 4111 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented in nsMsgQuickSearchDBView.

Definition at line 3962 of file nsMsgDBView.cpp.

{
       PRUint32 numChildren;
       nsresult      rv;

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

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

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

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

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

       return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 382 of file nsMsgDBView.cpp.

{
  nsXPIDLCString accountKey;

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 356 of file nsMsgDBView.cpp.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 462 of file nsMsgDBView.cpp.

{
  PRTime dateOfMsg;
  PRTime dateOfMsgLocal;
  nsAutoString formattedDateString;

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

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

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

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

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

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

      bGotConstants = PR_TRUE;
    }

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

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

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

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

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

Here is the call graph for this function:

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

Definition at line 645 of file nsMsgDBView.cpp.

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

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

Here is the call graph for this function:

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

Definition at line 715 of file nsMsgDBView.cpp.

{
  nsresult rv = NS_OK;
  nsMsgLabelValue label = 0;

  NS_ENSURE_ARG_POINTER(aHdr);  
  NS_ENSURE_ARG_POINTER(aLabelString);  

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

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

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

Here is the caller graph for this function:

nsresult nsMsgSearchDBView::FetchLocation ( PRInt32  aRow,
PRUnichar **  aLocationString 
) [protected, inherited]

Definition at line 147 of file nsMsgSearchDBView.cpp.

{
  nsCOMPtr <nsIMsgFolder> folder;
  nsresult rv = GetFolderForViewIndex(aRow, getter_AddRefs(folder));
  NS_ENSURE_SUCCESS(rv,rv);

  rv = folder->GetPrettiestName(aLocationString);
  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::FetchPriority ( nsIMsgDBHdr aHdr,
PRUnichar **  aPriorityString 
) [protected, inherited]

Definition at line 613 of file nsMsgDBView.cpp.

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

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

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

  return NS_OK;
}

Here is the caller graph for this function:

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

Definition at line 417 of file nsMsgDBView.cpp.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 575 of file nsMsgDBView.cpp.

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

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

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

Here is the call graph for this function:

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

Definition at line 554 of file nsMsgDBView.cpp.

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

Here is the caller graph for this function:

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

Definition at line 443 of file nsMsgDBView.cpp.

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

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 673 of file nsMsgDBView.cpp.

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

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

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

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 5372 of file nsMsgDBView.cpp.

{
    return FindNextFlagged(0, pResultIndex);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 5321 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 3886 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 3901 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented in nsMsgGroupView.

Definition at line 4584 of file nsMsgDBView.cpp.

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

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 5298 of file nsMsgDBView.cpp.

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

    *pResultIndex = nsMsgViewIndex_None;

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

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 4473 of file nsMsgDBView.cpp.

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

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

    msgHdr->GetThreadParent(&parentKey);
  }

  return startOfThreadViewIndex;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 5377 of file nsMsgDBView.cpp.

{
    nsMsgViewIndex curIndex;

    *pResultIndex = nsMsgViewIndex_None;

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 5333 of file nsMsgDBView.cpp.

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

    if (startIndex == nsMsgViewIndex_None)
        return NS_MSG_MESSAGE_NOT_FOUND;

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 237 of file nsMsgDBView.h.

                                     {return FindKey(key, PR_FALSE);}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 3765 of file nsMsgDBView.cpp.

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

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

Definition at line 840 of file nsMsgDBView.cpp.

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

Definition at line 3893 of file nsMsgDBView.cpp.

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

Here is the caller graph for this function:

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

An atomized list of properties for a given cell.

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

NS_IMETHODIMP nsMsgSearchDBView::GetCellText ( PRInt32  aRow,
nsITreeColumn aCol,
nsAString &  aValue 
) [inherited]

Definition at line 131 of file nsMsgSearchDBView.cpp.

{
  const PRUnichar* colID;
  aCol->GetIdConst(&colID);
  if (colID[0] == 'l' && colID[1] == 'o') // location, need to check for "lo" not just "l" to avoid "label" column
  {
    // XXX fix me by converting Fetch* to take an nsAString& parameter
    nsXPIDLString valueText;
    nsresult rv = FetchLocation(aRow, getter_Copies(valueText));
    aValue.Assign(valueText);
    return rv;
  }
  else
    return nsMsgDBView::GetCellText(aRow, aCol, aValue);
}

Here is the call graph for this function:

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

The text for a given cell.

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

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

The value for a given cell.

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

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

Definition at line 3432 of file nsMsgDBView.cpp.

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

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

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 1576 of file nsMsgDBView.cpp.

{
  nsIMsgCustomColumnHandler* columnHandler = nsnull;

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

Here is the caller graph for this function:

Called to get properties to paint a column background.

For shading the sort column, etc.

Definition at line 1556 of file nsMsgDBView.cpp.

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

  return GetColumnHandler(colID.get());
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from nsMsgDBView.

Definition at line 183 of file nsMsgSearchDBView.cpp.

{
  nsCOMPtr <nsIMsgFolder> aFolder;
  GetFolderForViewIndex(index, getter_AddRefs(aFolder));
  if (aFolder)
    return aFolder->GetMsgDatabase(nsnull, db);
  else
    return NS_MSG_INVALID_DBVIEW_INDEX;
}

Here is the call graph for this function:

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

Definition at line 3235 of file nsMsgDBView.cpp.

{
    NS_ENSURE_ARG_POINTER(pMaxLen);
    NS_ENSURE_ARG_POINTER(pFieldType);

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

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented in nsMsgQuickSearchDBView.

Definition at line 3797 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 178 of file nsMsgSearchDBView.cpp.

{
  return m_folders->QueryElementAt(index, NS_GET_IID(nsIMsgFolder), (void **) aFolder);
}

Here is the caller graph for this function:

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

Reimplemented from nsMsgDBView.

Definition at line 618 of file nsMsgSearchDBView.cpp.

{
  nsCOMPtr <nsIMsgMessageService> msgMessageService;
  nsresult rv = GetMessageServiceFromURI(aMsgURI, getter_AddRefs(msgMessageService));
  NS_ENSURE_SUCCESS(rv,rv);
  
  nsCOMPtr <nsIMsgDBHdr> msgHdr;
  rv = msgMessageService->MessageURIToMsgHdr(aMsgURI, getter_AddRefs(msgHdr));
  NS_ENSURE_SUCCESS(rv,rv);
  
  return msgHdr->GetFolder(aFolder);
}

Here is the call graph for this function:

nsresult nsMsgSearchDBView::GetFolders ( nsISupportsArray **  aFolders) [virtual, inherited]

Reimplemented from nsMsgDBView.

Definition at line 286 of file nsMsgSearchDBView.cpp.

{
  NS_ENSURE_ARG_POINTER(aFolders);
  NS_IF_ADDREF(*aFolders = m_folders);
  return NS_OK;
}
nsresult nsMsgSearchDBView::GetFoldersAndHdrsForSelection ( nsMsgViewIndex indices,
PRInt32  numIndices 
) [protected, inherited]

Definition at line 405 of file nsMsgSearchDBView.cpp.

{
  nsresult rv = NS_OK; 
  mCurIndex = 0;
                    //initialize and clear from the last usage
  if (!m_uniqueFoldersSelected)
  {
    m_uniqueFoldersSelected = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, rv); 
  }
  else
    m_uniqueFoldersSelected->Clear();
  
  if (!m_hdrsForEachFolder)
  {
    m_hdrsForEachFolder = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv,rv);
  }
  else
    m_hdrsForEachFolder->Clear();

  //Build unique folder list based on headers selected by the user
  for (nsMsgViewIndex i = 0; i < (nsMsgViewIndex) numIndices; i++)
  {
     nsCOMPtr <nsISupports> curSupports = getter_AddRefs(m_folders->ElementAt(indices[i]));
     if ( m_uniqueFoldersSelected->IndexOf(curSupports) < 0)
       m_uniqueFoldersSelected->AppendElement(curSupports); 
  }

  PRUint32 numFolders =0; 
  rv = m_uniqueFoldersSelected->Count(&numFolders);   //group the headers selected by each folder 
  NS_ENSURE_SUCCESS(rv,rv);
  for (PRUint32 folderIndex=0; folderIndex < numFolders; folderIndex++)
  {
     nsCOMPtr <nsIMsgFolder> curFolder =
         do_QueryElementAt(m_uniqueFoldersSelected, folderIndex, &rv);
     nsCOMPtr <nsISupportsArray> msgHdrsForOneFolder;
     NS_NewISupportsArray(getter_AddRefs(msgHdrsForOneFolder));
     for (nsMsgViewIndex i = 0; i < (nsMsgViewIndex) numIndices; i++) 
     {
       nsCOMPtr <nsIMsgFolder> msgFolder = do_QueryElementAt(m_folders,
                                                             indices[i], &rv);
       if (NS_SUCCEEDED(rv) && msgFolder && msgFolder == curFolder) 
       {
          nsCOMPtr<nsIMsgDBHdr> msgHdr; 
          rv = GetMsgHdrForViewIndex(indices[i],getter_AddRefs(msgHdr));
          NS_ENSURE_SUCCESS(rv,rv);
          nsCOMPtr <nsISupports> hdrSupports = do_QueryInterface(msgHdr);
          msgHdrsForOneFolder->AppendElement(hdrSupports);
       }
     }
     nsCOMPtr <nsISupports> supports = do_QueryInterface(msgHdrsForOneFolder, &rv);
     if (NS_SUCCEEDED(rv) && supports)
       m_hdrsForEachFolder->AppendElement(supports);
  }
  return rv;


}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 603 of file nsMsgSearchDBView.cpp.

{
  NS_ENSURE_ARG_POINTER(hdr);
  PRInt32 index;
  if (!mTreeSelection)
    return NS_ERROR_NULL_POINTER;
  nsresult rv = mTreeSelection->GetCurrentIndex(&index);
  NS_ENSURE_SUCCESS(rv,rv);

  rv = GetMsgHdrForViewIndex(index, hdr);
  NS_ENSURE_SUCCESS(rv,rv);
  return NS_OK;
}

Here is the call graph for this function:

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

The image path for a given cell.

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

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

Definition at line 5858 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

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

Definition at line 4234 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3777 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 4383 of file nsMsgDBView.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 4291 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 3860 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

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

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

Definition at line 3504 of file nsMsgDBView.cpp.

{
    nsCOMPtr <nsIMsgFolder> folder;

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

    if (!folder)
      return NS_ERROR_NULL_POINTER;

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

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

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

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 3339 of file nsMsgDBView.cpp.

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

  PRBool isRead;
  PRUint32 bits;

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

Getting the file message message ID.

This method is taylored specifically for nsIMsgCopyService::CopyFileMessage() when saving Drafts/Templates. In order to work with imap server which doesn't support uidplus we have to use search comman to retrieve the key of newly created message. Message ID generated by the compose gurantee its uniqueness. aMessageId -

Definition at line 465 of file nsMsgXFVirtualFolderDBView.cpp.

{
  NS_ENSURE_ARG_POINTER(aMsgFolder);
  NS_IF_ADDREF(*aMsgFolder = m_viewFolder);
  return NS_OK;
}
nsresult nsMsgSearchDBView::GetMsgHdrForViewIndex ( nsMsgViewIndex  index,
nsIMsgDBHdr **  msgHdr 
) [virtual, inherited]

Reimplemented from nsMsgDBView.

Definition at line 163 of file nsMsgSearchDBView.cpp.

{
  nsresult rv = NS_MSG_INVALID_DBVIEW_INDEX;
  nsCOMPtr<nsIMsgFolder> folder = do_QueryElementAt(m_folders, index);
  if (folder)
    {
      nsCOMPtr <nsIMsgDatabase> db;
      rv = folder->GetMsgDatabase(mMsgWindow, getter_AddRefs(db));
      NS_ENSURE_SUCCESS(rv, rv);
      if (db)
        rv = db->GetMsgHdrForKey(m_keys.GetAt(index), msgHdr);
    }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

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

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

Definition at line 304 of file nsMsgDBView.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

An atomized list of properties for a given row.

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

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

Definition at line 1103 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 204 of file nsMsgDBView.h.

Here is the caller graph for this function:

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

Definition at line 249 of file nsMsgDBView.h.

{return(m_keys.GetSize());}

Here is the caller graph for this function:

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

Definition at line 3304 of file nsMsgDBView.cpp.

{
  NS_ENSURE_ARG_POINTER(msgHdr);
  NS_ENSURE_ARG_POINTER(result);

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

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

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

    return NS_OK;
}

Here is the caller graph for this function:

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

Definition at line 281 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 4223 of file nsMsgDBView.cpp.

{
  nsCOMPtr <nsIMsgDBHdr> msgHdr;

  NS_ENSURE_TRUE(m_db, NS_ERROR_NULL_POINTER);

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented in nsMsgGroupView.

Definition at line 4106 of file nsMsgDBView.cpp.

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

Here is the caller graph for this function:

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

Definition at line 3928 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 5477 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from nsMsgSearchDBView.

Definition at line 57 of file nsMsgXFVirtualFolderDBView.h.

{return "XFVirtualFolderView"; }

Definition at line 141 of file nsMsgXFVirtualFolderDBView.cpp.

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

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

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

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

Definition at line 6027 of file nsMsgDBView.cpp.

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

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

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

Here is the call graph for this function:

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

Definition at line 173 of file nsMsgDBView.cpp.

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

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

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

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

Here is the call graph for this function:

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

Definition at line 266 of file nsMsgDBView.cpp.

{
  nsresult rv = NS_OK;
  nsCString prefString;

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

Here is the call graph for this function:

nsresult nsMsgXFVirtualFolderDBView::InsertHdrFromFolder ( nsIMsgDBHdr msgHdr,
nsISupports *  folder 
) [virtual]

Definition at line 176 of file nsMsgXFVirtualFolderDBView.cpp.

{
  nsMsgViewIndex insertIndex = GetInsertIndex(msgHdr);
  if (insertIndex == nsMsgViewIndex_None)
    return AddHdrFromFolder(msgHdr, folder);

  nsMsgKey msgKey;
  PRUint32 msgFlags;
  msgHdr->GetMessageKey(&msgKey);
  msgHdr->GetFlags(&msgFlags);
  m_keys.InsertAt(insertIndex, msgKey);
  m_flags.InsertAt(insertIndex, msgFlags);
  m_folders->InsertElementAt(folder, insertIndex);
  m_levels.InsertAt((PRInt32) insertIndex, (PRUint8) 0);
    
  // 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);
  return NS_OK;
}

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.

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

Definition at line 5403 of file nsMsgDBView.cpp.

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

Here is the caller graph for this function:

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

Reimplemented in nsMsgQuickSearchDBView.

Definition at line 4540 of file nsMsgDBView.cpp.

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

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 4491 of file nsMsgDBView.cpp.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 4623 of file nsMsgDBView.cpp.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 4886 of file nsMsgDBView.cpp.

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

    nsMsgViewIndex threadIndex;

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 4909 of file nsMsgDBView.cpp.

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

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

        PRBool isRead;

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

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

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 4987 of file nsMsgDBView.cpp.

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

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

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

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

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

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

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

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

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

Here is the call graph for this function:

Indicates if navigation of the passed motion type is valid.

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

Definition at line 5765 of file nsMsgDBView.cpp.

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

Definition at line 4779 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 4807 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 4803 of file nsMsgDBView.cpp.

{
}

Here is the caller graph for this function:

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

Definition at line 5750 of file nsMsgDBView.cpp.

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

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

Here is the call graph for this function:

Definition at line 275 of file nsMsgSearchDBView.cpp.

{
  nsIMsgDatabase *db = NS_STATIC_CAST(nsIMsgDatabase *, instigator);
  if (db)
  {
    db->RemoveListener(this);
    m_dbToUseList.RemoveObject(db);
  }
  return NS_OK;
}

Here is the call graph for this function:

void nsIMsgDBView::onDeleteCompleted ( in boolean  succeeded) [inherited]
virtual void nsMsgDBView::OnExtraFlagChanged ( nsMsgViewIndex  ,
PRUint32   
) [inline, protected, virtual, inherited]

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

Reimplemented in nsMsgThreadedDBView.

Definition at line 282 of file nsMsgDBView.h.

{}     

Here is the caller graph for this function:

nsresult nsMsgXFVirtualFolderDBView::OnNewHeader ( nsIMsgDBHdr newHdr,
nsMsgKey  parentKey,
PRBool  ensureListed 
) [virtual]

Reimplemented from nsMsgSearchDBView.

Definition at line 155 of file nsMsgXFVirtualFolderDBView.cpp.

{
  if (newHdr)
  {
    PRBool match=PR_FALSE;
    nsCOMPtr <nsIMsgSearchSession> searchSession = do_QueryReferent(m_searchSession);
    if (searchSession)
      searchSession->MatchHdr(newHdr, m_db, &match);
    if (match)
    {
      nsCOMPtr <nsIMsgFolder> folder;
      newHdr->GetFolder(getter_AddRefs(folder));
      PRBool saveDoingSearch = m_doingSearch;
      m_doingSearch = PR_FALSE;
      OnSearchHit(newHdr, folder); 
      m_doingSearch = saveDoingSearch;
    }
  }
  return NS_OK;
}

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 nsIMsgCopyServiceListener::OnProgress ( in PRUint32  aProgress,
in PRUint32  aProgressMax 
) [inherited]

Notify the observer that progress as occurred for the message copy aProgress - aProgressMax -.

void nsIMsgSearchNotify::onSearchHit ( in nsIMsgDBHdr  header,
in nsIMsgFolder  folder 
) [inherited]

Notify the observer that the message has started to be copied.

This method is called only once, at the beginning of a message copyoperation.

Implemented in CopyListener.

Notify the observer that the message copied operation has completed.

This method is called regardless of whether the the operation was successful. aStatus - indicate whether the operation was succeeded

Reimplemented from nsMsgSearchDBView.

Definition at line 64 of file nsMsgXFVirtualFolderDBView.cpp.

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

Definition at line 5408 of file nsMsgDBView.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgSearchDBView::PartitionSelectionByFolder ( nsMsgViewIndex indices,
PRInt32  numIndices,
nsUInt32Array **  indexArrays,
PRInt32 numArrays 
) [protected, inherited]

Definition at line 369 of file nsMsgSearchDBView.cpp.

{
  nsresult rv = NS_OK; 
  nsCOMPtr <nsISupportsArray> uniqueFoldersSelected = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
  mCurIndex = 0;

  //Build unique folder list based on headers selected by the user
  for (nsMsgViewIndex i = 0; i < (nsMsgViewIndex) numIndices; i++)
  {
     nsCOMPtr <nsISupports> curSupports = getter_AddRefs(m_folders->ElementAt(indices[i]));
     if ( uniqueFoldersSelected->IndexOf(curSupports) < 0)
       uniqueFoldersSelected->AppendElement(curSupports); 
  }

  PRUint32 numFolders =0; 
  rv = uniqueFoldersSelected->Count(&numFolders);   //group the headers selected by each folder 
  *indexArrays = new nsUInt32Array[numFolders];
  *numArrays = numFolders;
  NS_ENSURE_TRUE(*indexArrays, NS_ERROR_OUT_OF_MEMORY);
  for (PRUint32 folderIndex=0; folderIndex < numFolders; folderIndex++)
  {
     nsCOMPtr <nsIMsgFolder> curFolder =
         do_QueryElementAt(uniqueFoldersSelected, folderIndex, &rv);
     for (nsMsgViewIndex i = 0; i < (nsMsgViewIndex) numIndices; i++) 
     {
       nsCOMPtr <nsIMsgFolder> msgFolder = do_QueryElementAt(m_folders,
                                                             indices[i], &rv);
       if (NS_SUCCEEDED(rv) && msgFolder && msgFolder == curFolder) 
          (*indexArrays)[folderIndex].Add(indices[i]);
     }
  }
  return rv;

}

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

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

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

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

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

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

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

Definition at line 4841 of file nsMsgDBView.cpp.

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

Here is the caller graph for this function:

Definition at line 552 of file nsMsgSearchDBView.cpp.

{
    PRUint32 numFolders =0;
    nsresult rv = m_uniqueFoldersSelected->Count(&numFolders);
    NS_ENSURE_SUCCESS(rv,rv);
    for (PRUint32 folderIndex=0; folderIndex < numFolders; folderIndex++)
    {
       nsCOMPtr<nsIMsgFolder> curFolder =
           do_QueryElementAt(m_uniqueFoldersSelected, folderIndex);
       NS_ASSERTION (curFolder, "curFolder is null");

       nsCOMPtr <nsISupportsArray> messageArray =
           do_QueryElementAt(m_hdrsForEachFolder, folderIndex);
       NS_ASSERTION(messageArray, "messageArray is null");

       curFolder->DeleteMessages(messageArray, window, PR_TRUE /* delete storage */, PR_FALSE /* is move*/, nsnull/*copyServListener*/, PR_FALSE /*allowUndo*/ );
    }

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 520 of file nsMsgSearchDBView.cpp.

{
    nsresult rv = NS_OK;

    nsCOMPtr<nsIMsgFolder> curFolder =
        do_QueryElementAt(m_uniqueFoldersSelected, mCurIndex);
    NS_ASSERTION(curFolder, "curFolder is null");
    nsCOMPtr <nsISupportsArray> messageArray =
        do_QueryElementAt(m_hdrsForEachFolder, mCurIndex);
    NS_ASSERTION(messageArray, "messageArray is null");

    // called for delete with trash, copy and move
    if (mCommand == nsMsgViewCommandType::deleteMsg)
        curFolder->DeleteMessages(messageArray, window, PR_FALSE /* delete storage */, PR_FALSE /* is move*/, this, PR_TRUE /*allowUndo*/);
    else 
    {
      NS_ASSERTION(!(curFolder == mDestFolder), "The source folder and the destination folder are the same");
      if (NS_SUCCEEDED(rv) && curFolder != mDestFolder)
      {
         nsCOMPtr<nsIMsgCopyService> copyService = do_GetService(NS_MSGCOPYSERVICE_CONTRACTID, &rv);
         if (NS_SUCCEEDED(rv))
         {
           if (mCommand == nsMsgViewCommandType::moveMessages)
             copyService->CopyMessages(curFolder, messageArray, mDestFolder, PR_TRUE /* isMove */, this, window, PR_TRUE /*allowUndo*/);
           else if (mCommand == nsMsgViewCommandType::copyMessages)
             copyService->CopyMessages(curFolder, messageArray, mDestFolder, PR_FALSE /* isMove */, this, window, PR_TRUE /*allowUndo*/);
         }
      }
    }
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from nsMsgDBView.

Definition at line 334 of file nsMsgSearchDBView.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIMsgDBView::removeColumnHandler ( in AString  aColumn) [inherited]

Definition at line 70 of file nsMsgXFVirtualFolderDBView.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIMsgDBService> msgDBService = do_GetService(NS_MSGDB_SERVICE_CONTRACTID, &rv);
  // UnregisterPendingListener will return an error when there are no more instances
  // of this object registered as pending listeners.
  while (NS_SUCCEEDED(rv))
    rv = msgDBService->UnregisterPendingListener(this);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDBView::RestoreSelection ( nsMsgKey  aCurrentmsgKey,
nsMsgKeyArray *  aMsgKeyArray 
) [protected, inherited]

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: