Bug 348660 User selection for 'Tasks in View'/'Workweek days only' reset on exit, r1=lilmatt, r2=dmose

This commit is contained in:
jminta%gmail.com 2006-08-24 21:02:17 +00:00
parent 716a7a6e89
commit 7b976e8acb
4 changed files with 43 additions and 4 deletions

View File

@ -134,6 +134,21 @@
]]></setter>
</property>
<property name="initialized">
<getter><![CDATA[
var retval;
// Some views throw when accessing an uninitialized startDay
try {
retval = this.displayCalendar && this.startDay
&& this.endDay;
} catch(ex) {
return false;
}
return retval;
]]></getter>
</property>
<property name="selectedItem">
<getter><![CDATA[
return document.getAnonymousElementByAttribute(this, "anonid", "view-element").selectedItem;

View File

@ -69,6 +69,13 @@ interface calIDecoratedView : nsISupports
*/
readonly attribute AUTF8String observerID;
/**
* Generally corresponds to whether or not the view has been previously shown.
* Strictly speaking, it reports whether displayCalendar, startDay and endDay
* are all non-null.
*/
readonly attribute boolean initialized;
/**
* The displayCalendar of the embedded calICalendarView. This *must* be set
* prior to calling goToDay the first time.

View File

@ -116,9 +116,9 @@ function ltnMinimonthPick(minimonth)
document.getElementById("calendar-view-box")) {
var view = currentView();
// We set the display calendar on the views in showCalendarView
// the first time they are shown.
if (!view.displayCalendar) {
// If we've never shown the view before, we need to do some special
// things here.
if (!view.initialized) {
showCalendarView('month');
view = currentView();
cdt.timezone = view.timezone;
@ -193,7 +193,7 @@ function refreshUIBits() {
// refresh the current view, if it has ever been shown
var cView = currentView();
if (cView.displayCalendar) {
if (cView.initialized) {
cView.goToDay(cView.selectedDay);
}
@ -226,6 +226,19 @@ function showCalendarView(type)
gMsgFolderSelected = null;
msgWindow.openFolder = null;
}
var view = document.getElementById(type+"-view");
if (!view.initialized) {
// Set up this view with the current view-checkbox values
var workdaysMenu = document.getElementById("ltn-workdays-only");
view.workdaysOnly = (workdaysMenu.getAttribute("checked") == 'true');
var tasksMenu = document.getElementById("ltn-tasks-in-view")
view.tasksInView = (tasksMenu.getAttribute("checked") == 'true');
}
switchToView(type);
document.getElementById("displayDeck").selectedPanel = calendarViewBox;
switchToView(type);

View File

@ -94,9 +94,13 @@
<menu label="&viewMenu.label;">
<menupopup>
<menuitem type="checkbox"
id="ltn-workdays-only"
persist="checked"
label="&calendar.onlyworkday.checkbox.label;"
oncommand="toggleWorkdaysOnly()"/>
<menuitem type="checkbox"
id="ltn-tasks-in-view"
persist="checked"
label="&calendar.displaytodos.checkbox.label;"
oncommand="toggleTasksInView()"/>
</menupopup>