diff --git a/calendar/lightning/content/messenger-overlay-sidebar.js b/calendar/lightning/content/messenger-overlay-sidebar.js index 0f1de2364c..83d31d7139 100644 --- a/calendar/lightning/content/messenger-overlay-sidebar.js +++ b/calendar/lightning/content/messenger-overlay-sidebar.js @@ -66,6 +66,14 @@ var calendarTabType = { }, showTab: function(aTab) { ltnSwitch2Calendar(); + }, + closeTab: function(aTab) { + if (gCurrentMode == "calendar") { + // Only revert menu hacks if closing the active tab, otherwise we + // would switch to mail mode even if in task mode and closing the + // calendar tab. + ltnSwitch2Mail(); + } } }, tasks: { @@ -77,6 +85,14 @@ var calendarTabType = { }, showTab: function(aTab) { ltnSwitch2Task(); + }, + closeTab: function(aTab) { + if (gCurrentMode == "task") { + // Only revert menu hacks if closing the active tab, otherwise we + // would switch to mail mode even if in calendar mode and closing the + // tasks tab. + ltnSwitch2Mail(); + } } }, }, @@ -87,9 +103,6 @@ var calendarTabType = { saveTabState: function(aTab) { ltnSwitch2Mail(); }, - closeTab: function(aTab) { - ltnSwitch2Mail(); - }, }; window.addEventListener("load", function(e) { document.getElementById('tabmail').registerTabType(calendarTabType); }, false);