Bug 381220 - until I modify a folder, the dateAdded / lastModified values don't appear in the bookmark organizer. r=sspitzer.

This commit is contained in:
mozilla.mano@sent.com 2007-05-20 04:39:02 -07:00
parent 961f2ca8fc
commit 0f13352128
2 changed files with 22 additions and 1 deletions

View File

@ -1764,8 +1764,14 @@ nsNavBookmarks::ResultNodeForFolder(PRInt64 aID,
rv = mDBGetItemProperties->GetUTF8String(kGetItemPropertiesIndex_Title, title);
*aNode = new nsNavHistoryFolderResultNode(title, aOptions, aID, folderType);
if (! *aNode)
if (!*aNode)
return NS_ERROR_OUT_OF_MEMORY;
(*aNode)->mDateAdded =
mDBGetItemProperties->AsInt64(kGetItemPropertiesIndex_DateAdded);
(*aNode)->mLastModified =
mDBGetItemProperties->AsInt64(kGetItemPropertiesIndex_LastModified);
NS_ADDREF(*aNode);
return NS_OK;
}
@ -1865,6 +1871,12 @@ nsNavBookmarks::QueryFolderChildren(PRInt64 aFolderId,
// the next else block);
node->mItemId =
mDBGetChildren->AsInt64(nsNavHistory::kGetInfoIndex_ItemId);
// date-added and last-modified
node->mDateAdded =
mDBGetChildren->AsInt64(nsNavHistory::kGetInfoIndex_ItemDateAdded);
node->mLastModified =
mDBGetChildren->AsInt64(nsNavHistory::kGetInfoIndex_ItemLastModified);
} else {
rv = History()->RowToResult(mDBGetChildren, options,
getter_AddRefs(node));

View File

@ -659,6 +659,9 @@ function testSimpleFolderResult() {
bmsvc.setItemTitle(item, "test bookmark");
var folder = bmsvc.createFolder(parent, "test folder", bmsvc.DEFAULT_INDEX);
// re-set the folder title so we can test nodes' lastModified
bmsvc.setItemTitle(folder, "test folder");
var options = histsvc.getNewQueryOptions();
var query = histsvc.getNewQuery();
query.setFolders([parent], 1);
@ -668,14 +671,20 @@ function testSimpleFolderResult() {
do_check_eq(rootNode.childCount, 3);
var node = rootNode.getChild(0);
do_check_true(node.dateAdded > 0);
do_check_eq(node.lastModified, 0);
do_check_eq(node.itemId, sep);
do_check_eq(node.title, "");
node = rootNode.getChild(1);
do_check_eq(node.itemId, item);
do_check_true(node.dateAdded > 0);
do_check_true(node.lastModified > 0);
do_check_eq(node.title, "test bookmark");
node = rootNode.getChild(2);
do_check_eq(node.itemId, folder);
do_check_eq(node.title, "test folder");
do_check_true(node.dateAdded > 0);
do_check_true(node.lastModified > 0);
rootNode.containerOpen = false;
}