From 56e295998fe764ff5ba3003da07c59de63cde3de Mon Sep 17 00:00:00 2001 From: "Berend.Cornelius%sun.com" Date: Wed, 23 Jan 2008 10:02:56 +0000 Subject: [PATCH] Bug 412948-Tasks cannot be deleted;r=mickey git-svn-id: svn://10.0.0.236/trunk@243813 18797224-902f-48f8-a5cc-f745e15eee43 --- .../base/content/calendar-common-sets.js | 155 +++++++++--------- .../base/content/calendar-common-sets.xul | 4 +- .../base/content/calendar-task-tree.js | 36 ++-- .../content/messenger-overlay-sidebar.xul | 14 ++ 4 files changed, 112 insertions(+), 97 deletions(-) diff --git a/mozilla/calendar/base/content/calendar-common-sets.js b/mozilla/calendar/base/content/calendar-common-sets.js index ce16c2d58fb..02da2390932 100644 --- a/mozilla/calendar/base/content/calendar-common-sets.js +++ b/mozilla/calendar/base/content/calendar-common-sets.js @@ -94,13 +94,6 @@ var calendarController = { }, isCommandEnabled: function cC_isCommandEnabled(aCommand) { - if (this.defaultController && !this.isCalendarInForeground()) { - // If calendar is not in foreground, let the default controller take - // care. If we don't have a default controller (i.e sunbird), just - // continue. - return this.defaultController.isCommandEnabled(aCommand); - } - switch (aCommand) { case "calendar_new_event_command": return this.writable && this.calendars_support_events; @@ -108,7 +101,6 @@ var calendarController = { return this.item_selected; case "calendar_delete_event_command": return this.selected_items_writable; - case "calendar_new_todo_command": return this.writable && this.calendars_support_tasks; case "calendar_modify_todo_command": @@ -117,7 +109,6 @@ var calendarController = { return this.writable && this.todo_items_selected && this.todo_items_writable; - case "calendar_delete_calendar_command": return !this.last_calendar; @@ -131,43 +122,43 @@ var calendarController = { case "calendar_reload_remote_calendar": return !this.no_network_calendars && !this.offline - - // Thunderbird Commands - case "cmd_cut": - return this.selected_items_writable; - case "cmd_copy": - return this.item_selected; - case "cmd_paste": - return this.writable && canPaste(); - case "cmd_undo": - goSetMenuValue(aCommand, 'valueDefault'); - return canUndo(); - case "cmd_redo": - goSetMenuValue(aCommand, 'valueDefault'); - return canRedo(); - case "cmd_printpreview": - return false; - case "button_delete": - case "cmd_delete": - return this.item_selected; - } - - if (aCommand in this.commands) { - // All other commands we support should be enabled by default - return true; + default: + if (aCommand in this.commands) { + // All other commands we support should be enabled by default + return true; + } + if (this.defaultController && !this.isCalendarInForeground()) { + // If calendar is not in foreground, let the default controller take + // care. If we don't have a default controller (i.e sunbird), just + // continue. + return this.defaultController.isCommandEnabled(aCommand); + } + switch (aCommand) { + // Thunderbird Commands + case "cmd_cut": + return this.selected_items_writable; + case "cmd_copy": + return this.item_selected; + case "cmd_paste": + return this.writable && canPaste(); + case "cmd_undo": + goSetMenuValue(aCommand, 'valueDefault'); + return canUndo(); + case "cmd_redo": + goSetMenuValue(aCommand, 'valueDefault'); + return canRedo(); + case "cmd_printpreview": + return false; + case "button_delete": + case "cmd_delete": + return this.item_selected; + } } return false; + }, doCommand: function cC_doCommand(aCommand) { - if (this.defaultController && !this.isCalendarInForeground()) { - // If calendar is not in foreground, let the default controller take - // care. If we don't have a default controller (i.e sunbird), just - // continue. - this.defaultController.doCommand(aCommand); - return; - } - switch (aCommand) { // Common Commands case "calendar_new_event_command": @@ -226,45 +217,55 @@ var calendarController = { case "calendar_reload_remote_calendars": getCompositeCalendar().refresh(); break; - - // These commands are overridden in lightning and native in sunbird. - case "cmd_cut": - cutToClipboard(); - break; - case "cmd_copy": - copyToClipboard(); - break; - case "cmd_paste": - pasteFromClipboard(); - break; - case "cmd_undo": - if (canUndo()) { - getTransactionMgr().undo(); + default: + if (this.defaultController && !this.isCalendarInForeground()) { + // If calendar is not in foreground, let the default controller take + // care. If we don't have a default controller (i.e sunbird), just + // continue. + return this.defaultController.doCommand(aCommand); } - break; - case "cmd_redo": - if (canRedo()) { - getTransactionMgr().redo(); - } - break; - case "cmd_selectAll": - selectAllEvents(); - break; - case "cmd_pageSetup": - PrintUtils.showPageSetup(); - break; - case "button_print": - case "cmd_print": - calPrint(); - break; + switch (aCommand) { + // These commands are overridden in lightning and native in sunbird. + case "cmd_cut": + cutToClipboard(); + break; + case "cmd_copy": + copyToClipboard(); + break; + case "cmd_paste": + pasteFromClipboard(); + break; + case "cmd_undo": + if (canUndo()) { + getTransactionMgr().undo(); + } + break; + case "cmd_redo": + if (canRedo()) { + getTransactionMgr().redo(); + } + break; + case "cmd_selectAll": + selectAllEvents(); + break; + case "cmd_pageSetup": + PrintUtils.showPageSetup(); + break; + case "button_print": + case "cmd_print": + calPrint(); + break; - // Thunderbird commands - case "cmd_printpreview": - case "button_delete": - case "cmd_delete": - // For these commands, nothing should happen in calendar mode. - return; + // Thunderbird commands + // For these commands, nothing should happen in calendar mode. + case "cmd_printpreview": + case "button_delete": + case "cmd_delete": + default: + return; + } } + return; }, onEvent: function cC_onEvent(aEvent) { diff --git a/mozilla/calendar/base/content/calendar-common-sets.xul b/mozilla/calendar/base/content/calendar-common-sets.xul index c65c8bb2206..1e58d2eb840 100755 --- a/mozilla/calendar/base/content/calendar-common-sets.xul +++ b/mozilla/calendar/base/content/calendar-common-sets.xul @@ -125,11 +125,11 @@ observes="calendar_delete_todo_command"/> + observes="calendar_iscompleted_command" + command="calendar_iscompleted_command"/> diff --git a/mozilla/calendar/base/content/calendar-task-tree.js b/mozilla/calendar/base/content/calendar-task-tree.js index 166b14d920c..0456020cb39 100644 --- a/mozilla/calendar/base/content/calendar-task-tree.js +++ b/mozilla/calendar/base/content/calendar-task-tree.js @@ -123,23 +123,23 @@ function contextChangeProgress(aProgress) { var taskTree = getFocusedTaskTree(); var tasks = taskTree.selectedTasks; for (var t = 0; t < tasks.length; t++) { - var task = tasks[t]; - var newTask = task.clone().QueryInterface( Components.interfaces.calITodo ); - newTask.percentComplete = aProgress; - switch (aProgress) { - case 0: - newTask.isCompleted = false; - break; - case 100: - newTask.isCompleted = true; - break; - default: - newTask.status = "IN-PROCESS"; - newTask.completedDate = null; - break; - } - doTransaction('modify', newTask, newTask.calendar, task, null); + var task = tasks[t]; + var newTask = task.clone().QueryInterface( Components.interfaces.calITodo ); + newTask.percentComplete = aProgress; + switch (aProgress) { + case 0: + newTask.isCompleted = false; + break; + case 100: + newTask.isCompleted = true; + break; + default: + newTask.status = "IN-PROCESS"; + newTask.completedDate = null; + break; } + doTransaction('modify', newTask, newTask.calendar, task, null); + } endBatchTransaction(); } @@ -214,8 +214,8 @@ function tasksToEvents() { function toggleCompleted(aEvent) { if (aEvent.target.getAttribute("checked") == "true") { - contextChangeProgress(100); - } else { contextChangeProgress(0); + } else { + contextChangeProgress(100); } } diff --git a/mozilla/calendar/lightning/content/messenger-overlay-sidebar.xul b/mozilla/calendar/lightning/content/messenger-overlay-sidebar.xul index 5c759b18e7c..032bc9c5688 100644 --- a/mozilla/calendar/lightning/content/messenger-overlay-sidebar.xul +++ b/mozilla/calendar/lightning/content/messenger-overlay-sidebar.xul @@ -98,17 +98,20 @@ mode="calendar" label="&calendar.export.selection.label;" accesskey="&calendar.export.selection.accesskey;" + command="calendar_export_selection_command" observes="calendar_export_selection_command" insertafter="menu_close"/> @@ -121,11 +124,13 @@ @@ -133,6 +138,7 @@ mode="mail" insertbefore="newAccountMenuItem"/> @@ -161,6 +167,7 @@ label="&calendar.orientation.label;" accesskey="&calendar.orientation.accesskey;" mode="calendar" + command="calendar_toggle_orientation_command" observes="calendar_toggle_orientation_command"/>