Bug 243793 Add 'Edit Task' option to tasklist context menu r=mvl npotb

This commit is contained in:
jminta%gmail.com 2005-08-15 12:57:50 +00:00
Родитель 55b7fe30db
Коммит 54becbe24d
3 изменённых файлов: 33 добавлений и 6 удалений

Просмотреть файл

@ -334,9 +334,10 @@
<menuitem label="&calendar.context.newtodo.label;"
accesskey="&calendar.context.newtodo.accesskey;"
observes="new_todo_command"/>
<!--
Currently no way to get the item that we clicked on originally
<menuitem label="&calendar.context.modifytask.label;" accesskey="&calendar.context.modifytask.accesskey;" observes="modify_todo_command"/>-->
<menuitem id="task-context-menu-modify"
label="&calendar.context.modifytask.label;"
accesskey="&calendar.context.modifytask.accesskey;"
oncommand="modifyTaskFromContext()"/>
<menuitem label="&calendar.context.deletetask.label;"
accesskey="&calendar.context.deletetask.accesskey;"
observes="delete_todo_command"/>

Просмотреть файл

@ -513,6 +513,7 @@ function dateToMilliseconds(oeICalDateTime) {
function calendarTaskView( taskArray )
{
this.contextTask = null;
this.taskArray = taskArray;
}
@ -614,12 +615,36 @@ function contextChangePriority( event, Priority )
endBatchTransaction();
}
function modifyTaskFromContext() {
var task = document.getElementById( ToDoUnifinderTreeName ).taskView.contextTask;
if(task)
editToDo(task);
}
function changeContextMenuForToDo( event )
{
if (event.target.id != "taskitem-context-menu")
return;
var toDoItem = getToDoFromEvent( event );
// If only one task is selected, enable 'Edit Task'
var tree = document.getElementById( ToDoUnifinderTreeName );
var start = new Object();
var end = new Object();
var numRanges = tree.view.selection.getRangeCount();
tree.view.selection.getRangeAt(0, start, end);
if (numRanges == 1 && (start.value == end.value) && toDoItem) {
document.getElementById("task-context-menu-modify")
.removeAttribute("disabled");
tree.taskView.contextTask = toDoItem;
}
else {
document.getElementById("task-context-menu-modify")
.setAttribute("disabled", true);
tree.taskView.contextTask = null;
}
if( toDoItem )
{
document.getElementById("is_editable").removeAttribute("disabled");

Просмотреть файл

@ -171,9 +171,10 @@
<menuitem label="&calendar.context.newtodo.label;"
accesskey="&calendar.context.newtodo.accesskey;"
observes="new_todo_command"/>
<!--
Currently no way to get the item that we clicked on originally
<menuitem label="&calendar.context.modifytask.label;" accesskey="&calendar.context.modifytask.accesskey;" observes="modify_todo_command"/>-->
<menuitem id="task-context-menu-modify"
label="&calendar.context.modifytask.label;"
accesskey="&calendar.context.modifytask.accesskey;"
oncommand="modifyTaskFromContext()"/>
<menuitem label="&calendar.context.deletetask.label;"
accesskey="&calendar.context.deletetask.accesskey;"
observes="delete_todo_command"/>