зеркало из https://github.com/mozilla/pjs.git
Bug 309426 Double clicking on agenda/calendar items should open edit-dialogs. r=dmose
This commit is contained in:
Родитель
5412831edb
Коммит
02fb84e545
|
@ -62,7 +62,8 @@
|
|||
<spacer/>
|
||||
</hbox>
|
||||
<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>
|
||||
<treecol id="col-agenda-item" primary="true" label="&agenda.treeview.item.label;" flex="3"/>
|
||||
<treecol id="col-agenda-when" label="" flex="1"/>
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -125,7 +125,11 @@
|
|||
<button id="cal-sidebar-delete-calendar" label="&lightning.sidebar.delete.label;"
|
||||
oncommand="ltnDeleteSelectedCalendar();"/>
|
||||
</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>
|
||||
<treecol id="col-calendar-Checkbox" cycler="true" fixed="true" width="18" >
|
||||
<image />
|
||||
|
|
Загрузка…
Ссылка в новой задаче