From 4a173cbe16853cf0f27e9a5706a3018b12f4687c Mon Sep 17 00:00:00 2001 From: "shaver%mozilla.org" Date: Thu, 7 Jul 2005 15:28:57 +0000 Subject: [PATCH] Wire up edit, delete, and new-todo from the todo list. Try to make the todo labels aligned correctly, still somewhat failing. --- .../lightning/content/calendar-todo-list.css | 5 ++-- .../lightning/content/calendar-todo-list.xml | 2 +- calendar/lightning/content/todo-list.js | 24 ++++++++++++++----- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/calendar/lightning/content/calendar-todo-list.css b/calendar/lightning/content/calendar-todo-list.css index 15d26470540..9a99707799b 100644 --- a/calendar/lightning/content/calendar-todo-list.css +++ b/calendar/lightning/content/calendar-todo-list.css @@ -6,6 +6,7 @@ calendar-todo-item { -moz-binding: url("calendar-todo-list.xml#calendar-todo-item"); } -.calendar-todo-item-label { - -moz-box-align: inherit; +.calendar-todo-item-label, .calendar-todo-item-checkbox { + -moz-box-align: center; + margin: 0px; } diff --git a/calendar/lightning/content/calendar-todo-list.xml b/calendar/lightning/content/calendar-todo-list.xml index 9a3aa4eeca4..2727eced9f6 100644 --- a/calendar/lightning/content/calendar-todo-list.xml +++ b/calendar/lightning/content/calendar-todo-list.xml @@ -154,7 +154,7 @@ - + diff --git a/calendar/lightning/content/todo-list.js b/calendar/lightning/content/todo-list.js index 54f373e7e48..f46a0eab7c7 100644 --- a/calendar/lightning/content/todo-list.js +++ b/calendar/lightning/content/todo-list.js @@ -7,20 +7,32 @@ function eventToTodo(event) } } -function handleTodoListEvent(event) +function editTodoItem(event) { var todo = eventToTodo(event); - var name = todo ? ('"' + todo.title + '"') : ""; - dump("Todo list event: " + event.type + " (" + name + ")\n"); + if (todo) + modifyEventWithDialog(todo); +} + +function newTodoItem(event) +{ + createTodoWithDialog(); +} + +function deleteTodoItem(event) +{ + var todo = eventToTodo(event); + if (todo) + todo.calendar.deleteItem(todo, null); } function initializeTodoList() { var todoList = document.getElementById("calendar-todo-list"); todoList.calendar = getCompositeCalendar(); - todoList.addEventListener("todo-item-open", handleTodoListEvent, false); - todoList.addEventListener("todo-item-delete", handleTodoListEvent, false); - todoList.addEventListener("todo-empty-dblclick", handleTodoListEvent, false); + todoList.addEventListener("todo-item-open", editTodoItem, false); + todoList.addEventListener("todo-item-delete", deleteTodoItem, false); + todoList.addEventListener("todo-empty-dblclick", newTodoItem, false); } window.addEventListener("load", initializeTodoList, false);