diff --git a/calendar/resources/content/calendar.xul b/calendar/resources/content/calendar.xul
index 6e5d1ce85f0..ed86a21a25a 100644
--- a/calendar/resources/content/calendar.xul
+++ b/calendar/resources/content/calendar.xul
@@ -334,9 +334,10 @@
-
+
diff --git a/calendar/resources/content/unifinderToDo.js b/calendar/resources/content/unifinderToDo.js
index e6b01c85265..86ac1adfa84 100644
--- a/calendar/resources/content/unifinderToDo.js
+++ b/calendar/resources/content/unifinderToDo.js
@@ -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");
diff --git a/calendar/sunbird/base/content/calendar.xul b/calendar/sunbird/base/content/calendar.xul
index 9abc14145be..155b8865414 100644
--- a/calendar/sunbird/base/content/calendar.xul
+++ b/calendar/sunbird/base/content/calendar.xul
@@ -171,9 +171,10 @@
-
+