Bug 327206 r=annie.sullivan Make folder result nodes' readonly property sync

with bookmark readonly property.
This commit is contained in:
brettw%gmail.com 2006-03-03 21:16:23 +00:00
Родитель 4ed12dd0cf
Коммит 47f1712cbf
2 изменённых файлов: 28 добавлений и 5 удалений

Просмотреть файл

@ -1363,6 +1363,8 @@ nsNavHistoryContainerResultNode::GetChild(PRUint32 aIndex,
// nsNavHistoryContainerResultNode::GetChildrenReadOnly
//
// Overridden for folders to query the bookmarks service directly.
NS_IMETHODIMP
nsNavHistoryContainerResultNode::GetChildrenReadOnly(PRBool *aChildrenReadOnly)
@ -2475,6 +2477,26 @@ nsNavHistoryFolderResultNode::GetHasChildren(PRBool* aHasChildren)
}
// nsNavHistoryFolderResultNode::GetChildrenReadOnly
//
// Here, we override the getter and ignore the value stored in our object.
// The bookmarks service can tell us whether this folder should be read-only
// or not.
//
// It would be nice to put this code in the folder constructor, but the
// database was complaining. I believe it is because most folders are
// created while enumerating the bookmarks table and having a statement
// open, and doing another statement might make it unhappy in some cases.
NS_IMETHODIMP
nsNavHistoryFolderResultNode::GetChildrenReadOnly(PRBool *aChildrenReadOnly)
{
nsNavBookmarks* bookmarks = nsNavBookmarks::GetBookmarksService();
NS_ENSURE_TRUE(bookmarks, NS_ERROR_UNEXPECTED);
return bookmarks->GetFolderReadonly(mFolderId, aChildrenReadOnly);
}
// nsNavHistoryFolderResultNode::GetUri
//
// This lazily computes the URI for this specific folder query with

Просмотреть файл

@ -353,7 +353,7 @@ public:
// derived classes each provide their own implementation of has children and
// forward the rest to us using this macro
#define NS_FORWARD_CONTAINERNODE_EXCEPT_HASCHILDREN \
#define NS_FORWARD_CONTAINERNODE_EXCEPT_HASCHILDREN_AND_READONLY \
NS_IMETHOD GetContainerOpen(PRBool *aContainerOpen) \
{ return nsNavHistoryContainerResultNode::GetContainerOpen(aContainerOpen); } \
NS_IMETHOD SetContainerOpen(PRBool aContainerOpen) \
@ -362,8 +362,6 @@ public:
{ return nsNavHistoryContainerResultNode::GetChildCount(aChildCount); } \
NS_IMETHOD GetChild(PRUint32 index, nsINavHistoryResultNode **_retval) \
{ return nsNavHistoryContainerResultNode::GetChild(index, _retval); } \
NS_IMETHOD GetChildrenReadOnly(PRBool *aChildrenReadOnly) \
{ return nsNavHistoryContainerResultNode::GetChildrenReadOnly(aChildrenReadOnly); } \
NS_IMETHOD GetRemoteContainerType(nsACString& aRemoteContainerType) \
{ return nsNavHistoryContainerResultNode::GetRemoteContainerType(aRemoteContainerType); } \
NS_IMETHOD AppendURINode(const nsACString& aURI, const nsACString& aTitle, PRUint32 aAccessCount, PRTime aTime, const nsACString& aIconURI, nsINavHistoryResultNode **_retval) \
@ -525,8 +523,10 @@ public:
NS_IMETHOD GetType(PRUint32* type)
{ *type = nsNavHistoryResultNode::RESULT_TYPE_QUERY; return NS_OK; }
NS_IMETHOD GetUri(nsACString& aURI); // does special lazy creation
NS_FORWARD_CONTAINERNODE_EXCEPT_HASCHILDREN
NS_FORWARD_CONTAINERNODE_EXCEPT_HASCHILDREN_AND_READONLY
NS_IMETHOD GetHasChildren(PRBool* aHasChildren);
NS_IMETHOD GetChildrenReadOnly(PRBool *aChildrenReadOnly)
{ return nsNavHistoryContainerResultNode::GetChildrenReadOnly(aChildrenReadOnly); }
NS_DECL_NSINAVHISTORYQUERYRESULTNODE
PRBool CanExpand();
@ -582,8 +582,9 @@ public:
NS_IMETHOD GetType(PRUint32* type)
{ *type = nsNavHistoryResultNode::RESULT_TYPE_FOLDER; return NS_OK; }
NS_IMETHOD GetUri(nsACString& aURI);
NS_FORWARD_CONTAINERNODE_EXCEPT_HASCHILDREN
NS_FORWARD_CONTAINERNODE_EXCEPT_HASCHILDREN_AND_READONLY
NS_IMETHOD GetHasChildren(PRBool* aHasChildren);
NS_IMETHOD GetChildrenReadOnly(PRBool *aChildrenReadOnly);
NS_DECL_NSINAVHISTORYQUERYRESULTNODE
NS_IMETHOD GetFolderId(PRInt64* aFolderId)