зеркало из https://github.com/mozilla/gecko-dev.git
Bug 266241: use system time format in the views. patch by ssiter, r=mvl
This commit is contained in:
Родитель
911241a85c
Коммит
f959c1bf09
|
@ -67,18 +67,15 @@
|
||||||
<setter><![CDATA[
|
<setter><![CDATA[
|
||||||
this.mOccurrence = val;
|
this.mOccurrence = val;
|
||||||
|
|
||||||
function formatTime(aTime) {
|
|
||||||
var m = aTime.minute;
|
|
||||||
return (aTime.hour + ":" + (m < 10 ? "0" : "") + m);
|
|
||||||
}
|
|
||||||
|
|
||||||
var str = null;
|
var str = null;
|
||||||
// if val is an event and not an all day event, show start time in title
|
// if val is an event and not an all day event, show start time in title
|
||||||
if (val instanceof Components.interfaces.calIEvent && !val.startDate.isDate) {
|
if (val instanceof Components.interfaces.calIEvent && !val.startDate.isDate) {
|
||||||
str = formatTime(val.startDate.getInTimezone(this.calendarView.mTimezone))
|
var df = Components.classes["@mozilla.org/calendar/datetime-formatter;1"]
|
||||||
|
.getService(Components.interfaces.calIDateTimeFormatter);
|
||||||
|
str = df.formatTime(val.startDate.getInTimezone(this.calendarView.mTimezone));
|
||||||
} else if (val instanceof Components.interfaces.calITodo) {
|
} else if (val instanceof Components.interfaces.calITodo) {
|
||||||
// yeah, this should really be a little picture instead of a "*"
|
// yeah, this should really be a little picture instead of a "*"
|
||||||
str = "* "
|
str = "* ";
|
||||||
} else {
|
} else {
|
||||||
str = " ";
|
str = " ";
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,9 @@
|
||||||
while (topbox.lastChild)
|
while (topbox.lastChild)
|
||||||
topbox.removeChild(topbox.lastChild);
|
topbox.removeChild(topbox.lastChild);
|
||||||
|
|
||||||
|
var formatter = Components.classes["@mozilla.org/intl/scriptabledateformat;1"]
|
||||||
|
.getService(nsIScriptableDateFormat);
|
||||||
|
var timeString;
|
||||||
var theMin = this.mStartMin;
|
var theMin = this.mStartMin;
|
||||||
var theHour = Math.floor(theMin / 60);
|
var theHour = Math.floor(theMin / 60);
|
||||||
var durLeft = this.mEndMin - this.mStartMin;
|
var durLeft = this.mEndMin - this.mStartMin;
|
||||||
|
@ -167,7 +170,10 @@
|
||||||
if (dur != 60) {
|
if (dur != 60) {
|
||||||
box = makeTimeBox("", dur * this.mPixPerMin);
|
box = makeTimeBox("", dur * this.mPixPerMin);
|
||||||
} else {
|
} else {
|
||||||
box = makeTimeBox(String(theHour) + ":00", dur * this.mPixPerMin);
|
timeString = formatter.FormatTime("",
|
||||||
|
nsIScriptableDateFormat.timeFormatNoSeconds,
|
||||||
|
theHour, 0, 0);
|
||||||
|
box = makeTimeBox(timeString, dur * this.mPixPerMin);
|
||||||
}
|
}
|
||||||
|
|
||||||
box.setAttribute("class", "calendar-time-bar-box-" + (theHour % 2 == 0 ? "even" : "odd"));
|
box.setAttribute("class", "calendar-time-bar-box-" + (theHour % 2 == 0 ? "even" : "odd"));
|
||||||
|
@ -1172,8 +1178,17 @@
|
||||||
var endhr = Math.floor(realendmin / 60);
|
var endhr = Math.floor(realendmin / 60);
|
||||||
var endmin = realendmin % 60;
|
var endmin = realendmin % 60;
|
||||||
|
|
||||||
this.fgboxes.startlabel.setAttribute("value", starthr + ":" + (startmin < 10 ? "0" : "") + startmin);
|
var formatter = Components.classes["@mozilla.org/intl/scriptabledateformat;1"]
|
||||||
this.fgboxes.endlabel.setAttribute("value", endhr + ":" + (endmin < 10 ? "0" : "") + endmin);
|
.getService(nsIScriptableDateFormat);
|
||||||
|
var startstr = formatter.FormatTime("",
|
||||||
|
nsIScriptableDateFormat.timeFormatNoSeconds,
|
||||||
|
starthr, startmin, 0);
|
||||||
|
var endstr = formatter.FormatTime("",
|
||||||
|
nsIScriptableDateFormat.timeFormatNoSeconds,
|
||||||
|
endhr, endmin, 0);
|
||||||
|
|
||||||
|
this.fgboxes.startlabel.setAttribute("value", startstr);
|
||||||
|
this.fgboxes.endlabel.setAttribute("value", endstr);
|
||||||
|
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче