Calendar:Dev Guide: Difference between revisions

 
(9 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<small>[[Calendar:Home Page|<< Back to Calendar Home Page]]</small>
{{Outdated}}
This page is a work in progress.  It is eventually meant to replace the old Developer's Guide at http://www.mozilla.org/projects/calendar/dev_guide.html
This page is a work in progress.  It is eventually meant to replace the old Developer's Guide at http://www.mozilla.org/projects/calendar/dev_guide.html


Line 14: Line 18:
*[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].
*[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].
*[http://lxr.mozilla.org/mozilla/source/calendar/lightning/ lightning/] contains files specific to Lighting.
*[http://lxr.mozilla.org/mozilla/source/calendar/lightning/ lightning/] contains files specific to Lighting.
*[http://lxr.mozilla.org/mozilla/source/calendar/locales/ locales/] contains the en-US strings. Alternative locales live in the /l10n repository.
*[http://lxr.mozilla.org/mozilla/source/calendar/providers/ providers/] See the Providers section of this document.
*[http://lxr.mozilla.org/mozilla/source/calendar/providers/ providers/] See the Providers section of this document.
*[http://lxr.mozilla.org/mozilla/source/calendar/resources/ resources/] is the original front-end directory.  Many front-end files live here.
*[http://lxr.mozilla.org/mozilla/source/calendar/resources/ resources/] is the original front-end directory.  Many front-end files live here.
Line 25: Line 30:
See also the backend [http://lxr.mozilla.org/mozilla/source/calendar/base/public/calICalendarManager.idl calCalendarManager interface].
See also the backend [http://lxr.mozilla.org/mozilla/source/calendar/base/public/calICalendarManager.idl calCalendarManager interface].
==== Sunbird ====
==== Sunbird ====
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/resources/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].  The previously used [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/calendarManager.js calendarManager.js] is now obsolete and not packaged with any current builds.  It will likely be removed from CVS soon.
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].


==== Lightning ====
==== Lightning ====
Line 34: Line 39:


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].
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].
The files [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/localCalDialog.xul lcoalCalDialog.xul], [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/localCalDialog.js lcoalCalDialog.js], [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/serverDialog.xul serverDialog.xul], and [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/serverDialog.js serverDialog.js] which were used for these tasks in Sunbird 0.2 are now obsolete.


== Task Lists ==
== Task Lists ==
Line 62: Line 65:
== Dialogs ==
== Dialogs ==
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
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
==== Sunbird ====
Sunbird's current event/task dialog is defined in [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/eventDialog.xul eventDialog.xul] and [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/eventDialog.js eventDialog.js]


The publishing 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]
==== Shared UI ====
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].
 
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]


==== Sunbird ====
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.
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.


==== Lightning ====
==== Lightning ====
Lightning's event/task 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].
None.


Lightning's publish dialog lives in [http://lxr.mozilla.org/mozilla/source/calendar/base/content/calendar-publish-dialog.xul calendar-publish-dialog.xul] and [http://lxr.mozilla.org/mozilla/source/calendar/base/content/calendar-publish-dialog.js calendar-publish-dialog.js].  At the time of this writing, its functionality is suspect.
==== Shared UI ====
None yet.  It is hoped to soon unite the publish dialogs, and implement the goToDate dialog in Lightning.


See also the backend section on 'Events/Tasks'
See also the backend section on 'Events/Tasks'
Line 81: Line 82:
== Preferences ==
== Preferences ==
==== Sunbird ====
==== Sunbird ====
The files controlling Sunbird's preferences are all in the [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/pref/ pref/] folder.  The files [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/pref/prefBird.xul prefBird.xul] and [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/pref/prefBirdOverly.xul prefBirdOverlay.xul] correspond to preferences that were used in the calendar.xpi, which is no longer supported.
The files controlling Sunbird's preferences are all in the [http://lxr.mozilla.org/mozilla/source/calendar/base/content/preferences/ calendar/base/content/preferences/] folder.
 
==== Lighting ====
==== Lighting ====
Lightning overlays a prefpane directly into Thunderbird'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]
Lightning overlays a prefpane directly into Thunderbird'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]


== Alarms ==
== Alarms ==
The alarm system is currently undergoing a rewrite in [https://bugzilla.mozilla.org/show_bug.cgi?id=298358 Bug 298358].
<strike>The alarm system is currently undergoing a rewrite in [https://bugzilla.mozilla.org/show_bug.cgi?id=298358 Bug 298358].</strike>
 
The referenced bug is no longer active, as it has been marked resolved.
 
<!-- Can someone "in the know" 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! -->


== Other useful files ==
== Other useful files ==
Line 121: Line 127:
Sunbird and Lighting only define 1 'real' 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'll also need to modify the jar.mn file for lightning, so that the component file can be added to the .xpi.
Sunbird and Lighting only define 1 'real' 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'll also need to modify the jar.mn file for lightning, so that the component file can be added to the .xpi.


= Potential Pitfalls =
[[category:calendar|Dev Guide]]
One of the most confusing aspects of the Sunbird code is often the fact that there are actually two calendar.xul files.  One can be found at [http://lxr.mozilla.org/mozilla/source/calendar/resources/content/calendar.xul resources/content/calendar.xul] and the other at [http://lxr.mozilla.org/mozilla/source/calendar/sunbird/base/content/calendar.xul sunbird/base/content/calendar.xul].  This is a vestige of the original sharing of code between Sunbird and the calendar extension.  The Sunbird build process uses the calendar.xul in the sunbird/ folder.  When making changes to one calendar.xul, please make changes to the other.  It's still theoretically possible to build the calendar extension, and we'd like to keep this possibility around as long as possible.
2

edits