Bug 400279 - Category colors should be displayed next to the event boxes, r=berend

This commit is contained in:
michael.buettner%sun.com 2007-11-05 17:51:03 +00:00
Родитель 64670e874c
Коммит 7a06fdf42b
14 изменённых файлов: 195 добавлений и 106 удалений

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

@ -82,6 +82,16 @@
subj.QueryInterface(Components.interfaces.nsIPrefBranch2);
// refresh view if categories seem to have changed
if (pref.indexOf("calendar.category.color") == 0) {
if (!this.calView.startDay || !this.calView.endDay) {
// Don't refresh if we're not initialized
return;
}
// Refresh the view to recreate the event boxes
this.calView.goToDay(this.calView.selectedDay);
}
switch (pref) {
case "calendar.previousweeks.inview":

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

@ -85,6 +85,16 @@
subj.QueryInterface(Components.interfaces.nsIPrefBranch2);
// refresh view if categories seem to have changed
if (pref.indexOf("calendar.category.color") == 0) {
if (!this.calView.startDay || !this.calView.endDay) {
// Don't refresh if we're not initialized
return;
}
// Refresh the view to recreate the event boxes
this.calView.goToDay(this.calView.selectedDay);
}
switch (pref) {
case "calendar.previousweeks.inview":

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

@ -78,6 +78,16 @@
<body><![CDATA[
aSubject.QueryInterface(Components.interfaces.nsIPrefBranch2);
// refresh view if categories seem to have changed
if (aPreference.indexOf("calendar.category.color") == 0) {
if (!this.startDay || !this.endDay) {
// Don't refresh if we're not initialized
return;
}
// Refresh the view to recreate the event boxes
this.goToDay(this.selectedDay);
}
switch (aPreference) {
case "calendar.week.start":

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

@ -57,40 +57,44 @@
<xul:hbox>
<xul:image class="calendar-event-box-shadow-left"/>
<xul:box anonid="event-container" flex="1">
<xul:stack class="calendar-event-selection" flex="1">
<xul:hbox class="calendar-event-details">
<xul:image anonid="item-icon"
class="calendar-month-day-box-item-image"/>
<xul:label anonid="item-label"
class="calendar-month-day-box-item-label"
xbl:inherits="context"/>
<xul:vbox align="left"
class="calendar-event-box-container"
flex="1"
xbl:inherits="context">
<xul:label anonid="event-name"
crop="end"
flex="1"
style="margin: 0;"/>
<xul:textbox anonid="event-name-textbox"
class="plain"
<xul:box class="calendar-event-selection" orient="horizontal" flex="1">
<xul:stack anonid="eventbox"
class="calendar-event-box-container"
flex="1">
<xul:hbox class="calendar-event-details">
<xul:image anonid="item-icon"
class="calendar-month-day-box-item-image"/>
<xul:label anonid="item-label"
class="calendar-month-day-box-item-label"
xbl:inherits="context"/>
<xul:vbox align="left"
flex="1"
xbl:inherits="context">
<xul:label anonid="event-name"
crop="end"
hidden="true"
style="background: transparent !important;"
wrap="true"/>
<xul:spacer flex="1"/>
</xul:vbox>
<xul:vbox pack="center">
<xul:image anonid="alarm-image"
class="alarm-image"
xbl:inherits="flashing"
hidden="true"/>
</xul:vbox>
</xul:hbox>
<xul:image anonid="gradient"
class="calendar-event-box-gradient event-frame"
hidden="true" height="1px"/>
</xul:stack>
flex="1"
style="margin: 0;"/>
<xul:textbox anonid="event-name-textbox"
class="plain"
crop="end"
hidden="true"
style="background: transparent !important;"
wrap="true"/>
<xul:spacer flex="1"/>
</xul:vbox>
<xul:vbox pack="center">
<xul:image anonid="alarm-image"
class="alarm-image"
xbl:inherits="flashing"
hidden="true"/>
</xul:vbox>
</xul:hbox>
<xul:image anonid="gradient"
class="calendar-event-box-gradient"
hidden="true" height="1px"/>
</xul:stack>
</xul:box>
<xul:calendar-category-box anonid="category-box"/>
</xul:box>
<xul:image class="calendar-event-box-shadow-right"/>
</xul:hbox>
@ -100,7 +104,7 @@
<xul:image class="calendar-event-box-shadow-edge-right"/>
</xul:box>
</xul:vbox>
</content>
</content>
<implementation>
<constructor><![CDATA[

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

@ -229,22 +229,12 @@
<handlers>
<handler event="mousedown" button="0"><![CDATA[
event.stopPropagation();
var whichside = this.getAttribute("whichside");
if (!whichside)
return;
// we make assumptions about our position in the tree here;
// specifically, this should get us to a <calendar-event-box>
var evbox = this.parentNode.parentNode.parentNode.parentNode.
parentNode.parentNode.parentNode;
// still select it (since we'll stopPropagation())
evbox.calendarView.setSelectedItems(1,
[event.ctrlKey ? evbox.mOccurrence.parentItem : evbox.mOccurrence]);
// then start dragging it
evbox.parentColumn.startSweepingToModifyEvent(evbox, evbox.mOccurrence, whichside, event.screenX, event.screenY);
// store the attribute 'whichside' in the event object
// but *don't* call stopPropagation(). as soon as the
// enclosing event box will receive the event it will
// make use of this information in order to invoke the
// appropriate action.
event.whichside = this.getAttribute("whichside");
]]></handler>
<handler event="click" button="0"><![CDATA[
event.stopPropagation();
@ -1846,9 +1836,7 @@
class="calendar-event-box-shadow-left"
hidden="true"/>
<xul:box anonid="event-container" xbl:inherits="orient" flex="1">
<xul:box class="calendar-event-selection"
flex="1"
xbl:inherits="orient">
<xul:box class="calendar-event-selection" orient="horizontal" flex="1">
<xul:stack anonid="eventbox"
align="stretch"
class="calendar-event-box-container"
@ -1887,6 +1875,7 @@
not be resizable using the gripbars. If you want to insert
additional elements, do so above the box with the gripbars. -->
</xul:stack>
<xul:calendar-category-box anonid="category-box"/>
</xul:box>
</xul:box>
<xul:image anonid="shadow-bottom"
@ -2027,6 +2016,16 @@
this.mInMouseDown = true;
this.mMouseX = event.screenX;
this.mMouseY = event.screenY;
var whichside = event.whichside;
if (!whichside)
return;
this.calendarView.setSelectedItems(1,
[event.ctrlKey ? this.mOccurrence.parentItem : this.mOccurrence]);
// start dragging it
this.parentColumn.startSweepingToModifyEvent(this, this.mOccurrence, whichside, event.screenX, event.screenY);
]]></handler>
<handler event="mousemove"><![CDATA[

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

@ -124,6 +124,12 @@ function onLoad() {
document.getElementById("item-location").value = location;
}
var category = item.getProperty("CATEGORIES");
if (category && category.length) {
document.getElementById("category-row").removeAttribute("hidden");
document.getElementById("item-category").value = category;
}
var organizer = item.organizer;
if (organizer) {
if (organizer.commonName && organizer.commonName.length) {

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

@ -103,6 +103,10 @@
<label value="&read.only.location.label;" class="headline"/>
<label id="item-location"/>
</row>
<row id="category-row" align="top" hidden="true">
<label value="&read.only.category.label;" class="headline"/>
<label id="item-category"/>
</row>
<row id="organizer-row" align="top" hidden="true">
<label value="&read.only.organizer.label;" class="headline"/>
<label id="item-organizer"

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

@ -91,3 +91,7 @@ calendar-month-view-column-header {
calendar-editable-item {
-moz-binding: url(chrome://calendar/content/calendar-view-core.xml#calendar-editable-item);
}
calendar-category-box {
-moz-binding: url(chrome://calendar/content/calendar-view-core.xml#calendar-category-box);
}

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

@ -52,42 +52,48 @@
<xul:vbox flex="1">
<xul:hbox>
<xul:image class="calendar-event-box-shadow-left"/>
<xul:stack anonid="event-container"
class="calendar-event-box-container"
flex="1"
xbl:inherits="context">
<xul:vbox class="calendar-event-details calendar-event-selection">
<xul:label anonid="event-name"
crop="right"
flex="1"
style="margin: 0;"/>
<xul:textbox anonid="event-name-textbox"
class="plain"
crop="right"
hidden="true"
style="background: transparent !important;"
wrap="true"/>
<xul:spacer flex="1"/>
</xul:vbox>
<xul:hbox pack="end">
<xul:vbox pack="center">
<xul:image anonid="alarm-image"
class="alarm-image"
xbl:inherits="flashing"
hidden="true"/>
</xul:vbox>
</xul:hbox>
<xul:image anonid="gradient"
class="calendar-event-box-gradient event-frame"
hidden="true" height="1px"/>
</xul:stack>
<xul:box anonid="event-container" flex="1">
<xul:box class="calendar-event-selection" orient="horizontal" flex="1">
<xul:stack anonid="eventbox"
class="calendar-event-box-container"
flex="1">
<xul:hbox class="calendar-event-details">
<xul:vbox align="left"
flex="1"
xbl:inherits="context">
<xul:label anonid="event-name"
crop="end"
flex="1"
style="margin: 0;"/>
<xul:textbox anonid="event-name-textbox"
class="plain"
crop="end"
hidden="true"
style="background: transparent !important;"
wrap="true"/>
<xul:spacer flex="1"/>
</xul:vbox>
<xul:vbox pack="center">
<xul:image anonid="alarm-image"
class="alarm-image"
xbl:inherits="flashing"
hidden="true"/>
</xul:vbox>
</xul:hbox>
<xul:image anonid="gradient"
class="calendar-event-box-gradient"
hidden="true" height="1px"/>
</xul:stack>
</xul:box>
<xul:calendar-category-box anonid="category-box"/>
</xul:box>
<xul:image class="calendar-event-box-shadow-right"/>
</xul:hbox>
<xul:hbox>
<xul:box orient="horizontal">
<xul:image class="calendar-event-box-shadow-edge-left"/>
<xul:image class="calendar-event-box-shadow-bottom" flex="1"/>
<xul:image class="calendar-event-box-shadow-edge-right"/>
</xul:hbox>
</xul:box>
</xul:vbox>
</content>
@ -198,7 +204,20 @@
categoriesSelectorList = categoriesList.join(" ");
}
container.setAttribute("item-category", categoriesSelectorList);
var box = document.
getAnonymousElementByAttribute(this,"anonid","category-box");
if (box) {
box.categories = categoriesSelectorList;
box = document.
getAnonymousElementByAttribute(this,"anonid","eventbox");
if (box) {
if (categoriesSelectorList.length > 0) {
box.setAttribute("has-category","true");
} else {
box.removeAttribute("has-category");
}
}
}
var alarmImage = document.getAnonymousElementByAttribute(this, "anonid", "alarm-image");
if (item.alarmOffset && getPrefSafe("calendar.alarms.indicator.show", true)) {
@ -313,4 +332,31 @@
]]></handler>
</handlers>
</binding>
<binding id="calendar-category-box">
<content>
<xul:vbox anonid="category-box" hidden="true" class="calendar-item calendar-event-selection">
<xul:hbox flex="1">
<xul:image class="calendar-category-box-gradient" height="1"/>
</xul:hbox>
<xul:hbox height="1"/>
</xul:vbox>
</content>
<implementation>
<property name="categories">
<setter><![CDATA[
var box = document.getAnonymousElementByAttribute(this,
"anonid",
"category-box");
box.setAttribute("item-category", val);
if (val.length > 0) {
box.removeAttribute("hidden");
} else {
box.setAttribute("hidden","true");
}
]]></setter>
</property>
</implementation>
</binding>
</bindings>

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

@ -435,7 +435,7 @@ function updateStyleSheetForObject(aObject, aSheet) {
ruleUpdaterFunc = function categoryRuleFunc(aRule, aIndex) {
var color = getPrefSafe("calendar.category.color."+aObject, null);
if (color) {
aRule.style.border = color + " solid 2px";
aRule.style.backgroundColor = color;
} else {
aSheet.deleteRule(aIndex);
}

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

@ -96,6 +96,7 @@ calendar.jar:
skin/classic/calendar/event-grippy-right.png (themes/common/event-grippy-right.png)
skin/classic/calendar/event-grippy-top.png (themes/common/event-grippy-top.png)
skin/classic/calendar/gradient-overlay.png (themes/common/gradient-overlay.png)
skin/classic/calendar/category-overlay.png (themes/common/category-overlay.png)
skin/classic/calendar/shadow-bottom.png (themes/common/shadow-bottom.png)
skin/classic/calendar/shadow-edge-left.png (themes/common/shadow-edge-left.png)
skin/classic/calendar/shadow-edge-right.png (themes/common/shadow-edge-right.png)

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

@ -159,19 +159,12 @@ calendar-header-container[weekend="true"][selected="true"],
.calendar-event-box-container {
padding: 0;
margin: 1px;
overflow: hidden;
}
.calendar-event-box-container[parentorient="vertical"] {
margin: 2px;
}
.calendar-event-box-container[parentorient="horizontal"] {
margin: 2px;
}
.event-frame {
margin: 2px;
.calendar-event-box-container[has-category="true"] {
margin-right: 0px;
}
.calendar-event-details {
@ -419,6 +412,10 @@ box[dropbox="true"] {
list-style-image: url("chrome://calendar/skin/gradient-overlay.png");
}
.calendar-category-box-gradient {
list-style-image: url("chrome://calendar/skin/category-overlay.png");
}
.calendar-event-box-shadow-right {
list-style-image: url("chrome://calendar/skin/shadow-right.png");
}

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

@ -159,19 +159,12 @@ calendar-header-container[weekend="true"][selected="true"],
.calendar-event-box-container {
padding: 0;
margin: 1px;
overflow: hidden;
}
.calendar-event-box-container[parentorient="vertical"] {
margin: 2px;
}
.calendar-event-box-container[parentorient="horizontal"] {
margin: 2px;
}
.event-frame {
margin: 2px;
.calendar-event-box-container[has-category="true"] {
margin-right: 0px;
}
.calendar-event-details {
@ -419,6 +412,10 @@ box[dropbox="true"] {
list-style-image: url("chrome://calendar/skin/gradient-overlay.png");
}
.calendar-category-box-gradient {
list-style-image: url("chrome://calendar/skin/category-overlay.png");
}
.calendar-event-box-shadow-right {
list-style-image: url("chrome://calendar/skin/shadow-right.png");
}

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

@ -278,6 +278,7 @@
<!ENTITY read.only.date.label "Date:">
<!ENTITY read.only.repeat.label "Repeat:">
<!ENTITY read.only.location.label "Location:">
<!ENTITY read.only.category.label "Category:">
<!ENTITY read.only.organizer.label "Organizer:">
<!ENTITY read.only.reply.label "Reply:">
<!ENTITY read.only.accept.label "I will attend">