Bug 412948-Tasks cannot be deleted;r=mickey

git-svn-id: svn://10.0.0.236/trunk@243813 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
Berend.Cornelius%sun.com
2008-01-23 10:02:56 +00:00
parent 508d6043dd
commit 56e295998f
4 changed files with 112 additions and 97 deletions

View File

@@ -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) {

View File

@@ -125,11 +125,11 @@
observes="calendar_delete_todo_command"/>
<menuseparator/>
<menuitem type="checkbox"
validate="always"
label="&calendar.context.markcompleted.label;"
accesskey="&calendar.context.markcompleted.accesskey;"
id="calendar.context.markcompleted"
observes="calendar_iscompleted_command"/>
observes="calendar_iscompleted_command"
command="calendar_iscompleted_command"/>
<menu label="&calendar.context.progress.label;"
accesskey="&calendar.context.progress.accesskey;"
id="task-context-menu-progress">

View File

@@ -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);
}
}

View File

@@ -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"/>
<menuitem id="calendar-export-menu"
mode="calendar"
label="&calendar.export.calendar;"
accesskey="&calendar.export.calendar.accesskey;"
command="calendar_export_command"
observes="calendar_export_command"
insertafter="menu_close"/>
<menuitem id="calendar-import-menu"
label="&calendar.importcalendar.label;"
accesskey="&calendar.import.accesskey;"
command="calendar_import_command"
observes="calendar_import_command"
mode="calendar"
insertafter="menu_close"/>
@@ -121,11 +124,13 @@
<menuitem id="ltnNewEvent" label="&lightning.menupopup.new.event.label;"
accesskey="&event.new.event.accesskey;"
key="newEventKey"
command="calendar_new_event_command"
observes="calendar_new_event_command"
position="2"/>
<menuitem id="ltnNewTask" label="&lightning.menupopup.new.task.label;"
accesskey="&event.new.todo.accesskey;"
key="newTaskKey"
command="calendar_new_todo_command"
observes="calendar_new_todo_command"
position="3"/>
<menuseparator id="afterltnNewTask" position="4"/>
@@ -133,6 +138,7 @@
mode="mail"
insertbefore="newAccountMenuItem"/>
<menuitem id="ltnNewCalendar" label="&lightning.menupopup.new.calendar.label;"
command="calendar_new_calendar_command"
observes="calendar_new_calendar_command"
accesskey="&calendar.new.server.accesskey;"
insertafter="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"/>
<menuitem id="tasks-view-filter-all"
disabled="true"
@@ -259,6 +266,7 @@
label="&calendar.toolbar.label;"
accesskey="&calendar.toolbar.accesskey;"
mode="calendar"
command="cmd_toggleCalendarToolbar"
observes="cmd_toggleCalendarToolbar"
position="1"/>
<menuitem id="ltnModeToolbar"
@@ -386,30 +394,36 @@
accesskey="&event.new.event.accesskey;"
key="newEventKey"
observes="calendar_new_event_command"
command="calendar_new_event_command"
position="2"/>
<menuitem id="ltnNewTask2" label="&event.new.todo;"
accesskey="&event.new.todo.accesskey;"
key="newTaskKey"
observes="calendar_new_todo_command"
command="calendar_new_todo_command"
position="3"/>
<menuseparator id="firstCalendarSeparator" mode="calendar"/>
<menuitem id="publishCalendar"
label="&calendar.publish.label;"
accesskey="&calendar.publish.accesskey;"
commmand="calendar_publish_calendar_command"
observes="calendar_publish_calendar_command"/>
<menuseparator id="afterSubscription"/>
<menuitem label="&calendar.context.newserver.label;"
id="calpopup-new"
accesskey="&calendar.context.newserver.accesskey;"
command="calendar_new_calendar_command"
observes="calendar_new_calendar_command"/>
<menuitem id="ltnDeleteSelectedCalendar"
label="&calendar.context.deleteserver.label;"
accesskey="&calendar.context.deleteserver.accesskey;"
command="calendar_delete_calendar_command"
observes="calendar_delete_calendar_command"/>
<menuseparator id="beforeProperties"/>
<menuitem label="&calendar.properties.label;"
id="calendarproperties"
accesskey="&calendar.properties.accesskey;"
command="calendar_edit_calendar_command"
observes="calendar_edit_calendar_command"/>
</menupopup>
<menu id="ltnCalendarMenu" label="&lightning.calendar.label;"