зеркало из https://github.com/mozilla/pjs.git
Fix bug 288496 - Alarm indicator icon on event box. r=mickey
This commit is contained in:
Родитель
e082922d62
Коммит
5906268487
|
@ -118,6 +118,14 @@
|
|||
this.calView.goToDay(this.calView.selectedDay);
|
||||
break;
|
||||
|
||||
case "calendar.alarms.indicator.show":
|
||||
if (this.calView.startDay && this.calView.endDay) {
|
||||
// Refresh the view, the view core takes care of
|
||||
// resetting the alarm image.
|
||||
this.calView.goToDay(this.calView.selectedDay);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
-
|
||||
- Contributor(s):
|
||||
- Dan Mosedale <dan.mosedale@oracle.com>
|
||||
- Philipp Kewisch <mozilla@kewis.ch>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -170,6 +171,14 @@
|
|||
this.goToDay(this.selectedDay);
|
||||
break;
|
||||
|
||||
case "calendar.alarms.indicator.show":
|
||||
if (this.startDay && this.endDay) {
|
||||
// Refresh the view, the view core takes care of
|
||||
// resetting the alarm image.
|
||||
this.goToDay(this.selectedDay);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -130,6 +130,14 @@
|
|||
this.calView.goToDay(this.calView.selectedDay);
|
||||
break;
|
||||
|
||||
case "calendar.alarms.indicator.show":
|
||||
if (this.calView.startDay && this.calView.endDay) {
|
||||
// Refresh the view, the view core takes care of
|
||||
// resetting the alarm image.
|
||||
this.calView.goToDay(this.calView.selectedDay);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -80,6 +80,12 @@
|
|||
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"
|
||||
|
@ -488,6 +494,10 @@
|
|||
box.setAttribute("item-calendar", itd.item.calendar.uri.spec);
|
||||
box.setAttribute("tooltip", "itemTooltip");
|
||||
|
||||
if (itd.item.hashId in this.monthView.mFlashingEvents) {
|
||||
box.setAttribute("flashing", "true");
|
||||
}
|
||||
|
||||
var categoriesSelectorList = "";
|
||||
if (itd.item.getProperty("CATEGORIES") != null) {
|
||||
var categoriesList = itd.item.getProperty("CATEGORIES").split(",");
|
||||
|
@ -818,11 +828,19 @@
|
|||
headerbox.appendChild(hdr);
|
||||
hdr.index = i;
|
||||
}
|
||||
|
||||
var alarmService = Components.classes['@mozilla.org/calendar/alarm-service;1']
|
||||
.getService(Components.interfaces.calIAlarmService);
|
||||
alarmService.addObserver(this.mObserver);
|
||||
]]></constructor>
|
||||
|
||||
<destructor><![CDATA[
|
||||
if (this.mCalendar)
|
||||
if (this.mCalendar) {
|
||||
this.mCalendar.removeObserver(this.mObserver);
|
||||
}
|
||||
var alarmService = Components.classes['@mozilla.org/calendar/alarm-service;1']
|
||||
.getService(Components.interfaces.calIAlarmService);
|
||||
alarmService.removeObserver(this.mObserver);
|
||||
]]></destructor>
|
||||
|
||||
<!-- fields -->
|
||||
|
@ -846,6 +864,7 @@
|
|||
<field name="mDisplayDaysOff">true</field>
|
||||
<field name="mDropShadows">null</field>
|
||||
<field name="mShadowIndex">0</field>
|
||||
<field name="mFlashingEvents">new Object()</field>
|
||||
|
||||
<!-- other methods -->
|
||||
<method name="setAttribute">
|
||||
|
@ -1376,6 +1395,7 @@
|
|||
return null;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="findBoxesForItem">
|
||||
<parameter name="aItem"/>
|
||||
<body><![CDATA[
|
||||
|
@ -1520,7 +1540,7 @@
|
|||
]]></field>
|
||||
|
||||
<field name="mObserver"><![CDATA[
|
||||
// the calIObserver, and calICompositeObserver
|
||||
// the calIObserver, calICompositeObserver, calIAlarmServiceObserver
|
||||
({
|
||||
calView: this,
|
||||
mBatchCount: 0,
|
||||
|
@ -1528,6 +1548,7 @@
|
|||
QueryInterface: function (aIID) {
|
||||
if (!aIID.equals(Components.interfaces.calIObserver) &&
|
||||
!aIID.equals(Components.interfaces.calICompositeObserver) &&
|
||||
!aIID.equals(Ci.calIAlarmServiceObserver) &&
|
||||
!aIID.equals(Components.interfaces.nsISupports)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
@ -1621,6 +1642,27 @@
|
|||
},
|
||||
onError: function (aErrNo, aMessage) { },
|
||||
|
||||
//
|
||||
// calIAlarmServiceObserver stuff
|
||||
//
|
||||
onAlarm: function onAlarm(aAlarmItem) {
|
||||
this.calView.flashAlarm(aAlarmItem, false);
|
||||
},
|
||||
|
||||
onRemoveAlarmsByItem: function onRemoveAlarmsByItem(aItem) {
|
||||
// Stop the flashing for the item.
|
||||
this.calView.flashAlarm(aItem, true);
|
||||
},
|
||||
|
||||
onRemoveAlarmsByCalendar: function onRemoveAlarmsByCalendar(aCalendar) {
|
||||
// Stop the flashing for all items of this calendar
|
||||
for each (var item in this.calView.mFlashingEvents) {
|
||||
if (item.calendar.id == aCalendar.id) {
|
||||
this.calView.flashAlarm(item, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
// calICompositeObserver stuff
|
||||
// XXXvv we can be smarter about how we handle this stuff
|
||||
|
@ -1639,6 +1681,44 @@
|
|||
})
|
||||
]]></field>
|
||||
|
||||
<method name="flashAlarm">
|
||||
<parameter name="aAlarmItem"/>
|
||||
<parameter name="aStop"/>
|
||||
<body><![CDATA[
|
||||
var showIndicator = getPrefSafe("calendar.alarms.indicator.show", true);
|
||||
var totaltime = getPrefSafe("calendar.alarms.indicator.totaltime", 3600);
|
||||
|
||||
if (!aStop && (!showIndicator || totaltime < 1)) {
|
||||
// No need to animate if the indicator should not be shown.
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the flashing attribute is set or reset on all visible
|
||||
// boxes.
|
||||
var boxes = this.findBoxesForItem(aAlarmItem);
|
||||
for each (var box in boxes) {
|
||||
for each (var itemData in box.box.mItemData) {
|
||||
if (itemData.item.hasSameIds(aAlarmItem)) {
|
||||
if (aStop) {
|
||||
itemData.box.removeAttribute("flashing");
|
||||
} else {
|
||||
itemData.box.setAttribute("flashing", "true");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!aStop) {
|
||||
// Set up a timer to stop the flashing after the total time.
|
||||
var this_ = this;
|
||||
this.mFlashingEvents[aAlarmItem.hashId] = aAlarmItem;
|
||||
setTimeout(function() { this_.flashAlarm(aAlarmItem, true) }, totaltime);
|
||||
} else {
|
||||
// We are done flashing, prevent newly created event boxes from flashing.
|
||||
delete this.mFlashingEvents[aAlarmItem.hashId];
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
|
@ -1659,5 +1739,3 @@
|
|||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
||||
<!-- -*- Mode: xml; indent-tabs-mode: nil; -*- -->
|
||||
|
|
|
@ -802,6 +802,10 @@
|
|||
chunkBox.setAttribute("width", durMinutes * this.mPixPerMin);
|
||||
}
|
||||
|
||||
if (chunk.event.hashId in this.calendarView.mFlashingEvents) {
|
||||
chunkBox.setAttribute("flashing", "true");
|
||||
}
|
||||
|
||||
innerColumn.appendChild(chunkBox);
|
||||
|
||||
chunkBox.calendarView = this.calendarView;
|
||||
|
@ -1727,6 +1731,20 @@
|
|||
]]></setter>
|
||||
</property>
|
||||
|
||||
<method name="findBoxForItem">
|
||||
<parameter name="aItem"/>
|
||||
<body><![CDATA[
|
||||
for each (var item in this.mItemBoxes) {
|
||||
if (aItem && item.occurrence.hasSameIds(aItem)) {
|
||||
// We can return directly, since there will only be one box per
|
||||
// item in the header.
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="addEvent">
|
||||
<parameter name="aItem"/>
|
||||
<body><![CDATA[
|
||||
|
@ -1749,6 +1767,10 @@
|
|||
this.calendarView.getAttribute("context");
|
||||
itemBox.setAttribute("context", ctxt);
|
||||
|
||||
if (aItem.hashId in this.calendarView.mFlashingEvents) {
|
||||
itemBox.setAttribute("flashing", "true");
|
||||
}
|
||||
|
||||
this.mItemBoxes.push(itemBox);
|
||||
]]></body>
|
||||
</method>
|
||||
|
@ -1853,6 +1875,14 @@
|
|||
whichside="end"
|
||||
xbl:inherits="parentorient=orient"/>
|
||||
</xul:box>
|
||||
<xul:hbox pack="end">
|
||||
<xul:vbox pack="start">
|
||||
<xul:image anonid="alarm-image"
|
||||
class="alarm-image"
|
||||
xbl:inherits="flashing"
|
||||
hidden="true"/>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</xul:stack>
|
||||
</xul:box>
|
||||
</xul:box>
|
||||
|
@ -2158,6 +2188,10 @@
|
|||
childbox, "class", "box-inherit scrollbox-innerbox").flex = "1";
|
||||
|
||||
this.reorient();
|
||||
|
||||
var alarmService = Components.classes['@mozilla.org/calendar/alarm-service;1']
|
||||
.getService(Components.interfaces.calIAlarmService);
|
||||
alarmService.addObserver(this.mObserver);
|
||||
]]></constructor>
|
||||
|
||||
<destructor><![CDATA[
|
||||
|
@ -2166,6 +2200,10 @@
|
|||
}
|
||||
window.removeEventListener("scroll", this.mScrollHandler, true);
|
||||
window.removeEventListener("resize", this.mResizeHandler, true);
|
||||
|
||||
var alarmService = Components.classes['@mozilla.org/calendar/alarm-service;1']
|
||||
.getService(Components.interfaces.calIAlarmService);
|
||||
alarmService.removeObserver(this.mObserver);
|
||||
]]></destructor>
|
||||
|
||||
<property name="daysInView" readonly="true">
|
||||
|
@ -2248,12 +2286,14 @@
|
|||
<field name="mDisplayDaysOff">true</field>
|
||||
<field name="mDaysOffArray">[0,6]</field>
|
||||
<field name="mTimezone">"UTC"</field>
|
||||
<field name="mFlashingEvents">new Object()</field>
|
||||
|
||||
<field name="mObserver"><![CDATA[
|
||||
// the calIObserver, and calICompositeObserver
|
||||
// the calIObserver, calICompositeObserver, and calIAlarmServiceObserver
|
||||
({
|
||||
QueryInterface: function QueryInterface(aIID) {
|
||||
if (!aIID.equals(Components.interfaces.calIObserver) &&
|
||||
!aIID.equals(Ci.calIAlarmServiceObserver) &&
|
||||
!aIID.equals(Components.interfaces.calICompositeObserver) &&
|
||||
!aIID.equals(Components.interfaces.nsISupports)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
@ -2365,6 +2405,27 @@
|
|||
},
|
||||
onError: function onError(aErrNo, aMessage) { },
|
||||
|
||||
//
|
||||
// calIAlarmServiceObserver stuff
|
||||
//
|
||||
onAlarm: function onAlarm(aAlarmItem) {
|
||||
this.calView.flashAlarm(aAlarmItem, false);
|
||||
},
|
||||
|
||||
onRemoveAlarmsByItem: function onRemoveAlarmsByItem(aItem) {
|
||||
// Stop the flashing for the item.
|
||||
this.calView.flashAlarm(aItem, true);
|
||||
},
|
||||
|
||||
onRemoveAlarmsByCalendar: function onRemoveAlarmsByCalendar(aCalendar) {
|
||||
// Stop the flashing for all items of this calendar
|
||||
for each (var item in this.calView.mFlashingEvents) {
|
||||
if (item.calendar.id == aCalendar.id) {
|
||||
this.calView.flashAlarm(item, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
// calICompositeObserver stuff
|
||||
// XXXvv we can be smarter about how we handle this stuff
|
||||
|
@ -2420,6 +2481,52 @@
|
|||
})
|
||||
]]></field>
|
||||
|
||||
<method name="flashAlarm">
|
||||
<parameter name="aAlarmItem"/>
|
||||
<parameter name="aStop"/>
|
||||
<body><![CDATA[
|
||||
var showIndicator = getPrefSafe("calendar.alarms.indicator.show", true);
|
||||
var totaltime = getPrefSafe("calendar.alarms.indicator.totaltime", 3600);
|
||||
|
||||
if (!aStop && (!showIndicator || totaltime < 1)) {
|
||||
// No need to animate if the indicator should not be shown.
|
||||
return;
|
||||
}
|
||||
|
||||
// Helper function to save some duplicate code
|
||||
function setFlashingAttribute(aBox) {
|
||||
if (aStop) {
|
||||
aBox.removeAttribute("flashing");
|
||||
} else {
|
||||
aBox.setAttribute("flashing", "true");
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure the flashing attribute is set or reset on all visible
|
||||
// boxes.
|
||||
var columns = this.findColumnsForItem(aAlarmItem);
|
||||
for each (var col in columns) {
|
||||
var box = col.column.findChunkForOccurrence(aAlarmItem);
|
||||
if (box && box.eventbox) {
|
||||
setFlashingAttribute(box.eventbox);
|
||||
}
|
||||
box = col.header.findBoxForItem(aAlarmItem);
|
||||
if (box) {
|
||||
setFlashingAttribute(box);
|
||||
}
|
||||
}
|
||||
|
||||
if (!aStop) {
|
||||
// Set up a timer to stop the flashing after the total time.
|
||||
var this_ = this;
|
||||
this.mFlashingEvents[aAlarmItem.hashId] = aAlarmItem;
|
||||
setTimeout(function() { this_.flashAlarm(aAlarmItem, true) }, totaltime);
|
||||
} else {
|
||||
// We are done flashing, prevent newly created event boxes from flashing.
|
||||
delete this.mFlashingEvents[aAlarmItem.hashId];
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- calICalendarView -->
|
||||
<property name="supportsDisjointDates"
|
||||
|
@ -3102,18 +3209,21 @@
|
|||
]]></body>
|
||||
</method>
|
||||
|
||||
|
||||
<method name="findColumnsForItem">
|
||||
<parameter name="aItem"/>
|
||||
<body><![CDATA[
|
||||
var columns = new Array();
|
||||
|
||||
if (!this.mDateColumns) {
|
||||
return columns;
|
||||
}
|
||||
|
||||
var tz = this.mDateColumns[0].date.timezone;
|
||||
|
||||
// Note that these may be dates or datetimes
|
||||
var startDate = aItem.startDate || aItem.entryDate;
|
||||
var targetDate = startDate.getInTimezone(tz);
|
||||
var endDate = aItem.endDate || aItem.dueDate;
|
||||
var endDate = aItem.endDate || aItem.dueDate || startDate;
|
||||
var finishDate = endDate.getInTimezone(tz);
|
||||
|
||||
if (!targetDate.isDate) {
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
-
|
||||
- Contributor(s):
|
||||
- Michael Büttner <michael.buettner@sun.com>
|
||||
- Philipp Kewisch <mozilla@kewis.ch>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -68,6 +69,14 @@
|
|||
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"/>
|
||||
|
@ -108,6 +117,7 @@
|
|||
self.stopEditing(false);
|
||||
};
|
||||
]]></constructor>
|
||||
|
||||
<field name="mOccurrence">null</field>
|
||||
<field name="mSelected">false</field>
|
||||
<field name="mCalendarView">null</field>
|
||||
|
@ -137,11 +147,10 @@
|
|||
]]></setter>
|
||||
</property>
|
||||
|
||||
|
||||
<property name="occurrence">
|
||||
<getter><![CDATA[
|
||||
return this.mOccurrence;
|
||||
]]></getter>
|
||||
return this.mOccurrence;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.mOccurrence = val;
|
||||
this.setEditableLabel();
|
||||
|
@ -190,6 +199,11 @@
|
|||
}
|
||||
|
||||
container.setAttribute("item-category", categoriesSelectorList);
|
||||
|
||||
var alarmImage = document.getAnonymousElementByAttribute(this, "anonid", "alarm-image");
|
||||
if (item.alarmOffset && getPrefSafe("calendar.alarms.indicator.show", true)) {
|
||||
alarmImage.removeAttribute("hidden");
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
|
|
|
@ -74,6 +74,8 @@ calendar.jar:
|
|||
content/calendar/sun-calendar-event-dialog-attendees.js (/calendar/prototypes/wcap/sun-calendar-event-dialog-attendees.js)
|
||||
% skin calendar classic/1.0 %skin/classic/calendar/
|
||||
skin/classic/calendar/abcard.png (themes/common/abcard.png)
|
||||
skin/classic/calendar/alarm-flashing.png (themes/common/alarm-flashing.png)
|
||||
skin/classic/calendar/alarm.png (themes/common/alarm.png)
|
||||
#expand skin/classic/calendar/cal-icon32.png (themes/__THEME__/cal-icon32.png)
|
||||
#expand skin/classic/calendar/daypicker-background.png (/calendar/base/themes/common/daypicker-background.png)
|
||||
#expand skin/classic/calendar/calendar-toolbar.css (themes/__THEME__/calendar-toolbar.css)
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 2.7 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 514 B |
|
@ -454,3 +454,11 @@ calendar-event-box[orient="horizontal"]:hover .calendar-event-box-grippy-top {
|
|||
calendar-event-box[orient="horizontal"]:hover .calendar-event-box-grippy-bottom {
|
||||
list-style-image: url("chrome://calendar/skin/event-grippy-right.png");
|
||||
}
|
||||
|
||||
.alarm-image {
|
||||
list-style-image: url(chrome://calendar/skin/alarm.png);
|
||||
}
|
||||
|
||||
.alarm-image[flashing="true"] {
|
||||
list-style-image: url(chrome://calendar/skin/alarm-flashing.png);
|
||||
}
|
||||
|
|
|
@ -454,3 +454,11 @@ calendar-event-box[orient="horizontal"]:hover .calendar-event-box-grippy-top {
|
|||
calendar-event-box[orient="horizontal"]:hover .calendar-event-box-grippy-bottom {
|
||||
list-style-image: url("chrome://calendar/skin/event-grippy-right.png");
|
||||
}
|
||||
|
||||
.alarm-image {
|
||||
list-style-image: url(chrome://calendar/skin/alarm.png);
|
||||
}
|
||||
|
||||
.alarm-image[flashing="true"] {
|
||||
list-style-image: url(chrome://calendar/skin/alarm-flashing.png);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче