From c9d5e7f94ee50f1ca5a80f92e669e56bb16d85ba Mon Sep 17 00:00:00 2001 From: Decathlon Date: Tue, 13 Apr 2010 07:15:00 +0200 Subject: [PATCH] Fix bug 457536 - [Today Pane] Wrong time shown on events spanning multiple days. r=philipp --HG-- extra : rebase_source : 534c652e6512b06e3160e32ce1c892cc5c2ea6a2 --- calendar/base/content/agenda-listbox.js | 2 +- calendar/base/content/agenda-listbox.xml | 105 +++++++++++++++--- .../themes/common/images/calendar-overlay.png | Bin 290 -> 441 bytes calendar/base/themes/pinstripe/today-pane.css | 25 +++++ calendar/base/themes/winstripe/today-pane.css | 24 ++++ 5 files changed, 137 insertions(+), 19 deletions(-) diff --git a/calendar/base/content/agenda-listbox.js b/calendar/base/content/agenda-listbox.js index db192c765d..b720989ce8 100644 --- a/calendar/base/content/agenda-listbox.js +++ b/calendar/base/content/agenda-listbox.js @@ -310,7 +310,7 @@ function addItemBefore(aNewItem, aAgendaItem, aPeriod, visible) { } else { this.agendaListboxControl.insertBefore(newelement, aAgendaItem); } - newelement.setOccurrence(aNewItem, (aPeriod.duration > 1)); + newelement.setOccurrence(aNewItem, aPeriod); newelement.removeAttribute("selected"); return newelement; } diff --git a/calendar/base/content/agenda-listbox.xml b/calendar/base/content/agenda-listbox.xml index 7ba9e33955..bc8ac7abb3 100644 --- a/calendar/base/content/agenda-listbox.xml +++ b/calendar/base/content/agenda-listbox.xml @@ -125,7 +125,8 @@ xbl:inherits="selected,disabled" flex="1"> - + + @@ -144,6 +145,32 @@ = 0 && + startDate.compare(periodEndDate) <= 0) { + iconType = "start"; + } else if (endDate.compare(periodStartDate) >= 0 && + endDate.compare(periodEndDate) <= 0) { + iconType = "end"; + } else { + iconType = "continue"; + } + } + let multiDayImage = document.getAnonymousElementByAttribute(this, "anonid", "agenda-multiDayEvent-image"); + multiDayImage.setAttribute("type", iconType); ]]> @@ -160,14 +187,17 @@ extends="chrome://calendar/content/agenda-listbox.xml#agenda-base-richlist-item"> - - - - - - + + + + + + - + + + + @@ -175,23 +205,62 @@ - + 1; + + let duration = ""; + let iconType = ""; + if (startDate.compare(endDate) == 0 || + (startDate.compare(endPreviousDay) == 0 && endAtMidnight)) { + // event that starts and ends in the same day, midnight included + duration = longFormat ? dateFormatter.formatDateTime(start) : + dateFormatter.formatTime(start); } else { - duration = dateFormatter.formatTime(start); + // event spanning multiple days + if (startDate.compare(periodStartDate) >= 0 && + startDate.compare(periodEndDate) <= 0) { + iconType = "start"; + duration = longFormat ? dateFormatter.formatDateTime(start) : + dateFormatter.formatTime(start); + } else if (endDate.compare(periodStartDate) >= 0 && + endDate.compare(periodEndDate) <= 0) { + iconType = "end"; + if (endAtMidnight) { + duration = dateFormatter.formatDate(endPreviousDay) + " "; + duration = longFormat ? duration + calGetString("dateFormat", "midnight") : + calGetString("dateFormat", "midnight"); + } else { + duration = longFormat ? dateFormatter.formatDateTime(end) : + dateFormatter.formatTime(end); + } + } else { + iconType = "continue"; + } } - var durationbox = document.getAnonymousElementByAttribute(this, "anonid", "agenda-event-start"); + let multiDayImage = document.getAnonymousElementByAttribute(this, "anonid", "agenda-multiDayEvent-image"); + multiDayImage.setAttribute("type", iconType); + let durationbox = document.getAnonymousElementByAttribute(this, "anonid", "agenda-event-start"); durationbox.value = duration; this.refreshColor(); ]]> diff --git a/calendar/base/themes/common/images/calendar-overlay.png b/calendar/base/themes/common/images/calendar-overlay.png index e0abeade6b15d46d4932931f562781d24980d866..af341e77dff8d303962c63eac55c9327b08e88a3 100644 GIT binary patch delta 428 zcmV;d0aN~>0=WY~iBL{Q4GJ0x0000DNk~Le0000e0000A2nGNE0LGdePyhe`0drDE zLIAGL9O(c600v@9M??TP05||RYG_1`ks%m=2XskIMF-jh3KSIvAhnyo0003wNkljK9i{;<}v5V~($L`1u;1EA|VthKst+gKeVB0nWH zgOU|+4P1bm!hx3&^Bp!VSyC#6#BL4bLxlHKgq^A$y!Vf}p{fU9x7L!axU_6i>=jUt zHr^G+Fk%pqNrK$mmT=CQpqRCG;)nrb9)M5p{c|os(=_h^6W3K*mvQ1iIK~DNTmSYd zr~};2T(pjEtLedMV&|O6shZ+)Zsf4X6;2%gqXyTsEdx9O_X`BSfRC*WcnPrrSYr5qeKP}72kWUHOh--^Xml|NGBC0P|9JQM`uaOJLJEtE_cLE)U_5f@ z#EBDZTmG3&INN{tNY-@)Q=lrNiQGpRlN4jP9J3ghIF<;csGg`$mEn?a$YJJCnBXL* zP{(yd$wH*bMvGU#!9ZB@Lj>