зеркало из https://github.com/mozilla/pjs.git
Bug 346318 Datepicker appears only briefly when clicking on date dropdown in event dialog r=dmose
This commit is contained in:
Родитель
1f7ae111e5
Коммит
10a10725b9
|
@ -95,7 +95,9 @@
|
||||||
onkeypress="if (event.keyCode == 13) this.kDatePicker.parseTextBoxDate(true);"
|
onkeypress="if (event.keyCode == 13) this.kDatePicker.parseTextBoxDate(true);"
|
||||||
xbl:inherits="disabled">
|
xbl:inherits="disabled">
|
||||||
<xul:menupopup popupanchor="bottomright" popupalign="topright"
|
<xul:menupopup popupanchor="bottomright" popupalign="topright"
|
||||||
onpopupshowing="this.parentNode.kDatePicker.onPopup()">
|
anonid="datepopup"
|
||||||
|
onpopupshowing="onPopup()"
|
||||||
|
onpopuphiding="reshowPopup()">
|
||||||
<xul:minimonth/>
|
<xul:minimonth/>
|
||||||
</xul:menupopup>
|
</xul:menupopup>
|
||||||
</xul:menulist>
|
</xul:menulist>
|
||||||
|
@ -120,12 +122,12 @@
|
||||||
this.value = new Date();
|
this.value = new Date();
|
||||||
}
|
}
|
||||||
this.kMinimonth.addEventListener("select", this.clickDate, false);
|
this.kMinimonth.addEventListener("select", this.clickDate, false);
|
||||||
this.kMinimonth.addEventListener("monthchange", this.reshowPopup, false);
|
|
||||||
this.kMinimonth.addEventListener("popuplisthidden", this.reshowPopup, false);
|
|
||||||
this.mIsReshowing = false;
|
|
||||||
]]>
|
]]>
|
||||||
</constructor>
|
</constructor>
|
||||||
|
|
||||||
|
<!-- We only let the popup close if this is true.-->
|
||||||
|
<field name="mReallyClose">false</field>
|
||||||
|
|
||||||
<method name="update">
|
<method name="update">
|
||||||
<parameter name="aValue"/>
|
<parameter name="aValue"/>
|
||||||
<parameter name="aRefresh"/>
|
<parameter name="aRefresh"/>
|
||||||
|
@ -167,7 +169,11 @@
|
||||||
this.mInPopup = false;
|
this.mInPopup = false;
|
||||||
// select all to remove cursor since can't type while popped-up
|
// select all to remove cursor since can't type while popped-up
|
||||||
this.select();
|
this.select();
|
||||||
|
// From this point on, until the user does something we
|
||||||
|
// care about, we shouldn't close.
|
||||||
|
this.mReallyClose = false;
|
||||||
}
|
}
|
||||||
|
this.mIsReshowing = false;
|
||||||
]]>
|
]]>
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
@ -178,14 +184,18 @@
|
||||||
<parameter name="aEvent"/>
|
<parameter name="aEvent"/>
|
||||||
<body>
|
<body>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
var datepicker = aEvent.target.parentNode.parentNode.kDatePicker;
|
if (this.mReallyClose) {
|
||||||
datepicker.mIsReshowing = true;
|
return;
|
||||||
try {
|
|
||||||
aEvent.target.parentNode.hidePopup();
|
|
||||||
aEvent.target.parentNode.showPopup();
|
|
||||||
} finally {
|
|
||||||
datepicker.mIsReshowing = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.mIsReshowing = true;
|
||||||
|
var popup = document.getAnonymousElementByAttribute(this, "anonid", "datepopup");
|
||||||
|
// This must be in a timeout in order to give the popup time to
|
||||||
|
// finish closing. Otherwise, our widget will think the popup is
|
||||||
|
// still open, and hence it will ignore this call, and then close
|
||||||
|
// a split-second later. See bug 348146
|
||||||
|
setTimeout(popup.showPopup, 0);
|
||||||
|
|
||||||
]]>
|
]]>
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
@ -220,6 +230,7 @@
|
||||||
datepicker.update(new Date(aEvent.target.value), true);
|
datepicker.update(new Date(aEvent.target.value), true);
|
||||||
// select changed value so no cursor appears (can't type to it).
|
// select changed value so no cursor appears (can't type to it).
|
||||||
datepicker.select();
|
datepicker.select();
|
||||||
|
this.mReallyClose = true;
|
||||||
aEvent.target.parentNode.hidePopup();
|
aEvent.target.parentNode.hidePopup();
|
||||||
}
|
}
|
||||||
]]>
|
]]>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче