Bug 309426 Double clicking on agenda/calendar items should open edit-dialogs. r=dmose

This commit is contained in:
jminta%gmail.com 2005-11-23 03:59:29 +00:00
Родитель bd9b2c493c
Коммит cbf0bc7fd2
4 изменённых файлов: 58 добавлений и 3 удалений

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

@ -62,7 +62,8 @@
<spacer/> <spacer/>
</hbox> </hbox>
<deck id="agenda-viewcustomize-deck" selectedIndex="0" flex="1"> <deck id="agenda-viewcustomize-deck" selectedIndex="0" flex="1">
<tree id="agenda-tree" hidecolumnpicker="true" flex="1"> <tree id="agenda-tree" hidecolumnpicker="true" flex="1"
ondblclick="agendaTreeView.onDoubleClick(event);">
<treecols> <treecols>
<treecol id="col-agenda-item" primary="true" label="&agenda.treeview.item.label;" flex="3"/> <treecol id="col-agenda-item" primary="true" label="&agenda.treeview.item.label;" flex="3"/>
<treecol id="col-agenda-when" label="" flex="1"/> <treecol id="col-agenda-when" label="" flex="1"/>

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

@ -253,6 +253,38 @@ function addItem(item)
this.calendarUpdateComplete(); 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 = agendaTreeView.deleteItem =
function deleteItem(item) function deleteItem(item)
{ {

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

@ -340,7 +340,25 @@ var ltnCalendarTreeView = {
getImageSrc: function(row, col) { return null; }, getImageSrc: function(row, col) { return null; },
getRowProperties: function(row, props) { }, getRowProperties: function(row, props) { },
getColumnProperties: function(colid, col, 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() function ltnSetTreeView()

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

@ -125,7 +125,11 @@
<button id="cal-sidebar-delete-calendar" label="&lightning.sidebar.delete.label;" <button id="cal-sidebar-delete-calendar" label="&lightning.sidebar.delete.label;"
oncommand="ltnDeleteSelectedCalendar();"/> oncommand="ltnDeleteSelectedCalendar();"/>
</hbox> </hbox>
<tree id="calendarTree" hidecolumnpicker="true" seltype="single" onfocus="selectedCalendarPane(event)" flex="1" onselect="ltnSidebarCalendarSelected(this);" context="calendartree-context-menu"> <tree id="calendarTree" hidecolumnpicker="true" seltype="single"
onfocus="selectedCalendarPane(event)" flex="1"
onselect="ltnSidebarCalendarSelected(this);"
ondblclick="ltnCalendarTreeView.onDoubleClick(event);"
context="calendartree-context-menu">
<treecols> <treecols>
<treecol id="col-calendar-Checkbox" cycler="true" fixed="true" width="18" > <treecol id="col-calendar-Checkbox" cycler="true" fixed="true" width="18" >
<image /> <image />