Get sorting working with new tree structure. Basically, just look for treechildren instead of treebody when walking down from the root of the tree.
This commit is contained in:
Родитель
308b62c2da
Коммит
b6daf9c497
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style: "stroustrup" -*-
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-file-style: "stroustrup" -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
|
@ -176,7 +176,7 @@ private:
|
|||
static nsIRDFService *gRDFService;
|
||||
|
||||
nsresult FindTreeElement(nsIContent* aElement,nsIContent** aTreeElement);
|
||||
nsresult FindTreeBodyElement(nsIContent *tree, nsIContent **treeBody);
|
||||
nsresult FindTreeChildrenElement(nsIContent *tree, nsIContent **treeBody);
|
||||
nsresult GetSortColumnIndex(nsIContent *tree, const nsString&sortResource, const nsString& sortDirection, PRInt32 *colIndex);
|
||||
nsresult GetSortColumnInfo(nsIContent *tree, nsString &sortResource, nsString &sortDirection);
|
||||
nsresult GetTreeCell(nsIContent *node, PRInt32 colIndex, nsIContent **cell);
|
||||
|
@ -357,12 +357,12 @@ XULSortServiceImpl::~XULSortServiceImpl(void)
|
|||
nsresult
|
||||
XULSortServiceImpl::GetSortService(nsIXULSortService** mgr)
|
||||
{
|
||||
if (! gXULSortService) {
|
||||
if (! gXULSortService)
|
||||
{
|
||||
gXULSortService = new XULSortServiceImpl();
|
||||
if (! gXULSortService)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(gXULSortService);
|
||||
*mgr = gXULSortService;
|
||||
return NS_OK;
|
||||
|
@ -428,7 +428,7 @@ XULSortServiceImpl::FindTreeElement(nsIContent *aElement, nsIContent **aTreeElem
|
|||
|
||||
|
||||
nsresult
|
||||
XULSortServiceImpl::FindTreeBodyElement(nsIContent *tree, nsIContent **treeBody)
|
||||
XULSortServiceImpl::FindTreeChildrenElement(nsIContent *tree, nsIContent **treeBody)
|
||||
{
|
||||
nsCOMPtr<nsIContent> child;
|
||||
PRInt32 childIndex = 0, numChildren = 0, nameSpaceID;
|
||||
|
@ -443,7 +443,7 @@ XULSortServiceImpl::FindTreeBodyElement(nsIContent *tree, nsIContent **treeBody)
|
|||
{
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
if (NS_FAILED(rv = child->GetTag(*getter_AddRefs(tag)))) return rv;
|
||||
if (tag.get() == kTreeBodyAtom)
|
||||
if (tag.get() == kTreeChildrenAtom)
|
||||
{
|
||||
*treeBody = child;
|
||||
NS_ADDREF(*treeBody);
|
||||
|
@ -1379,7 +1379,7 @@ XULSortServiceImpl::DoSort(nsIDOMNode* node, const nsString& sortResource,
|
|||
if (NS_FAILED(rv = GetSortColumnIndex(treeNode, sortResource, sortDirection, &colIndex))) return(rv);
|
||||
sortInfo.colIndex = colIndex;
|
||||
nsCOMPtr<nsIContent> treeBody;
|
||||
if (NS_FAILED(rv = FindTreeBodyElement(treeNode, getter_AddRefs(treeBody)))) return(rv);
|
||||
if (NS_FAILED(rv = FindTreeChildrenElement(treeNode, getter_AddRefs(treeBody)))) return(rv);
|
||||
if (NS_SUCCEEDED(rv = SortTreeChildren(treeBody, colIndex, &sortInfo, 0)))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style: "stroustrup" -*-
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-file-style: "stroustrup" -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
|
@ -176,7 +176,7 @@ private:
|
|||
static nsIRDFService *gRDFService;
|
||||
|
||||
nsresult FindTreeElement(nsIContent* aElement,nsIContent** aTreeElement);
|
||||
nsresult FindTreeBodyElement(nsIContent *tree, nsIContent **treeBody);
|
||||
nsresult FindTreeChildrenElement(nsIContent *tree, nsIContent **treeBody);
|
||||
nsresult GetSortColumnIndex(nsIContent *tree, const nsString&sortResource, const nsString& sortDirection, PRInt32 *colIndex);
|
||||
nsresult GetSortColumnInfo(nsIContent *tree, nsString &sortResource, nsString &sortDirection);
|
||||
nsresult GetTreeCell(nsIContent *node, PRInt32 colIndex, nsIContent **cell);
|
||||
|
@ -357,12 +357,12 @@ XULSortServiceImpl::~XULSortServiceImpl(void)
|
|||
nsresult
|
||||
XULSortServiceImpl::GetSortService(nsIXULSortService** mgr)
|
||||
{
|
||||
if (! gXULSortService) {
|
||||
if (! gXULSortService)
|
||||
{
|
||||
gXULSortService = new XULSortServiceImpl();
|
||||
if (! gXULSortService)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(gXULSortService);
|
||||
*mgr = gXULSortService;
|
||||
return NS_OK;
|
||||
|
@ -428,7 +428,7 @@ XULSortServiceImpl::FindTreeElement(nsIContent *aElement, nsIContent **aTreeElem
|
|||
|
||||
|
||||
nsresult
|
||||
XULSortServiceImpl::FindTreeBodyElement(nsIContent *tree, nsIContent **treeBody)
|
||||
XULSortServiceImpl::FindTreeChildrenElement(nsIContent *tree, nsIContent **treeBody)
|
||||
{
|
||||
nsCOMPtr<nsIContent> child;
|
||||
PRInt32 childIndex = 0, numChildren = 0, nameSpaceID;
|
||||
|
@ -443,7 +443,7 @@ XULSortServiceImpl::FindTreeBodyElement(nsIContent *tree, nsIContent **treeBody)
|
|||
{
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
if (NS_FAILED(rv = child->GetTag(*getter_AddRefs(tag)))) return rv;
|
||||
if (tag.get() == kTreeBodyAtom)
|
||||
if (tag.get() == kTreeChildrenAtom)
|
||||
{
|
||||
*treeBody = child;
|
||||
NS_ADDREF(*treeBody);
|
||||
|
@ -1379,7 +1379,7 @@ XULSortServiceImpl::DoSort(nsIDOMNode* node, const nsString& sortResource,
|
|||
if (NS_FAILED(rv = GetSortColumnIndex(treeNode, sortResource, sortDirection, &colIndex))) return(rv);
|
||||
sortInfo.colIndex = colIndex;
|
||||
nsCOMPtr<nsIContent> treeBody;
|
||||
if (NS_FAILED(rv = FindTreeBodyElement(treeNode, getter_AddRefs(treeBody)))) return(rv);
|
||||
if (NS_FAILED(rv = FindTreeChildrenElement(treeNode, getter_AddRefs(treeBody)))) return(rv);
|
||||
if (NS_SUCCEEDED(rv = SortTreeChildren(treeBody, colIndex, &sortInfo, 0)))
|
||||
{
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче