1/*
2Open Tracker License
3
4Terms and Conditions
5
6Copyright (c) 1991-2001, Be Incorporated. All rights reserved.
7
8Permission is hereby granted, free of charge, to any person obtaining a copy of
9this software and associated documentation files (the "Software"), to deal in
10the Software without restriction, including without limitation the rights to
11use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
12of the Software, and to permit persons to whom the Software is furnished to do
13so, subject to the following conditions:
14
15The above copyright notice and this permission notice applies to all licensees
16and shall be included in all copies or substantial portions of the Software.
17
18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
20FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
23WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
25Except as contained in this notice, the name of Be Incorporated shall not be
26used in advertising or otherwise to promote the sale, use or other dealings in
27this Software without prior written authorization from Be Incorporated.
28
29BeMail(TM), Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
30of Be Incorporated in the United States and other countries. Other brand product
31names are registered trademarks or trademarks of their respective holders.
32All rights reserved.
33*/
34#ifndef _MAIL_WINDOW_H
35#define _MAIL_WINDOW_H
36
37
38#include <Entry.h>
39#include <Font.h>
40#include <List.h>
41#include <Locker.h>
42#include <Messenger.h>
43#include <Window.h>
44
45#include <E-mail.h>
46#include <mail_encoding.h>
47
48
49class TContentView;
50class TEnclosuresView;
51class THeaderView;
52class TMailApp;
53class TMenu;
54class TPrefsWindow;
55class TSignatureWindow;
56
57class BEmailMessage;
58class BFile;
59class BFilePanel;
60class BMailMessage;
61class BMenu;
62class BMenuBar;
63class BMenuItem;
64class BmapButton;
65class ButtonBar;
66class Words;
67
68class TMailWindow : public BWindow {
69	public:
70								TMailWindow(BRect frame, const char* title,
71									TMailApp* app, const entry_ref* ref,
72									const char* to, const BFont *font,
73									bool resending,
74									BMessenger* trackerMessenger);
75		virtual					~TMailWindow();
76
77		virtual	void			FrameResized(float width, float height);
78		virtual	void			MenusBeginning();
79		virtual	void			MessageReceived(BMessage*);
80		virtual	bool			QuitRequested();
81		virtual	void			Show();
82		virtual	void			Zoom(BPoint, float, float);
83		virtual	void			WindowActivated(bool state);
84
85				void			SetTo(const char* mailTo, const char* subject,
86									const char* ccTo = NULL,
87									const char* bccTo = NULL,
88									const BString* body = NULL,
89									BMessage* enclosures = NULL);
90				void			AddSignature(BMailMessage*);
91				void			Forward(entry_ref*, TMailWindow*,
92									bool includeAttachments);
93				void			Print();
94				void			PrintSetup();
95				void			Reply(entry_ref*, TMailWindow*, uint32);
96				void			CopyMessage(entry_ref* ref, TMailWindow* src);
97				status_t		Send(bool);
98				status_t		SaveAsDraft();
99				status_t		OpenMessage(const entry_ref* ref,
100									uint32 characterSetForDecoding
101										= B_MAIL_NULL_CONVERSION);
102
103				status_t		GetMailNodeRef(node_ref &nodeRef) const;
104				BEmailMessage*	Mail() const { return fMail; }
105
106				bool			GetTrackerWindowFile(entry_ref*,
107									bool dir) const;
108				void			SaveTrackerPosition(entry_ref*);
109				void			SetOriginatingWindow(BWindow* window);
110
111				void			PreserveReadingPos(bool save);
112				void			MarkMessageRead(entry_ref* message,
113									read_flags flag);
114				void			SetTrackerSelectionToCurrent();
115				TMailWindow*	FrontmostWindow();
116				void			UpdateViews();
117				void			UpdatePreferences();
118
119	protected:
120				void			SetTitleForMessage();
121				void			AddEnclosure(BMessage* msg);
122				void			BuildButtonBar();
123				status_t		TrainMessageAs(const char* commandWord);
124
125	private:
126				void			_UpdateSizeLimits();
127
128				status_t		_GetQueryPath(BPath* path) const;
129				void			_RebuildQueryMenu(bool firstTime = false);
130				char*			_BuildQueryString(BEntry* entry) const;
131
132 				void			_AddReadButton();
133				void			_UpdateReadButton();
134
135				void			_SetDownloading(bool downloading);
136
137				TMailApp*		fApp;
138
139				BEmailMessage*	fMail;
140				entry_ref*		fRef;
141					// Reference to currently displayed file
142				int32			fFieldState;
143				BFilePanel*		fPanel;
144				BMenuBar*		fMenuBar;
145				BMenuItem*		fAdd;
146				BMenuItem*		fCut;
147				BMenuItem*		fCopy;
148				BMenuItem*		fHeader;
149				BMenuItem*		fPaste;
150				BMenuItem*		fPrint;
151				BMenuItem*		fPrintSetup;
152				BMenuItem*		fQuote;
153				BMenuItem*		fRaw;
154				BMenuItem*		fRemove;
155				BMenuItem*		fRemoveQuote;
156				BMenuItem*		fSendNow;
157				BMenuItem*		fSendLater;
158				BMenuItem*		fUndo;
159				BMenuItem*		fRedo;
160				BMenuItem*		fNextMsg;
161				BMenuItem*		fPrevMsg;
162				BMenuItem*		fDeleteNext;
163				BMenuItem*		fSpelling;
164				BMenu*			fSaveAddrMenu;
165
166				BMenu*			fQueryMenu;
167				BMenu*			fLeaveStatusMenu;
168
169				ButtonBar*		fButtonBar;
170				BmapButton*		fSendButton;
171				BmapButton*		fSaveButton;
172				BmapButton*		fPrintButton;
173				BmapButton*		fSigButton;
174
175				BRect			fZoom;
176				TContentView*	fContentView;
177				THeaderView*	fHeaderView;
178				TEnclosuresView* fEnclosuresView;
179				TMenu*			fSignature;
180
181				BMessenger		fTrackerMessenger;
182					// Talks to tracker window that this was launched from.
183				BMessenger		fMessengerToSpamServer;
184
185				entry_ref		fPrevRef;
186				entry_ref		fNextRef;
187				bool			fPrevTrackerPositionSaved : 1;
188				bool			fNextTrackerPositionSaved : 1;
189
190				entry_ref		fOpenFolder;
191
192				bool			fSigAdded : 1;
193				bool			fIncoming : 1;
194				bool			fReplying : 1;
195				bool			fResending : 1;
196				bool			fSent : 1;
197				bool			fDraft : 1;
198				bool			fChanged : 1;
199
200				static BList	sWindowList;
201				static BLocker	sWindowListLock;
202
203				entry_ref		fRepliedMail;
204				BMessenger*		fOriginatingWindow;
205
206				bool			fAutoMarkRead : 1;
207				BmapButton*		fReadButton;
208				BmapButton*		fNextButton;
209
210				bool			fKeepStatusOnQuit;
211
212				bool			fDownloading;
213};
214
215#endif // _MAIL_WINDOW_H
216
217