BEmailMessage::BEmailMessage(const entry_ref *ref, uint32 defaultCharSet) : BMailContainer(defaultCharSet), _bcc(NULL), _num_components(0), _body(NULL), _text_body(NULL) { BMailSettings settings; _account_id = settings.DefaultOutboundAccount(); fData = new BFile(); _status = static_cast<BFile *>(fData)->SetTo(ref,B_READ_ONLY); if (_status == B_OK) SetToRFC822(fData,-1); }
BEmailMessage::BEmailMessage(BPositionIO *file, bool own, uint32 defaultCharSet) : BMailContainer (defaultCharSet), fData(NULL), _status(B_NO_ERROR), _bcc(NULL), _num_components(0), _body(NULL), _text_body(NULL) { BMailSettings settings; _account_id = settings.DefaultOutboundAccount(); if (own) fData = file; if (file != NULL) SetToRFC822(file,-1); }
status_t TMailApp::LoadSettings() { BMailSettings accountSettings; fDefaultAccount = accountSettings.DefaultOutboundAccount(); BPath path; status_t status = GetSettingsPath(path); if (status != B_OK) return status; path.Append("BeMail Settings"); BFile file; status = file.SetTo(path.Path(), B_READ_ONLY); if (status != B_OK) return LoadOldSettings(); BMessage settings; status = settings.Unflatten(&file); if (status < B_OK || settings.what != 'BeMl') { // the current settings are corrupted, try old ones return LoadOldSettings(); } BRect rect; if (settings.FindRect("MailWindowSize", &rect) == B_OK) fMailWindowFrame = rect; int32 int32Value; // if (settings.FindInt32("ExperienceLevel", &int32Value) == B_OK) // level = int32Value; const char *fontFamily; if (settings.FindString("FontFamily", &fontFamily) == B_OK) { const char *fontStyle; if (settings.FindString("FontStyle", &fontStyle) == B_OK) { float size; if (settings.FindFloat("FontSize", &size) == B_OK) { if (size >= 7) fContentFont.SetSize(size); if (fontFamily[0] && fontStyle[0]) { fContentFont.SetFamilyAndStyle(fontFamily[0] ? fontFamily : NULL, fontStyle[0] ? fontStyle : NULL); } } } } if (settings.FindRect("SignatureWindowSize", &rect) == B_OK) fSignatureWindowFrame = rect; bool boolValue; if (settings.FindBool("WordWrapMode", &boolValue) == B_OK) fWrapMode = boolValue; BPoint point; if (settings.FindPoint("PreferencesWindowLocation", &point) == B_OK) fPrefsWindowPos = point; if (settings.FindBool("AutoMarkRead", &boolValue) == B_OK) fAutoMarkRead = boolValue; const char *string; if (settings.FindString("SignatureText", &string) == B_OK) { free(fSignature); fSignature = strdup(string); } if (settings.FindInt32("CharacterSet", &int32Value) == B_OK) fMailCharacterSet = int32Value; if (fMailCharacterSet != B_MAIL_UTF8_CONVERSION && fMailCharacterSet != B_MAIL_US_ASCII_CONVERSION && BCharacterSetRoster::GetCharacterSetByConversionID(fMailCharacterSet) == NULL) fMailCharacterSet = B_MS_WINDOWS_CONVERSION; if (settings.FindString("FindString", &string) == B_OK) FindWindow::SetFindString(string); int8 int8Value; if (settings.FindInt8("ShowButtonBar", &int8Value) == B_OK) fShowToolBar = int8Value; if (settings.FindInt32("UseAccountFrom", &int32Value) == B_OK) fUseAccountFrom = int32Value; if (fUseAccountFrom < ACCOUNT_USE_DEFAULT || fUseAccountFrom > ACCOUNT_FROM_MAIL) fUseAccountFrom = ACCOUNT_USE_DEFAULT; if (settings.FindBool("ColoredQuotes", &boolValue) == B_OK) fColoredQuotes = boolValue; if (settings.FindString("ReplyPreamble", &string) == B_OK) { free(fReplyPreamble); fReplyPreamble = strdup(string); } if (settings.FindBool("AttachAttributes", &boolValue) == B_OK) fAttachAttributes = boolValue; if (settings.FindBool("WarnAboutUnencodableCharacters", &boolValue) == B_OK) fWarnAboutUnencodableCharacters = boolValue; if (settings.FindBool("StartWithSpellCheck", &boolValue) == B_OK) fStartWithSpellCheckOn = boolValue; return B_OK; }