From 3f7875d176f49ef9d223892a8d2dbc925080d32b Mon Sep 17 00:00:00 2001 From: "shaver%mozilla.org" Date: Mon, 4 Jul 2005 14:44:38 +0000 Subject: [PATCH] Lightning fix potpourri: bug 299236 is hacked around with a collapse trick, which mostly works, kinda -- better than before! bug 298343 is kinda fixed, with a todo list that shows todos and allows completed/incomplete setting via the checkbox, has calendar colouring, and notices new events. Doesn't notice active-calendar-set changes, handle deletion, or let you select the items for editing/deletion yet. Fix some CSS and other problems by using a proper data: url for our magic stylesheet. r=35-degree-heat --- calendar/lightning/chrome.manifest | 1 + calendar/lightning/content/agenda-tree.js | 6 ++ .../lightning/content/calendar-management.js | 2 +- .../lightning/content/calendar-todo-list.css | 3 + .../lightning/content/calendar-todo-list.xml | 96 +++++++++++++++++++ .../content/messenger-overlay-sidebar.js | 9 +- .../content/messenger-overlay-sidebar.xul | 7 +- .../lightning/content/todo-list-overlay.xul | 13 +++ calendar/lightning/content/todo-list.js | 74 ++++++++++++++ calendar/lightning/jar.mn | 4 + 10 files changed, 207 insertions(+), 8 deletions(-) create mode 100644 calendar/lightning/content/calendar-todo-list.css create mode 100644 calendar/lightning/content/calendar-todo-list.xml create mode 100644 calendar/lightning/content/todo-list-overlay.xul create mode 100644 calendar/lightning/content/todo-list.js diff --git a/calendar/lightning/chrome.manifest b/calendar/lightning/chrome.manifest index 8cf061eaa90..c74d6af2526 100644 --- a/calendar/lightning/chrome.manifest +++ b/calendar/lightning/chrome.manifest @@ -4,6 +4,7 @@ overlay chrome://messenger/content/messenger.xul chrome://lightning/content/mess overlay chrome://messenger/content/preferences/preferences.xul chrome://lightning/content/messenger-overlay-preferences.xul overlay chrome://messenger/content/messenger.xul chrome://lightning/content/messenger-overlay-toolbar.xul overlay chrome://lightning/content/messenger-overlay-sidebar.xul chrome://lightning/content/agenda-tree-overlay.xul +overlay chrome://lightning/content/messenger-overlay-sidebar.xul chrome://lightning/content/todo-list-overlay.xul overlay chrome://lightning/content/lightning-standalone.xul chrome://lightning/content/messenger-overlay-sidebar.xul skin lightning classic/1.0 jar:chrome/classic.jar!/skin/classic/lightning/ # shared pieces for chrome://calendar/ diff --git a/calendar/lightning/content/agenda-tree.js b/calendar/lightning/content/agenda-tree.js index 50aa44c0149..e159130e2c9 100644 --- a/calendar/lightning/content/agenda-tree.js +++ b/calendar/lightning/content/agenda-tree.js @@ -363,6 +363,9 @@ agendaTreeView.calendarObserver = { agendaTreeView.calendarObserver.onAddItem = function observer_onAddItem(item) { + if (!(item instanceof Components.interfaces.calIEvent)) + return; + var occs = item.getOccurrencesBetween(this.agendaTreeView.today.start, this.agendaTreeView.soon.end, {}); occs.forEach(this.agendaTreeView.addItem, this.agendaTreeView); @@ -372,6 +375,9 @@ function observer_onAddItem(item) agendaTreeView.calendarObserver.onDeleteItem = function observer_onDeleteItem(item, rebuildFlag) { + if (!(item instanceof Components.interfaces.calIEvent)) + return; + var occs = item.getOccurrencesBetween(this.agendaTreeView.today.start, this.agendaTreeView.soon.end, {}); occs.forEach(this.agendaTreeView.deleteItem, this.agendaTreeView); diff --git a/calendar/lightning/content/calendar-management.js b/calendar/lightning/content/calendar-management.js index 878825e5e44..a3c1d5a4924 100644 --- a/calendar/lightning/content/calendar-management.js +++ b/calendar/lightning/content/calendar-management.js @@ -4,7 +4,7 @@ var calendarPrefStyleSheet = null; for (var i = 0; i < document.styleSheets.length; i++) { - if (document.styleSheets[i].href == "about:blank?calendar-dynamic-style-sheet") { + if (document.styleSheets[i].title == "calendar-dynamic-style-sheet") { calendarPrefStyleSheet = document.styleSheets[i]; break; } diff --git a/calendar/lightning/content/calendar-todo-list.css b/calendar/lightning/content/calendar-todo-list.css new file mode 100644 index 00000000000..44fd2bc86be --- /dev/null +++ b/calendar/lightning/content/calendar-todo-list.css @@ -0,0 +1,3 @@ +calendar-todo-item { + -moz-binding: url("calendar-todo-list.xml#calendar-todo-item"); +} diff --git a/calendar/lightning/content/calendar-todo-list.xml b/calendar/lightning/content/calendar-todo-list.xml new file mode 100644 index 00000000000..1e2487a6376 --- /dev/null +++ b/calendar/lightning/content/calendar-todo-list.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + null + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " + uneval(this.checkbox.checked) + "\n"); + clone.isCompleted = this.checkbox.checked; + dirty = true; + } else { + dump("checked not changed (" + uneval(this.mTodo.isCompleted) + + " == " + uneval(this.checkbox.checked) + "\n"); + } + if (this.mTodo.title != this.label.value) { + clone.title = this.label.value; + dirty = true; + } + if (dirty) { + this.mTodo.calendar.modifyItem(clone, this.mTodo, null); + dump(clone.icalComponent.serializeToICS() + "\n"); + this.mTodo = clone; + } + ]]> + + + + + + + + + + + + + + diff --git a/calendar/lightning/content/messenger-overlay-sidebar.js b/calendar/lightning/content/messenger-overlay-sidebar.js index a8ab3a98dbd..e6ce1c66bc5 100644 --- a/calendar/lightning/content/messenger-overlay-sidebar.js +++ b/calendar/lightning/content/messenger-overlay-sidebar.js @@ -97,7 +97,6 @@ function showCalendar(aDate1, aDate2) } function switchView(type) { - var messengerDisplayDeck = document.getElementById("displayDeck"); var calendarViewBox = document.getElementById("calendar-view-box"); var monthView = document.getElementById("calendar-month-view"); @@ -141,8 +140,9 @@ function selectedCalendarPane(event) document.getElementById("displayDeck").selectedPanel = document.getElementById("calendar-view-box"); - // give the view the calendar - showCalendar(today()); + // give the view the calendar, but make sure that everything + // has uncollapsed first before we try to relayout! + setTimeout(0, function() { showCalendar(today()); }); } function LtnObserveDisplayDeckChange(event) @@ -154,8 +154,9 @@ function LtnObserveDisplayDeckChange(event) GetMessagePane().collapsed = true; document.getElementById("threadpane-splitter").collapsed = true; gSearchBox.collapsed = true; + document.getElementById("calendar-view-box").collapsed = false; } else { - // nothing to "undo" for now + document.getElementById("calendar-view-box").collapsed = true; // Later: mark the view as not needing reflow due to new events coming // in, for better performance and batching. } diff --git a/calendar/lightning/content/messenger-overlay-sidebar.xul b/calendar/lightning/content/messenger-overlay-sidebar.xul index c291beb65c8..e29a1db4fd2 100644 --- a/calendar/lightning/content/messenger-overlay-sidebar.xul +++ b/calendar/lightning/content/messenger-overlay-sidebar.xul @@ -7,7 +7,7 @@ - + @@ -17,7 +17,6 @@