Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Private Attributes
nsCertTree Class Reference

#include <nsCertTree.h>

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

List of all members.

Public Types

enum  sortCriterion {
  sort_IssuerOrg, sort_Org, sort_Token, sort_CommonName,
  sort_IssuedDateDescending, sort_Email, sort_None
}

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSICERTTREE
NS_DECL_NSITREEVIEW 
nsCertTree ()
virtual ~nsCertTree ()
void loadCerts (in unsigned long type)
void loadCertsFromCache (in nsINSSCertCache cache, in unsigned long type)
nsIX509Cert getCert (in unsigned long index)
void removeCert (in unsigned long index)
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.

Public Attributes

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 Types

typedef int(* nsCertCompareFunc )(void *, nsIX509Cert *a, nsIX509Cert *b)

Protected Member Functions

nsresult InitCompareHash ()
void ClearCompareHash ()
void RemoveCacheEntry (void *key)
nsCertCompareFunc GetCompareFuncFromCertType (PRUint32 aType)
PRInt32 CountOrganizations ()
PRBool GetCertsByType (PRUint32 aType, nsCertCompareFunc aCertCmpFn, void *aCertCmpFnArg, nsISupportsArray **_certs)
PRBool GetCertsByTypeFromCache (nsINSSCertCache *aCache, PRUint32 aType, nsCertCompareFunc aCertCmpFn, void *aCertCmpFnArg, nsISupportsArray **_certs)

Static Protected Member Functions

static CompareCacheHashEntrygetCacheEntry (void *cache, void *aCert)
static void CmpInitCriterion (nsIX509Cert *cert, CompareCacheHashEntry *entry, sortCriterion crit, PRInt32 level)
static PRInt32 CmpByCrit (nsIX509Cert *a, CompareCacheHashEntry *ace, nsIX509Cert *b, CompareCacheHashEntry *bce, sortCriterion crit, PRInt32 level)
static PRInt32 CmpBy (void *cache, nsIX509Cert *a, nsIX509Cert *b, sortCriterion c0, sortCriterion c1, sortCriterion c2)
static PRInt32 CmpCACert (void *cache, nsIX509Cert *a, nsIX509Cert *b)
static PRInt32 CmpWebSiteCert (void *cache, nsIX509Cert *a, nsIX509Cert *b)
static PRInt32 CmpUserCert (void *cache, nsIX509Cert *a, nsIX509Cert *b)
static PRInt32 CmpEmailCert (void *cache, nsIX509Cert *a, nsIX509Cert *b)

Private Member Functions

treeArrayEl * GetThreadDescAtIndex (PRInt32 _index)
nsIX509CertGetCertAtIndex (PRInt32 _index)
void FreeCertArray ()
nsresult UpdateUIContents ()
PRBool GetCertsByTypeFromCertList (CERTCertList *aCertList, PRUint32 aType, nsCertCompareFunc aCertCmpFn, void *aCertCmpFnArg, nsISupportsArray **_certs)

Private Attributes

nsCOMPtr< nsISupportsArraymCertArray
nsCOMPtr< nsITreeBoxObjectmTree
nsCOMPtr< nsITreeSelectionmSelection
treeArrayEl * mTreeArray
PRInt32 mNumOrgs
PRInt32 mNumRows
PLDHashTable mCompareCache
nsCOMPtr< nsINSSComponent > mNSSComponent

Detailed Description

Definition at line 69 of file nsCertTree.h.


Member Typedef Documentation

Definition at line 87 of file nsCertTree.h.


Member Enumeration Documentation

Enumerator:
sort_IssuerOrg 
sort_Org 
sort_Token 
sort_CommonName 
sort_IssuedDateDescending 
sort_Email 
sort_None 

Definition at line 79 of file nsCertTree.h.


Constructor & Destructor Documentation

Definition at line 140 of file nsCertTree.cpp.

Here is the call graph for this function:

nsCertTree::~nsCertTree ( ) [virtual]

Definition at line 165 of file nsCertTree.cpp.

{
  ClearCompareHash();
  delete [] mTreeArray;
}

Here is the call graph for this function:


Member Function Documentation

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

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

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

