From 0b1415cb0494d1f72ef417e1e7cb029bb18cbf0f Mon Sep 17 00:00:00 2001 From: "mattwillis%gmail.com" Date: Tue, 13 Mar 2007 23:38:27 +0000 Subject: [PATCH] =?UTF-8?q?bug=20327930=20-=20when=20using=20getItems()=20?= =?UTF-8?q?LAST-MODIFIED=20property=20should=20actually=20represent=20the?= =?UTF-8?q?=20last=20mtime.=20Patch=20by=20Norbert=20P=C3=83=C2=BCschel=20?= =?UTF-8?q?,=20r1=3Dctalbert,=20r2=3Dm?= =?UTF-8?q?vl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.0.0.236/trunk@221847 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/calendar/base/src/calItemBase.js | 6 +++- .../providers/storage/calStorageCalendar.js | 32 +++++++++++++------ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/mozilla/calendar/base/src/calItemBase.js b/mozilla/calendar/base/src/calItemBase.js index f8d6d34422c..db8427d3abe 100644 --- a/mozilla/calendar/base/src/calItemBase.js +++ b/mozilla/calendar/base/src/calItemBase.js @@ -378,7 +378,11 @@ calItemBase.prototype = { }, setProperty: function (aName, aValue) { - this.modify(); + if (aName == "LAST-MODIFIED") { + this.mDirty = false; + } else { + this.modify(); + } this.mProperties.setProperty(aName.toUpperCase(), aValue); }, diff --git a/mozilla/calendar/providers/storage/calStorageCalendar.js b/mozilla/calendar/providers/storage/calStorageCalendar.js index fc52e6b54c7..c55fc6f4257 100644 --- a/mozilla/calendar/providers/storage/calStorageCalendar.js +++ b/mozilla/calendar/providers/storage/calStorageCalendar.js @@ -1484,10 +1484,6 @@ calStorageCalendar.prototype = { // read in the common ItemBase attributes from aDBRow, and stick // them on item getItemBaseFromRow: function (row, flags, item) { - if (row.time_created) - item.creationDate = newDateTime(row.time_created, "UTC"); - if (row.last_modified) - item.lastModifiedTime = newDateTime(row.last_modified, "UTC"); item.calendar = this; item.id = row.id; if (row.title) @@ -1548,32 +1544,41 @@ calStorageCalendar.prototype = { if (flags) flags.value = row.flags; + + if (row.time_created) { + item.setProperty("CREATED", newDateTime(row.time_created, "UTC")); + } + + // This must be done last because the setting of any other property + // after this would overwrite it again. + if (row.last_modified) { + item.setProperty("LAST-MODIFIED", newDateTime(row.last_modified, "UTC")); + } }, getEventFromRow: function (row, flags) { var item = createEvent(); - this.getItemBaseFromRow (row, flags, item); - if (row.event_start) item.startDate = newDateTime(row.event_start, row.event_start_tz); if (row.event_end) item.endDate = newDateTime(row.event_end, row.event_end_tz); if (row.event_stamp) - item.stampTime = newDateTime(row.event_stamp, "UTC"); + item.setProperty("DTSTAMP", newDateTime(row.event_stamp, "UTC")); if ((row.flags & CAL_ITEM_FLAG_EVENT_ALLDAY) != 0) { item.startDate.isDate = true; item.endDate.isDate = true; } + // This must be done last to keep the modification time intact. + this.getItemBaseFromRow (row, flags, item); + return item; }, getTodoFromRow: function (row, flags) { var item = createTodo(); - this.getItemBaseFromRow (row, flags, item); - if (row.todo_entry) item.entryDate = newDateTime(row.todo_entry, row.todo_entry_tz); if (row.todo_due) @@ -1583,6 +1588,9 @@ calStorageCalendar.prototype = { if (row.todo_complete) item.percentComplete = row.todo_complete; + // This must be done last to keep the modification time intact. + this.getItemBaseFromRow (row, flags, item); + return item; }, @@ -1594,6 +1602,9 @@ calStorageCalendar.prototype = { // against mDBTwo in here! getAdditionalDataForItem: function (item, flags) { + // This is needed to keep the modification time intact. + var savedLastModifiedTime = item.lastModifiedTime; + if (flags & CAL_ITEM_FLAG_HAS_ATTENDEES) { var selectItem = null; if (item.recurrenceId == null) @@ -1750,6 +1761,9 @@ calStorageCalendar.prototype = { rec.modifyException(exc.item); } } + + // Restore the saved modification time + item.setProperty("LAST-MODIFIED", savedLastModifiedTime); }, getAttendeeFromRow: function (row) {