зеркало из https://github.com/mozilla/gecko-dev.git
Bug 243793 Add 'Edit Task' option to tasklist context menu r=mvl npotb
This commit is contained in:
Родитель
b831e6d9a3
Коммит
a7e445b38f
|
@ -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"/>
|
||||
|
|
Загрузка…
Ссылка в новой задаче