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 <Locker.h> 41 #include <Messenger.h> 42 #include <ObjectList.h> 43 #include <Window.h> 44 45 #include <ToolBar.h> 46 47 #include <E-mail.h> 48 #include <mail_encoding.h> 49 50 51 class TContentView; 52 class TEnclosuresView; 53 class THeaderView; 54 class TMailApp; 55 class TMenu; 56 class TPrefsWindow; 57 class TSignatureWindow; 58 59 class BEmailMessage; 60 class BFile; 61 class BFilePanel; 62 class BMailMessage; 63 class BMenu; 64 class BMenuBar; 65 class BMenuItem; 66 class Words; 67 68 class 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 BuildToolBar(); 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 static BBitmap* _RetrieveVectorIcon(int32 id); 170 struct BitmapItem { 171 BBitmap* bm; 172 int32 id; 173 }; 174 static BObjectList<BitmapItem> fBitmapCache; 175 static BLocker fBitmapCacheLock; 176 177 BToolBar* fToolBar; 178 179 BRect fZoom; 180 TContentView* fContentView; 181 THeaderView* fHeaderView; 182 TEnclosuresView* fEnclosuresView; 183 TMenu* fSignature; 184 185 BMessenger fTrackerMessenger; 186 // Talks to tracker window that this was launched from. 187 BMessenger fMessengerToSpamServer; 188 189 entry_ref fPrevRef; 190 entry_ref fNextRef; 191 bool fPrevTrackerPositionSaved : 1; 192 bool fNextTrackerPositionSaved : 1; 193 194 entry_ref fOpenFolder; 195 196 bool fSigAdded : 1; 197 bool fIncoming : 1; 198 bool fReplying : 1; 199 bool fResending : 1; 200 bool fSent : 1; 201 bool fDraft : 1; 202 bool fChanged : 1; 203 204 static BList sWindowList; 205 static BLocker sWindowListLock; 206 207 entry_ref fRepliedMail; 208 BMessenger* fOriginatingWindow; 209 210 bool fAutoMarkRead : 1; 211 bool fKeepStatusOnQuit; 212 213 bool fDownloading; 214 }; 215 216 #endif // _MAIL_WINDOW_H 217 218