From dfba8d3aa52e3fe21816ab21a39c85e451f243fa Mon Sep 17 00:00:00 2001 From: Philipp Kewisch Date: Wed, 24 Jun 2009 20:47:52 +0200 Subject: [PATCH] Fix bug 499542 - View menu entries Rotate View and Workweek Days Only are always disabled (regression). r=ssitter --HG-- extra : rebase_source : 58bcdd9014c39d8956845d8708ec16e41a202094 --- calendar/base/content/calendar-common-sets.js | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/calendar/base/content/calendar-common-sets.js b/calendar/base/content/calendar-common-sets.js index d55d4e8491..8b6b11c4b5 100644 --- a/calendar/base/content/calendar-common-sets.js +++ b/calendar/base/content/calendar-common-sets.js @@ -181,14 +181,10 @@ var calendarController = { case "calendar_export_selection_command": return this.item_selected; case "calendar_toggle_orientation_command": - return this.isCalendarInForeground() && - gCurrentMode && - gCurrentMode == "calendar" && + return this.isInMode("calendar") && currentView().supportsRotation; case "calendar_toggle_workdays_only_command": - return this.isCalendarInForeground() && - gCurrentMode && - gCurrentMode == "calendar" && + return this.isInMode("calendar") && currentView().supportsWorkdaysOnly; case "calendar_publish_selected_events_command": return this.item_selected; @@ -209,14 +205,11 @@ var calendarController = { // changing things. case "calendar_show_unifinder_command": case "calendar_mode_calendar": - return this.isCalendarInForeground() && - gCurrentMode && - gCurrentMode == "calendar"; + return this.isInMode("calendar"); case "calendar_mode_task": - return this.isCalendarInForeground() && - gCurrentMode && - gCurrentMode == "task"; + return this.isInMode("task"); + default: if (this.defaultController && !this.isCalendarInForeground()) { // The delete-button demands a special handling in mail-mode @@ -445,6 +438,17 @@ var calendarController = { 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) { var selectedItems = aEvent.detail; calendarController.item_selected = selectedItems && (selectedItems.length > 0);