1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 2001
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38 #include "nsISupports.idl"
39 #include "MailNewsTypes2.idl"
40
41 interface nsIMsgFolder;
42 interface nsIMsgWindow;
43 interface nsIMessenger;
44 interface nsIMsgDBHdr;
45 interface nsIMsgDBViewCommandUpdater;
46 interface nsIMsgDatabase;
47 interface nsIMsgSearchSession;
48 interface nsISimpleEnumerator;
49 interface nsITreeView;
50 interface nsIMsgCustomColumnHandler;
51
52 typedef long nsMsgViewNotificationCodeValue;
53 typedef long nsMsgViewCommandCheckStateValue;
54 typedef long nsMsgViewCommandTypeValue;
55 typedef long nsMsgNavigationTypeValue;
56
57 [scriptable, uuid(682a18be-fd18-11d4-a5be-0060b0fc04b7)]
58 interface nsMsgViewSortOrder
59 {
60 const nsMsgViewSortOrderValue none = 0;
61 const nsMsgViewSortOrderValue ascending = 1;
62 const nsMsgViewSortOrderValue descending = 2;
63 };
64
65 [scriptable, uuid(f28a1cdf-06c3-4e98-8f66-f49991670071)]
66 interface nsMsgViewType {
67 const nsMsgViewTypeValue eShowAllThreads = 0;
68 const nsMsgViewTypeValue eShowThreadsWithUnread = 2;
69 const nsMsgViewTypeValue eShowWatchedThreadsWithUnread = 3;
70 const nsMsgViewTypeValue eShowQuickSearchResults = 4;
71 const nsMsgViewTypeValue eShowVirtualFolderResults = 5;
72 const nsMsgViewTypeValue eShowSearch = 6;
73 };
74
75 [scriptable, uuid(64852276-1dd2-11b2-8103-afe12002c053)]
76 interface nsMsgViewFlagsType
77 {
78 /**
79 * flags for GetViewFlags
80 */
81 const nsMsgViewFlagsTypeValue kNone = 0x0;
82 const nsMsgViewFlagsTypeValue kThreadedDisplay = 0x1;
83 const nsMsgViewFlagsTypeValue kShowIgnored = 0x8;
84 const nsMsgViewFlagsTypeValue kUnreadOnly = 0x10;
85 const nsMsgViewFlagsTypeValue kExpandAll = 0x20;
86 const nsMsgViewFlagsTypeValue kGroupBySort = 0x40;
87 };
88
89 [scriptable, uuid(e8fdf9ca-9425-49de-b231-8d8fb51b8ee2)]
90 interface nsMsgViewSortType
91 {
92 const nsMsgViewSortTypeValue byNone = 0x11; /* not sorted */
93 const nsMsgViewSortTypeValue byDate = 0x12;
94 const nsMsgViewSortTypeValue bySubject = 0x13;
95 const nsMsgViewSortTypeValue byAuthor = 0x14;
96 const nsMsgViewSortTypeValue byId = 0x15;
97 const nsMsgViewSortTypeValue byThread = 0x16;
98 const nsMsgViewSortTypeValue byPriority = 0x17;
99 const nsMsgViewSortTypeValue byStatus = 0x18;
100 const nsMsgViewSortTypeValue bySize = 0x19;
101 const nsMsgViewSortTypeValue byFlagged = 0x1a;
102 const nsMsgViewSortTypeValue byUnread = 0x1b;
103 const nsMsgViewSortTypeValue byRecipient = 0x1c;
104 const nsMsgViewSortTypeValue byLocation = 0x1d;
105 const nsMsgViewSortTypeValue byTags = 0x1e;
106 const nsMsgViewSortTypeValue byJunkStatus = 0x1f;
107 const nsMsgViewSortTypeValue byAttachments = 0x20;
108 const nsMsgViewSortTypeValue byAccount = 0x21;
109 const nsMsgViewSortTypeValue byCustom = 0x22;
110 const nsMsgViewSortTypeValue byReceived = 0x23;
111 };
112
113 [scriptable, uuid(255d1c1e-fde7-11d4-a5be-0060b0fc04b7)]
114 interface nsMsgViewNotificationCode
115 {
116 const nsMsgViewNotificationCodeValue none = 0;
117 /* No change; this call is just being used to potentially nest other sets of calls
118 inside it. The "where" and "num" parameters are unused.
119 */
120 const nsMsgViewNotificationCodeValue insertOrDelete = 1;
121 /* Some lines have been inserted or deleted.
122 The "where" parameter will indicate the first line that has been added or
123 removed; the "num" parameter will indicate how many lines, and will be positive on
124 an insertion and negative on a deletion.
125 */
126 const nsMsgViewNotificationCodeValue changed = 2;
127 /* Some lines have had their contents changed (e.g., messages have been marked read
128 or something.) "where" indicates the first line with a change; "num" indicates
129 how many chaged.
130 */
131 const nsMsgViewNotificationCodeValue scramble = 3;
132 /* Everything changed. Probably means we resorted the folder. We are still working
133 with the same set of items, or at least have some overlap, but all the indices are
134 invalid. The "where" and "num" parameters are unused.
135 */
136 const nsMsgViewNotificationCodeValue all = 4;
137 /* Everything changed. We're now not displaying anything like what we were; we
138 probably opened a new folder or something. The FE needs to forget anything it ever knew
139 about what was being displayed, and start over. The "where" and "num" parameters are
140 unused.
141 */
142 const nsMsgViewNotificationCodeValue totalContentChanged = 5;
143 /* Introduced for the address book to support virtual list views. The total number of
144 entries on the LDAP directory has changed and the FE must update its scrollbar. The
145 "num" parameter contains the total number of entries on the LDAP server.
146 */
147 const nsMsgViewNotificationCodeValue newTopIndex = 6;
148 /* Introduced for the address book to support virtual list views. The virtual list view
149 cache data has changed and the FE view may be out of date. The view should be updated
150 so that the first/top index in the view is the index in the "where" parameter. The
151 scrollbar should be updated to match the new position.
152 */
153
154 };
155
156 [scriptable, uuid(4ec9248e-0108-11d5-a5be-0060b0fc04b7)]
157 interface nsMsgViewCommandCheckState
158 {
159 const nsMsgViewCommandCheckStateValue notUsed = 0;
160 const nsMsgViewCommandCheckStateValue checked = 1;
161 const nsMsgViewCommandCheckStateValue unchecked = 2;
162 };
163
164 [scriptable, uuid(ad36e6cc-0109-11d5-a5be-0060b0fc04b7)]
165 interface nsMsgViewCommandType
166 {
167 const nsMsgViewCommandTypeValue markMessagesRead = 0;
168 const nsMsgViewCommandTypeValue markMessagesUnread = 1;
169 const nsMsgViewCommandTypeValue toggleMessageRead = 2;
170
171 const nsMsgViewCommandTypeValue flagMessages = 3;
172 const nsMsgViewCommandTypeValue unflagMessages = 4;
173
174 const nsMsgViewCommandTypeValue toggleThreadWatched = 6;
175
176 const nsMsgViewCommandTypeValue deleteMsg = 7;
177 const nsMsgViewCommandTypeValue deleteNoTrash = 8;
178 const nsMsgViewCommandTypeValue markThreadRead = 9;
179 const nsMsgViewCommandTypeValue markAllRead = 10;
180 const nsMsgViewCommandTypeValue expandAll = 11;
181 const nsMsgViewCommandTypeValue collapseAll = 12;
182
183 const nsMsgViewCommandTypeValue copyMessages = 13;
184 const nsMsgViewCommandTypeValue moveMessages = 14;
185
186 const nsMsgViewCommandTypeValue selectAll = 15;
187 const nsMsgViewCommandTypeValue downloadSelectedForOffline = 16;
188 const nsMsgViewCommandTypeValue downloadFlaggedForOffline = 17;
189
190 const nsMsgViewCommandTypeValue selectThread = 18;
191 const nsMsgViewCommandTypeValue selectFlagged = 19;
192 const nsMsgViewCommandTypeValue cmdRequiringMsgBody = 20;
193 const nsMsgViewCommandTypeValue label0 = 21;
194 const nsMsgViewCommandTypeValue label1 = 22;
195 const nsMsgViewCommandTypeValue label2 = 23;
196 const nsMsgViewCommandTypeValue label3 = 24;
197 const nsMsgViewCommandTypeValue label4 = 25;
198 const nsMsgViewCommandTypeValue label5 = 26;
199 const nsMsgViewCommandTypeValue lastLabel = 26;
200
201 const nsMsgViewCommandTypeValue junk = 27;
202 const nsMsgViewCommandTypeValue unjunk = 28;
203 const nsMsgViewCommandTypeValue undeleteMsg = 29;
204
205 const nsMsgViewCommandTypeValue applyFilters = 30;
206 const nsMsgViewCommandTypeValue runJunkControls = 31;
207 const nsMsgViewCommandTypeValue deleteJunk = 32;
208 };
209
210 [scriptable, uuid(65903eb2-1dd2-11b2-ac45-c5b69c1618d7)]
211 interface nsMsgNavigationType
212 {
213 const nsMsgNavigationTypeValue firstMessage = 1;
214 const nsMsgNavigationTypeValue nextMessage = 2;
215 const nsMsgNavigationTypeValue previousMessage = 3;
216 const nsMsgNavigationTypeValue lastMessage = 4;
217 /**
218 * must match nsMsgViewCommandTypeValue toggleThreadKilled
219 */
220 const nsMsgNavigationTypeValue toggleThreadKilled = 5;
221 const nsMsgNavigationTypeValue firstUnreadMessage = 6;
222 const nsMsgNavigationTypeValue nextUnreadMessage = 7;
223 const nsMsgNavigationTypeValue previousUnreadMessage = 8;
224 const nsMsgNavigationTypeValue lastUnreadMessage = 9;
225 const nsMsgNavigationTypeValue nextUnreadThread = 10;
226 const nsMsgNavigationTypeValue nextUnreadFolder = 11;
227 const nsMsgNavigationTypeValue nextFolder = 12;
228 const nsMsgNavigationTypeValue readMore = 13;
229 /**
230 * Go back to the previous visited message
231 */
232 const nsMsgNavigationTypeValue back = 15;
233 /**
234 * Go forward to the previous visited message
235 */
236 const nsMsgNavigationTypeValue forward = 16;
237 const nsMsgNavigationTypeValue firstFlagged = 17;
238 const nsMsgNavigationTypeValue nextFlagged = 18;
239 const nsMsgNavigationTypeValue previousFlagged = 19;
240 const nsMsgNavigationTypeValue firstNew = 20;
241 const nsMsgNavigationTypeValue editUndo = 21;
242 const nsMsgNavigationTypeValue editRedo = 22;
243 const nsMsgNavigationTypeValue toggleSubthreadKilled = 23;
244 };
245
246
247 [scriptable, uuid(8b3de23c-09c8-484c-9269-d35cf7865b2a)]
248 interface nsIMsgDBView : nsISupports
249 {
250 void open(in nsIMsgFolder folder, in nsMsgViewSortTypeValue sortType, in nsMsgViewSortOrderValue sortOrder, in nsMsgViewFlagsTypeValue viewFlags, out long count);
251 void openWithHdrs(in nsISimpleEnumerator aHeaders, in nsMsgViewSortTypeValue aSortType,
252 in nsMsgViewSortOrderValue aSortOrder,
253 in nsMsgViewFlagsTypeValue aViewFlags, out long aCount);
254 void close();
255
256 void init(in nsIMessenger aMessengerInstance, in nsIMsgWindow aMsgWindow, in nsIMsgDBViewCommandUpdater aCommandUpdater);
257
258 void sort(in nsMsgViewSortTypeValue sortType, in nsMsgViewSortOrderValue sortOrder);
259
260 void doCommand(in nsMsgViewCommandTypeValue command);
261 void doCommandWithFolder(in nsMsgViewCommandTypeValue command, in nsIMsgFolder destFolder);
262 void getCommandStatus(in nsMsgViewCommandTypeValue command, out boolean selectable_p,
263 out nsMsgViewCommandCheckStateValue selected_p);
264
265 readonly attribute nsMsgViewTypeValue viewType;
266 attribute nsMsgViewFlagsTypeValue viewFlags;
267 attribute nsMsgViewSortTypeValue sortType;
268 readonly attribute nsMsgViewSortOrderValue sortOrder;
269 readonly attribute nsMsgKey keyForFirstSelectedMessage;
270 readonly attribute nsMsgViewIndex viewIndexForFirstSelectedMsg;
271 /**
272 * this method will automatically expand the destination thread,
273 * if needs be.
274 */
275 void viewNavigate(in nsMsgNavigationTypeValue motion, out nsMsgKey resultId, out nsMsgViewIndex resultIndex, out nsMsgViewIndex threadIndex, in boolean wrap);
276
277 /**
278 * Indicates if navigation of the passed motion type is valid.
279 */
280 boolean navigateStatus(in nsMsgNavigationTypeValue motion);
281
282 readonly attribute nsIMsgFolder msgFolder;
283 attribute nsIMsgFolder viewFolder; // in the case of virtual folders, the VF db.
284
285 nsMsgKey getKeyAt(in nsMsgViewIndex index);
286 nsIMsgFolder getFolderForViewIndex(in nsMsgViewIndex index); // mainly for search
287 ACString getURIForViewIndex(in nsMsgViewIndex index);
288 nsIMsgDBView cloneDBView(in nsIMessenger aMessengerInstance, in nsIMsgWindow aMsgWindow, in nsIMsgDBViewCommandUpdater aCommandUpdater);
289 void getURIsForSelection([array, size_is(count)] out string uris, out unsigned long count);
290 void getIndicesForSelection([array, size_is(count)] out nsMsgViewIndex indices, out unsigned long count);
291
292 readonly attribute ACString URIForFirstSelectedMessage;
293 readonly attribute nsIMsgDBHdr hdrForFirstSelectedMessage;
294 void loadMessageByMsgKey(in nsMsgKey aMsgKey);
295 void loadMessageByViewIndex(in nsMsgViewIndex aIndex);
296 void loadMessageByUrl(in string aUrl);
297 void reloadMessage();
298 void reloadMessageWithAllParts();
299
300 readonly attribute unsigned long numSelected;
301 readonly attribute nsMsgViewIndex msgToSelectAfterDelete;
302 readonly attribute nsMsgViewIndex currentlyDisplayedMessage;
303
304 // used by "go to folder" feature
305 // and "remember last selected message" feature
306 // if key is not found, we don't select.
307 void selectMsgByKey(in nsMsgKey key);
308
309 void selectFolderMsgByKey(in nsIMsgFolder aFolder, in nsMsgKey aKey);
310 // we'll suppress displaying messages if the message pane is collapsed
311 attribute boolean suppressMsgDisplay;
312
313 // we'll suppress command updating during folder loading
314 attribute boolean suppressCommandUpdating;
315
316 //to notify tree that rows are going away
317 void onDeleteCompleted(in boolean succeeded);
318
319 readonly attribute nsIMsgDatabase db;
320
321 readonly attribute boolean supportsThreading;
322
323 attribute nsIMsgSearchSession searchSession;
324 readonly attribute boolean removeRowOnMoveOrDelete;
325
326 nsMsgViewIndex findIndexFromKey(in nsMsgKey aMsgKey, in boolean aExpand);
327 void ExpandAndSelectThreadByIndex(in nsMsgViewIndex aIndex, in boolean aAugment);
328
329 // use lines or kB for size?
330 readonly attribute boolean usingLines;
331
332 // Custom Column Implementation note: see nsIMsgCustomColumnHandler
333
334 // attaches a custom column handler to a specific column (can be a new column or a built in)
335 void addColumnHandler(in AString aColumn, in nsIMsgCustomColumnHandler aHandler);
336
337 // removes a custom column handler leaving the column to be handled by the system
338 void removeColumnHandler(in AString aColumn);
339
340 // returns the custom column handler attached to a specific column - if any
341 nsIMsgCustomColumnHandler getColumnHandler(in AString aColumn);
342 };
343
344 /* this interface is rapidly morphing from a command updater interface into a more generic
345 FE updater interface to handle changes in the view
346 */
347
348 [scriptable, uuid(65FC9AD5-0912-11d5-9901-001083010E9B)]
349 interface nsIMsgDBViewCommandUpdater : nsISupports
350 {
351 /* Eventually we'll flush this out into some kind of rich interface
352 which may take specifc selection changed type notifications like
353 no selections, single selection, multi-selection, etc. For starters,
354 we are going to keep it generic. The back end will only push an update
355 command status when the # of selected items changes.
356 */
357
358 void updateCommandStatus();
359
360 /* displayed message has changed */
361 void displayMessageChanged(in nsIMsgFolder aFolder, in AString aSubject, in ACString aKeywords);
362
363 /**
364 * allows the backend to tell the front end to re-determine
365 * which message we should selet after a delete or move
366 */
367 void updateNextMessageAfterDelete();
368 };