From cbf0bc7fd200e97e331f3f242c222c233d1764aa Mon Sep 17 00:00:00 2001 From: "jminta%gmail.com" Date: Wed, 23 Nov 2005 03:59:29 +0000 Subject: [PATCH] Bug 309426 Double clicking on agenda/calendar items should open edit-dialogs. r=dmose --- .../lightning/content/agenda-tree-overlay.xul | 3 +- calendar/lightning/content/agenda-tree.js | 32 +++++++++++++++++++ .../lightning/content/calendar-management.js | 20 +++++++++++- .../content/messenger-overlay-sidebar.xul | 6 +++- 4 files changed, 58 insertions(+), 3 deletions(-) diff --git a/calendar/lightning/content/agenda-tree-overlay.xul b/calendar/lightning/content/agenda-tree-overlay.xul index a36b1e2da1f4..da9978c41bf9 100644 --- a/calendar/lightning/content/agenda-tree-overlay.xul +++ b/calendar/lightning/content/agenda-tree-overlay.xul @@ -62,7 +62,8 @@ - + diff --git a/calendar/lightning/content/agenda-tree.js b/calendar/lightning/content/agenda-tree.js index a42203ccc765..7be6daf17fad 100644 --- a/calendar/lightning/content/agenda-tree.js +++ b/calendar/lightning/content/agenda-tree.js @@ -253,6 +253,38 @@ function addItem(item) this.calendarUpdateComplete(); }; +agendaTreeView.onDoubleClick = +function agendaDoubleClick(event) +{ + // We only care about left-clicks + if (event.button != 0) + return; + + // Find the row clicked on, and the corresponding event + var tree = document.getElementById("agenda-tree"); + var row = tree.treeBoxObject.getRowAt(event.clientX, event.clientY); + var calendar = ltnSelectedCalendar(); + var calEvent = this.events[row]; + + if (!calEvent) { // Clicked in empty space, just create a new event + createEventWithDialog(calendar, today(), today()); + return; + } + if (!this.isContainer(row)) { // Clicked on a task/event, edit it + modifyEventWithDialog(calEvent); + } else { // Clicked on a container, create an event that day + if (calEvent == this.today) { + createEventWithDialog(calendar, today(), today()); + } else { + var tom = today().clone(); + var offset = (calEvent == this.tomorrow) ? 1 : 2; + tom.day += offset; + tom.normalize() + createEventWithDialog(calendar, tom, tom); + } + } +} + agendaTreeView.deleteItem = function deleteItem(item) { diff --git a/calendar/lightning/content/calendar-management.js b/calendar/lightning/content/calendar-management.js index d53d46dbc2c9..2a5d82c550da 100644 --- a/calendar/lightning/content/calendar-management.js +++ b/calendar/lightning/content/calendar-management.js @@ -340,7 +340,25 @@ var ltnCalendarTreeView = { getImageSrc: function(row, col) { return null; }, getRowProperties: function(row, props) { }, getColumnProperties: function(colid, col, props) { }, - cycleHeader: function() { } + cycleHeader: function() { }, + onDoubleClick: function(event) + { + // We only care about left-clicks + if (event.button != 0) + return; + + // Find the row clicked on + var tree = document.getElementById("agenda-tree"); + var row = tree.treeBoxObject.getRowAt(event.clientX, event.clientY); + + // If we clicked on a calendar, edit it, otherwise create a new one + var cal = getCalendars()[row]; + if (!cal) { + ltnNewCalendar(); + } else { + ltnEditCalendarProperties(cal); + } + } }; function ltnSetTreeView() diff --git a/calendar/lightning/content/messenger-overlay-sidebar.xul b/calendar/lightning/content/messenger-overlay-sidebar.xul index c918a6076969..0636b3c65e36 100644 --- a/calendar/lightning/content/messenger-overlay-sidebar.xul +++ b/calendar/lightning/content/messenger-overlay-sidebar.xul @@ -125,7 +125,11 @@