Bug 1433229 - Move view related functions into calViewUtils.jsm - automatic changes. r=MakeMyDay
authorPhilipp Kewisch <mozilla@kewis.ch>
Sun, 15 Oct 2017 12:56:44 +0200
changeset 30179 850b32c6652c3b669154a068534dd1537e52efaa
parent 30178 033ede986813abe46b060a294645a46de42b21b1
child 30180 50b6d12405049bee66fb6dbde52d62ee783ec8fb
push id2140
push userclokep@gmail.com
push dateMon, 12 Mar 2018 19:42:51 +0000
treeherdercomm-beta@2d485f0d3723 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMakeMyDay
bugs1433229
Bug 1433229 - Move view related functions into calViewUtils.jsm - automatic changes. r=MakeMyDay MozReview-Commit-ID: KvY3P6hIp6C
calendar/base/content/agenda-listbox.js
calendar/base/content/calendar-common-sets.js
calendar/base/content/calendar-management.js
calendar/base/content/calendar-menus.xml
calendar/base/content/calendar-month-view.xml
calendar/base/content/calendar-task-editing.js
calendar/base/content/calendar-task-tree.js
calendar/base/content/calendar-task-tree.xml
calendar/base/content/calendar-unifinder.js
calendar/base/content/calendar-view-core.xml
calendar/base/content/calendar-views.js
calendar/base/content/dialogs/calendar-migration-dialog.js
calendar/base/content/dialogs/calendar-print-dialog.js
calendar/base/content/dialogs/chooseCalendarDialog.xul
calendar/base/content/preferences/categories.js
calendar/base/content/preferences/editCategory.js
calendar/base/content/widgets/calendar-list-tree.xml
calendar/base/content/widgets/calendar-widgets.xml
calendar/base/content/widgets/minimonth.xml
calendar/base/modules/calPrintUtils.jsm
calendar/providers/gdata/content/gdata-calendar-creation.js
calendar/test/unit/test_utils.js
--- a/calendar/base/content/agenda-listbox.js
+++ b/calendar/base/content/agenda-listbox.js
@@ -110,17 +110,17 @@ agendaListbox.removePeriodListItem = fun
 /**
  * Handler function called when changing the checkbox state on period items.
  *
  * @param event     The DOM event that triggered the checkbox state change.
  */
 agendaListbox.onCheckboxChange = function(event) {
     let periodCheckbox = event.target;
     let lopen = (periodCheckbox.getAttribute("checked") == "true");
-    let listItem = cal.getParentNodeOrThis(periodCheckbox, "agenda-checkbox-richlist-item");
+    let listItem = cal.view.getParentNodeOrThis(periodCheckbox, "agenda-checkbox-richlist-item");
     let period = listItem.getItem();
     period.open = lopen;
     // as the agenda-checkboxes are only transient we have to set the "checked"
     // attribute at their hidden origins to make that attribute persistent.
     document.getElementById(listItem.id + "-hidden").setAttribute("checked",
                             periodCheckbox.getAttribute("checked"));
     if (lopen) {
         agendaListbox.refreshCalendarQuery(period.start, period.end);
@@ -680,17 +680,17 @@ agendaListbox.refreshCalendarQuery = fun
 };
 
 /**
  * Sets up the calendar for the agenda listbox.
  */
 agendaListbox.setupCalendar = function() {
     this.init();
     if (this.calendar == null) {
-        this.calendar = cal.getCompositeCalendar(window);
+        this.calendar = cal.view.getCompositeCalendar(window);
     }
     if (this.calendar) {
         // XXX This always gets called, does that happen on purpose?
         this.calendar.removeObserver(this.calendarObserver);
     }
     this.calendar.addObserver(this.calendarObserver);
     if (this.mListener) {
         this.mListener.updatePeriod();
--- a/calendar/base/content/calendar-common-sets.js
+++ b/calendar/base/content/calendar-common-sets.js
@@ -290,17 +290,17 @@ var calendarController = {
             case "calendar_modify_event_command":
                 editSelectedEvents();
                 break;
             case "calendar_modify_focused_item_command": {
                 let focusedElement = document.commandDispatcher.focusedElement;
                 if (!focusedElement && this.defaultController && !this.isCalendarInForeground()) {
                     this.defaultController.doCommand(aCommand);
                 } else {
-                    let focusedRichListbox = cal.getParentNodeOrThis(focusedElement, "richlistbox");
+                    let focusedRichListbox = cal.view.getParentNodeOrThis(focusedElement, "richlistbox");
                     if (focusedRichListbox && focusedRichListbox.id == "agenda-listbox") {
                         agendaListbox.editSelectedItem();
                     } else if (focusedElement && focusedElement.className == "calendar-task-tree") {
                         modifyTaskFromContext();
                     } else if (this.isInMode("calendar")) {
                         editSelectedEvents();
                     }
                 }
@@ -309,17 +309,17 @@ var calendarController = {
             case "calendar_delete_event_command":
                 deleteSelectedEvents();
                 break;
             case "calendar_delete_focused_item_command": {
                 let focusedElement = document.commandDispatcher.focusedElement;
                 if (!focusedElement && this.defaultController && !this.isCalendarInForeground()) {
                     this.defaultController.doCommand(aCommand);
                 } else {
-                    let focusedRichListbox = cal.getParentNodeOrThis(focusedElement, "richlistbox");
+                    let focusedRichListbox = cal.view.getParentNodeOrThis(focusedElement, "richlistbox");
                     if (focusedRichListbox && focusedRichListbox.id == "agenda-listbox") {
                         agendaListbox.deleteSelectedItem(false);
                     } else if (focusedElement && focusedElement.className == "calendar-task-tree") {
                         deleteToDoCommand(null, false);
                     } else if (this.isInMode("calendar")) {
                         deleteSelectedEvents();
                     }
                 }
@@ -381,17 +381,17 @@ var calendarController = {
             case "calendar_publish_calendar_command":
                 publishEntireCalendar();
                 break;
             case "calendar_publish_selected_events_command":
                 publishCalendarData();
                 break;
 
             case "calendar_reload_remote_calendars":
-                cal.getCompositeCalendar(window).refresh();
+                cal.view.getCompositeCalendar(window).refresh();
                 break;
             case "calendar_show_unifinder_command":
                 toggleUnifinder();
                 break;
             case "calendar_view_next_command":
                 currentView().moveView(1);
                 break;
             case "calendar_view_prev_command":
--- a/calendar/base/content/calendar-management.js
+++ b/calendar/base/content/calendar-management.js
@@ -15,17 +15,17 @@ Components.utils.import("resource://gre/
 Components.utils.import("resource://gre/modules/Preferences.jsm");
 
 /**
  * Get this window's currently selected calendar.
  *
  * @return      The currently selected calendar.
  */
 function getSelectedCalendar() {
-    return cal.getCompositeCalendar(window).defaultCalendar;
+    return cal.view.getCompositeCalendar(window).defaultCalendar;
 }
 
 /**
  * Deletes the passed calendar, prompting the user if he really wants to do
  * this. If there is only one calendar left, no calendar is removed and the user
  * is not prompted.
  *
  * @param aCalendar     The calendar to delete.
@@ -82,17 +82,17 @@ function promptDeleteCalendar(aCalendar)
 }
 
 /**
  * Called to initialize the calendar manager for a window.
  */
 function loadCalendarManager() {
     // Set up the composite calendar in the calendar list widget.
     let tree = document.getElementById("calendar-list-tree-widget");
-    let compositeCalendar = cal.getCompositeCalendar(window);
+    let compositeCalendar = cal.view.getCompositeCalendar(window);
     tree.compositeCalendar = compositeCalendar;
 
     // Initialize our composite observer
     compositeCalendar.addObserver(compositeObserver);
 
     // Create the home calendar if no calendar exists.
     let calendars = cal.getCalendarManager().getCalendars({});
     if (calendars.length) {
@@ -109,17 +109,17 @@ function loadCalendarManager() {
     }
 }
 
 /**
  * Creates the initial "Home" calendar if no calendar exists.
  */
 function initHomeCalendar() {
     let calMgr = cal.getCalendarManager();
-    let composite = cal.getCompositeCalendar(window);
+    let composite = cal.view.getCompositeCalendar(window);
     let url = Services.io.newURI("moz-storage-calendar://");
     let homeCalendar = calMgr.createCalendar("storage", url);
     homeCalendar.name = cal.calGetString("calendar", "homeCalendarName");
     calMgr.registerCalendar(homeCalendar);
     Preferences.set("calendar.list.sortOrder", homeCalendar.id);
     composite.addCalendar(homeCalendar);
 
     // Wrapping this in a try/catch block, as if any of the migration code
@@ -134,17 +134,17 @@ function initHomeCalendar() {
 
     return homeCalendar;
 }
 
 /**
  * Called to clean up the calendar manager for a window.
  */
 function unloadCalendarManager() {
-    let compositeCalendar = cal.getCompositeCalendar(window);
+    let compositeCalendar = cal.view.getCompositeCalendar(window);
     compositeCalendar.setStatusObserver(null, null);
     compositeCalendar.removeObserver(compositeObserver);
 }
 
 /**
  * Updates the sort order preference based on the given event. The event is a
  * "SortOrderChanged" event, emitted from the calendar-list-tree binding. You
  * can also pass in an object like { sortOrder: "Space separated calendar ids" }
@@ -189,17 +189,17 @@ function calendarListTooltipShowing(even
  * @return              Returns true if the context menu should be shown.
  */
 function calendarListSetupContextMenu(event) {
     let col = {};
     let row = {};
     let calendar;
     let calendars = cal.getCalendarManager().getCalendars({});
     let treeNode = document.getElementById("calendar-list-tree-widget");
-    let composite = cal.getCompositeCalendar(window);
+    let composite = cal.view.getCompositeCalendar(window);
 
     if (document.popupNode.localName == "tree") {
         // Using VK_APPS to open the context menu will target the tree
         // itself. In that case we won't have a client point even for
         // opening the context menu. The "target" element should then be the
         // selected calendar.
         row.value = treeNode.tree.currentIndex;
         col.value = treeNode.getColumn("calendarname-treecol");
@@ -301,29 +301,29 @@ function ensureCalendarVisible(aCalendar
 }
 
 /**
  * Hides the specified calendar if it is visible, or shows it if it is hidden.
  *
  * @param aCalendar   The calendar to show or hide
  */
 function toggleCalendarVisible(aCalendar) {
-    let composite = cal.getCompositeCalendar(window);
+    let composite = cal.view.getCompositeCalendar(window);
     if (composite.getCalendarById(aCalendar.id)) {
         composite.removeCalendar(aCalendar);
     } else {
         composite.addCalendar(aCalendar);
     }
 }
 
 /**
  * Shows all hidden calendars.
  */
 function showAllCalendars() {
-    let composite = cal.getCompositeCalendar(window);
+    let composite = cal.view.getCompositeCalendar(window);
     let cals = cal.getCalendarManager().getCalendars({});
 
     composite.startBatch();
     for (let calendar of cals) {
         if (!composite.getCalendarById(calendar.id)) {
             composite.addCalendar(calendar);
         }
     }
@@ -331,17 +331,17 @@ function showAllCalendars() {
 }
 
 /**
  * Shows only the specified calendar, and hides all others.
  *
  * @param aCalendar   The calendar to show as the only visible calendar
  */
 function showOnlyCalendar(aCalendar) {
-    let composite = cal.getCompositeCalendar(window);
+    let composite = cal.view.getCompositeCalendar(window);
     let cals = composite.getCalendars({}) || [];
 
     composite.startBatch();
     for (let calendar of cals) {
         if (calendar.id != aCalendar.id) {
             composite.removeCalendar(calendar);
         }
     }
--- a/calendar/base/content/calendar-menus.xml
+++ b/calendar/base/content/calendar-menus.xml
@@ -15,17 +15,17 @@
       <field name="mType">null</field>;
       <field name="mPopupHandler">null</field>
       <field name="mParentMenuPopup">null</field>
 
       <constructor><![CDATA[
           Components.utils.import("resource://calendar/modules/calUtils.jsm");
 
           this.mPopupHandler = () => { this.changeMenuByPropertyName(); };
-          this.mParentMenuPopup = cal.getParentNodeOrThis(this, "menupopup");
+          this.mParentMenuPopup = cal.view.getParentNodeOrThis(this, "menupopup");
           this.mParentMenuPopup.addEventListener("popupshowing", this.mPopupHandler, true);
       ]]></constructor>
 
       <destructor><![CDATA[
           this.mParentMenuPopup.removeEventListener("popupshowing", this.mPopupHandler, true);
       ]]></destructor>
 
       <!-- This method checks a command which naming follows
@@ -52,17 +52,17 @@
                 let tasks = getSelectedTasks();
                 let tasksSelected = (tasks != null) && (tasks.length > 0);
                 if (tasksSelected) {
                     let task = tasks[0];
                     if (cal.isPropertyValueSame(tasks, this.mType)) {
                         propertyValue = task[this.mType];
                     }
                 } else {
-                    cal.applyAttributeToMenuChildren(this, "disabled", !tasksSelected);
+                    cal.view.applyAttributeToMenuChildren(this, "disabled", !tasksSelected);
                 }
             }
             if (propertyValue || propertyValue == 0) {
                 let command = document.getElementById("calendar_" + this.mType + "-" + propertyValue + "_command");
                 if (command) {
                     command.setAttribute("checked", "true");
                 }
             }
--- a/calendar/base/content/calendar-month-view.xml
+++ b/calendar/base/content/calendar-month-view.xml
@@ -325,17 +325,17 @@
           this.calendarView.controller.createNewEvent();
       ]]></handler>
       <handler event="click" button="0"><![CDATA[
           if (!(event.ctrlKey || event.metaKey)) {
               this.calendarView.setSelectedItems(0, []);
           }
       ]]></handler>
       <handler event="wheel"><![CDATA[
-          if (cal.getParentNodeOrThisByAttribute(event.originalTarget, "anonid", "day-label") == null) {
+          if (cal.view.getParentNodeOrThisByAttribute(event.originalTarget, "anonid", "day-label") == null) {
               if (this.dayitems.scrollHeight > this.dayitems.clientHeight) {
                   event.stopPropagation();
               }
           }
       ]]></handler>
     </handlers>
   </binding>
 
--- a/calendar/base/content/calendar-task-editing.js
+++ b/calendar/base/content/calendar-task-editing.js
@@ -148,25 +148,25 @@ var taskEdit = {
      */
     onLoad: function(aEvent) {
         // TODO use getElementsByClassName
         let taskEditFields = document.getElementsByAttribute("class", "task-edit-field");
         for (let i = 0; i < taskEditFields.length; i++) {
             taskEdit.onBlur({ target: taskEditFields[i] });
         }
 
-        cal.getCompositeCalendar(window).addObserver(taskEdit.compositeObserver);
+        cal.view.getCompositeCalendar(window).addObserver(taskEdit.compositeObserver);
         taskEdit.observedCalendar = getSelectedCalendar();
     },
 
     /**
      * Window load function to clean up all quick-add fields.
      */
     onUnload: function() {
-        cal.getCompositeCalendar(window).removeObserver(taskEdit.compositeObserver);
+        cal.view.getCompositeCalendar(window).removeObserver(taskEdit.compositeObserver);
         taskEdit.observedCalendar = null;
     },
 
     /**
      * Observer to watch for readonly, disabled and capability changes of the
      * observed calendar.
      *
      * @see calIObserver
--- a/calendar/base/content/calendar-task-tree.js
+++ b/calendar/base/content/calendar-task-tree.js
@@ -53,33 +53,33 @@ function changeContextMenuForTask(aEvent
     document.getElementById("task-context-menu-modify-todaypane").hidden =
         (idnode == "calendar-task-tree");
     document.getElementById("task-context-menu-filter-todaypane").hidden =
         (idnode == "calendar-task-tree");
     document.getElementById("task-context-menu-separator-filter").hidden =
         (idnode == "calendar-task-tree");
 
     let tasksSelected = (items.length > 0);
-    cal.applyAttributeToMenuChildren(aEvent.target, "disabled", !tasksSelected);
+    cal.view.applyAttributeToMenuChildren(aEvent.target, "disabled", !tasksSelected);
     if (calendarController.isCommandEnabled("calendar_new_todo_command") &&
         calendarController.isCommandEnabled("calendar_new_todo_todaypane_command")) {
         document.getElementById("calendar_new_todo_command").removeAttribute("disabled");
         document.getElementById("calendar_new_todo_todaypane_command").removeAttribute("disabled");
     } else {
         document.getElementById("calendar_new_todo_command").setAttribute("disabled", "true");
         document.getElementById("calendar_new_todo_todaypane_command").setAttribute("disabled", "true");
     }
 
     // make sure the "Paste" and "Cut" menu items are enabled
     goUpdateCommand("cmd_paste");
     goUpdateCommand("cmd_cut");
 
     // make sure the filter menu is enabled
     document.getElementById("task-context-menu-filter-todaypane").removeAttribute("disabled");
-    cal.applyAttributeToMenuChildren(document.getElementById("task-context-menu-filter-todaypane-popup"),
+    cal.view.applyAttributeToMenuChildren(document.getElementById("task-context-menu-filter-todaypane-popup"),
                                      "disabled", false);
 
     changeMenuForTask(aEvent);
 
     let menu = document.getElementById("task-context-menu-attendance-menu");
     setupAttendanceMenu(menu, items);
 }
 
--- a/calendar/base/content/calendar-task-tree.xml
+++ b/calendar/base/content/calendar-task-tree.xml
@@ -123,17 +123,17 @@
           this.mFilter = new calFilter();
 
           // set up the custom tree view
           let tree = document.getAnonymousElementByAttribute(this, "anonid", "calendar-task-tree");
           this.mTreeView.tree = tree;
           tree.view = this.mTreeView;
 
           // set up our calendar event observer
-          let composite = cal.getCompositeCalendar(window);
+          let composite = cal.view.getCompositeCalendar(window);
           composite.addObserver(this.mTaskTreeObserver);
 
           // set up the preference observer
           let branch = Services.prefs.getBranch("");
           branch.addObserver("calendar.", this);
 
 
           // we want to make several attributes on the column
@@ -168,17 +168,17 @@
                   }
               }
           }
       ]]></constructor>
       <destructor><![CDATA[
           Components.utils.import("resource://gre/modules/Services.jsm");
 
           // remove composite calendar observer
-          let composite = cal.getCompositeCalendar(window);
+          let composite = cal.view.getCompositeCalendar(window);
           composite.removeObserver(this.mTaskTreeObserver);
 
           // remove the preference observer
           let branch = Services.prefs.getBranch("");
           branch.removeObserver("calendar.", this);
 
           let widths = "";
           let ordinals = "";
@@ -512,32 +512,32 @@
                 if (item.priority > 0 && item.priority < 5) {
                     properties.push("highpriority");
                 } else if (item.priority > 5 && item.priority < 10) {
                     properties.push("lowpriority");
                 }
                 properties.push(cal.item.getProgressAtom(item));
 
                 // Add calendar name and id atom
-                properties.push("calendar-" + cal.formatStringForCSSRule(item.calendar.name));
-                properties.push("calendarid-" + cal.formatStringForCSSRule(item.calendar.id));
+                properties.push("calendar-" + cal.view.formatStringForCSSRule(item.calendar.name));
+                properties.push("calendarid-" + cal.view.formatStringForCSSRule(item.calendar.id));
 
                 // Add item status atom
                 if (item.status) {
                     properties.push("status-" + item.status.toLowerCase());
                 }
 
                 // Alarm status atom
                 if (item.getAlarms({}).length) {
                     properties.push("alarm");
                 }
 
                 // Task categories
                 properties = properties.concat(item.getCategories({})
-                                                   .map(cal.formatStringForCSSRule));
+                                                   .map(cal.view.formatStringForCSSRule));
 
                 return properties.join(" ");
             },
 
             // Called on the view when a cell in a non-selectable cycling
             // column (e.g., unread/flag/etc.) is clicked.
             cycleCell: function(aRow, aCol) {
                 let task = this.binding.mTaskArray[aRow];
@@ -954,17 +954,17 @@
             }
         ]]></body>
       </method>
 
       <!-- Called by event observers to update the display -->
       <method name="refresh">
         <parameter name="aFilter"/>
         <body><![CDATA[
-            let cals = cal.getCompositeCalendar(window).getCalendars({}) || [];
+            let cals = cal.view.getCompositeCalendar(window).getCalendars({}) || [];
             for (let calendar of cals) {
                 if (!calendar.getProperty("disabled")) {
                     this.refreshFromCalendar(calendar, aFilter);
                 }
             }
         ]]></body>
       </method>
 
--- a/calendar/base/content/calendar-unifinder.js
+++ b/calendar/base/content/calendar-unifinder.js
@@ -190,17 +190,17 @@ function prepareCalendarUnifinder() {
 
     // Add pref observer
     let branch = Services.prefs.getBranch("");
     branch.addObserver("calendar.", unifinderObserver);
 
     // Check if this is not the hidden window, which has no UI elements
     if (unifinderTree) {
         // set up our calendar event observer
-        let ccalendar = cal.getCompositeCalendar(window);
+        let ccalendar = cal.view.getCompositeCalendar(window);
         ccalendar.addObserver(unifinderObserver);
 
         kDefaultTimezone = cal.dtz.defaultTimezone;
 
         // Set up the filter
         unifinderTreeView.mFilter = new calFilter();
 
         // Set up the unifinder views.
@@ -239,17 +239,17 @@ function prepareCalendarUnifinder() {
     }
 }
 
 /**
  * Called when the window is unloaded to clean up any observers and listeners
  * added.
  */
 function finishCalendarUnifinder() {
-    let ccalendar = cal.getCompositeCalendar(window);
+    let ccalendar = cal.view.getCompositeCalendar(window);
     ccalendar.removeObserver(unifinderObserver);
 
     // Remove pref observer
     let branch = Services.prefs.getBranch("");
     branch.removeObserver("calendar.", unifinderObserver);
 
     let viewDeck = getViewDeck();
     if (viewDeck) {
@@ -688,31 +688,31 @@ var unifinderTreeView = {
         let item = this.eventArray[aRow];
         if (item.priority > 0 && item.priority < 5) {
             properties.push("highpriority");
         } else if (item.priority > 5 && item.priority < 10) {
             properties.push("lowpriority");
         }
 
         // Add calendar name atom
-        properties.push("calendar-" + cal.formatStringForCSSRule(item.calendar.name));
+        properties.push("calendar-" + cal.view.formatStringForCSSRule(item.calendar.name));
 
         // Add item status atom
         if (item.status) {
             properties.push("status-" + item.status.toLowerCase());
         }
 
         // Alarm status atom
         if (item.getAlarms({}).length) {
             properties.push("alarm");
         }
 
         // Task categories
         properties = properties.concat(item.getCategories({})
-                                           .map(cal.formatStringForCSSRule));
+                                           .map(cal.view.formatStringForCSSRule));
 
         return properties.join(" ");
     },
     getColumnProperties: function(aCol) { return ""; },
 
     isContainer: function() {
         return false;
     },
@@ -832,17 +832,17 @@ var unifinderTreeView = {
  * applying the current filter.
  */
 function refreshEventTree() {
     let field = document.getElementById("unifinder-search-field");
     if (field) {
         unifinderTreeView.mFilter.filterText = field.value;
     }
 
-    addItemsFromCalendar(cal.getCompositeCalendar(window),
+    addItemsFromCalendar(cal.view.getCompositeCalendar(window),
                          addItemsFromCompositeCalendarInternal);
 }
 
 /**
  * EXTENSION_POINTS
  * Filters the passed event array according to the currently applied filter.
  * Afterwards, applies the items to the unifinder view.
  *
--- a/calendar/base/content/calendar-view-core.xml
+++ b/calendar/base/content/calendar-view-core.xml
@@ -155,17 +155,17 @@
 
       <method name="setCSSClasses">
         <body><![CDATA[
             let item = this.mOccurrence;
             this.setAttribute("calendar-uri", item.calendar.uri.spec);
             this.setAttribute("calendar-id", item.calendar.id);
             let categoriesArray = item.getCategories({});
             if (categoriesArray.length > 0) {
-                let cssClassesArray = categoriesArray.map(cal.formatStringForCSSRule);
+                let cssClassesArray = categoriesArray.map(cal.view.formatStringForCSSRule);
                 this.setAttribute("categories", cssClassesArray.join(" "));
             }
 
             // Add alarm icons as needed.
             let alarms = item.getAlarms({});
             if (alarms.length && Preferences.get("calendar.alarms.indicator.show", true)) {
                 let iconsBox = document.getAnonymousElementByAttribute(this, "anonid", "alarm-icons-box");
                 cal.alarms.addReminderImages(iconsBox, alarms);
--- a/calendar/base/content/calendar-views.js
+++ b/calendar/base/content/calendar-views.js
@@ -249,17 +249,17 @@ function switchToView(aViewType) {
     // Anyone wanting to plug in a view needs to follow this naming scheme
     let view = document.getElementById(aViewType + "-view");
     viewDeck.selectedPanel = view;
 
     // Select the corresponding tab
     let viewTabs = document.getElementById("view-tabs");
     viewTabs.selectedIndex = getViewDeck().selectedIndex;
 
-    let compositeCal = cal.getCompositeCalendar(window);
+    let compositeCal = cal.view.getCompositeCalendar(window);
     if (view.displayCalendar != compositeCal) {
         view.displayCalendar = compositeCal;
         view.timezone = cal.dtz.defaultTimezone;
         view.controller = calendarViewController;
     }
 
     view.goToDay(selectedDay);
     view.setSelectedItems(currentSelection.length, currentSelection);
@@ -390,17 +390,17 @@ function updateStyleSheetForViews(aCalen
         let ruleString = '.calendar-color-box[calendar-id="' + aCalendar.id + '"] {} ';
         let ruleIndex = sheet.insertRule(ruleString, sheet.cssRules.length);
 
         ruleCache[aCalendar.id] = sheet.cssRules[ruleIndex];
     }
 
     let color = aCalendar.getProperty("color") || "#A8C2E1";
     ruleCache[aCalendar.id].style.backgroundColor = color;
-    ruleCache[aCalendar.id].style.color = cal.getContrastingTextColor(color);
+    ruleCache[aCalendar.id].style.color = cal.view.getContrastingTextColor(color);
 }
 
 /**
  * Category preferences observer. Used to update the stylesheets for category
  * colors.
  *
  * Note we need to keep the categoryPrefBranch variable outside of
  * initCategories since branch observers only live as long as the branch object
@@ -413,17 +413,17 @@ var categoryManagement = {
     initCategories: function() {
         categoryPrefBranch = Services.prefs.getBranch("calendar.category.color.");
         let categories = categoryPrefBranch.getChildList("");
 
         // Fix illegally formatted category prefs.
         for (let i in categories) {
             let category = categories[i];
             if (category.search(/[^_0-9a-z-]/) != -1) {
-                let categoryFix = cal.formatStringForCSSRule(category);
+                let categoryFix = cal.view.formatStringForCSSRule(category);
                 if (categoryPrefBranch.prefHasUserValue(categoryFix)) {
                     categories.splice(i, 1); // remove illegal name
                 } else {
                     let color = categoryPrefBranch.getCharPref(category);
                     categoryPrefBranch.setCharPref(categoryFix, color);
                     categoryPrefBranch.clearUserPref(category); // not usable
                     categories[i] = categoryFix;  // replace illegal name
                 }
@@ -652,17 +652,17 @@ function selectAllEvents() {
         },
         onGetResult: function(aCalendar, aStatus, aItemType, aDetail, aCount, aItems) {
             for (let item of aItems) {
                 items.push(item);
             }
         }
     };
 
-    let composite = cal.getCompositeCalendar(window);
+    let composite = cal.view.getCompositeCalendar(window);
     let filter = composite.ITEM_FILTER_CLASS_OCCURRENCES;
 
     if (currentView().tasksInView) {
         filter |= composite.ITEM_FILTER_TYPE_ALL;
     } else {
         filter |= composite.ITEM_FILTER_TYPE_EVENT;
     }
     if (currentView().showCompleted) {
--- a/calendar/base/content/dialogs/calendar-migration-dialog.js
+++ b/calendar/base/content/dialogs/calendar-migration-dialog.js
@@ -277,17 +277,17 @@ var gDataMigrator = {
                     // Remote subscription
                     // XXX check for duplicates
                     var url = Services.io.newURI(getRDFAttr(node, "remotePath"));
                     calendar = calManager.createCalendar("ics", url);
                 }
                 calendar.name = getRDFAttr(node, "name");
                 calendar.setProperty("color", getRDFAttr(node, "color"));
                 calManager.registerCalendar(calendar);
-                cal.getCompositeCalendar(window).addCalendar(calendar);
+                cal.view.getCompositeCalendar(window).addCalendar(calendar);
             }
             aCallback();
         }
 
         var migrators = [];
 
         // Look in our current profile directory, in case we're upgrading in
         // place
@@ -395,17 +395,17 @@ var gDataMigrator = {
                                 .createInstance(Components.interfaces.nsIConverterOutputStream);
                 convStream.init(stream, 'UTF-8');
                 convStream.writeString(str);
 
                 var calendar = gDataMigrator.importICSToStorage(tempFile);
                 calendar.name = "iCalendar"+i;
                 i++;
                 calManager.registerCalendar(calendar);
-                cal.getCompositeCalendar(window).addCalendar(calendar);
+                cal.view.getCompositeCalendar(window).addCalendar(calendar);
             }
             migLOG("icalMig making callback");
             aCallback();
         }
         var profileDir = this.dirService.get("ProfD", Components.interfaces.nsIFile);
         var icalSpec = profileDir.path;
         var diverge = icalSpec.indexOf("Thunderbird");
         if (diverge == -1) {
@@ -433,17 +433,17 @@ var gDataMigrator = {
         function evoMigrate(aDataDir, aCallback) {
             var i = 1;
             function evoDataMigrate(dataStore) {
                 migLOG("Migrating evolution data file in " + dataStore.path);
                 if (dataStore.exists()) {
                     var calendar = gDataMigrator.importICSToStorage(dataStore);
                     calendar.name = "Evolution " + (i++);
                     calManager.registerCalendar(calendar);
-                    cal.getCompositeCalendar(window).addCalendar(calendar);
+                    cal.view.getCompositeCalendar(window).addCalendar(calendar);
                 }
                 return dataStore.exists();
             }
 
             var calManager = cal.getCalendarManager();
             var dirs = aDataDir.directoryEntries;
             while (dirs.hasMoreElements()) {
                 var dataDir = dirs.getNext().QueryInterface(Components.interfaces.nsIFile);
@@ -485,17 +485,17 @@ var gDataMigrator = {
                     storage.name = name;
 
                     if (color) {
                         storage.setProperty("color", color);
                     }
                     calManager.registerCalendar(storage);
 
                     if (enabled) {
-                        cal.getCompositeCalendar(window).addCalendar(storage);
+                        cal.view.getCompositeCalendar(window).addCalendar(storage);
                     }
                 }
             }
             aCallback();
         }
 
         if (!this.dirService.has("LocalAppData")) {
             // We are probably not on windows
--- a/calendar/base/content/dialogs/calendar-print-dialog.js
+++ b/calendar/base/content/dialogs/calendar-print-dialog.js
@@ -156,17 +156,17 @@ function getPrintSettings(receiverFunc) 
                         }
                     }
                     settings.eventList = eventWithDueDate;
                 }
             }
         };
         let filter = getFilter(settings);
         if (filter) {
-            cal.getCompositeCalendar(window.opener).getItems(filter, 0, settings.start, settings.end, listener);
+            cal.view.getCompositeCalendar(window.opener).getItems(filter, 0, settings.start, settings.end, listener);
         } else {
             // No filter means no items, just complete with the empty list set above
             receiverFunc(settings);
         }
     } else {
         receiverFunc(settings);
     }
 }
@@ -299,17 +299,17 @@ function printAndClose() {
     });
     return false; // leave open
 }
 
 /**
  * Called when once a date has been selected in the datepicker.
  */
 function onDatePick() {
-    cal.calRadioGroupSelectItem("view-field", "custom-range");
+    cal.view.radioGroupSelectItem("view-field", "custom-range");
     setTimeout(refreshHtml, 0);
 }
 
 function eventsAndTasksOptions(targetId) {
     let checkbox = document.getElementById(targetId);
     let checked = checkbox.getAttribute("checked") == "true";
     // Workaround to make the checkbox persistent (bug 15232).
     checkbox.setAttribute("checked", checked ? "true" : "false");
--- a/calendar/base/content/dialogs/chooseCalendarDialog.xul
+++ b/calendar/base/content/dialogs/chooseCalendarDialog.xul
@@ -23,17 +23,17 @@
     <script type="application/javascript" src="chrome://calendar/content/calendar-ui-utils.js"/>
     <script type="application/javascript"><![CDATA[
         Components.utils.import("resource://calendar/modules/calUtils.jsm");
 
         function loadCalendars() {
             const calendarManager = Components.classes["@mozilla.org/calendar/manager;1"]
                                             .getService(Components.interfaces.calICalendarManager);
             var listbox = document.getElementById("calendar-list");
-            var composite = cal.getCompositeCalendar(window.opener);
+            var composite = cal.view.getCompositeCalendar(window.opener);
             var selectedIndex = 0;
             var calendars;
 
             if (window.arguments[0].calendars) {
                 calendars = window.arguments[0].calendars;
             } else {
                 calendars = calendarManager.getCalendars({});
             }
--- a/calendar/base/content/preferences/categories.js
+++ b/calendar/base/content/preferences/categories.js
@@ -100,17 +100,17 @@ var gCategoriesPane = {
             listbox.lastChild.remove();
         }
 
         for (let i = 0; i < gCategoryList.length; i++) {
             let newListItem = document.createElement("listitem");
             let categoryName = document.createElement("listcell");
             categoryName.setAttribute("id", gCategoryList[i]);
             categoryName.setAttribute("label", gCategoryList[i]);
-            let categoryNameFix = cal.formatStringForCSSRule(gCategoryList[i]);
+            let categoryNameFix = cal.view.formatStringForCSSRule(gCategoryList[i]);
             let categoryColor = document.createElement("listcell");
             try {
                 let colorCode = categoryPrefBranch.getCharPref(categoryNameFix);
                 categoryColor.setAttribute("id", colorCode);
                 categoryColor.setAttribute("style", "background-color: " + colorCode + ";");
             } catch (ex) {
                 categoryColor.setAttribute("label", noneLabel);
             }
@@ -141,17 +141,17 @@ var gCategoriesPane = {
         }
     },
 
     /**
      * Edits the currently selected category using the edit category dialog.
      */
     editCategory: function() {
         let list = document.getElementById("categorieslist");
-        let categoryNameFix = cal.formatStringForCSSRule(gCategoryList[list.selectedIndex]);
+        let categoryNameFix = cal.view.formatStringForCSSRule(gCategoryList[list.selectedIndex]);
         let currentColor = categoryPrefBranch.getCharPref(categoryNameFix, "");
 
         let params = {
             title: editTitle,
             category: gCategoryList[list.selectedIndex],
             color: currentColor
         };
         if (list.selectedItem) {
@@ -167,17 +167,17 @@ var gCategoriesPane = {
      * Removes the selected category.
      */
     deleteCategory: function() {
         let list = document.getElementById("categorieslist");
         if (list.selectedCount < 1) {
             return;
         }
 
-        let categoryNameFix = cal.formatStringForCSSRule(gCategoryList[list.selectedIndex]);
+        let categoryNameFix = cal.view.formatStringForCSSRule(gCategoryList[list.selectedIndex]);
         this.backupData(categoryNameFix);
         try {
             categoryPrefBranch.clearUserPref(categoryNameFix);
         } catch (ex) {
             // If the pref doesn't exist, don't bail out here.
         }
 
         // Remove category entry from listbox and gCategoryList.
@@ -228,17 +228,17 @@ var gCategoriesPane = {
             }
         }
 
         if (categoryName.length == 0) {
             Services.prompt.alert(null, null, noBlankCategories);
             return;
         }
 
-        let categoryNameFix = cal.formatStringForCSSRule(categoryName);
+        let categoryNameFix = cal.view.formatStringForCSSRule(categoryName);
         if (list.selectedIndex == -1) {
             this.backupData(categoryNameFix);
             gCategoryList.push(categoryName);
             if (categoryColor) {
                 categoryPrefBranch.setCharPref(categoryNameFix, categoryColor);
             }
         } else {
             this.backupData(categoryNameFix);
--- a/calendar/base/content/preferences/editCategory.js
+++ b/calendar/base/content/preferences/editCategory.js
@@ -9,17 +9,17 @@ Components.utils.import("resource://cale
 // Global variable, set to true if the user has picked a custom color.
 var customColorSelected = false;
 
 /**
  * Load Handler, called when the edit category dialog is loaded
  */
 function editCategoryLoad() {
     let winArg = window.arguments[0];
-    let color = winArg.color || cal.hashColor(winArg.category);
+    let color = winArg.color || cal.view.hashColor(winArg.category);
     let hasColor = !!winArg.color;
     document.getElementById("categoryName").value = winArg.category;
     document.getElementById("categoryColor").value = color;
     document.getElementById("useColor").checked = hasColor;
     customColorSelected = hasColor;
     document.title = winArg.title;
 
     toggleColor();
@@ -47,17 +47,17 @@ function categoryNameChanged() {
 
     // The user removed the category name, assign the color automatically again.
     if (newValue == "") {
         customColorSelected = false;
     }
 
     if (!customColorSelected && document.getElementById("useColor").checked) {
         // Color is wanted, choose the color based on the category name's hash.
-        document.getElementById("categoryColor").value = cal.hashColor(newValue);
+        document.getElementById("categoryColor").value = cal.view.hashColor(newValue);
     }
 }
 
 /**
  * Handler function to be called when the color picker's color has been changed.
  */
 function colorPickerChanged() {
     document.getElementById("useColor").checked = true;
--- a/calendar/base/content/widgets/calendar-list-tree.xml
+++ b/calendar/base/content/widgets/calendar-list-tree.xml
@@ -656,17 +656,17 @@
 
             // Get the calendar color
             let color = (calendar.getProperty("color") || "").substr(1);
 
             // Set up the calendar color (background)
             properties.push("color-" + (color || "default"));
 
             // Set a property to get the contrasting text color (foreground)
-            properties.push(cal.getContrastingTextColor(color || "a8c2e1"));
+            properties.push(cal.view.getContrastingTextColor(color || "a8c2e1"));
 
             let currentStatus = calendar.getProperty("currentStatus");
             if (!Components.isSuccessCode(currentStatus)) {
                 // 'readfailed' is supposed to "win" over 'readonly', meaning that
                 // if reading from a calendar fails there is no further need to also display
                 // information about 'readonly' status
                 properties.push("readfailed");
             } else if (calendar.readOnly) {
--- a/calendar/base/content/widgets/calendar-widgets.xml
+++ b/calendar/base/content/widgets/calendar-widgets.xml
@@ -583,17 +583,17 @@
 
       <!-- removes all dropShadows from the binding. Dropshadows are recognized
            as such by carrying an attribute "dropshadow" -->
       <method name="removeDropShadows">
         <body><![CDATA[
             // method that may be overwritten by derived bindings...
             if (this.calendarView.mDropShadows) {
                 for (let shadow of this.calendarView.mDropShadows) {
-                    cal.removeChildElementsByAttribute(shadow, "class", "dropshadow");
+                    cal.view.removeChildElementsByAttribute(shadow, "class", "dropshadow");
                 }
             }
             this.calendarView.mDropShadows = null;
         ]]></body>
       </method>
 
       <!-- By setting the attribute "dropbox" to "true" or "false" the
            dropshadows are added or removed -->
--- a/calendar/base/content/widgets/minimonth.xml
+++ b/calendar/base/content/widgets/minimonth.xml
@@ -131,17 +131,17 @@
     <implementation>
       <field name="kMinimonth">null</field>
       <field name="mPopup">null</field>
       <field name="mScrollYearsHandler">null</field>
       <field name="mPixelScrollDelta">0</field>
       <constructor><![CDATA[
           Components.utils.import("resource://calendar/modules/calUtils.jsm");
 
-          this.kMinimonth = cal.getParentNodeOrThis(this, "minimonth");
+          this.kMinimonth = cal.view.getParentNodeOrThis(this, "minimonth");
           document.getAnonymousElementByAttribute(this, "anonid", "back-button").kMinimonth = this.kMinimonth;
           document.getAnonymousElementByAttribute(this, "anonid", "today-button").kMinimonth = this.kMinimonth;
           document.getAnonymousElementByAttribute(this, "anonid", "forward-button").kMinimonth = this.kMinimonth;
 
           this.mScrollYearsHandler = this.scrollYears.bind(this);
           document.getAnonymousElementByAttribute(this, "anonid", "years-popup")
                   .addEventListener("wheel", this.mScrollYearsHandler, true);
       ]]></constructor>
@@ -183,17 +183,17 @@
                 this.kMinimonth.fireEvent("popuplisthidden");
             }
         ]]></body>
       </method>
 
       <method name="onMonthsPopupCommand">
         <parameter name="aItem"/>
         <body><![CDATA[
-            let popup = cal.getParentNodeOrThis(aItem, "menupopup");
+            let popup = cal.view.getParentNodeOrThis(aItem, "menupopup");
             let triggerNode = popup.triggerNode || popup.anchorNode;
             let deck = triggerNode.parentNode;
 
             this.hidePopupList();
             this.kMinimonth.switchMonth(aItem.getAttribute("index"));
 
             deck.childNodes[deck.selectedIndex].focus();
         ]]></body>
@@ -235,17 +235,17 @@
                 year.setFullYear(curfullYear + 1);
             }
         ]]></body>
       </method>
 
       <method name="scrollYears">
         <parameter name="event"/>
         <body><![CDATA[
-            let yearPopup = cal.getParentNodeOrThis(event.target, "menupopup");
+            let yearPopup = cal.view.getParentNodeOrThis(event.target, "menupopup");
             const pixelThreshold = 75;
             if (yearPopup) {
                 let monthList = yearPopup.getElementsByAttribute("class", "minimonth-list");
                 if (monthList && monthList.length > 0) {
                     if (event.deltaMode == event.DOM_DELTA_PAGE) {
                         let dir = event.deltaY > 0 ? "up" : "down";
                         this.moveYears(dir, Math.abs(event.deltaY) * monthList.length);
                     } else if (event.deltaMode == event.DOM_DELTA_LINE) {
@@ -462,17 +462,17 @@
           let branch = Services.prefs.getBranch("");
           branch.addObserver("calendar.", this);
       ]]></constructor>
 
       <destructor><![CDATA[
           Components.utils.import("resource://gre/modules/Services.jsm");
 
           if (this.mObservesComposite == true) {
-              cal.getCompositeCalendar(window).removeObserver(this);
+              cal.view.getCompositeCalendar(window).removeObserver(this);
           }
 
           // Remove pref observer
           let branch = Services.prefs.getBranch("");
           branch.removeObserver("calendar.", this);
       ]]></destructor>
 
       <!-- calIOperationListener methods -->
@@ -1020,22 +1020,22 @@
         ]]></body>
       </method>
 
       <method name="_setFreeBusy">
         <parameter name="aFreeBusy"/>
         <body><![CDATA[
             if (aFreeBusy == true) {
                 if (this.mObservesComposite == false) {
-                    cal.getCompositeCalendar(window).addObserver(this);
+                    cal.view.getCompositeCalendar(window).addObserver(this);
                     this.mObservesComposite = true;
                     this.getItems();
                 }
             } else if (this.mObservesComposite == true) {
-                cal.getCompositeCalendar(window).removeObserver(this);
+                cal.view.getCompositeCalendar(window).removeObserver(this);
                 this.mObservesComposite = false;
             }
         ]]></body>
       </method>
 
       <method name="removeAttribute">
         <parameter name="aAttr"/>
         <body><![CDATA[
@@ -1062,17 +1062,17 @@
       </method>
 
       <method name="getItems">
         <parameter name="aCalendar"/>
         <body><![CDATA[
             // The minimonth automatically clears extra styles on a month change.
             // Therefore we only need to fill the minimonth with new info.
 
-            let calendar = aCalendar || cal.getCompositeCalendar(window);
+            let calendar = aCalendar || cal.view.getCompositeCalendar(window);
             let filter = calendar.ITEM_FILTER_COMPLETED_ALL |
                          calendar.ITEM_FILTER_CLASS_OCCURRENCES |
                          calendar.ITEM_FILTER_ALL_ITEMS;
 
             // Get new info
             calendar.getItems(filter,
                               0,
                               this.firstDate,
--- a/calendar/base/modules/calPrintUtils.jsm
+++ b/calendar/base/modules/calPrintUtils.jsm
@@ -27,17 +27,17 @@ cal.print = {
      * @param document      The document that contains <style id="sheet"/>.
      * @param categories    Array of categories to insert rules for.
      */
     insertCategoryRules: function(document, categories) {
         let sheet = document.getElementById("sheet");
         sheet.insertedCategoryRules = sheet.insertedCategoryRules || {};
 
         for (let category of categories) {
-            let prefName = cal.formatStringForCSSRule(category);
+            let prefName = cal.view.formatStringForCSSRule(category);
             let color = Preferences.get("calendar.category.color." + prefName) || "transparent";
             if (!(prefName in sheet.insertedCategoryRules)) {
                 sheet.insertedCategoryRules[prefName] = true;
                 let ruleAdd = ' .category-color-box[categories~="' + prefName + '"] { ' +
                               " border: 2px solid " + color + "; }\n";
                 sheet.textContent += ruleAdd;
             }
         }
@@ -54,20 +54,20 @@ cal.print = {
      */
     insertCalendarRules: function(document, calendar) {
         let sheet = document.getElementById("sheet");
         let color = calendar.getProperty("color") || "#A8C2E1";
         sheet.insertedCalendarRules = sheet.insertedCalendarRules || {};
 
         if (!(calendar.id in sheet.insertedCalendarRules)) {
             sheet.insertedCalendarRules[calendar.id] = true;
-            let formattedId = cal.formatStringForCSSRule(calendar.id);
+            let formattedId = cal.view.formatStringForCSSRule(calendar.id);
             let ruleAdd = ' .calendar-color-box[calendar-id="' + formattedId + '"] { ' +
                           " background-color: " + color + "; " +
-                          " color: " + cal.getContrastingTextColor(color) + "; }\n";
+                          " color: " + cal.view.getContrastingTextColor(color) + "; }\n";
             sheet.textContent += ruleAdd;
         }
     },
 
     /**
      * Serializes the given item by setting marked nodes to the item's content.
      * Has some expectations about the DOM document (in CSS-selector-speak), all
      * following nodes MUST exist.
@@ -91,26 +91,26 @@ cal.print = {
         // Fill in details of the item
         let itemInterval = cal.print.getItemIntervalString(item, boxDate);
         itemNode.querySelector(".item-interval").textContent = itemInterval;
         itemNode.querySelector(".item-title").textContent = item.title;
 
         // Fill in category details
         let categoriesArray = item.getCategories({});
         if (categoriesArray.length > 0) {
-            let cssClassesArray = categoriesArray.map(cal.formatStringForCSSRule);
+            let cssClassesArray = categoriesArray.map(cal.view.formatStringForCSSRule);
             itemNode.querySelector(".category-color-box")
                     .setAttribute("categories", cssClassesArray.join(" "));
 
             cal.print.insertCategoryRules(document, categoriesArray);
         }
 
         // Fill in calendar color
         itemNode.querySelector(".calendar-color-box")
-                .setAttribute("calendar-id", cal.formatStringForCSSRule(item.calendar.id));
+                .setAttribute("calendar-id", cal.view.formatStringForCSSRule(item.calendar.id));
         cal.print.insertCalendarRules(document, item.calendar);
 
         // Add it to the day container in the right order
         cal.binaryInsertNode(dayContainer, itemNode, item, cal.view.compareItems);
     },
 
     /**
      * Serializes the given item by setting marked nodes to the item's
--- a/calendar/providers/gdata/content/gdata-calendar-creation.js
+++ b/calendar/providers/gdata/content/gdata-calendar-creation.js
@@ -173,17 +173,17 @@ Components.utils.import("resource://gdat
                     }
                 }
             }
 
             let taskcals = tasksLists.map(function(tasklist) {
                 let uri = "googleapi://" + session.id + "/?tasks=" + encodeURIComponent(tasklist.id);
                 let calendar = calMgr.createCalendar("gdata", Services.io.newURI(uri));
                 calendar.id = cal.getUUID();
-                calendar.setProperty("color", cal.hashColor(tasklist.title));
+                calendar.setProperty("color", cal.view.hashColor(tasklist.title));
                 calendar.name = tasklist.title;
                 if (existing.has("tasks=" + tasklist.id)) {
                     calendar.readOnly = true;
                 }
                 return calendar;
             });
             let calcals = calendarList.map(function(calendarEntry) {
                 let uri = "googleapi://" + session.id + "/?calendar=" + encodeURIComponent(calendarEntry.id);
--- a/calendar/test/unit/test_utils.js
+++ b/calendar/test/unit/test_utils.js
@@ -48,19 +48,19 @@ function test_recentzones() {
     cal.dtz.saveRecentTimezone("Unknown");
     equal(cal.dtz.getRecentTimezones().length, 3);
     equal(cal.dtz.getRecentTimezones(true).length, 2);
 
     Preferences.set("calendar.timezone.local", oldDefaultTz);
 }
 
 function test_formatcss() {
-    equal(cal.formatStringForCSSRule(" "), "_");
-    equal(cal.formatStringForCSSRule("ü"), "-uxfc-");
-    equal(cal.formatStringForCSSRule("a"), "a");
+    equal(cal.view.formatStringForCSSRule(" "), "_");
+    equal(cal.view.formatStringForCSSRule("ü"), "-uxfc-");
+    equal(cal.view.formatStringForCSSRule("a"), "a");
 }
 
 function test_attendeeMatchesAddresses() {
     let a = cal.createAttendee("ATTENDEE:mailto:horst");
     ok(cal.attendeeMatchesAddresses(a, ["HORST", "peter"]));
     ok(!cal.attendeeMatchesAddresses(a, ["HORSTpeter", "peter"]));
     ok(!cal.attendeeMatchesAddresses(a, ["peter"]));