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:
mozilla.mano%sent.com 2007-07-10 07:57:31 +00:00
Родитель 97ea5bc44a
Коммит 31ff7088a2
1 изменённых файлов: 30 добавлений и 8 удалений

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

@ -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);
@ -1077,6 +1083,9 @@ nsNavBookmarks::CreateFolderWithID(PRInt64 aFolder, PRInt64 aParent,
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"),