Bug 1553000 - Get last-used calendar view directly from the XUL store. r=philipp
authorGeoff Lankow <geoff@darktrojan.net>
Fri, 24 May 2019 19:52:26 +1200
changeset 35748 8503388a38449367ce7316ac33e49cc1f76fe9fc
parent 35747 7211eed9164b20c7be4ca855151c58c4eef57c3b
child 35749 7389c579b86823526669b8831696635b09cf4c27
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersphilipp
bugs1553000
Bug 1553000 - Get last-used calendar view directly from the XUL store. r=philipp
calendar/base/content/calendar-views-utils.js
--- a/calendar/base/content/calendar-views-utils.js
+++ b/calendar/base/content/calendar-views-utils.js
@@ -638,19 +638,20 @@ function goToDate(date) {
 
 /**
  * Returns the calendar view that was selected before restart, or the current
  * calendar view if it has already been set in this session
  *
  * @return          The last calendar view.
  */
 function getLastCalendarView() {
-    let deck = getViewDeck();
-    if (deck.hasAttribute("selectedIndex")) {
-        let viewNode = deck.childNodes[deck.selectedIndex];
+    if (Services.xulStore.hasValue(document.location.href, "view-deck", "selectedIndex")) {
+        let deck = getViewDeck();
+        let selectedIndex = Services.xulStore.getValue(document.location.href, "view-deck", "selectedIndex");
+        let viewNode = deck.childNodes[selectedIndex];
         return viewNode.id.replace(/-view/, "");
     }
 
     // No deck item was selected beforehand, default to week view.
     return "week";
 }
 
 /**