mozdev.org

contentgetter

resources:
ContentGetter Implementation

ContentGetter Implementation

 

          The ContentGetter UI consists of the preferences options and the run option.  The preferences option is overlayed onto the preferences page, and the run option is overlayed onto the tools menu. 

 

ContentGetter Preferences Overlay (PrefsOverlay.xul):

The preferences overlay consists of a XUL tree.  The tree has a single tree cell which links to the preferences page.

 

The Preferences Page (pref-getter0.xul):

The preferences page is a XUL page element containing the various checkboxes and textboxes you see when setting the contentgetter preferences.  In this file are also the functions to get and set the preferences.  The get function instantiates the contentgetter preferences component using XPConnect.  The methods of this object are then called using the data from the checkboxes and the directory textbox.  The same design is used for setting the preferences. 

 

The Overlay on the Tools menu (contentGetterOverlay.xul):

ContentGetter is run by selecting tools->contentgetter->run contentgetter.  This option is added using a XUL overlay.  This overlay calls a function in the same file which instantiates both the preferences component, and the contentgetter component.  The preferences component is used to determine if the preferences are already set, if they are not (if false is returned from getDirectory) then the user is told to set the preferences first.  If the preferences are set the method on the contentgetter component is called which saves the content.

 

The Preferences Component (contentgetterprefs.js):

The preferences component is used to get and set the contentgetter preferences.  This component uses an implementation of nsIPrefService to do this.  Four functions are defined:

·        getDirectory: This function will return the value (as an out parameter) of the directory value from Mozilla’s preferences.  If there is no directory set then false is returned. 

·        setDirectory:  This function will set the directory using the value from the preferences page text box.

·        setPrefs:  This function will set the remaining preferences.

·        GetPrefs: This function will get the remaining preferences.

 

The ContentGetter Component (contentgetter.js):

This component executes the functionality of contentgetter.  It uses the preferences set by the user and saves the content of the current page into the directory selected.

 

Manifest (/content/contents.rdf):

The manifest created using the Resource Description Framework syntax informs Mozilla where to overlay the preferences tree, and the menu item.  This connects the XUL UI to the Mozilla browser.

The contentgetter project can be contacted through the mailing list or the member list.
Copyright © 2000-2019. All rights reserved. Terms of Use & Privacy Policy.