Bug 331485 Use selected day from view as start date for new tasks in setDefaultAlarmValues(). r=mvl

This commit is contained in:
jminta%gmail.com 2006-03-27 19:35:39 +00:00
parent 41b40d7f8c
commit 27c899acb7

View File

@ -374,6 +374,18 @@ function getContrastingTextColor(bgColor)
return "black";
}
/**
* Returns the selected day in the views in a platform (Sunbird vs. Lightning)
* neutral way
*/
function getSelectedDay() {
var sbView = document.getElementById("view-deck");
var ltnView = document.getElementById("calendar-view-box");
var viewDeck = sbView || ltnView;
return viewDeck.selectedPanel.selectedDay;
}
/**
* Read default alarm settings from user preferences and apply them to
* the event/todo passed in.
@ -409,8 +421,7 @@ function setDefaultAlarmValues(aItem)
if (alarmsBranch.getIntPref("onfortodos") == 1) {
// You can't have an alarm if the entryDate doesn't exist.
if (!aItem.entryDate) {
// XXX We should use the selected day from view instead
aItem.entryDate = now();
aItem.entryDate = getSelectedDay().clone();
}
var alarmOffset = Components.classes["@mozilla.org/calendar/duration;1"]
.createInstance(Components.interfaces.calIDuration);