calendar/import-export/CalListFormatter.jsm
author Khushil Mistry <khushil324@gmail.com>
Tue, 25 Feb 2020 12:48:44 +0200
changeset 37431 5958d77c395b5ec1df97b100215eeabd796e8924
parent 37400 calendar/import-export/calListFormatter.js@f61f27a35d891c977792cfdd4b10d1031b5ec10d
child 39075 18f27bc33168c576676908b2a9cdb34707fb89e2
permissions -rw-r--r--
Bug 1562313 - Convert most calendar JavaScript components (not calBackendLoader) to static registration. r=pmorris DONTBUILD

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var EXPORTED_SYMBOLS = ["CalListFormatter"];

var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");

/**
 * A thin wrapper around the html list exporter for the list print format.
 */
function CalListFormatter() {
  this.wrappedJSObject = this;
}

CalListFormatter.prototype = {
  QueryInterface: ChromeUtils.generateQI([Ci.calIPrintFormatter]),
  classID: Components.ID("{9ae04413-fee3-45b9-8bbb-1eb39a4cbd1b}"),

  get name() {
    return cal.l10n.getCalString("formatListName");
  },

  formatToHtml(aStream, aStart, aEnd, aItems, aTitle) {
    let htmlexporter = Cc["@mozilla.org/calendar/export;1?type=htmllist"].createInstance(
      Ci.calIExporter
    );
    htmlexporter.exportToStream(aStream, aItems, aTitle);
  },
};