Definition at line 146 of file nsCertTree.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsCertTree::CmpBy ( void cache,
nsIX509Cert a,
nsIX509Cert b,
sortCriterion  c0,
sortCriterion  c1,
sortCriterion  c2 
) [static, protected]

Definition at line 1038 of file nsCertTree.cpp.

{
  NS_ENSURE_TRUE( (cache!=0 && a!=0 && b!=0), 0 );

  if (a == b)
    return 0;

  CompareCacheHashEntry *ace = getCacheEntry(cache, a);
  CompareCacheHashEntry *bce = getCacheEntry(cache, b);

  PRInt32 cmp;
  cmp = CmpByCrit(a, ace, b, bce, c0, 0);
  if (cmp != 0)
    return cmp;

  if (c1 != sort_None) {
    cmp = CmpByCrit(a, ace, b, bce, c1, 1);
    if (cmp != 0)
      return cmp;
    
    if (c2 != sort_None) {
      return CmpByCrit(a, ace, b, bce, c2, 2);
    }
  }

  return cmp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsCertTree::CmpByCrit ( nsIX509Cert a,
CompareCacheHashEntry ace,
nsIX509Cert b,
CompareCacheHashEntry bce,
sortCriterion  crit,
PRInt32  level 
) [static, protected]

Definition at line 1008 of file nsCertTree.cpp.

{
  NS_ENSURE_TRUE( (a!=0 && ace!=0 && b!=0 && bce!=0), 0 );

  if (!ace->mCritInit[level]) {
    CmpInitCriterion(a, ace, crit, level);
  }

  if (!bce->mCritInit[level]) {
    CmpInitCriterion(b, bce, crit, level);
  }

  nsXPIDLString &str_a = ace->mCrit[level];
  nsXPIDLString &str_b = bce->mCrit[level];

  PRInt32 result;
  if (str_a && str_b)
    result = Compare(str_a, str_b);
  else
    result = !str_a ? (!str_b ? 0 : -1) : 1;

  if (sort_IssuedDateDescending == crit)
    result *= -1; // reverse compare order

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsCertTree::CmpCACert ( void cache,
nsIX509Cert a,
nsIX509Cert b 
) [static, protected]

Definition at line 1068 of file nsCertTree.cpp.

{
  // XXX we assume issuer org is always criterion 1
  return CmpBy(cache, a, b, sort_IssuerOrg, sort_Org, sort_Token);
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsCertTree::CmpEmailCert ( void cache,
nsIX509Cert a,
nsIX509Cert b 
) [static, protected]

Definition at line 1089 of file nsCertTree.cpp.

{
  // XXX we assume issuer org is always criterion 1
  return CmpBy(cache, a, b, sort_IssuerOrg, sort_Email, sort_CommonName);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsCertTree::CmpInitCriterion ( nsIX509Cert cert,
CompareCacheHashEntry entry,
sortCriterion  crit,
PRInt32  level 
) [static, protected]

Definition at line 956 of file nsCertTree.cpp.

{
  NS_ENSURE_TRUE( (cert!=0 && entry!=0), RETURN_NOTHING );

  entry->mCritInit[level] = PR_TRUE;
  nsXPIDLString &str = entry->mCrit[level];
  
  switch (crit) {
    case sort_IssuerOrg:
      cert->GetIssuerOrganization(str);
      break;
    case sort_Org:
      cert->GetOrganization(str);
      break;
    case sort_Token:
      cert->GetTokenName(str);
      break;
    case sort_CommonName:
      cert->GetCommonName(str);
      break;
    case sort_IssuedDateDescending:
      {
        nsresult rv;
        nsCOMPtr<nsIX509CertValidity> validity;
        PRTime notBefore;

        rv = cert->GetValidity(getter_AddRefs(validity));
        if (NS_SUCCEEDED(rv)) {
          rv = validity->GetNotBefore(&notBefore);
        }

        if (NS_SUCCEEDED(rv)) {
          PRExplodedTime explodedTime;
          PR_ExplodeTime(notBefore, PR_GMTParameters, &explodedTime);
          char datebuf[20]; // 4 + 2 + 2 + 2 + 2 + 2 + 1 = 15
          if (0 != PR_FormatTime(datebuf, sizeof(datebuf), "%Y%m%d%H%M%S", &explodedTime)) {
            str = NS_ConvertASCIItoUCS2(nsDependentCString(datebuf));
          }
        }
      }
      break;
    case sort_Email:
      cert->GetEmailAddress(str);
      break;
    case sort_None:
    default:
      break;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsCertTree::CmpUserCert ( void cache,
nsIX509Cert a,
nsIX509Cert b 
) [static, protected]

Definition at line 1082 of file nsCertTree.cpp.

{
  // XXX we assume issuer org is always criterion 1
  return CmpBy(cache, a, b, sort_IssuerOrg, sort_Token, sort_IssuedDateDescending);
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsCertTree::CmpWebSiteCert ( void cache,
nsIX509Cert a,
nsIX509Cert b 
) [static, protected]

Definition at line 1075 of file nsCertTree.cpp.

{
  // XXX we assume issuer org is always criterion 1
  return CmpBy(cache, a, b, sort_IssuerOrg, sort_CommonName, sort_None);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 210 of file nsCertTree.cpp.

{
  PRUint32 i, certCount;
  nsresult rv = mCertArray->Count(&certCount);
  if (NS_FAILED(rv)) return -1;
  if (certCount == 0) return 0;
  nsCOMPtr<nsISupports> isupport = dont_AddRef(mCertArray->ElementAt(0));
  nsCOMPtr<nsIX509Cert> orgCert = do_QueryInterface(isupport);
  nsCOMPtr<nsIX509Cert> nextCert = nsnull;
  PRInt32 orgCount = 1;
  for (i=1; i<certCount; i++) {
    isupport = dont_AddRef(mCertArray->ElementAt(i));
    nextCert = do_QueryInterface(isupport);
    // XXX we assume issuer org is always criterion 1
    if (CmpBy(&mCompareCache, orgCert, nextCert, sort_IssuerOrg, sort_None, sort_None) != 0) {
      orgCert = nextCert;
      orgCount++;
    }
  }
  return orgCount;
}

Here is the call graph for this function:

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.

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

Called when the user drops something on this view.

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

Definition at line 172 of file nsCertTree.cpp.

{
  if (mCertArray) {
    PRUint32 count;
    nsresult rv = mCertArray->Count(&count);
    if (NS_FAILED(rv))
    {
      NS_ASSERTION(0, "Count failed");
      return;
    }
    PRInt32 i;
    for (i = count - 1; i >= 0; i--)
    {
      mCertArray->RemoveElementAt(i);
    }
  }
}
CompareCacheHashEntry * nsCertTree::getCacheEntry ( void cache,
void aCert 
) [static, protected]

Definition at line 191 of file nsCertTree.cpp.

{
  PLDHashTable &aCompareCache = *NS_REINTERPRET_CAST(PLDHashTable*, cache);
  CompareCacheHashEntryPtr *entryPtr = 
    NS_STATIC_CAST(CompareCacheHashEntryPtr*,
                   PL_DHashTableOperate(&aCompareCache, aCert, PL_DHASH_ADD));
  return entryPtr ? entryPtr->entry : NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

An atomized list of properties for a given cell.

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

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

The text for a given cell.

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

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

The value for a given cell.

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

nsIX509Cert nsICertTree::getCert ( in unsigned long  index) [inherited]

Definition at line 258 of file nsCertTree.cpp.

{
  int i, idx = 0, cIndex = 0, nc;
  nsIX509Cert *rawPtr = nsnull;
  if (index < 0) return nsnull;
  // Loop over the threads
  for (i=0; i<mNumOrgs; i++) {
    if (index == idx) return nsnull; // index is for thread
    idx++; // get past the thread
    nc = (mTreeArray[i].open) ? mTreeArray[i].numChildren : 0;
    if (index < idx + nc) { // cert is within range of this thread
      PRInt32 certIndex = cIndex + index - idx;
      nsCOMPtr<nsISupports> isupport = 
                             dont_AddRef(mCertArray->ElementAt(certIndex));
      nsCOMPtr<nsIX509Cert> cert = do_QueryInterface(isupport);
      rawPtr = cert;
      NS_IF_ADDREF(rawPtr);
      break;
    }
    if (mTreeArray[i].open)
      idx += mTreeArray[i].numChildren;
    cIndex += mTreeArray[i].numChildren;
    if (idx > index) break;
  }
  return rawPtr;
}

Here is the call graph for this function:

PRBool nsCertTree::GetCertsByType ( PRUint32  aType,
nsCertCompareFunc  aCertCmpFn,
void aCertCmpFnArg,
nsISupportsArray **  _certs 
) [protected]

Definition at line 340 of file nsCertTree.cpp.

{
  nsNSSShutDownPreventionLock locker;
  CERTCertList *certList = NULL;
  nsCOMPtr<nsIInterfaceRequestor> cxt = new PipUIContext();
  certList = PK11_ListCerts(PK11CertListUnique, cxt);
  PRBool rv = GetCertsByTypeFromCertList(certList, aType, aCertCmpFn, aCertCmpFnArg, _certs);
  if (certList)
    CERT_DestroyCertList(certList);
  return rv;
}

Here is the call graph for this function:

PRBool nsCertTree::GetCertsByTypeFromCache ( nsINSSCertCache aCache,
PRUint32  aType,
nsCertCompareFunc  aCertCmpFn,
void aCertCmpFnArg,
nsISupportsArray **  _certs 
) [protected]

Definition at line 356 of file nsCertTree.cpp.

{
  NS_ENSURE_ARG_POINTER(aCache);
  CERTCertList *certList = NS_REINTERPRET_CAST(CERTCertList*, aCache->GetCachedCerts());
  if (!certList)
    return NS_ERROR_FAILURE;
  return GetCertsByTypeFromCertList(certList, aType, aCertCmpFn, aCertCmpFnArg, _certs);
}

Here is the call graph for this function:

PRBool nsCertTree::GetCertsByTypeFromCertList ( CERTCertList *  aCertList,
PRUint32  aType,
nsCertCompareFunc  aCertCmpFn,
void aCertCmpFnArg,
nsISupportsArray **  _certs 
) [private]

Definition at line 302 of file nsCertTree.cpp.

{
  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("GetCertsByTypeFromCertList"));
  if (!aCertList)
    return PR_FALSE;
  nsCOMPtr<nsISupportsArray> certarray;
  nsresult rv = NS_NewISupportsArray(getter_AddRefs(certarray));
  if (NS_FAILED(rv)) return PR_FALSE;
  CERTCertListNode *node;
  int count = 0;
  for (node = CERT_LIST_HEAD(aCertList);
       !CERT_LIST_END(node, aCertList);
       node = CERT_LIST_NEXT(node)) {
    if (getCertType(node->cert) == aType) {
      nsCOMPtr<nsIX509Cert> pipCert = new nsNSSCertificate(node->cert);
      if (pipCert) {
        int i;
        for (i = 0; i < count; ++i) {
          nsCOMPtr<nsIX509Cert> cert = do_QueryElementAt(certarray, i);
          if ((*aCertCmpFn)(aCertCmpFnArg, pipCert, cert) < 0) {
            break;
          }
        }
        certarray->InsertElementAt(pipCert, i);
        ++count;
      }
    }
  }
  *_certs = certarray;
  NS_ADDREF(*_certs);
  return PR_TRUE;
}

Here is the call graph for this function:

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 286 of file nsCertTree.cpp.

{
  switch (aType) {
    case nsIX509Cert::USER_CERT:
      return CmpUserCert;
    case nsIX509Cert::CA_CERT:
      return CmpCACert;
    case nsIX509Cert::EMAIL_CERT:
      return CmpEmailCert;
    case nsIX509Cert::SERVER_CERT:
    default:
      return CmpWebSiteCert;
  }
}

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.

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.

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.

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.

treeArrayEl * nsCertTree::GetThreadDescAtIndex ( PRInt32  _index) [private]

Definition at line 237 of file nsCertTree.cpp.

{
  int i, idx=0;
  if (index < 0) return nsnull;
  for (i=0; i<mNumOrgs; i++) {
    if (index == idx) {
      return &mTreeArray[i];
    }
    if (mTreeArray[i].open) {
      idx += mTreeArray[i].numChildren;
    }
    idx++;
    if (idx > index) break;
  }
  return nsnull;
}
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.

Definition at line 154 of file nsCertTree.cpp.

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.

void nsICertTree::loadCerts ( in unsigned long  type) [inherited]
void nsICertTree::loadCertsFromCache ( in nsINSSCertCache  cache,
in unsigned long  type 
) [inherited]
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.

void nsCertTree::RemoveCacheEntry ( void key) [protected]

Definition at line 200 of file nsCertTree.cpp.

Here is the call graph for this function:

void nsICertTree::removeCert ( in unsigned long  index) [inherited]

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

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

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

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

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

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

Called during initialization to link the view to the front end box object.

void nsITreeView::toggleOpenState ( in long  index) [inherited]

Called on the view when an item is opened or closed.

Definition at line 412 of file nsCertTree.cpp.

{
  PRUint32 count;
  nsresult rv = mCertArray->Count(&count);
  if (NS_FAILED(rv)) return rv;
  mNumOrgs = CountOrganizations();
  mTreeArray = new treeArrayEl[mNumOrgs];
  if (!mTreeArray)
    return NS_ERROR_OUT_OF_MEMORY;

  PRUint32 j = 0;
  nsCOMPtr<nsISupports> isupport = dont_AddRef(mCertArray->ElementAt(j));
  nsCOMPtr<nsIX509Cert> orgCert = do_QueryInterface(isupport);
  for (PRInt32 i=0; i<mNumOrgs; i++) {
    orgCert->GetIssuerOrganization(mTreeArray[i].orgName);
    mTreeArray[i].open = PR_TRUE;
    mTreeArray[i].certIndex = j;
    mTreeArray[i].numChildren = 1;
    if (++j >= count) break;
    isupport = dont_AddRef(mCertArray->ElementAt(j));
    nsCOMPtr<nsIX509Cert> nextCert = do_QueryInterface(isupport);
    while (0 == CmpBy(&mCompareCache, orgCert, nextCert, sort_IssuerOrg, sort_None, sort_None)) {
      mTreeArray[i].numChildren++;
      if (++j >= count) break;
      isupport = dont_AddRef(mCertArray->ElementAt(j));
      nextCert = do_QueryInterface(isupport);
    }
    orgCert = nextCert;
  }
  if (mTree) {
    mTree->BeginUpdateBatch();
    mTree->RowCountChanged(0, -mNumRows);
  }
  mNumRows = count + mNumOrgs;
  if (mTree)
    mTree->EndUpdateBatch();
  return NS_OK;
}

Here is the call graph for this function:


Member Data Documentation

const short nsITreeView::DROP_AFTER = 1 [inherited]

Definition at line 103 of file nsITreeView.idl.

const short nsITreeView::DROP_BEFORE = -1 [inherited]

Definition at line 101 of file nsITreeView.idl.

const short nsITreeView::DROP_ON = 0 [inherited]

Definition at line 102 of file nsITreeView.idl.

Definition at line 111 of file nsCertTree.h.

Definition at line 117 of file nsCertTree.h.

nsCOMPtr<nsINSSComponent> nsCertTree::mNSSComponent [private]

Definition at line 118 of file nsCertTree.h.

Definition at line 115 of file nsCertTree.h.

Definition at line 116 of file nsCertTree.h.

Definition at line 113 of file nsCertTree.h.

Definition at line 112 of file nsCertTree.h.

treeArrayEl* nsCertTree::mTreeArray [private]

Definition at line 114 of file nsCertTree.h.

const short nsITreeView::PROGRESS_NONE = 3 [inherited]

Definition at line 153 of file nsITreeView.idl.

const short nsITreeView::PROGRESS_NORMAL = 1 [inherited]

The progress mode for a given cell.

This method is only called for columns of type |progressmeter|.

Definition at line 151 of file nsITreeView.idl.

Definition at line 152 of file nsITreeView.idl.

readonly attribute long nsITreeView::rowCount [inherited]

The total number of rows in the tree (including the offscreen rows).

Definition at line 53 of file nsITreeView.idl.

The selection for this view.

Definition at line 58 of file nsITreeView.idl.


The documentation for this class was generated from the following files: