Back to index

lightning-sunbird  0.9+nobinonly
nsIMsgDBView.idl
Go to the documentation of this file.
00001 /* -*- Mode: IDL; tab-width: 4; 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) 2001
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #include "nsISupports.idl"
00039 #include "MailNewsTypes2.idl"
00040 
00041 interface nsIMsgFolder;
00042 interface nsIMsgWindow;
00043 interface nsIMessenger;
00044 interface nsIMsgDBHdr;
00045 interface nsIMsgDBViewCommandUpdater;
00046 interface nsIMsgDatabase;
00047 interface nsIMsgSearchSession;
00048 interface nsISimpleEnumerator;
00049 interface nsITreeView;
00050 interface nsIMsgCustomColumnHandler;
00051 
00052 typedef long nsMsgViewNotificationCodeValue;
00053 typedef long nsMsgViewCommandCheckStateValue;
00054 typedef long nsMsgViewCommandTypeValue;
00055 typedef long nsMsgNavigationTypeValue;
00056 
00057 [scriptable, uuid(682a18be-fd18-11d4-a5be-0060b0fc04b7)]
00058 interface nsMsgViewSortOrder
00059 {
00060        const nsMsgViewSortOrderValue none = 0;
00061        const nsMsgViewSortOrderValue ascending = 1;
00062        const nsMsgViewSortOrderValue descending = 2;
00063 };
00064 
00065 [scriptable, uuid(f28a1cdf-06c3-4e98-8f66-f49991670071)]
00066 interface nsMsgViewType {
00067     const nsMsgViewTypeValue eShowAllThreads = 0;
00068     const nsMsgViewTypeValue eShowThreadsWithUnread = 2;
00069     const nsMsgViewTypeValue eShowWatchedThreadsWithUnread = 3;
00070     const nsMsgViewTypeValue eShowQuickSearchResults = 4;
00071     const nsMsgViewTypeValue eShowVirtualFolderResults = 5;
00072     const nsMsgViewTypeValue eShowSearch = 6;
00073 };
00074 
00075 [scriptable, uuid(64852276-1dd2-11b2-8103-afe12002c053)]
00076 interface nsMsgViewFlagsType
00077 {
00081     const nsMsgViewFlagsTypeValue kNone = 0x0;
00082     const nsMsgViewFlagsTypeValue kThreadedDisplay = 0x1;
00083     const nsMsgViewFlagsTypeValue kShowIgnored = 0x8;
00084     const nsMsgViewFlagsTypeValue kUnreadOnly = 0x10;
00085     const nsMsgViewFlagsTypeValue kExpandAll = 0x20;
00086     const nsMsgViewFlagsTypeValue kGroupBySort = 0x40;
00087 };
00088 
00089 [scriptable, uuid(e8fdf9ca-9425-49de-b231-8d8fb51b8ee2)]
00090 interface nsMsgViewSortType
00091 {
00092   const nsMsgViewSortTypeValue byNone = 0x11; /* not sorted */
00093        const nsMsgViewSortTypeValue byDate = 0x12;
00094        const nsMsgViewSortTypeValue bySubject = 0x13;
00095        const nsMsgViewSortTypeValue byAuthor = 0x14;
00096        const nsMsgViewSortTypeValue byId = 0x15;
00097        const nsMsgViewSortTypeValue byThread = 0x16;
00098        const nsMsgViewSortTypeValue byPriority = 0x17;
00099        const nsMsgViewSortTypeValue byStatus = 0x18;
00100        const nsMsgViewSortTypeValue bySize = 0x19;
00101        const nsMsgViewSortTypeValue byFlagged = 0x1a;
00102        const nsMsgViewSortTypeValue byUnread = 0x1b;
00103        const nsMsgViewSortTypeValue byRecipient = 0x1c;
00104   const nsMsgViewSortTypeValue byLocation = 0x1d;
00105        const nsMsgViewSortTypeValue byTags = 0x1e;
00106        const nsMsgViewSortTypeValue byJunkStatus = 0x1f;
00107        const nsMsgViewSortTypeValue byAttachments = 0x20;
00108   const nsMsgViewSortTypeValue byAccount = 0x21;
00109   const nsMsgViewSortTypeValue byCustom = 0x22;
00110 };
00111 
00112 [scriptable, uuid(255d1c1e-fde7-11d4-a5be-0060b0fc04b7)]
00113 interface nsMsgViewNotificationCode
00114 {
00115   const nsMsgViewNotificationCodeValue none = 0;                      
00116                   /* No change; this call is just being used
00117                                                            to potentially nest other sets of calls
00118                                                            inside it.  The "where" and "num" parameters
00119                                                            are unused. */
00120   const nsMsgViewNotificationCodeValue insertOrDelete = 1;            
00121                   /* Some lines have been inserted or deleted.
00122                                                            The "where" parameter will indicate
00123                                                            the first line that has been added or
00124                                                            removed; the "num" parameter will indicate
00125                                                            how many lines, and will be positive on
00126                                                            an insertion and negative on a deletion. */
00127   const nsMsgViewNotificationCodeValue changed = 2;                   
00128                   /* Some lines have had their contents changed
00129                                                            (e.g., messages have been marked read
00130                                                            or something.)  "where" indicates the
00131                                                            first line with a change; "num" indicates
00132                                                            how many chaged. */
00133  const nsMsgViewNotificationCodeValue  scramble = 3;    
00134                      /* Everything changed.  Probably means we
00135                                                            resorted the folder.  We are still working
00136                                                            with the same set of items, or at least
00137                                                            have some overlap, but all the indices are
00138                                                            invalid.  The "where" and "num" parameters
00139                                                            are unused. */
00140   const nsMsgViewNotificationCodeValue all = 4;                       /* Everything changed.  We're now not
00141                                                            displaying anything like what we were; we
00142                                                            probably opened a new folder or something.
00143                                                            The FE needs to forget anything it ever knew
00144                                                            about what was being displayed, and start
00145                                                            over.  The "where" and "num" parameters are
00146                                                            unused.  */
00147   const nsMsgViewNotificationCodeValue totalContentChanged = 5;
00148                                                      /* Introduced for the address book to support
00149                                                            virtual list views.  The total number of
00150                                                            entries on the LDAP directory has changed
00151                                                            and the FE must update its scrollbar.  The
00152                                                            "num" parameter contains the total number of
00153                                                            entries on the LDAP server. */
00154   const nsMsgViewNotificationCodeValue newTopIndex = 6;        
00155                     /* Introduced for the address book to support
00156                                                            virtual list views.  The virtual list view
00157                                                            cache data has changed and the FE view may
00158                                                            be out of date.  The view should be updated
00159                                                            so that the first/top index in the view is
00160                                                            the index in the "where" parameter.  The
00161                                                            scrollbar should be updated to match the new
00162                                                            position. */
00163 
00164 };
00165 
00166 [scriptable, uuid(4ec9248e-0108-11d5-a5be-0060b0fc04b7)]
00167 interface nsMsgViewCommandCheckState
00168 {
00169   const nsMsgViewCommandCheckStateValue notUsed = 0;
00170   const nsMsgViewCommandCheckStateValue checked = 1;
00171   const nsMsgViewCommandCheckStateValue unchecked = 2;
00172 };
00173 
00174 [scriptable, uuid(ad36e6cc-0109-11d5-a5be-0060b0fc04b7)]
00175 interface nsMsgViewCommandType
00176 {
00177   const nsMsgViewCommandTypeValue markMessagesRead = 0;
00178   const nsMsgViewCommandTypeValue markMessagesUnread = 1;
00179   const nsMsgViewCommandTypeValue toggleMessageRead = 2;
00180                                                            
00181   const nsMsgViewCommandTypeValue flagMessages = 3;
00182   const nsMsgViewCommandTypeValue unflagMessages = 4;
00183 
00184   const nsMsgViewCommandTypeValue toggleThreadWatched = 6;
00185 
00186   const nsMsgViewCommandTypeValue deleteMsg = 7;
00187   const nsMsgViewCommandTypeValue deleteNoTrash = 8;
00188   const nsMsgViewCommandTypeValue markThreadRead = 9;
00189   const nsMsgViewCommandTypeValue markAllRead = 10;
00190   const nsMsgViewCommandTypeValue expandAll = 11;
00191   const nsMsgViewCommandTypeValue collapseAll = 12;
00192   
00193   const nsMsgViewCommandTypeValue copyMessages = 13;
00194   const nsMsgViewCommandTypeValue moveMessages = 14;
00195 
00196   const nsMsgViewCommandTypeValue selectAll = 15;
00197   const nsMsgViewCommandTypeValue downloadSelectedForOffline = 16;
00198   const nsMsgViewCommandTypeValue downloadFlaggedForOffline = 17;
00199 
00200   const nsMsgViewCommandTypeValue selectThread = 18;
00201   const nsMsgViewCommandTypeValue selectFlagged = 19;
00202   const nsMsgViewCommandTypeValue cmdRequiringMsgBody = 20;
00203   const nsMsgViewCommandTypeValue label0 = 21;
00204   const nsMsgViewCommandTypeValue label1 = 22;
00205   const nsMsgViewCommandTypeValue label2 = 23;
00206   const nsMsgViewCommandTypeValue label3 = 24;
00207   const nsMsgViewCommandTypeValue label4 = 25;
00208   const nsMsgViewCommandTypeValue label5 = 26;
00209   const nsMsgViewCommandTypeValue lastLabel = 26;
00210 
00211   const nsMsgViewCommandTypeValue junk = 27;
00212   const nsMsgViewCommandTypeValue unjunk = 28;
00213   const nsMsgViewCommandTypeValue undeleteMsg = 29;
00214 
00215   const nsMsgViewCommandTypeValue applyFilters = 30;
00216   const nsMsgViewCommandTypeValue runJunkControls = 31;
00217   const nsMsgViewCommandTypeValue deleteJunk = 32;
00218 };
00219 
00220 [scriptable, uuid(65903eb2-1dd2-11b2-ac45-c5b69c1618d7)]
00221 interface nsMsgNavigationType
00222 {
00223   const nsMsgNavigationTypeValue firstMessage = 1;
00224   const nsMsgNavigationTypeValue nextMessage = 2;
00225   const nsMsgNavigationTypeValue previousMessage = 3;
00226   const nsMsgNavigationTypeValue lastMessage = 4;
00230   const nsMsgNavigationTypeValue toggleThreadKilled = 5;
00231   const nsMsgNavigationTypeValue firstUnreadMessage = 6;
00232   const nsMsgNavigationTypeValue nextUnreadMessage = 7;
00233   const nsMsgNavigationTypeValue previousUnreadMessage = 8;
00234   const nsMsgNavigationTypeValue lastUnreadMessage = 9;
00235   const nsMsgNavigationTypeValue nextUnreadThread = 10;
00236   const nsMsgNavigationTypeValue nextUnreadFolder = 11;
00237   const nsMsgNavigationTypeValue nextFolder = 12;
00238   const nsMsgNavigationTypeValue readMore = 13;
00242   const nsMsgNavigationTypeValue back = 15;
00246   const nsMsgNavigationTypeValue forward = 16;
00247   const nsMsgNavigationTypeValue firstFlagged = 17;
00248   const nsMsgNavigationTypeValue nextFlagged = 18;
00249   const nsMsgNavigationTypeValue previousFlagged = 19;
00250   const nsMsgNavigationTypeValue firstNew = 20;
00251   const nsMsgNavigationTypeValue editUndo = 21;
00252   const nsMsgNavigationTypeValue editRedo = 22;
00253 };
00254 
00255 
00256 [scriptable, uuid(7a49bcaa-5367-476d-a3da-7f305b7afb90)]
00257 interface nsIMsgDBView : nsISupports
00258 {
00259     void open(in nsIMsgFolder folder, in nsMsgViewSortTypeValue sortType, in nsMsgViewSortOrderValue sortOrder, in nsMsgViewFlagsTypeValue viewFlags, out long count);
00260     void openWithHdrs(in nsISimpleEnumerator aHeaders, in nsMsgViewSortTypeValue aSortType, 
00261                         in nsMsgViewSortOrderValue aSortOrder, 
00262                         in nsMsgViewFlagsTypeValue aViewFlags, out long aCount);
00263     void close();
00264 
00265     void init(in nsIMessenger aMessengerInstance, in nsIMsgWindow aMsgWindow, in nsIMsgDBViewCommandUpdater aCommandUpdater);
00266 
00267     void sort(in nsMsgViewSortTypeValue sortType, in nsMsgViewSortOrderValue sortOrder);
00268 
00269     void doCommand(in nsMsgViewCommandTypeValue command);
00270     void doCommandWithFolder(in nsMsgViewCommandTypeValue command, in nsIMsgFolder destFolder);
00271     void getCommandStatus(in nsMsgViewCommandTypeValue command,
00272                                            out boolean selectable_p, out nsMsgViewCommandCheckStateValue selected_p);
00273 
00274     readonly attribute nsMsgViewTypeValue viewType;
00275     attribute nsMsgViewFlagsTypeValue viewFlags;
00276     attribute nsMsgViewSortTypeValue sortType;
00277     readonly attribute nsMsgViewSortOrderValue sortOrder;
00278     readonly attribute nsMsgKey keyForFirstSelectedMessage;
00279     readonly attribute nsMsgViewIndex viewIndexForFirstSelectedMsg;
00284     void viewNavigate(in nsMsgNavigationTypeValue motion, out nsMsgKey resultId, out nsMsgViewIndex resultIndex, out nsMsgViewIndex threadIndex, in boolean wrap);
00285 
00289     boolean navigateStatus(in nsMsgNavigationTypeValue motion);
00290 
00291     readonly attribute nsIMsgFolder msgFolder;
00292     attribute nsIMsgFolder viewFolder; // in the case of virtual folders, the VF db.
00293 
00294     nsMsgKey getKeyAt(in nsMsgViewIndex index);
00295     nsIMsgFolder getFolderForViewIndex(in nsMsgViewIndex index); // mainly for search
00296     string getURIForViewIndex(in nsMsgViewIndex index);
00297     nsIMsgDBView cloneDBView(in nsIMessenger aMessengerInstance, in nsIMsgWindow aMsgWindow, in nsIMsgDBViewCommandUpdater aCommandUpdater);
00298     void getURIsForSelection([array, size_is(count)] out string uris, out unsigned long count);
00299     void getIndicesForSelection([array, size_is(count)] out nsMsgViewIndex indices, out unsigned long count);
00300 
00301     readonly attribute string URIForFirstSelectedMessage;
00302     readonly attribute nsIMsgDBHdr hdrForFirstSelectedMessage;
00303     void loadMessageByMsgKey(in nsMsgKey aMsgKey);
00304     void loadMessageByViewIndex(in nsMsgViewIndex aIndex);
00305     void loadMessageByUrl(in string aUrl);
00306     void reloadMessage();
00307     void reloadMessageWithAllParts();
00308 
00309     readonly attribute unsigned long numSelected;
00310     readonly attribute nsMsgViewIndex msgToSelectAfterDelete; 
00311     readonly attribute nsMsgViewIndex currentlyDisplayedMessage; 
00312 
00313     // used by "go to folder" feature
00314        // and "remember last selected message" feature
00315        // if key is not found, we don't select.
00316     void selectMsgByKey(in nsMsgKey key);
00317 
00318     // we'll suppress displaying messages if the message pane is collapsed
00319     attribute boolean suppressMsgDisplay;
00320 
00321        // we'll suppress command updating during folder loading
00322        attribute boolean suppressCommandUpdating;
00323 
00324        //to notify tree that rows are going away
00325     void onDeleteCompleted(in boolean succeeded);
00326 
00327     readonly attribute nsIMsgDatabase db;
00328 
00329     readonly attribute boolean supportsThreading;
00330 
00331     attribute nsIMsgSearchSession searchSession;
00332     readonly attribute boolean removeRowOnMoveOrDelete; 
00333 
00334        nsMsgViewIndex findIndexFromKey(in nsMsgKey aMsgKey, in boolean aExpand);
00335     void ExpandAndSelectThreadByIndex(in nsMsgViewIndex aIndex, in boolean aAugment);
00336 
00337     // use lines or kB for size?
00338     readonly attribute boolean usingLines;
00339     
00340     // Custom Column Implementation note: see nsIMsgCustomColumnHandler
00341     
00342     // attaches a custom column handler to a specific column (can be a new column or a built in)
00343     void addColumnHandler(in AString aColumn, in nsIMsgCustomColumnHandler aHandler);
00344     
00345     // removes a custom column handler leaving the column to be handled by the system
00346     void removeColumnHandler(in AString aColumn);
00347     
00348     // returns the custom column handler attached to a specific column - if any
00349     nsIMsgCustomColumnHandler getColumnHandler(in AString aColumn);
00350 };
00351 
00352 /* this interface is rapidly morphing from a command updater interface into a more generic
00353    FE updater interface to handle changes in the view 
00354 */
00355 
00356 [scriptable, uuid(65FC9AD5-0912-11d5-9901-001083010E9B)]
00357 interface nsIMsgDBViewCommandUpdater : nsISupports
00358 {
00359        /* Eventually we'll flush this out into some kind of rich interface
00360           which may take specifc selection changed type notifications like
00361           no selections, single selection, multi-selection, etc. For starters,
00362           we are going to keep it generic. The back end will only push an update
00363           command status when the # of selected items changes.
00364        */
00365 
00366        void updateCommandStatus();
00367 
00368        /* displayed message has changed */
00369        void displayMessageChanged(in nsIMsgFolder aFolder, in wstring aSubject, in string aKeywords);
00370 
00375        void updateNextMessageAfterDelete();
00376 };