Some random todo hacking I want to get out of my tree, so vlad can help me

debug. r=2:52am.
This commit is contained in:
shaver%mozilla.org 2005-07-06 06:52:48 +00:00
parent 751a91d6f6
commit 711c1ef9fa
5 changed files with 88 additions and 7 deletions

View File

@ -1,3 +1,7 @@
calendar-todo-item {
-moz-binding: url("calendar-todo-list.xml#calendar-todo-item");
}
.calendar-todo-item-label {
-moz-box-align: inherit;
}

View File

@ -7,8 +7,8 @@
<binding id="calendar-todo-item" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
<content>
<xul:hbox flex="1">
<xul:checkbox anonid="todo-check" xbl:inherits="checked=completed" oncommand="document.getBindingParent(this).updateTodoFromDisplay();"/>
<xul:label anonid="todo-label" crop="end" xbl:inherits="item-calendar,value=label"/>
<xul:checkbox class="calendar-todo-item-checkbox" anonid="todo-check" xbl:inherits="checked=completed" oncommand="document.getBindingParent(this).updateTodoFromDisplay();"/>
<xul:label class="calendar-todo-item-label" anonid="todo-label" crop="end" xbl:inherits="item-calendar,value=label"/>
</xul:hbox>
</content>
<implementation>
@ -90,7 +90,29 @@
this.updateDisplayFromTodo();
]]></body>
</method>
</implementation>
<handlers>
<handler event="dblclick"><![CDATA[
this.fireEvent("item-open");
]]>
</handler>
<handler event="keypress"><![CDATA[
dump("handling keypress " + event.keyCode + "\n");
const kKE = Components.interfaces.nsIDOMKeyEvent;
if (event.keyCode == 13) {
this.fireEvent("item-open");
} else if (event.keyCode == kKE.DOM_VK_BACK_SPACE ||
event.keyCode == kKE.DOM_VK_DELETE) {
this.fireEvent("item-delete");
} else if (event.keyCode == kKE.DOM_VK_SPACE) {
this.checkbox.checked = !this.checkbox.checked;
this.updateTodoFromDisplay();
}
]]>
</handler>
</handlers>
</binding>
</bindings>

View File

@ -142,7 +142,8 @@ function selectedCalendarPane(event)
// give the view the calendar, but make sure that everything
// has uncollapsed first before we try to relayout!
setTimeout(0, function() { showCalendar(today()); });
showCalendar(today());
//setTimeout(function() { showCalendar(today()); }, 0);
}
function LtnObserveDisplayDeckChange(event)

View File

@ -12,6 +12,15 @@ function initialize()
this.populateTodoList();
};
todoListManager.rebuildList =
function rebuildList()
{
while (this.mOuterBox.firstChild)
this.mOuterBox.removeChild(this.mOuterBox.firstChild);
this.populateTodoList();
};
todoListManager.addTodo =
function addTodo(newTodo)
{
@ -48,6 +57,44 @@ todoListManager.calendarObserver =
{
};
todoListManager.calendarObserver.QueryInterface =
function QueryInterface(aIID)
{
if (!aIID.equals(Components.interfaces.calIObserver) &&
!aIID.equals(Components.interfaces.calICompositeObserver) &&
!aIID.equals(Components.interfaces.nsISupports)) {
throw Components.results.NS_ERROR_NO_INTERFACE;
}
return this;
};
todoListManager.calendarObserver.onCalendarAdded =
todoListManager.calendarObserver.onCalendarRemoved =
function observer_onCalendarAddedOrRemoved(calendar)
{
todoListManager.rebuildList();
};
todoListManager.calendarObserver.onModifyItem =
function observer_onModifyItem(item)
{
if (!(item instanceof Components.interfaces.calITodo))
return;
todoListManager.rebuildList();
};
todoListManager.calendarObserver.onDeleteItem =
function observer_onDeleteItem(item)
{
if (!(item instanceof Components.interfaces.calITodo))
return;
todoListManager.rebuildList();
};
todoListManager.calendarObserver.onAddItem =
function observer_onAddItem(item)
{

View File

@ -1,10 +1,17 @@
/* Skin-domain style rules for lightning UI (pinstripe version) */
#calendarTree {
background: #cccccc;
calendar-todo-item {
-moz-box-align: center;
margin-top: 0;
margin-bottom: 0;
}
treechildren::-moz-tree-cell(checked) {
calendar-todo-item[selected="true"] {
background-color: Highlight;
color: HighlightText;
}
#calendarTree > treechildren::-moz-tree-cell(checked) {
background: #ff0000;
list-style-image: url("chrome://calendar/skin/dot.png");
}