зеркало из https://github.com/mozilla/pjs.git
Bug 321546 Make item-boxes inherit from a base class. Also allows for inline-editing in the month/multiweek views. r=dmose
This commit is contained in:
Родитель
bf65cdd50a
Коммит
4809af7e2e
|
@ -45,46 +45,26 @@
|
|||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="calendar-month-day-box-item">
|
||||
<binding id="calendar-month-day-box-item" extends="chrome://calendar/content/calendar-view-core.xml#calendar-editable-item">
|
||||
<content>
|
||||
<xul:label anonid="item-label" crop="end" class="calendar-month-day-box-item-label" xbl:inherits="context"/>
|
||||
<xul:hbox>
|
||||
<xul:label anonid="item-label" crop="end" class="calendar-month-day-box-item-label" xbl:inherits="context"/>
|
||||
<xul:vbox class="calendar-event-box-container" xbl:inherits="context" flex="1" align="left">
|
||||
<xul:label anonid="event-name" style="margin: 0px;" flex="1" crop="right"/>
|
||||
<xul:textbox class="plain" style="background: transparent !important"
|
||||
anonid="event-name-textbox" crop="right" hidden="true" wrap="true"/>
|
||||
<xul:spacer flex="1"/>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<field name="mItem">null</field>
|
||||
<field name="mSelected">false</field>
|
||||
<field name="mCalendarView">null</field>
|
||||
|
||||
<property name="selected">
|
||||
<property name="occurrence">
|
||||
<getter><![CDATA[
|
||||
return this.mSelected;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
if (val && !this.mSelected) {
|
||||
this.mSelected = true;
|
||||
this.setAttribute("selected", "true");
|
||||
} else if (!val && this.mSelected) {
|
||||
this.mSelected = false;
|
||||
this.removeAttribute("selected");
|
||||
}
|
||||
]]></setter>
|
||||
</property>
|
||||
<property name="calendarView">
|
||||
<getter><![CDATA[
|
||||
return this.mCalendarView;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.mCalendarView = val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
|
||||
<property name="item">
|
||||
<getter><![CDATA[
|
||||
return this.mItem;
|
||||
return this.mOccurrence;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.mItem = val;
|
||||
this.mOccurrence = val;
|
||||
|
||||
function formatTime(aTime) {
|
||||
var m = aTime.minute;
|
||||
|
@ -93,45 +73,24 @@
|
|||
|
||||
var str = null;
|
||||
if (val instanceof Components.interfaces.calIEvent) {
|
||||
str = formatTime(val.startDate.getInTimezone(this.calendarView.mTimezone)) + " " + val.title;
|
||||
str = formatTime(val.startDate.getInTimezone(this.calendarView.mTimezone))
|
||||
} else if (val instanceof Components.interfaces.calITodo) {
|
||||
// yeah, this should really be a little picture instead of a "*"
|
||||
str = "* " + val.title;
|
||||
str = "* "
|
||||
} else {
|
||||
str = val.title;
|
||||
str = " ";
|
||||
}
|
||||
|
||||
var label = document.getAnonymousElementByAttribute(this, "anonid", "item-label");
|
||||
if (label.firstChild)
|
||||
label.removeChild(label.firstChild);
|
||||
label.appendChild(document.createTextNode(str));
|
||||
this.setAttribute("class", "calendar-item");
|
||||
this.setAttribute("item-calendar", val.calendar.uri.spec);
|
||||
|
||||
return val;
|
||||
this.setEditableLabel();
|
||||
this.setCSSClasses();
|
||||
]]></setter>
|
||||
</property>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="click"><![CDATA[
|
||||
if (this.calendarView)
|
||||
this.calendarView.selectedItem = this.item;
|
||||
]]></handler>
|
||||
<handler event="mouseover"><![CDATA[
|
||||
if (this.calendarView && this.calendarView.controller) {
|
||||
event.preventBubble();
|
||||
onMouseOverItem(event);
|
||||
}
|
||||
]]></handler>
|
||||
<handler event="dblclick"><![CDATA[
|
||||
if (this.calendarView && this.calendarView.controller) {
|
||||
event.preventBubble();
|
||||
var occurrence = (event.ctrlKey) ? this.item.parentItem : this.item;
|
||||
this.calendarView.controller.modifyOccurrence(occurrence);
|
||||
}
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="calendar-month-day-box">
|
||||
|
@ -1155,7 +1114,7 @@
|
|||
if (event.keyCode == kKE.DOM_VK_BACK_SPACE ||
|
||||
event.keyCode == kKE.DOM_VK_DELETE)
|
||||
{
|
||||
if (this.selectedItem && this.controller) {
|
||||
if (!this.activeInPlaceEdit && this.selectedItem && this.controller) {
|
||||
var item = (event.ctrlKey) ? this.selectedItem.parentItem : this.selectedItem;
|
||||
this.controller.deleteOccurrence(item);
|
||||
}
|
||||
|
|
|
@ -667,24 +667,6 @@
|
|||
chunkBox.setAttribute("context", this.getAttribute("item-context") || this.getAttribute("context"));
|
||||
chunkBox.setAttribute("style", "min-width: 1px; min-height: 1px;");
|
||||
chunkBox.setAttribute("orient", orient);
|
||||
// chunkBox.setAttribute("style", "background: #eeeeff; padding: 0px 1px 0px 1px");
|
||||
|
||||
// chunkBox.setAttribute("flex", "1");
|
||||
|
||||
chunkBox.setAttribute("tooltip", "itemTooltip");
|
||||
|
||||
var categoriesSelectorList = "";
|
||||
if (chunk.event.event.getProperty("CATEGORIES") != null) {
|
||||
var categoriesList = chunk.event.event.getProperty("CATEGORIES").split(",");
|
||||
for (var i = 0; i < categoriesList.length; i++ ) {
|
||||
// Remove illegal chars.
|
||||
categoriesList[i] = categoriesList[i].replace(' ','_');
|
||||
categoriesList[i] = categoriesList[i].toLowerCase();
|
||||
}
|
||||
categoriesSelectorList = categoriesList.join(" ");
|
||||
}
|
||||
chunkBox.setAttribute("item-category", categoriesSelectorList);
|
||||
|
||||
if (orient == "vertical")
|
||||
chunkBox.setAttribute("height", duration * this.mPixPerMin);
|
||||
else
|
||||
|
@ -695,7 +677,6 @@
|
|||
chunkBox.calendarView = this.calendarView;
|
||||
chunkBox.occurrence = chunk.event.event;
|
||||
chunkBox.parentColumn = this;
|
||||
chunkBox.setAttribute("item-calendar", chunk.event.event.calendar.uri.spec);
|
||||
|
||||
chunk.event.eventbox = chunkBox;
|
||||
} else {
|
||||
|
@ -1232,7 +1213,7 @@
|
|||
<!--
|
||||
- An individual event box, to be inserted into a column.
|
||||
-->
|
||||
<binding id="calendar-event-box">
|
||||
<binding id="calendar-event-box" extends="chrome://calendar/content/calendar-view-core.xml#calendar-editable-item">
|
||||
|
||||
<content>
|
||||
<xul:box anonid="eventbox" xbl:inherits="orient,width,height" flex="1">
|
||||
|
@ -1268,13 +1249,7 @@
|
|||
]]></constructor>
|
||||
|
||||
<!-- fields -->
|
||||
<field name="mOccurrence">null</field>
|
||||
<field name="mParentColumn">null</field>
|
||||
<field name="mCalendarView">null</field>
|
||||
<field name="mSelected">null</field>
|
||||
<property name="calendarView"
|
||||
onget="return this.mCalendarView;"
|
||||
onset="return (this.mCalendarView = val);" />
|
||||
|
||||
<!-- methods/properties -->
|
||||
<method name="setAttribute">
|
||||
|
@ -1307,48 +1282,6 @@
|
|||
]]></body>
|
||||
</method>
|
||||
|
||||
<property name="eventNameLabel" readonly="true"
|
||||
onget="return document.getAnonymousElementByAttribute(this, 'anonid', 'event-name');"/>
|
||||
<property name="eventNameTextbox" readonly="true"
|
||||
onget="return document.getAnonymousElementByAttribute(this, 'anonid', 'event-name-textbox');"/>
|
||||
<property name="eventNameInput" readonly="true"
|
||||
onget="return document.getAnonymousElementByAttribute(this, 'anonid', 'event-name-textbox').inputField;"/>
|
||||
|
||||
<property name="occurrence">
|
||||
<getter><![CDATA[
|
||||
return this.mOccurrence;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.mOccurrence = val;
|
||||
var evl = this.eventNameLabel;
|
||||
|
||||
while (evl.firstChild)
|
||||
evl.removeChild(evl.firstChild);
|
||||
|
||||
if (val && val != "")
|
||||
evl.appendChild(document.createTextNode(val.title));
|
||||
else
|
||||
evl.appendChild(document.createTextNode("Untitled Event"));
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="selected">
|
||||
<getter><![CDATA[
|
||||
return this.mSelected;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
if (val && !this.mSelected) {
|
||||
this.mSelected = true;
|
||||
this.setAttribute("selected", "true");
|
||||
} else if (!val && this.mSelected) {
|
||||
this.mSelected = null;
|
||||
this.removeAttribute("selected");
|
||||
}
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="parentColumn"
|
||||
onget="return this.mParentColumn;"
|
||||
onset="return (this.mParentColumn = val);"/>
|
||||
|
@ -1358,89 +1291,9 @@
|
|||
|
||||
<property name="endMinute" readonly="true"
|
||||
onget="if (!this.mOccurrence) return 0; return this.mOccurrence.endDate.hour * 60 + this.mOccurrence.endDate.minute"/>
|
||||
|
||||
<method name="startEditing">
|
||||
<body><![CDATA[
|
||||
this.editingTimer = null;
|
||||
this.mOriginalTextLabel = this.mOccurrence.title;
|
||||
|
||||
this.eventNameLabel.setAttribute("hidden", "true");
|
||||
|
||||
this.mEditing = true;
|
||||
|
||||
this.eventNameTextbox.value = this.mOriginalTextLabel;
|
||||
this.eventNameTextbox.removeAttribute("hidden");
|
||||
if (this.calendarView)
|
||||
this.calendarView.activeInPlaceEdit = true;
|
||||
this.eventNameInput.focus();
|
||||
this.eventNameInput.select();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="stopEditing">
|
||||
<parameter name="saveChanges"/>
|
||||
<body><![CDATA[
|
||||
this.mEditing = false;
|
||||
|
||||
if (this.calendarView)
|
||||
this.calendarView.activeInPlaceEdit = false;
|
||||
|
||||
if (!saveChanges) {
|
||||
this.eventNameTextbox.setAttribute("hidden", "true");
|
||||
this.eventNameLabel.removeAttribute("hidden");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.eventNameTextbox.value != this.mOriginalTextLabel) {
|
||||
var clone = this.mOccurrence.clone();
|
||||
clone.title = this.eventNameTextbox.value;
|
||||
clone.calendar.modifyItem(clone, this.mOccurrence, null);
|
||||
|
||||
// Note that as soon as we do the modifyItem, this element ceases to exist,
|
||||
// so don't bother trying to modify anything further here! ('this' exists,
|
||||
// because it's being kept alive, but our child content etc. is all gone)
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="click"><![CDATA[
|
||||
var evTime = Date.now();
|
||||
if (this.mMouseDownTime && (evTime - this.mMouseDownTime > 1000)) {
|
||||
// not even a click!
|
||||
return;
|
||||
}
|
||||
|
||||
// If the middle/right button was used for click just select the item.
|
||||
// If the left button was used and the item is already selected start
|
||||
// the 'single click edit' timeout. Otherwise select the item too.
|
||||
if (this.selected && (event.button == 0)) {
|
||||
var self = this;
|
||||
if (this.editingTimer) {
|
||||
clearTimeout(this.editingTimer);
|
||||
}
|
||||
this.editingTimer = setTimeout(function () { self.startEditing(); }, 350);
|
||||
} else {
|
||||
this.calendarView.selectedItem = this.mOccurrence;
|
||||
}
|
||||
]]></handler>
|
||||
|
||||
<handler event="dblclick" button="0"><![CDATA[
|
||||
event.stopPropagation();
|
||||
|
||||
// stop 'single click edit' timeout (if started)
|
||||
if (this.editingTimer) {
|
||||
clearTimeout(this.editingTimer);
|
||||
this.editingTimer = null;
|
||||
}
|
||||
|
||||
if (this.calendarView.controller && this.mOccurrence) {
|
||||
var occurrence = (event.ctrlKey) ? this.mOccurrence.parentItem : this.mOccurrence;
|
||||
this.calendarView.controller.modifyOccurrence(occurrence);
|
||||
}
|
||||
]]></handler>
|
||||
|
||||
<handler event="mousedown" button="0"><![CDATA[
|
||||
event.preventBubble();
|
||||
|
||||
|
@ -1450,7 +1303,6 @@
|
|||
this.mInMouseDown = true;
|
||||
this.mMouseX = event.screenX;
|
||||
this.mMouseY = event.screenY;
|
||||
this.mMouseDownTime = Date.now();
|
||||
]]></handler>
|
||||
|
||||
<handler event="mousemove"><![CDATA[
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Calendar view code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Joey Minta <jminta@gmail.com>
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
calendar-editable-item {
|
||||
-moz-binding: url(chrome://calendar/content/calendar-view-core.xml#calendar-editable-item);
|
||||
}
|
|
@ -0,0 +1,241 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is Calendar view code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Joey Minta <jminta@gmail.com>
|
||||
- Portions created by the Initial Developer are Copyright (C) 2005
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK *****
|
||||
-->
|
||||
|
||||
<bindings id="calendar-core-view-bindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="calendar-editable-item">
|
||||
<content>
|
||||
<xul:vbox class="calendar-event-box-container" xbl:inherits="context" flex="1" align="left">
|
||||
<xul:label anonid="event-name" style="margin: 0px;" flex="1" crop="right"/>
|
||||
<xul:textbox class="plain" style="background: transparent !important"
|
||||
anonid="event-name-textbox" crop="right" hidden="true" wrap="true"/>
|
||||
<xul:spacer flex="1"/>
|
||||
</xul:vbox>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<constructor><![CDATA[
|
||||
this.setAttribute("tooltip", "itemTooltip");
|
||||
this.setAttribute("class", "calendar-item");
|
||||
|
||||
var self = this;
|
||||
this.eventNameInput.onblur = function alldayItemBlur() { self.stopEditing(true); };
|
||||
this.eventNameInput.onkeypress = function alldayItemKeyPress(event) {
|
||||
// save on enter
|
||||
if (event.keyCode == 13)
|
||||
self.stopEditing(true);
|
||||
// abort on escape
|
||||
else if (event.keyCode == 27)
|
||||
self.stopEditing(false);
|
||||
};
|
||||
]]></constructor>
|
||||
<field name="mOccurrence">null</field>
|
||||
<field name="mSelected">false</field>
|
||||
<field name="mCalendarView">null</field>
|
||||
|
||||
<property name="selected">
|
||||
<getter><![CDATA[
|
||||
return this.mSelected;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
if (val && !this.mSelected) {
|
||||
this.mSelected = true;
|
||||
this.setAttribute("selected", "true");
|
||||
} else if (!val && this.mSelected) {
|
||||
this.mSelected = false;
|
||||
this.removeAttribute("selected");
|
||||
}
|
||||
]]></setter>
|
||||
</property>
|
||||
<property name="calendarView">
|
||||
<getter><![CDATA[
|
||||
return this.mCalendarView;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.mCalendarView = val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
|
||||
<property name="occurrence">
|
||||
<getter><![CDATA[
|
||||
return this.mOccurrence;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.mOccurrence = val;
|
||||
this.setEditableLabel();
|
||||
this.setCSSClasses();
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="eventNameLabel" readonly="true"
|
||||
onget="return document.getAnonymousElementByAttribute(this, 'anonid', 'event-name');"/>
|
||||
<property name="eventNameTextbox" readonly="true"
|
||||
onget="return document.getAnonymousElementByAttribute(this, 'anonid', 'event-name-textbox');"/>
|
||||
<property name="eventNameInput" readonly="true"
|
||||
onget="return document.getAnonymousElementByAttribute(this, 'anonid', 'event-name-textbox').inputField;"/>
|
||||
<method name="setEditableLabel">
|
||||
<body><![CDATA[
|
||||
var evl = this.eventNameLabel;
|
||||
var item = this.mOccurrence;
|
||||
|
||||
while (evl.firstChild) {
|
||||
evl.removeChild(evl.firstChild);
|
||||
}
|
||||
|
||||
if (item.title && item.title != "") {
|
||||
evl.appendChild(document.createTextNode(item.title));
|
||||
} else {
|
||||
var sbs = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService);
|
||||
var props = sbs.createBundle("chrome://calendar/locale/calendar.properties");
|
||||
evl.appendChild(document.createTextNode(props.GetStringFromName("eventUntitled")));
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="setCSSClasses">
|
||||
<body><![CDATA[
|
||||
var item = this.mOccurrence
|
||||
this.setAttribute("item-calendar", item.calendar.uri.spec);
|
||||
|
||||
var categoriesSelectorList = "";
|
||||
if (item.getProperty("CATEGORIES") != null) {
|
||||
var categoriesList = item.getProperty("CATEGORIES").split(",");
|
||||
for (var i = 0; i < categoriesList.length; i++ ) {
|
||||
// Remove illegal chars.
|
||||
categoriesList[i] = categoriesList[i].replace(' ','_');
|
||||
categoriesList[i] = categoriesList[i].toLowerCase();
|
||||
}
|
||||
categoriesSelectorList = categoriesList.join(" ");
|
||||
}
|
||||
|
||||
this.setAttribute("item-category", categoriesSelectorList);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="startEditing">
|
||||
<body><![CDATA[
|
||||
this.editingTimer = null;
|
||||
this.mOriginalTextLabel = this.mOccurrence.title;
|
||||
|
||||
this.eventNameLabel.setAttribute("hidden", "true");
|
||||
|
||||
this.mEditing = true;
|
||||
|
||||
this.eventNameTextbox.value = this.mOriginalTextLabel;
|
||||
this.eventNameTextbox.removeAttribute("hidden");
|
||||
if (this.calendarView)
|
||||
this.calendarView.activeInPlaceEdit = true;
|
||||
this.eventNameInput.focus();
|
||||
this.eventNameInput.select();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="stopEditing">
|
||||
<parameter name="saveChanges"/>
|
||||
<body><![CDATA[
|
||||
if (!this.mEditing)
|
||||
return;
|
||||
|
||||
this.mEditing = false;
|
||||
|
||||
if (saveChanges && (this.eventNameTextbox.value != this.mOriginalTextLabel)) {
|
||||
var clone = this.mOccurrence.clone();
|
||||
clone.title = this.eventNameTextbox.value;
|
||||
clone.calendar.modifyItem(clone, this.mOccurrence, null);
|
||||
|
||||
// Note that as soon as we do the modifyItem, this element ceases to exist,
|
||||
// so don't bother trying to modify anything further here! ('this' exists,
|
||||
// because it's being kept alive, but our child content etc. is all gone)
|
||||
return;
|
||||
}
|
||||
|
||||
this.eventNameTextbox.setAttribute("hidden", "true");
|
||||
this.eventNameLabel.removeAttribute("hidden");
|
||||
return;
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="click"><![CDATA[
|
||||
if (this.mEditing) {
|
||||
return;
|
||||
}
|
||||
|
||||
// start 'single click edit' timeout
|
||||
if (this.selected) {
|
||||
var self = this;
|
||||
if (this.editingTimer) {
|
||||
clearTimeout(this.editingTimer);
|
||||
}
|
||||
this.editingTimer = setTimeout(function alldayTimeout() { self.startEditing(); }, 350);
|
||||
} else {
|
||||
this.calendarView.selectedItem = this.mOccurrence;
|
||||
}
|
||||
]]></handler>
|
||||
|
||||
<handler event="dblclick"><![CDATA[
|
||||
event.stopPropagation();
|
||||
|
||||
// stop 'single click edit' timeout (if started)
|
||||
if (this.editingTimer) {
|
||||
clearTimeout(this.editingTimer);
|
||||
this.editingTimer = null;
|
||||
}
|
||||
|
||||
if (this.calendarView.controller) {
|
||||
var item = (event.ctrlKey) ? this.mOccurrence.parentItem : this.mOccurrence;
|
||||
this.calendarView.controller.modifyOccurrence(item);
|
||||
}
|
||||
]]></handler>
|
||||
<handler event="mouseover"><![CDATA[
|
||||
if (this.calendarView && this.calendarView.controller) {
|
||||
event.preventBubble();
|
||||
onMouseOverItem(event);
|
||||
}
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
</bindings>
|
|
@ -53,6 +53,7 @@
|
|||
<?xml-stylesheet href="chrome://calendar/content/calendar-multiday-view.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://calendar/content/calendar-month-view.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://calendar/content/calendar-decorated-views.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://calendar/content/calendar-view-core.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://calendar/content/datetimepickers/minimonth.css" type="text/css"?>
|
||||
|
||||
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
|
|
@ -42,6 +42,8 @@ calendar.jar:
|
|||
content/calendar/calendar-multiday-view.xml (/calendar/base/content/calendar-multiday-view.xml)
|
||||
content/calendar/calendar-month-view.css (/calendar/base/content/calendar-month-view.css)
|
||||
content/calendar/calendar-month-view.xml (/calendar/base/content/calendar-month-view.xml)
|
||||
content/calendar/calendar-view-core.xml (/calendar/base/content/calendar-view-core.xml)
|
||||
content/calendar/calendar-view-core.css (/calendar/base/content/calendar-view-core.css)
|
||||
content/calendar/calendar-item-editing.js (/calendar/base/content/calendar-item-editing.js)
|
||||
content/calendar/calendar-alarm-dialog.xul (/calendar/base/content/calendar-alarm-dialog.xul)
|
||||
content/calendar/calendar-alarm-dialog.js (/calendar/base/content/calendar-alarm-dialog.js)
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
<?xml-stylesheet href="chrome://calendar/content/calendar-multiday-view.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://calendar/content/calendar-month-view.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://calendar/content/calendar-decorated-views.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://calendar/content/calendar-view-core.css" type="text/css"?>
|
||||
|
||||
<!-- Overlays -->
|
||||
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
|
||||
|
|
|
@ -39,6 +39,8 @@ calendar.jar:
|
|||
content/calendar/calendar-multiday-view.xml (/calendar/base/content/calendar-multiday-view.xml)
|
||||
content/calendar/calendar-recurrence-dialog.js (/calendar/base/content/calendar-recurrence-dialog.js)
|
||||
content/calendar/calendar-recurrence-dialog.xul (/calendar/base/content/calendar-recurrence-dialog.xul)
|
||||
content/calendar/calendar-view-core.xml (/calendar/base/content/calendar-view-core.xml)
|
||||
content/calendar/calendar-view-core.css (/calendar/base/content/calendar-view-core.css)
|
||||
content/calendar/calendarUtils.js (content/calendarUtils.js)
|
||||
* content/calendar/calendar.xul (content/calendar.xul)
|
||||
content/calendar/calendarMail.js (content/calendarMail.js)
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
<?xml-stylesheet href="chrome://calendar/content/calendar-multiday-view.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://calendar/content/calendar-month-view.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://calendar/content/calendar-decorated-views.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://calendar/content/calendar-view-core.css" type="text/css"?>
|
||||
|
||||
<!-- Overlays -->
|
||||
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
|
||||
|
|
Загрузка…
Ссылка в новой задаче