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