Back to index

lightning-sunbird  0.9+nobinonly
nsIMsgCompose.idl
Go to the documentation of this file.
00001 /* -*- Mode: idl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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  *   David Bienvenu - bienvenu@nventure.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 "nsIMsgCompFields.idl"
00041 #include "nsIMsgComposeParams.idl"
00042 
00043 %{C++
00044 #include "nsString.h"
00045 %}
00046 
00047 interface nsIMsgSend;
00048 interface nsIMsgIdentity;
00049 interface nsIMsgProgress;
00050 interface nsIDOMWindowInternal;
00051 interface nsIDOMWindow;
00052 interface nsIDOMNode;
00053 interface nsIEditor;
00054 interface nsIMsgWindow;
00055 
00056 typedef long MSG_ComposeSaveType;
00057 
00058 [scriptable, uuid(6953e50a-7531-11d3-85fe-006008948010)]
00059 interface nsIMsgCompSaveType {
00060     const long File     = 0;
00061     const long Template = 1;
00062     const long Draft    = 2;
00063 };
00064 
00065 typedef long MSG_DeliverMode;
00066 
00067 [scriptable, uuid(a9f27dd7-8f89-4de3-8fbf-41b789c16ee5)]
00068 interface nsIMsgCompDeliverMode {
00069     const long Now = 0;
00070     const long Later = 1;
00071     const long Save = 2;
00072     const long SaveAs = 3;
00073     const long SaveAsDraft = 4;
00074     const long SaveAsTemplate = 5;
00075     const long SendUnsent = 6;
00076     const long AutoSaveAsDraft = 7;
00077 };
00078 
00079 [scriptable, uuid(f38ea280-e090-11d3-a449-e3153319347c)]
00080 interface nsIMsgCompSendFormat {
00081     const long AskUser = 4;     /* Hack: Bug 44512. If this is 0 and passed
00082                                    as results.action to the askSendFormat
00083                                    dialog, the args object gets destroyed.*/
00084     const long PlainText = 1;
00085     const long HTML = 2;
00086     const long Both = 3;
00087 };
00088 
00089 [scriptable, uuid(9638af92-1dd1-11b2-bef1-ca5fee0abc62)]
00090 interface nsIMsgCompConvertible/*ToTXT*/ {
00091     const long Plain = 1;  // Like 4.x: Only <html>, <p>, <br>, ...
00092     const long Yes = 2;  // *Minor* alterations of the look: <ol>, <dd>, ...
00093     const long Altering = 3;  /* Look altered: <strong>, <i>, <h1>, ...
00094                                  Can be expressed in plaintext, but not in
00095                                  the way it looked in the HTML composer. */
00096     const long No = 4;  /* Will lose data: <font>, ...
00097                            Really *requires* visual formatting or
00098                            is not supported by our HTML->TXT converter. */
00099     /* The values here have meaning, they are "levels":
00100        convertible({a; b}) == max(convertible({a}), convertible({b}))
00101        must be true, i.e. the higher value counts. */
00102 };
00103 
00104 [scriptable, uuid(6ce49b2a-07dc-4783-b307-9a355423163f)]
00105 interface nsIMsgComposeStateListener : nsISupports
00106 {
00107        /* ... */
00108        void        NotifyComposeFieldsReady();
00109        void        ComposeProcessDone(in nsresult aResult);
00110        void        SaveInFolderDone(in string folderName);
00111        void        NotifyComposeBodyReady();
00112 };
00113 
00114 %{ C++
00115 /* TODO: we should create an interface for this enum! */
00116 typedef enum {
00117    eComposeFieldsReady,
00118    eComposeProcessDone,
00119    eSaveInFolderDone,
00120    eComposeBodyReady
00121 } TStateListenerNotification;
00122 %}
00123 
00124 native TStateListenerNotification(TStateListenerNotification);
00125 native nsString(nsString);
00126 [ref] native nsStringRef(nsString);
00127 
00128 /* recycling listener interface */
00129 [scriptable, uuid(0b28cc56-1dd2-11b2-bbe4-99e6a314f8ba)]
00130 interface nsIMsgComposeRecyclingListener : nsISupports {
00131   void onClose();
00132   void onReopen(in nsIMsgComposeParams params);
00133 };
00134 
00135 
00136 [scriptable, uuid(41A7933D-DAC3-4a42-AA88-373A7DEA9F12)]
00137 interface nsIMsgCompose : nsISupports {
00138 
00139   /* ... */
00140   void Initialize(in nsIDOMWindowInternal aWindow, in nsIMsgComposeParams aParams); 
00141 
00142   /* ... */
00143   void SetDocumentCharset(in string charset);
00144   
00145   /* ... */
00146   void RegisterStateListener(in nsIMsgComposeStateListener stateListener);
00147 
00148   /* ... */
00149   void UnregisterStateListener(in nsIMsgComposeStateListener stateListener);
00150 
00151   /* ... */
00152   void SendMsg(in MSG_DeliverMode deliverMode, in nsIMsgIdentity identity, in string accountKey, in nsIMsgWindow aMsgWindow, in nsIMsgProgress progress);
00153 
00154   /* ... */
00155   void CloseWindow(in boolean reclycleIt);
00156 
00157   /* ... */
00158   void abort();
00159     
00160   /* ... */
00161   void quoteMessage(in string msgURI);
00162 
00163   /*
00164     AttachmentPrettyName will return only the leafName if the it's a file URL.
00165     It will also convert the filename to Unicode assuming it's in  the file system 
00166     charset. In case of URL, |charset| parameter will be used in the conversion.
00167     This UI utility function should probably go into it's own class
00168   */
00169   AUTF8String AttachmentPrettyName(in string url, in string charset);
00170     
00171   /*
00172     CheckAndPopulateRecipients will perform several tasks:
00173       1) if populateMailList is true, it will populate mailing presents in the compose field
00174       2) if returnNoHTMLRecipients is true, build a list of non HTML recipient
00175       3) return the lowest common format preferred by recipients (unknown, plaintext or html)
00176   */
00177   unsigned long CheckAndPopulateRecipients(in boolean populateMailList, in boolean returnNonHTMLRecipients, out wstring nonHTMLRecipients);
00178   
00179   /* bodyConvertible: The level of "convertibility" to plaintext
00180    * @return a value from nsIMsgCompConvertible.
00181   */
00182   long bodyConvertible();
00183 
00184   /* SetSignature: will replace the curr.
00185   */
00186   void SetSignature(in nsIMsgIdentity identity);
00187 
00188   /* Check if the composing mail headers (and identity) can be converted to a mail charset.
00189   */
00190   boolean checkCharsetConversion(in nsIMsgIdentity identity, out string fallbackCharset);
00191 
00192   /* Retreive the message send object */
00193   readonly attribute nsIMsgSend messageSend;
00194   
00195        /* ... */
00196   readonly attribute nsIEditor editor;
00197 
00198        /* ... */
00199   readonly attribute nsIDOMWindowInternal domWindow;
00200 
00201        /* ... */
00202   readonly attribute nsIMsgCompFields compFields;
00203     
00204        /* ... */
00205   readonly attribute boolean composeHTML;
00206 
00207        /* ... */
00208   attribute MSG_ComposeType type;
00209 
00210        /* ... */
00211   readonly attribute long wrapLength;
00212 
00213   /* by reading this value, you can determine if yes or not the message has been mofified
00214      by the user. When you set this value to false, you reset the modification count
00215      of the body to 0 (clean).
00216   */
00217   attribute boolean bodyModified;
00218 
00219 
00227   void initEditor(in nsIEditor editor, in nsIDOMWindow contentWindow);
00228 
00229   /* The following functions are for internal use, essentially for the listener */
00230 
00231   /* Clear the editor */
00232   [noscript] void clearEditor();
00233 
00234   /* ... */
00235   [noscript] void setCiteReference(in nsString citeReference);
00236 
00237   /* Set the URI of the folder where the message has been saved */
00238   attribute string savedFolderURI;
00239 
00240   /* Append the signature defined in the identity to the msgBody */
00241   [noscript] void processSignature(in nsIMsgIdentity identity,
00242                                    in boolean aQuoted,
00243                                    inout nsString aMsgBody);
00244 
00245   /* set any reply flags on the original message's folder */
00246   [noscript] void processReplyFlags();
00247   [noscript] void rememberQueuedDisposition();
00248 
00249   /* ... */
00250   [noscript] void convertAndLoadComposeWindow(in nsStringRef aPrefix,
00251                                               in nsStringRef aBuf, 
00252                                               in nsStringRef aSignature,
00253                                               in boolean aQuoted,
00254                                               in boolean aHTMLEditor);
00255 
00256   /* Tell the doc state listeners that the doc state has changed */
00257   [noscript] void notifyStateListeners(in TStateListenerNotification aNotificationType, in nsresult aResult);
00258 
00259   /* Retreive the progress object */
00260   readonly attribute nsIMsgProgress progress;
00261   
00262   /* Retreive the external send listener */
00263   nsIMsgSendListener getExternalSendListener();
00264   
00265        /* ... */
00266   [noscript] void buildBodyMessageAndSignature();
00267   
00268        /* ... */
00269   [noscript] void buildQuotedMessageAndSignature();
00270 
00271        /* ... */
00272   [noscript] void getQuotingToFollow(out boolean quotingToFollow);
00273 
00274        /* ... */
00275   attribute nsIMsgComposeRecyclingListener recyclingListener;
00276   
00277   /* ... */
00278   attribute boolean recycledWindow;
00279   
00280   readonly attribute string originalMsgURI;
00281 
00282   attribute boolean deleteDraft;
00283 
00284   /* true when the compose window is in the process of inserting quoted content
00285      (i.e. via reply, forward inline or a quoting operation) into the document 
00286    */
00287   attribute boolean insertingQuotedContent;
00288 };
00289 
00290 /* send listener interface */
00291 [noscript, uuid(ACC72780-2CEA-11D5-9DAA-BACDEAC1EEFC)]
00292 interface nsIMsgComposeSendListener : nsISupports {
00293 
00294   void setMsgCompose(in nsIMsgCompose msgCompose);
00295   void setDeliverMode(in MSG_DeliverMode deliverMode);
00296  
00297 };