Fix bug 499542 - View menu entries Rotate View and Workweek Days Only are always disabled (regression). r=ssitter

--HG--
extra : rebase_source : 58bcdd9014c39d8956845d8708ec16e41a202094
This commit is contained in:
Philipp Kewisch 2009-06-24 20:47:52 +02:00
Родитель edad9f56a6
Коммит dfba8d3aa5
1 изменённых файлов: 16 добавлений и 12 удалений

Просмотреть файл

@ -181,14 +181,10 @@ var calendarController = {
case "calendar_export_selection_command": case "calendar_export_selection_command":
return this.item_selected; return this.item_selected;
case "calendar_toggle_orientation_command": case "calendar_toggle_orientation_command":
return this.isCalendarInForeground() && return this.isInMode("calendar") &&
gCurrentMode &&
gCurrentMode == "calendar" &&
currentView().supportsRotation; currentView().supportsRotation;
case "calendar_toggle_workdays_only_command": case "calendar_toggle_workdays_only_command":
return this.isCalendarInForeground() && return this.isInMode("calendar") &&
gCurrentMode &&
gCurrentMode == "calendar" &&
currentView().supportsWorkdaysOnly; currentView().supportsWorkdaysOnly;
case "calendar_publish_selected_events_command": case "calendar_publish_selected_events_command":
return this.item_selected; return this.item_selected;
@ -209,14 +205,11 @@ var calendarController = {
// changing things. // changing things.
case "calendar_show_unifinder_command": case "calendar_show_unifinder_command":
case "calendar_mode_calendar": case "calendar_mode_calendar":
return this.isCalendarInForeground() && return this.isInMode("calendar");
gCurrentMode &&
gCurrentMode == "calendar";
case "calendar_mode_task": case "calendar_mode_task":
return this.isCalendarInForeground() && return this.isInMode("task");
gCurrentMode &&
gCurrentMode == "task";
default: default:
if (this.defaultController && !this.isCalendarInForeground()) { if (this.defaultController && !this.isCalendarInForeground()) {
// The delete-button demands a special handling in mail-mode // The delete-button demands a special handling in mail-mode
@ -445,6 +438,17 @@ var calendarController = {
return isSunbird() || (gCurrentMode && gCurrentMode != "mail"); return isSunbird() || (gCurrentMode && gCurrentMode != "mail");
}, },
isInMode: function cC_isInMode(mode) {
switch (mode) {
case "mail":
return !isCalendarInForeground();
case "calendar":
return isSunbird() || (gCurrentMode && gCurrentMode == "calendar");
case "task":
return !isSunbird() && (gCurrentMode && gCurrentMode == "task");
}
},
onSelectionChanged: function cC_onSelectionChanged(aEvent) { onSelectionChanged: function cC_onSelectionChanged(aEvent) {
var selectedItems = aEvent.detail; var selectedItems = aEvent.detail;
calendarController.item_selected = selectedItems && (selectedItems.length > 0); calendarController.item_selected = selectedItems && (selectedItems.length > 0);