mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 293201 Activate the agenda filter r=dmose
This commit is contained in:
parent
1a64476844
commit
0bb57fc1dd
@ -231,6 +231,24 @@ calTodo.prototype = {
|
|||||||
isPropertyPromoted: function (name) {
|
isPropertyPromoted: function (name) {
|
||||||
return (this.todoPromotedProps[name]);
|
return (this.todoPromotedProps[name]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getOccurrencesBetween: function(aStartDate, aEndDate, aCount) {
|
||||||
|
if (this.recurrenceInfo) {
|
||||||
|
return this.recurrenceInfo.getOccurrences(aStartDate, aEndDate, 0, aCount);
|
||||||
|
}
|
||||||
|
if (!this.entryDate && !this.dueDate)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if ((this.entryDate && this.entryDate.compare(aStartDate) >= 0 && this.entryDate.compare(aEndDate) <= 0) ||
|
||||||
|
(this.dueDate && this.dueDate.compare(aStartDate) >= 0 && this.dueDate.compare(aEndDate) <= 0))
|
||||||
|
{
|
||||||
|
aCount.value = 1;
|
||||||
|
return ([ this ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
aCount.value = 0;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// var decl to prevent spurious error messages when loaded as component
|
// var decl to prevent spurious error messages when loaded as component
|
||||||
|
@ -10,11 +10,11 @@
|
|||||||
<hbox>
|
<hbox>
|
||||||
<spacer flex="1"/>
|
<spacer flex="1"/>
|
||||||
<label value="View:"/>
|
<label value="View:"/>
|
||||||
<menulist label="View" oncommand="updateAgendaView(this);">
|
<menulist label="View" oncommand="agendaTreeView.updateFilter(this);">
|
||||||
<menupopup>
|
<menupopup>
|
||||||
<menuitem label="All"/>
|
<menuitem label="All" value="all"/>
|
||||||
<menuitem label="Events"/>
|
<menuitem label="Events" value="events"/>
|
||||||
<menuitem label="Tasks"/>
|
<menuitem label="Tasks" value="tasks"/>
|
||||||
<!-- menuitem label="Reminders"/ -->
|
<!-- menuitem label="Reminders"/ -->
|
||||||
<menuseparator id="calendar-list-start"/>
|
<menuseparator id="calendar-list-start"/>
|
||||||
<!--menuseparator id="calendar-list-end"/>
|
<!--menuseparator id="calendar-list-end"/>
|
||||||
@ -34,4 +34,4 @@
|
|||||||
<label value="Customize yer views!"/>
|
<label value="Customize yer views!"/>
|
||||||
</deck>
|
</deck>
|
||||||
</vbox>
|
</vbox>
|
||||||
</overlay>
|
</overlay>
|
||||||
|
@ -148,7 +148,7 @@ function getCellText(row, column)
|
|||||||
|
|
||||||
if (event instanceof Synthetic)
|
if (event instanceof Synthetic)
|
||||||
return "";
|
return "";
|
||||||
var start = event.startDate || event.entryDate;
|
var start = event.startDate || event.dueDate;
|
||||||
return start.toString();
|
return start.toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -224,7 +224,9 @@ function hasNextSibling(row, afterIndex)
|
|||||||
agendaTreeView.findPeriodForItem =
|
agendaTreeView.findPeriodForItem =
|
||||||
function findPeriodForItem(item)
|
function findPeriodForItem(item)
|
||||||
{
|
{
|
||||||
var start = item.startDate || item.entryDate;
|
var start = item.startDate || item.dueDate;
|
||||||
|
if (!start)
|
||||||
|
return null;
|
||||||
if (start.compare(this.today.end) <= 0)
|
if (start.compare(this.today.end) <= 0)
|
||||||
return this.today;
|
return this.today;
|
||||||
|
|
||||||
@ -279,8 +281,8 @@ function calendarUpdateComplete()
|
|||||||
{
|
{
|
||||||
[this.today, this.tomorrow, this.soon].forEach(function(when) {
|
[this.today, this.tomorrow, this.soon].forEach(function(when) {
|
||||||
function compare(a, b) {
|
function compare(a, b) {
|
||||||
var ad = a.startDate || a.entryDate;
|
var ad = a.startDate || a.dueDate;
|
||||||
var bd = b.startDate || b.entryDate;
|
var bd = b.startDate || b.dueDate;
|
||||||
return ad.compare(bd);
|
return ad.compare(bd);
|
||||||
}
|
}
|
||||||
when.events.sort(compare);
|
when.events.sort(compare);
|
||||||
@ -312,9 +314,22 @@ function listener_onGetResult(calendar, status, itemtype, detail, count, items)
|
|||||||
agendaTreeView.refreshCalendarQuery =
|
agendaTreeView.refreshCalendarQuery =
|
||||||
function refreshCalendarQuery()
|
function refreshCalendarQuery()
|
||||||
{
|
{
|
||||||
var filter = this.calendar.ITEM_FILTER_TYPE_EVENT |
|
var filter = this.calendar.ITEM_FILTER_COMPLETED_ALL |
|
||||||
this.calendar.ITEM_FILTER_COMPLETED_ALL |
|
|
||||||
this.calendar.ITEM_FILTER_CLASS_OCCURRENCES;
|
this.calendar.ITEM_FILTER_CLASS_OCCURRENCES;
|
||||||
|
if (!this.filterType)
|
||||||
|
this.filterType = 'all';
|
||||||
|
switch (this.filterType) {
|
||||||
|
case 'all':
|
||||||
|
filter |= this.calendar.ITEM_FILTER_TYPE_EVENT |
|
||||||
|
this.calendar.ITEM_FILTER_TYPE_TODO;
|
||||||
|
break;
|
||||||
|
case 'events':
|
||||||
|
filter |= this.calendar.ITEM_FILTER_TYPE_EVENT;
|
||||||
|
break;
|
||||||
|
case 'tasks':
|
||||||
|
filter |= this.calendar.ITEM_FILTER_TYPE_TODO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
this.periods.forEach(function (p) { p.events = []; });
|
this.periods.forEach(function (p) { p.events = []; });
|
||||||
this.calendar.getItems(filter, 0, this.today.start, this.soon.end,
|
this.calendar.getItems(filter, 0, this.today.start, this.soon.end,
|
||||||
@ -322,6 +337,13 @@ function refreshCalendarQuery()
|
|||||||
void("Calendar query started (" + this.today.start + " -> " + this.soon.end + ")\n");
|
void("Calendar query started (" + this.today.start + " -> " + this.soon.end + ")\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
agendaTreeView.updateFilter =
|
||||||
|
function updateAgendaFilter(menulist) {
|
||||||
|
this.filterType = menulist.selectedItem.value;
|
||||||
|
this.refreshCalendarQuery();
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
agendaTreeView.refreshPeriodDates =
|
agendaTreeView.refreshPeriodDates =
|
||||||
function refreshPeriodDates()
|
function refreshPeriodDates()
|
||||||
{
|
{
|
||||||
@ -367,9 +389,6 @@ agendaTreeView.calendarObserver.onLoad = function() {};
|
|||||||
agendaTreeView.calendarObserver.onAddItem =
|
agendaTreeView.calendarObserver.onAddItem =
|
||||||
function observer_onAddItem(item)
|
function observer_onAddItem(item)
|
||||||
{
|
{
|
||||||
if (!(item instanceof Components.interfaces.calIEvent))
|
|
||||||
return;
|
|
||||||
|
|
||||||
var occs = item.getOccurrencesBetween(this.agendaTreeView.today.start,
|
var occs = item.getOccurrencesBetween(this.agendaTreeView.today.start,
|
||||||
this.agendaTreeView.soon.end, {});
|
this.agendaTreeView.soon.end, {});
|
||||||
occs.forEach(this.agendaTreeView.addItem, this.agendaTreeView);
|
occs.forEach(this.agendaTreeView.addItem, this.agendaTreeView);
|
||||||
|
Loading…
Reference in New Issue
Block a user