Back to index

lightning-sunbird  0.9+nobinonly
nsIAbDirectory.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Seth Spitzer <sspitzer@netscape.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038  
00039 #include "nsISupports.idl"
00040 #include "nsIAbCard.idl"
00041 #include "nsISupportsArray.idl"
00042 
00043 [ptr] native nsFileSpec(nsFileSpec);
00044 
00045 %{C++
00046 #include "nsFileSpec.h"
00047 #include "nsDirPrefs.h"
00048 %}
00049 
00050 // used for when creating new directories
00051 // either from user input, or during bootstrapping
00052 [scriptable, uuid(f94812de-1dd1-11b2-b0ab-9eb5e055f712)]
00053 interface nsIAbDirectoryProperties : nsISupports {
00054   attribute AString description;
00055   attribute string URI;
00056   attribute string prefName;
00057   attribute string fileName;
00058   attribute unsigned long dirType;
00059   attribute unsigned long maxHits;
00060   attribute string authDn;
00061   attribute unsigned long syncTimeStamp;
00062   attribute long categoryId;
00063   attribute long position;
00064 };
00065 
00066 [scriptable, uuid(AA920C90-1DD1-11B2-96D3-AA81268ADAFC)]
00067 interface nsIAbDirectory : nsISupports {
00068 
00069        // Types of operation
00070        // Perform linear reading of directory card
00071        // content
00072     const long opRead = 0x1;
00073        // Perform modification and deletion on a
00074        // directories content
00075     const long opWrite = 0x2;
00076        // Perform searching on a directory card
00077        // content via the uri format:
00078        //     scheme://path?query
00079     const long opSearch = 0x4;
00080 
00081        // The supported operations
00082        readonly attribute long operations;
00083 
00084        // The description of the directory
00085     attribute wstring dirName;
00086     
00087     // will be used for LDAP replication
00088     attribute unsigned long  lastModifiedDate;
00089 
00090        // Defines whether this directory is a mail
00091        // list or not
00092        attribute PRBool isMailList;
00093 
00094   // Get the directory properties
00095   readonly attribute nsIAbDirectoryProperties directoryProperties;
00096 
00097        // Get the children directories
00098        readonly attribute nsISimpleEnumerator childNodes;
00099 
00100        // Get the cards associated with the directory
00101        // This will return the cards associated with
00102        // the mailing lists too
00103        readonly attribute nsIEnumerator childCards;
00104 
00105   // Modifies a top level directory, 
00106   // which also updates the preferences
00107   void modifyDirectory(in nsIAbDirectory directory, in nsIAbDirectoryProperties aProperties);
00108 
00109        // Deletes either a mailing list or a top
00110        // level directory, which also updates the
00111        // preferences
00112        void deleteDirectory(in nsIAbDirectory dierctory);
00113 
00114        // Delete the array of cards
00115        void deleteCards(in nsISupportsArray cards);
00116 
00117        // Check if directory contains card
00118        // If the implementation is asynchronous the card
00119        // may not yet have arrived. If it is in the process
00120        // of obtaining cards the method will throw an
00121        // NS_ERROR_NOT_AVAILABLE exception if the card
00122        // cannot be found.
00123        boolean hasCard(in nsIAbCard cards);
00124 
00125        // Check if directory contains directory
00126        boolean hasDirectory(in nsIAbDirectory dir);
00127 
00135     nsIAbCard addCard(in nsIAbCard card);
00136 
00137     void dropCard(in nsIAbCard card, in boolean needToCopyCard);
00138 
00142     readonly attribute boolean isRemote;
00143 
00147     readonly attribute boolean isSecure;
00148 
00152     readonly attribute boolean searchDuringLocalAutocomplete;
00153 
00154     // Mail list specific
00155     readonly attribute boolean supportsMailingLists;
00156 
00157         // XXX todo
00158         // fix this, ugh
00159        // This attribute servers two purposes 
00160        // depending if the directory is a mail list.
00161        // If not mail list directories are stored here
00162        // If so mail list card entries are stored here
00163        attribute nsISupportsArray addressLists;
00164 
00165        // Specific to a directory which stores mail lists
00166 
00167        // Creates a new mailing list in the directory
00168        // with the properties defined by list
00169        void addMailList (in nsIAbDirectory list);
00170 
00171   // Creates a new mailing list in the directory with
00172   // the properties defined by list and return a db key
00173   void addMailListWithKey (in nsIAbDirectory list, out PRUint32 key);
00174 
00175        // Specific to a directory which is a mail list
00176        attribute wstring listNickName;
00177        attribute wstring description;
00178 
00184        void editMailListToDatabase(in string uri, in nsIAbCard listCard);
00185 
00186        // Copies mail list properties from the srcList
00187        void copyMailList(in nsIAbDirectory srcList);
00188 
00189        /*
00190               Only creates a top level address book
00191               which is stored in the preferences
00192 
00193               Need to change to factory based approach
00194               to create new address books
00195 
00196               This method should become redundant or 
00197               be only associated with card folders
00198        */
00199     void createNewDirectory(in nsIAbDirectoryProperties aProperties);
00200 
00201     /* create a directory by passing the display name and address book uri */
00202        void createDirectoryByURI(in wstring displayName, in string uri, in boolean migrating);
00203 
00204        wstring getValueForCard(in nsIAbCard card, in string name);
00205        void setValueForCard(in nsIAbCard card, in string name, in wstring value);
00206 
00207   // the id of the directory used in prefs
00208        attribute ACString dirPrefId;
00209 };