<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.mozilla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jamescat</id>
	<title>MozillaWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.mozilla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jamescat"/>
	<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/Special:Contributions/Jamescat"/>
	<updated>2026-04-15T10:34:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.10</generator>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=Calendar:Dev_Guide&amp;diff=99010</id>
		<title>Calendar:Dev Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=Calendar:Dev_Guide&amp;diff=99010"/>
		<updated>2008-07-04T17:28:12Z</updated>

		<summary type="html">&lt;p&gt;Jamescat: /* Alarms */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;small&amp;gt;[[Calendar:Home Page|&amp;lt;&amp;lt; Back to Calendar Home Page]]&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Outdated}}&lt;br /&gt;
&lt;br /&gt;
This page is a work in progress.  It is eventually meant to replace the old Developer&#039;s Guide at http://www.mozilla.org/projects/calendar/dev_guide.html&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The Sunbird and Lightning code-bases can be roughly divided into the &#039;Front End&#039;, which corresponds to the XUL and js files that the user directly interacts with, and the &#039;Back End&#039;, which consists mainly of XPCOM components.&lt;br /&gt;
&lt;br /&gt;
As is often the case with software code, the actual code is usually the best resource.  There are a fair number of comments throughout the code that can help explain in greater detail what is going on.  This page is merely meant to give a &amp;quot;bird&#039;s eye&amp;quot; view of the code-base, to help provide entry points for searches.&lt;br /&gt;
&lt;br /&gt;
= Folder Structure =&lt;br /&gt;
All of the calendar-specific code lives in the [http://lxr.mozilla.org/mozilla/source/calendar/ calendar/] directory of the mozilla source tree.  Within there:&lt;br /&gt;
*[http://lxr.mozilla.org/mozilla/source/calendar/base/ base/] is meant to contain all of the files that are shared by both Lightning and Sunbird.  This rule is not strictly followed at this time though.&lt;br /&gt;
**[http://lxr.mozilla.org/mozilla/source/calendar/base/content/ base/content/] contains shared front-end code.&lt;br /&gt;
**[http://lxr.mozilla.org/mozilla/source/calendar/base/public/ base/public/] contains IDL files for all calendar-specific interfaces.&lt;br /&gt;
**[http://lxr.mozilla.org/mozilla/source/calendar/base/src/ base/src/] contains the actual code for all XPCOM components.&lt;br /&gt;
*[http://lxr.mozilla.org/mozilla/source/calendar/import-export/ import-export/] contains implementations of the [http://lxr.mozilla.org/mozilla/source/calendar/base/public/calIImportExport.idl import and export interfaces].&lt;br /&gt;
*[http://lxr.mozilla.org/mozilla/source/calendar/lightning/ lightning/] contains files specific to Lighting.&lt;br /&gt;
*[http://lxr.mozilla.org/mozilla/source/calendar/locales/ locales/] contains the en-US strings. Alternative locales live in the /l10n repository.&lt;br /&gt;
*[http://lxr.mozilla.org/mozilla/source/calendar/providers/ providers/] See the Providers section of this document.&lt;br /&gt;
*[http://lxr.mozilla.org/mozilla/source/calendar/resources/ resources/] is the original front-end directory.  Many front-end files live here.&lt;br /&gt;
*[http://lxr.mozilla.org/mozilla/source/calendar/sunbird/ sunbird/] Sunbird specific files.&lt;br /&gt;
&lt;br /&gt;
= Front End =&lt;br /&gt;
Start-up points: The front-end code in Sunbird begins to be called with the calendarInit() function in [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/calendar.js calendar.js].  In Lightning, the ltnOnLoad() function in [http://lxr.mozilla.org/mozilla/source/calendar/lightning/content/messenger-overlay-sidebar.js messenger-overlay-sidebar.js] is registered as an onload listener.  Note that backend components (especially the alarm-service) begin much earlier in the startup process.&lt;br /&gt;
== Calendar Management ==&lt;br /&gt;
Note: See also the backend Providers section for information on what actually makes up a calendar object.&lt;br /&gt;
&lt;br /&gt;
See also the backend [http://lxr.mozilla.org/mozilla/source/calendar/base/public/calICalendarManager.idl calCalendarManager interface].&lt;br /&gt;
==== Sunbird ====&lt;br /&gt;
Within Sunbird, all of the calendars that the user subscribes to are placed in a listbox within a tab in the upper-left of the display (as specified in [http://lxr.mozilla.org/mozilla/source/calendar/sunbird/base/content/calendar.xul calendar.xul]).  The code that builds this listbox, as well as other related code (such as the code that controls calendar colors) may be found in [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/calendarManagement.js calendarManagement.js].&lt;br /&gt;
&lt;br /&gt;
==== Lightning ====&lt;br /&gt;
Within Lightning, all of the calendars that the user subscribes to are placed in a tree in the tabbox in the lower left of the display, as specified in [http://lxr.mozilla.org/mozilla/source/calendar/lightning/content/messenger-overlay-sidebar.xul messenger-overlay-siderbar.xul]).  The equivalent of Sunbird&#039;s calendarManagement.js is [http://lxr.mozilla.org/mozilla/source/calendar/lightning/content/calendar-management.js calendar-management.js].&lt;br /&gt;
&lt;br /&gt;
==== Shared UI ====&lt;br /&gt;
Both Sunbird and Lightning use the Calendar Creation Wizard to provide the user with a way to create and subscribe to new calendars.  It is defined in [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/calendarCreation.xul calendarCreation.xul] and [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/calendarCreation.js calendarCreation.js].&lt;br /&gt;
&lt;br /&gt;
Both Sunbird and Lightning use the Calendar Properties dialog to allow the user to modify an existing calendar.  It is defined in [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/calendarProperties.xul calendarProperties.xul] and [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/calendarProperties.js calendarProperties.js].&lt;br /&gt;
&lt;br /&gt;
== Task Lists ==&lt;br /&gt;
The current status of the task lists is under review.&lt;br /&gt;
&lt;br /&gt;
== Event Lists ==&lt;br /&gt;
The current status of the event lists (agenda-tree vs. unifinder) is under review.&lt;br /&gt;
&lt;br /&gt;
== The Views ==&lt;br /&gt;
==== Shared UI ====&lt;br /&gt;
Both Sunbird and Lightning use a deck to display a series of views.  Each of these views implements the [http://lxr.mozilla.org/mozilla/source/calendar/base/public/calIDecoratedView.idl calIDecoratedView Interface].  Each of these decorated views inherits from [http://lxr.mozilla.org/mozilla/source/calendar/base/content/calendar-decorated-base.xml calendar-decorated-base.xml]  Within each of these decorated views is an embedded [http://lxr.mozilla.org/mozilla/source/calendar/base/public/calICalendarView.idl calICalendarView] object.&lt;br /&gt;
{| &lt;br /&gt;
| Decorated View || Embedded View &lt;br /&gt;
|- &lt;br /&gt;
| [http://lxr.mozilla.org/mozilla/source/calendar/base/content/calendar-decorated-month-view.xml calendar-decorated-month-view.xml] || [http://lxr.mozilla.org/mozilla/source/calendar/base/content/calendar-month-view.xml calendar-month-view.xml]&lt;br /&gt;
|- &lt;br /&gt;
| [http://lxr.mozilla.org/mozilla/source/calendar/base/content/calendar-decorated-multiweek-view.xml calendar-decorated-multiweek-view.xml] || [http://lxr.mozilla.org/mozilla/source/calendar/base/content/calendar-month-view.xml calendar-month-view.xml]&lt;br /&gt;
|- &lt;br /&gt;
| [http://lxr.mozilla.org/mozilla/source/calendar/base/content/calendar-decorated-week-view.xml calendar-decorated-week-view.xml] || [http://lxr.mozilla.org/mozilla/source/calendar/base/content/calendar-multiday-view.xml calendar-multiday-view.xml]&lt;br /&gt;
|- &lt;br /&gt;
| [http://lxr.mozilla.org/mozilla/source/calendar/base/content/calendar-decorated-day-view.xml calendar-decorated-day-view.xml] || [http://lxr.mozilla.org/mozilla/source/calendar/base/content/calendar-multiday-view.xml calendar-multiday-view.xml]&lt;br /&gt;
|}&lt;br /&gt;
Note: Only Sunbird implements the Multiweek view.&lt;br /&gt;
&lt;br /&gt;
Navigation (next/prev) is controlled within the actual xml files.  Switching of views, and interaction with exterior code is controlled (temporarily) in Sunbird by [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/calendarWindow.js calendarWindow.js] and in Lighting by parts of [http://lxr.mozilla.org/mozilla/source/calendar/lightning/content/messenger-overlay-sidebar.js messenger-overlay-sidebar.js]&lt;br /&gt;
== Dialogs ==&lt;br /&gt;
The main dialog that users interact with is the event/task creation/modification dialog.  This dialog is currently under review.  Both Sunbird and Lightning offer publish dialogs as well, and these too are under review&lt;br /&gt;
&lt;br /&gt;
==== Shared UI ====&lt;br /&gt;
Sunbird and Lightning share the event/task dialog. The dialog is defined in [http://lxr.mozilla.org/mozilla/source/calendar/base/content/calendar-event-dialog.xul calendar-event-dialog.xul] and [http://lxr.mozilla.org/mozilla/source/calendar/base/content/calendar-event-dialog.js calendar-event-dialog.js].  It also relies on code in [http://lxr.mozilla.org/mozilla/source/calendar/base/content/calendar-item-editing.js calendar-item-editing.js].&lt;br /&gt;
&lt;br /&gt;
Sunbird and Lightning share the publishing dialog. The dialog is defined in [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/publishDialog.xul publishDialog.xul] and [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/publishDialog.js publishDialog.js].  It also relies on code in [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/publish.js publish.js]&lt;br /&gt;
&lt;br /&gt;
==== Sunbird ====&lt;br /&gt;
Sunbird also offers a goToDate dialog ([http://lxr.mozilla.org/mozilla/source/calendar/resources/content/goToDateDialog.xul goToDateDialog.xul] and [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/goToDateDialog.js goToDateDialog.js]) and a printing dialog ([http://lxr.mozilla.org/mozilla/source/calendar/resources/content/printDialog.xul printDialog.xul] and [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/printDialog.js printDialog.js]).  Printing also relies on [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/calPrintEngine.xul calPrintEngine.xul] and [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/calPrintEngine.js calPrintEngine.js] for actual print-previews.&lt;br /&gt;
&lt;br /&gt;
==== Lightning ====&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See also the backend section on &#039;Events/Tasks&#039;&lt;br /&gt;
&lt;br /&gt;
== Preferences ==&lt;br /&gt;
==== Sunbird ====&lt;br /&gt;
The files controlling Sunbird&#039;s preferences are all in the [http://lxr.mozilla.org/mozilla/source/calendar/base/content/preferences/ calendar/base/content/preferences/] folder.&lt;br /&gt;
&lt;br /&gt;
==== Lighting ====&lt;br /&gt;
Lightning overlays a prefpane directly into Thunderbird&#039;s prefwindow.  This prefpane is defined in [http://lxr.mozilla.org/mozilla/source/calendar/lightning/content/lightning-preferences.xul lightning-preferences.xul] and [http://lxr.mozilla.org/mozilla/source/calendar/lightning/content/lightning-preferences.js lightning-preferences.js]&lt;br /&gt;
&lt;br /&gt;
== Alarms ==&lt;br /&gt;
&amp;lt;strike&amp;gt;The alarm system is currently undergoing a rewrite in [https://bugzilla.mozilla.org/show_bug.cgi?id=298358 Bug 298358].&amp;lt;/strike&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The referenced bug is no longer active, as it has been marked resolved.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Can someone &amp;quot;in the know&amp;quot; please replace this section with more current information on where to find the current pieces of the alarm system... with at least roughly the level of detail in other similar sections of this page? Thanks! --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful files ==&lt;br /&gt;
The [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/calendarUtils.js calendarUtils.js] file contains many common functions used in both Sunbird and Lightning.  It also contains the code for guessing the system timezone that the user is in.  Sunbird additionally offers a [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/applicationUtil.js applicationUtil.js] file that controls Sunbird specific utilities, such as opening the Extension/Theme managers.&lt;br /&gt;
&lt;br /&gt;
= Back End =&lt;br /&gt;
The back-end of Lightning and Sunbird consists largely of a series of XPCOM components that have been designed specifically for calendar-related purposes.  In most cases, these components implement a specific interface defined in an IDL file.  All of these interface definitions reside in [http://lxr.mozilla.org/mozilla/source/calendar/base/public/ public/] and contain substantial documentation on their use and implementation.  The back end  is entirely shared between all calendar applications and extensions. &lt;br /&gt;
&lt;br /&gt;
== SQLite ==&lt;br /&gt;
Sunbird/Lightning are now using the new [http://developer.mozilla.org/en/docs/mozStorage mozStorage] system to keep track of the majority of user-entered information.  There are several tables stored in the database.  The tables concerning calendar locations and preferences are defined [http://lxr.mozilla.org/mozilla/source/calendar/base/src/calCalendarManager.js#119 here] and those concerning events in individual calendars are defined [http://lxr.mozilla.org/mozilla/source/calendar/providers/storage/calStorageCalendar.js#1922 here].&lt;br /&gt;
&lt;br /&gt;
== Providers ==&lt;br /&gt;
There are currently 3 types of calendars that are available to the user, and 5 back-end types to support these.  Each of these calendar types must implement the [http://lxr.mozilla.org/mozilla/source/calendar/base/public/calICalendarProvider.idl calICalendarProvider interface].  Then, individual instances of a [http://lxr.mozilla.org/mozilla/source/calendar/base/public/calICalendar.idl calICalendar] object are created for each calendar the user subscribes to.&lt;br /&gt;
&lt;br /&gt;
*Local Calendars use the mozStorage (sqLite) system.  They are defined in [http://lxr.mozilla.org/mozilla/source/calendar/providers/storage/calStorageCalendar.js calStorageCalendar.js].&lt;br /&gt;
&lt;br /&gt;
*ICS (called &amp;quot;remote webdav&amp;quot; in the UI) calendars are defined in [http://lxr.mozilla.org/mozilla/source/calendar/providers/ics/calICSCalendar.js calICSCalendar.js]  They rely heavily on the [http://lxr.mozilla.org/mozilla/source/calendar/base/public/calIICSService.idl calIICSService].  With every ICS calendar a [http://lxr.mozilla.org/mozilla/source/calendar/providers/memory/calMemoryCalendar.js calMemeoryCalendar] is also created, to help improve speed.  ICS Calendars are built on top of the [http://lxr.mozilla.org/mozilla/source/calendar/libical/ libical.] component, which handles the lowest level parsing of ICS files.  All interactions with libical should go through calICSService.&lt;br /&gt;
&lt;br /&gt;
*Caldav (called &amp;quot;remote caldav&amp;quot; in the UI) calendars are defined in [http://lxr.mozilla.org/mozilla/source/calendar/providers/caldav/calDavCalendar.js calDavCalendar.js].&lt;br /&gt;
&lt;br /&gt;
Additionally, there is a special calendar type that has been created to reduce complexity the front-end code.  Rarely will the front end code interact with any of these calendars directly.  Instead, the calendar-management system will add and remove calendars from a [http://lxr.mozilla.org/mozilla/source/calendar/providers/composite/calCompositeCalendar.js calCompositeCalendar].  This calendar contains a collection of all the active (&amp;quot;check-marked&amp;quot;) calendars.  Asking it for events will return all events in all active calendars that meet the criteria specified.&lt;br /&gt;
&lt;br /&gt;
== Events/Tasks ==&lt;br /&gt;
Events are defined in the [http://lxr.mozilla.org/mozilla/source/calendar/base/public/calIEvent.idl calIEvent interface] and tasks similarly defined in the [http://lxr.mozilla.org/mozilla/source/calendar/base/public/calITodo.idl calITodo interface].  Each of these inherits from [http://lxr.mozilla.org/mozilla/source/calendar/base/public/calIItemBase.idl calIItemBase].&lt;br /&gt;
&lt;br /&gt;
Additionally, events and tasks rely on the majority of other interfaces defined.&lt;br /&gt;
&lt;br /&gt;
== Build System ==&lt;br /&gt;
The build system is magic.  Don&#039;t ask too many questions about it.  Hopefully XULRunner will simplify things.&lt;br /&gt;
=== Filling .jars ===&lt;br /&gt;
During the build process, the jar.mn file in each  directory of the calendar/ source is read.  Files referenced in there are added to the appropriate jar.  The syntax is fairly self-explanatory.  Note, however, that whenever you wish to add new files to the code, you must add an appropriate line to the relevant jar.mn file.&lt;br /&gt;
=== Registering Components ===&lt;br /&gt;
(someone check me on this)&lt;br /&gt;
Sunbird and Lighting only define 1 &#039;real&#039; component, in [http://lxr.mozilla.org/mozilla/source/calendar/base/src/calItemModule.js calItemModule.js].  This module then creates on-the-fly factories for most of the other components used.  To add a new component, you should add it to the array of components defined there.  See the patch on [https://bugzilla.mozilla.org/show_bug.cgi?id=298358 Bug 298358] for an example of how to do this.  Note that you&#039;ll also need to modify the jar.mn file for lightning, so that the component file can be added to the .xpi.&lt;br /&gt;
&lt;br /&gt;
[[category:calendar|Dev Guide]]&lt;/div&gt;</summary>
		<author><name>Jamescat</name></author>
	</entry>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=Help:Calculation&amp;diff=99009</id>
		<title>Help:Calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=Help:Calculation&amp;diff=99009"/>
		<updated>2008-07-04T17:26:45Z</updated>

		<summary type="html">&lt;p&gt;Jamescat: /* Without putting the result on the page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The software does not allow calculations, but one can use a [[piped link]] to a calculation with Google&#039;s calculator, with the label as answer, to demonstrate the numbers used in the computation. This way one can check for consistency, see the result with a higher accuracy, and also conveniently update the result.&lt;br /&gt;
&lt;br /&gt;
E.g., in the case of the population density in the [[w:Netherlands|Netherlands]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[google:16318199/33883|482/km²]]&amp;lt;/nowiki&amp;gt;, giving [[google:16318199/33883|482/km²]].&lt;br /&gt;
&lt;br /&gt;
With a suitable browser the evaluated expression pops up, so the link is useful even without following it.&lt;br /&gt;
&lt;br /&gt;
Suppose that someone updates the population figure but not the density, than the next person can see that the density is not based on the latest figure, replace the first number, press Preview, follow the link, copy the new result to the link label, and save. Thus the update requires a minimum of effort. &lt;br /&gt;
&lt;br /&gt;
Unfortunately, the result 482 has to be entered manually and consistency is not automatically maintained.&lt;br /&gt;
&lt;br /&gt;
==Without putting the result on the page==&lt;br /&gt;
&lt;br /&gt;
Alternatively, the user has to follow the link to see the result. Using [[template:popd]] is convenient and there is no redundancy, hence no worry about consistency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;{{popd|16318199|33883}}&amp;lt;/nowiki&amp;gt; gives:&lt;br /&gt;
&lt;br /&gt;
{{popd|16318199|33883}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- the output of the last &amp;quot;popd&amp;quot; gives km&amp;amp;amp;sup2 when output to the page, instead of km&amp;amp;sup2; ... if anyone knows how to fix the popd function in the wiki translation code (is it an upstream request for mediawiki??) that would be great. --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jamescat</name></author>
	</entry>
</feed>