xref: /haiku/src/apps/mail/MailApp.h (revision c302a243e15e640fae0f689e32cdf0c18749afee)
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_APP_H
35 #define _MAIL_APP_H
36 
37 
38 #include <Application.h>
39 #include <Catalog.h>
40 #include <Entry.h>
41 #include <Font.h>
42 #include <List.h>
43 #include <String.h>
44 
45 #include "People.h"
46 #include "QueryList.h"
47 
48 
49 class BFile;
50 class BMessenger;
51 class TMailWindow;
52 class TPrefsWindow;
53 class TSignatureWindow;
54 
55 
56 class TMailApp : public BApplication {
57 	public:
58 								TMailApp();
59 		virtual					~TMailApp();
60 
61 		virtual	void			ArgvReceived(int32, char**);
62 		virtual	void			MessageReceived(BMessage*);
63 		virtual	bool			QuitRequested();
64 		virtual	void			ReadyToRun();
65 		virtual	void			RefsReceived(BMessage*);
66 
67 				TMailWindow*	FindWindow(const entry_ref&);
68 				void			FontChange();
69 				TMailWindow*	NewWindow(const entry_ref* rec = NULL,
70 									const char* to = NULL, bool resend = false,
71 									BMessenger* messenger = NULL);
72 
73 				void			SetPrintSettings(const BMessage* settings);
74 				bool			HasPrintSettings();
75 				BMessage		PrintSettings();
76 
77 				void			SetLastWindowFrame(BRect frame);
78 
79 				// TODO: move these into a MailSettings class
80 				bool			AutoMarkRead();
81 				BString			Signature();
82 				BString			ReplyPreamble();
83 				bool			WrapMode();
84 				bool			AttachAttributes();
85 				bool			ColoredQuotes();
86 				uint8			ShowToolBar();
87 				bool			WarnAboutUnencodableCharacters();
88 				bool			StartWithSpellCheckOn();
89 				void			SetDefaultAccount(int32 account);
90 				int32			DefaultAccount();
91 				int32			UseAccountFrom();
92 				uint32			MailCharacterSet();
ShowSpamGUI()93 				bool			ShowSpamGUI() const
94 									{ return fShowSpamGUI; }
95 				BFont			ContentFont();
96 
PeopleQueryList()97 				QueryList&		PeopleQueryList()
98 									{ return fPeopleQueryList; }
People()99 				PersonList&		People()
100 									{ return fPeople; }
PeopleGroups()101 				GroupList&		PeopleGroups()
102 									{ return fPeopleGroups; }
103 
104 	private:
105 				void			_ClearPrintSettings();
106 				void			_CheckForSpamFilterExistence();
107 				TMailWindow*	_ActiveWindow();
108 
109 				status_t		GetSettingsPath(BPath &path);
110 				status_t		LoadOldSettings();
111 				status_t		SaveSettings();
112 				status_t		LoadSettings();
113 
114 				BList			fWindowList;
115 				int32			fWindowCount;
116 				TPrefsWindow*	fPrefsWindow;
117 				TSignatureWindow* fSigWindow;
118 
119 				BRect			fMailWindowFrame;
120 				BRect			fLastMailWindowFrame;
121 				BRect			fSignatureWindowFrame;
122 				BPoint			fPrefsWindowPos;
123 
124 				BMessage*		fPrintSettings;
125 
126 				bool			fPrintHelpAndExit;
127 
128 				// TODO: these should go into a settings class
129 				bool			fAutoMarkRead;
130 				char*			fSignature;
131 				char*			fReplyPreamble;
132 				bool			fWrapMode;
133 				bool			fAttachAttributes;
134 				bool			fColoredQuotes;
135 				uint8			fShowToolBar;
136 				bool			fWarnAboutUnencodableCharacters;
137 				bool			fStartWithSpellCheckOn;
138 				bool			fShowSpamGUI;
139 				int32			fDefaultAccount;
140 				int32			fUseAccountFrom;
141 				uint32			fMailCharacterSet;
142 				BFont			fContentFont;
143 
144 				QueryList		fPeopleQueryList;
145 				PersonList		fPeople;
146 				GroupList		fPeopleGroups;
147 };
148 
149 
150 #endif // #ifndef _MAIL_H
151 
152