pjs/mailnews/import/public/nsIImportAddressBooks.idl

180 строки
6.8 KiB
Plaintext

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
Interface for importing address books using the standard UI. Address
book import occurs in several forms (yuck!).
The destination can be 1..n new address books corresponding to the source
format. For instance a text file would import into a new address book
with the same name as the text file, Eudora may import multiple address books
with the same names as the ones in Eudora.
The destination can be 1 pre-defined address book, all entries will be
added to the supplied address book - this allows the address book UI so provide
an import command specific for an individual address book.
The source can import 1 or mulitple address books.
The address books can be auto-discoverable or user specified.
The address books can require field mapping or not.
All of this is rather complicated but it should work out OK.
1) The first UI
panel will allow selection of the address book and will indicate to the user
if the address book will be imported into an existing address book or new address
books. (This could be 2 separate xul UI's?).
2) The second panel will show field mapping if it is required - if it is required then
there will be one panel per address book for formats that support multiple
address books. If it is not required then there will be no second panel.
3) Show the progress dialog for the import - this could be per address book if
mapping is required? what to do, what to doooooo.....
4) All done, maybe a what was done panel??
*/
/*
*/
/*
*/
#include "nsISupports.idl"
interface nsIFile;
interface nsISupportsArray;
interface nsIImportABDescriptor;
interface nsIOutputStream;
interface nsIAddrDatabase;
interface nsIImportFieldMap;
[scriptable, uuid(d415da06-5d77-468d-aae4-9baaf5b3b6cc)]
interface nsIImportAddressBooks : nsISupports
{
/*
Does this interface supports 1 or 1..n address books. You only
get to choose 1 location so for formats where 1..n address books
are imported from a directory, then return true. For a 1 to 1 relationship
between location and address books return false.
*/
PRBool GetSupportsMultiple();
/*
If the address book is not found via a file location.then return true
along with a description string of how or where the address book is
located. If it is a file location then return false.
If true, return a string like: "Outlook Express standard address book,
also known as the Windows address book" or just "Outlook Express address book".
If false, GetDefaultLocation will be called.
*/
PRBool GetAutoFind( out wstring description);
/*
Returns true if the address book needs the user to specify a field map
for address books imported from this format.
*/
PRBool GetNeedsFieldMap( in nsIFile location);
/*
If found and userVerify BOTH return false, then it is assumed that this
means an error - mail cannot be found on this machine.
If userVerify is true, the user will have an opportunity to specify
a different location to import mail from.
*/
void GetDefaultLocation( out nsIFile location,
out boolean found,
out boolean userVerify);
/*
Returns an nsISupportsArray which contains an nsIImportABDescriptor for each
mailbox. The array is not sorted before display to the user. location is
null if GetAutoFind returned true.
*/
nsISupportsArray FindAddressBooks( in nsIFile location);
/*
Fill in defaults (if any) for a field map for importing address
books from this location.
*/
void InitFieldMap(in nsIImportFieldMap fieldMap);
/*
Import a specific mailbox into the destination file supplied. If an error
occurs that is non-fatal, the destination will be deleted and other mailbox's
will be imported. If a fatal error occurs, the destination will be deleted
and the import operation will abort.
*/
void ImportAddressBook( in nsIImportABDescriptor source,
in nsIAddrDatabase destination,
in nsIImportFieldMap fieldMap,
in boolean isAddrLocHome,
out wstring errorLog,
out wstring successLog,
out boolean fatalError);
/*
Return the amount of the address book that has been imported so far. This number
is used to present progress information and must never be larger than the
size specified in nsIImportABDescriptor.GetSize(); May be called from
a different thread than ImportAddressBook()
*/
unsigned long GetImportProgress();
/*
Set the location for reading sample data, this should be the same
as what is passed later to FindAddressBooks
*/
void SetSampleLocation( in nsIFile location);
/*
Return a string of sample data for a record, each field
is separated by a newline (which means no newlines in the fields!)
This is only supported by address books which use field maps and
is used by the field map UI to allow the user to properly
align fields to be imported.
*/
wstring GetSampleData( in long recordNumber, out boolean recordExists);
};
%{ C++
%}