mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-07 11:56:51 +00:00
Bug 385828 - Insertion, removal and move operations of items should update the last-modified field of their containing folder. r=dietrich.
This commit is contained in:
parent
ad89d87a35
commit
e52328c9e5
@ -650,8 +650,17 @@ BookmarkContentSink::HandleContainerEnd()
|
||||
BookmarkImportFrame& frame = CurFrame();
|
||||
if (frame.mContainerNesting > 0)
|
||||
frame.mContainerNesting --;
|
||||
if (mFrames.Length() > 1 && frame.mContainerNesting == 0)
|
||||
if (mFrames.Length() > 1 && frame.mContainerNesting == 0) {
|
||||
// we also need to re-set the imported last-modified date here. Otherwise
|
||||
// the addition of items will override the imported field.
|
||||
BookmarkImportFrame& prevFrame = PreviousFrame();
|
||||
if (prevFrame.mPreviousLastModifiedDate > 0) {
|
||||
nsresult rv = mBookmarksService->SetItemLastModified(frame.mContainerID,
|
||||
prevFrame.mPreviousLastModifiedDate);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "SetItemLastModified failed");
|
||||
}
|
||||
PopFrame();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -939,6 +939,9 @@ nsNavBookmarks::InsertBookmark(PRInt64 aFolder, nsIURI *aItem, PRInt32 aIndex,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
*aNewBookmarkId = rowId;
|
||||
|
||||
rv = SetItemLastModified(aFolder, PR_Now());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = transaction.Commit();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -993,6 +996,9 @@ nsNavBookmarks::RemoveItem(PRInt64 aItemId)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
rv = SetItemLastModified(folderId, PR_Now());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = transaction.Commit();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -1076,7 +1082,10 @@ nsNavBookmarks::CreateFolderWithID(PRInt64 aFolder, PRInt64 aParent,
|
||||
PRInt64 id;
|
||||
rv = dbConn->GetLastInsertRowID(&id);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
rv = SetItemLastModified(aParent, PR_Now());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = transaction.Commit();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -1168,6 +1177,9 @@ nsNavBookmarks::InsertSeparator(PRInt64 aParent, PRInt32 aIndex,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
*aNewItemId = rowId;
|
||||
|
||||
rv = SetItemLastModified(aParent, PR_Now());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = transaction.Commit();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -1304,6 +1316,9 @@ nsNavBookmarks::RemoveFolder(PRInt64 aFolder)
|
||||
rv = AdjustIndices(parent, index + 1, PR_INT32_MAX, -1);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = SetItemLastModified(parent, PR_Now());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = transaction.Commit();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -1530,6 +1545,12 @@ nsNavBookmarks::MoveItem(PRInt64 aItemId, PRInt64 aNewParent, PRInt32 aIndex)
|
||||
rv = dbConn->ExecuteSimpleSQL(buffer);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRTime now = PR_Now();
|
||||
rv = SetItemLastModified(oldParent, now);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = SetItemLastModified(aNewParent, now);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = transaction.Commit();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -1695,10 +1716,10 @@ nsNavBookmarks::SetItemTitle(PRInt64 aItemId, const nsAString &aTitle)
|
||||
rv = statement->Execute();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = transaction.Commit();
|
||||
rv = SetItemLastModified(aItemId, PR_Now());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = SetItemLastModified(aItemId, PR_Now());
|
||||
rv = transaction.Commit();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
ENUMERATE_WEAKARRAY(mObservers, nsINavBookmarkObserver,
|
||||
@ -2066,6 +2087,9 @@ nsNavBookmarks::ChangeBookmarkURI(PRInt64 aBookmarkId, nsIURI *aNewURI)
|
||||
rv = statement->Execute();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = SetItemLastModified(aBookmarkId, PR_Now());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = transaction.Commit();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -2073,9 +2097,6 @@ nsNavBookmarks::ChangeBookmarkURI(PRInt64 aBookmarkId, nsIURI *aNewURI)
|
||||
rv = aNewURI->GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = SetItemLastModified(aBookmarkId, PR_Now());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Pass the new URI to OnItemChanged.
|
||||
ENUMERATE_WEAKARRAY(mObservers, nsINavBookmarkObserver,
|
||||
OnItemChanged(aBookmarkId, NS_LITERAL_CSTRING("uri"), PR_FALSE, spec))
|
||||
@ -2271,11 +2292,12 @@ nsNavBookmarks::SetKeywordForBookmark(PRInt64 aBookmarkId, const nsAString& aKey
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = updateKeywordStmnt->Execute();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
transaction.Commit();
|
||||
|
||||
|
||||
rv = SetItemLastModified(aBookmarkId, PR_Now());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
transaction.Commit();
|
||||
|
||||
// Pass the new keyword to OnItemChanged.
|
||||
ENUMERATE_WEAKARRAY(mObservers, nsINavBookmarkObserver,
|
||||
OnItemChanged(aBookmarkId, NS_LITERAL_CSTRING("keyword"),
|
||||
|
Loading…
Reference in New Issue
Block a user