Separated loading and saving prefs again - even if it let you forget to balance loading/saving

of the values more easily (but you should think about changes to persistent file formats anyway),
it's far more readable.
Also made saving the settings a bit safer: the settings are now written to a temp file, and
only replace the original if that succeeded (before, there was the slight chance that you'd
end up without any settings if the system crashed at the wrong time).
Also extracted the old style settings loading mechanism to a separate method.
Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14094 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-08-31 01:25:18 +00:00
parent 8745360987
commit 3c40c4cead
2 changed files with 262 additions and 331 deletions
+256 -329
View File
@@ -177,7 +177,7 @@ int32
header_len(BFile *file) header_len(BFile *file)
{ {
char *buffer; char *buffer;
int32 len; int32 length;
int32 result = 0; int32 result = 0;
off_t size; off_t size;
@@ -190,10 +190,10 @@ header_len(BFile *file)
file->Seek(0, 0); file->Seek(0, 0);
if (file->Read(buffer, size) == size) if (file->Read(buffer, size) == size)
{ {
while ((len = linelen(buffer + result, size - result, true)) > 2) while ((length = linelen(buffer + result, size - result, true)) > 2)
result += len; result += length;
result += len; result += length;
} }
free(buffer); free(buffer);
file->WriteAttr(B_MAIL_ATTR_HEADER, B_INT32_TYPE, 0, &result, sizeof(int32)); file->WriteAttr(B_MAIL_ATTR_HEADER, B_INT32_TYPE, 0, &result, sizeof(int32));
@@ -203,7 +203,6 @@ header_len(BFile *file)
} }
//--------------------------------------------------------------------
// #pragma mark - // #pragma mark -
@@ -225,8 +224,8 @@ TMailApp::TMailApp()
signature_window.Set(6, TITLE_BAR_HEIGHT, 6 + kSigWidth, TITLE_BAR_HEIGHT + kSigHeight); signature_window.Set(6, TITLE_BAR_HEIGHT, 6 + kSigWidth, TITLE_BAR_HEIGHT + kSigHeight);
prefs_window.Set(6, TITLE_BAR_HEIGHT); prefs_window.Set(6, TITLE_BAR_HEIGHT);
// Find and read preferences file. // Find and read settings file.
LoadSavePrefs (true /* TRUE to load them */); LoadSettings();
CheckForSpamFilterExistence(); CheckForSpamFilterExistence();
fFont.SetSpacing(B_BITMAP_SPACING); fFont.SetSpacing(B_BITMAP_SPACING);
@@ -522,8 +521,10 @@ TMailApp::QuitRequested()
if (!BApplication::QuitRequested()) if (!BApplication::QuitRequested())
return false; return false;
mail_window = last_window; /* Last closed window becomes standard window size. */ mail_window = last_window;
LoadSavePrefs(false /* TRUE to load them */); // Last closed window becomes standard window size.
SaveSettings();
return true; return true;
} }
@@ -798,354 +799,284 @@ TMailApp::ClearPrintSettings()
print_settings = NULL; print_settings = NULL;
} }
/*
status_t
TMailApp::LoadSettings()
{
// write settings file
BPath path;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) < B_OK)
return;
path.Append(kWorkspacesSettingFile); status_t
TMailApp::GetSettingsPath(BPath &path)
{
status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path);
if (status != B_OK)
return status;
path.Append("Mail");
return create_directory(path.Path(), 0755);
}
status_t
TMailApp::LoadOldSettings()
{
BPath path;
status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path);
if (status != B_OK)
return status;
path.Append("Mail_data");
BFile file;
status = file.SetTo(path.Path(), B_READ_ONLY);
if (status != B_OK)
return status;
file.Read(&mail_window, sizeof(BRect));
file.Read(&level, sizeof(level));
font_family fontFamily;
font_style fontStyle;
float size;
file.Read(&fontFamily, sizeof(font_family));
file.Read(&fontStyle, sizeof(font_style));
file.Read(&size, sizeof(float));
if (size >= 9)
fFont.SetSize(size);
if (fontFamily[0] && fontStyle[0])
fFont.SetFamilyAndStyle(fontFamily, fontStyle);
file.Read(&signature_window, sizeof(BRect));
file.Read(&header_flag, sizeof(bool));
file.Read(&sWrapMode, sizeof(bool));
file.Read(&prefs_window, sizeof(BPoint));
int32 length;
if (file.Read(&length, sizeof(int32)) < (ssize_t)sizeof(int32))
return B_IO_ERROR;
free(signature);
signature = NULL;
if (length > 0) {
signature = (char *)malloc(length);
if (signature == NULL)
return B_NO_MEMORY;
file.Read(signature, length);
}
file.Read(&gMailCharacterSet, sizeof(int32));
if (gMailCharacterSet != B_MAIL_UTF8_CONVERSION
&& gMailCharacterSet != B_MAIL_US_ASCII_CONVERSION
&& BCharacterSetRoster::GetCharacterSetByConversionID(gMailCharacterSet) == NULL)
gMailCharacterSet = B_MS_WINDOWS_CONVERSION;
if (file.Read(&length, sizeof(int32)) == (ssize_t)sizeof(int32)) {
char *findString = (char *)malloc(length + 1);
if (findString == NULL)
return B_NO_MEMORY;
file.Read(findString, length);
findString[length] = '\0';
FindWindow::SetFindString(findString);
free(findString);
}
if (file.Read(&sShowButtonBar, sizeof(uint8)) < (ssize_t)sizeof(uint8))
sShowButtonBar = true;
if (file.Read(&gUseAccountFrom, sizeof(int32)) < (ssize_t)sizeof(int32)
|| gUseAccountFrom < ACCOUNT_USE_DEFAULT
|| gUseAccountFrom > ACCOUNT_FROM_MAIL)
gUseAccountFrom = ACCOUNT_USE_DEFAULT;
if (file.Read(&gColoredQuotes, sizeof(bool)) < (ssize_t)sizeof(bool))
gColoredQuotes = true;
if (file.Read(&length, sizeof(int32)) == (ssize_t)sizeof(int32)) {
free(gReplyPreamble);
gReplyPreamble = (char *)malloc(length + 1);
if (gReplyPreamble == NULL)
return B_NO_MEMORY;
file.Read(gReplyPreamble, length);
gReplyPreamble[length] = '\0';
}
file.Read(&attachAttributes_mode, sizeof(bool));
file.Read(&gWarnAboutUnencodableCharacters, sizeof(bool));
return B_OK;
} }
status_t status_t
TMailApp::SaveSettings() TMailApp::SaveSettings()
{ {
// write settings file
BPath path;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) < B_OK)
return;
path.Append(kWorkspacesSettingFile);
}
*/
void
TMailApp::LoadSavePrefs(bool loadThem)
{
// Load the preferences if loadThem is TRUE, otherwise save them. Uses a
// flattened BMessage (after a year or two of inertia with the unreliable
// binary dumps) in a file named "BeMail Settings" in the Mail folder in
// the user's settings directory. It can also read (but not write) the
// older binary dump file "Mail_data" in the top level settings directory,
// if it can't find the new settings.
BMailSettings chainSettings; BMailSettings chainSettings;
BDirectory directory;
status_t errorCode;
const char *fieldName;
BPath filePath;
BPath mailSettingsPath;
BFile prefsFile;
BMessage settingsMsg;
bool tempBool;
float tempFloat;
int32 tempInt32;
BPoint tempPoint;
BRect tempRect;
const char *tempString;
BPath topSettingsPath;
// Prepare the settings directories. if (gDefaultChain != ~0UL) {
if (find_directory(B_USER_SETTINGS_DIRECTORY, &topSettingsPath,
true /* create if needed */) != B_OK)
return; // No main settings directory, can't do anything.
mailSettingsPath = topSettingsPath;
mailSettingsPath.Append("Mail");
if (directory.SetTo(mailSettingsPath.Path()) != B_OK) {
mkdir (mailSettingsPath.Path(), 0755);
if (directory.SetTo(mailSettingsPath.Path()) != B_OK)
return;
}
directory.Unset(); // Not actually used any more.
// Read/write the default chain settings from somewhere system dependent.
if (loadThem) {
gDefaultChain = chainSettings.DefaultOutboundChainID();
} else if (gDefaultChain != ~0UL) {
chainSettings.SetDefaultOutboundChainID(gDefaultChain); chainSettings.SetDefaultOutboundChainID(gDefaultChain);
chainSettings.Save(); chainSettings.Save();
} }
// Open the new style settings file. BPath path;
status_t status = GetSettingsPath(path);
if (status != B_OK)
return status;
filePath = mailSettingsPath; path.Append("BeMail Settings~");
filePath.Append("BeMail Settings");
errorCode = prefsFile.SetTo (filePath.Path(), loadThem ? B_READ_ONLY :
B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
if (!loadThem && errorCode != B_OK)
return; // Need the file when saving.
if (loadThem && errorCode == B_OK) BFile file;
errorCode = settingsMsg.Unflatten (&prefsFile); status = file.SetTo(path.Path(), B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
if (status != B_OK)
return status;
if (loadThem && errorCode == B_OK && settingsMsg.what != 'BeMl') BMessage settings('BeMl');
errorCode = B_BAD_VALUE; settings.AddRect("MailWindowSize", mail_window);
settings.AddInt32("ExperienceLevel", level);
if (loadThem && errorCode != B_OK) {
// Unable to read the new style "BeMail Settings" file, try reading the
// old style "Mail_data" file.
filePath = topSettingsPath;
filePath.Append("Mail_data");
errorCode = prefsFile.SetTo (filePath.Path(), B_READ_ONLY);
if (errorCode != B_OK)
return; // Can't even find an old style file.
prefsFile.Read(&mail_window, sizeof(BRect));
prefsFile.Read(&level, sizeof(level));
font_family f_family;
font_style f_style;
float size;
prefsFile.Read(&f_family, sizeof(font_family));
prefsFile.Read(&f_style, sizeof(font_style));
prefsFile.Read(&size, sizeof(float));
if (size >= 9)
fFont.SetSize(size);
if ((strlen(f_family)) && (strlen(f_style)))
fFont.SetFamilyAndStyle(f_family, f_style);
prefsFile.Read(&signature_window, sizeof(BRect));
prefsFile.Read(&header_flag, sizeof(bool));
prefsFile.Read(&sWrapMode, sizeof(bool));
prefsFile.Read(&prefs_window, sizeof(BPoint));
int32 len;
if (prefsFile.Read(&len, sizeof(int32)) > 0)
{
free(signature);
signature = (char *)malloc(len);
prefsFile.Read(signature, len);
}
prefsFile.Read(&gMailCharacterSet, sizeof(int32));
if ((gMailCharacterSet != B_MAIL_UTF8_CONVERSION) &&
(gMailCharacterSet != B_MAIL_US_ASCII_CONVERSION) &&
(BCharacterSetRoster::GetCharacterSetByConversionID(gMailCharacterSet) == NULL)) {
gMailCharacterSet = B_MS_WINDOWS_CONVERSION;
}
if (prefsFile.Read(&len, sizeof(int32)) > 0)
{
char *findString = (char *)malloc(len + 1);
prefsFile.Read(findString, len);
findString[len] = '\0';
FindWindow::SetFindString(findString);
free(findString);
}
if (prefsFile.Read(&sShowButtonBar, sizeof(uint8)) <= 0)
sShowButtonBar = true;
if (prefsFile.Read(&gUseAccountFrom, sizeof(int32)) <= 0
|| gUseAccountFrom < ACCOUNT_USE_DEFAULT
|| gUseAccountFrom > ACCOUNT_FROM_MAIL)
gUseAccountFrom = ACCOUNT_USE_DEFAULT;
if (prefsFile.Read(&gColoredQuotes, sizeof(bool)) <= 0)
gColoredQuotes = true;
if (prefsFile.Read(&len, sizeof(int32)) > 0)
{
free(gReplyPreamble);
gReplyPreamble = (char *)malloc(len + 1);
prefsFile.Read(gReplyPreamble, len);
gReplyPreamble[len] = '\0';
}
prefsFile.Read(&attachAttributes_mode, sizeof(bool));
prefsFile.Read(&gWarnAboutUnencodableCharacters, sizeof(bool));
return; // Finished reading old style settings.
}
// Transfer the settings between the BMessage and our various global
// variables. For loading, if the setting isn't present, leave it at the
// default value. Note that loading and saving are intermingled here to
// make code maintenance easier (less chance of forgetting to update it if
// load and save were separate functions).
errorCode = B_OK; // So that saving settings can record an error.
fieldName = "MailWindowSize";
if (loadThem) {
if (settingsMsg.FindRect(fieldName, &tempRect) == B_OK)
mail_window = tempRect;
} else if (errorCode == B_OK)
errorCode = settingsMsg.AddRect(fieldName, mail_window);
fieldName = "ExperienceLevel";
if (loadThem) {
if (settingsMsg.FindInt32(fieldName, &tempInt32) == B_OK)
level = tempInt32;
} else if (errorCode == B_OK)
errorCode = settingsMsg.AddInt32(fieldName, level);
font_family fontFamily; font_family fontFamily;
memset (fontFamily, 0, sizeof (fontFamily));
font_style fontStyle; font_style fontStyle;
memset (fontStyle, 0, sizeof (fontStyle)); fFont.GetFamilyAndStyle(&fontFamily, &fontStyle);
float fontSize = 0;
if (!loadThem) { settings.AddString("FontFamily", fontFamily);
fFont.GetFamilyAndStyle(&fontFamily, &fontStyle); settings.AddString("FontStyle", fontStyle);
fontSize = fFont.Size(); settings.AddFloat("FontSize", fFont.Size());
settings.AddRect("SignatureWindowSize", signature_window);
settings.AddBool("ShowHeadersMode", header_flag);
settings.AddBool("WordWrapMode", sWrapMode);
settings.AddPoint("PreferencesWindowLocation", prefs_window);
settings.AddString("SignatureText", signature);
settings.AddInt32("CharacterSet", gMailCharacterSet);
settings.AddString("FindString", FindWindow::GetFindString());
settings.AddInt8("ShowButtonBar", sShowButtonBar);
settings.AddInt32("UseAccountFrom", gUseAccountFrom);
settings.AddBool("ColoredQuotes", gColoredQuotes);
settings.AddString("ReplyPreamble", gReplyPreamble);
settings.AddBool("AttachAttributes", attachAttributes_mode);
settings.AddBool("WarnAboutUnencodableCharacters", gWarnAboutUnencodableCharacters);
settings.AddBool("StartWithSpellCheck", gStartWithSpellCheckOn);
BEntry entry;
status = entry.SetTo(path.Path());
if (status != B_OK)
return status;
status = settings.Flatten(&file);
if (status == B_OK) {
// replace original settings file
status = entry.Rename("BeMail Settings", true);
} else
entry.Remove();
return status;
}
status_t
TMailApp::LoadSettings()
{
BMailSettings chainSettings;
gDefaultChain = chainSettings.DefaultOutboundChainID();
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();
} }
fieldName = "FontFamily"; BRect rect;
if (loadThem) { if (settings.FindRect("MailWindowSize", &rect) == B_OK)
if (settingsMsg.FindString(fieldName, &tempString) == B_OK) mail_window = rect;
strncpy (fontFamily, tempString, B_FONT_FAMILY_LENGTH);
} else if (errorCode == B_OK)
errorCode = settingsMsg.AddString(fieldName, fontFamily);
fieldName = "FontStyle"; int32 int32Value;
if (loadThem) { if (settings.FindInt32("ExperienceLevel", &int32Value) == B_OK)
if (settingsMsg.FindString(fieldName, &tempString) == B_OK) level = int32Value;
strncpy (fontStyle, tempString, B_FONT_STYLE_LENGTH);
} else if (errorCode == B_OK)
errorCode = settingsMsg.AddString(fieldName, fontStyle);
fieldName = "FontSize"; const char *fontFamily;
if (loadThem) { if (settings.FindString("FontFamily", &fontFamily) == B_OK) {
if (settingsMsg.FindFloat(fieldName, &tempFloat) == B_OK) const char *fontStyle;
fontSize = tempFloat; if (settings.FindString("FontStyle", &fontStyle) == B_OK) {
} else if (errorCode == B_OK) float size;
errorCode = settingsMsg.AddFloat(fieldName, fontSize); if (settings.FindFloat("FontSize", &size) == B_OK) {
if (size >= 7)
fFont.SetSize(size);
if (loadThem) { if (fontFamily[0] && fontStyle[0]) {
if (fontSize >= 9) fFont.SetFamilyAndStyle(fontFamily[0] ? NULL : fontFamily,
fFont.SetSize(fontSize); fontStyle[0] ? NULL : fontStyle);
if (fontFamily[0] != 0 || fontStyle[0] != 0) }
fFont.SetFamilyAndStyle( }
(fontFamily[0] == 0) ? NULL : fontFamily, }
(fontStyle[0] == 0) ? NULL : fontStyle);
} }
fieldName = "SignatureWindowSize"; if (settings.FindRect("SignatureWindowSize", &rect) == B_OK)
if (loadThem) { signature_window = rect;
if (settingsMsg.FindRect(fieldName, &tempRect) == B_OK)
signature_window = tempRect;
} else if (errorCode == B_OK)
errorCode = settingsMsg.AddRect(fieldName, signature_window);
fieldName = "ShowHeadersMode"; bool boolValue;
if (loadThem) { if (settings.FindBool("ShowHeadersMode", &boolValue) == B_OK)
if (settingsMsg.FindBool(fieldName, &tempBool) == B_OK) header_flag = boolValue;
header_flag = tempBool;
} else if (errorCode == B_OK)
errorCode = settingsMsg.AddBool(fieldName, header_flag);
fieldName = "WordWrapMode"; if (settings.FindBool("WordWrapMode", &boolValue) == B_OK)
if (loadThem) { sWrapMode = boolValue;
if (settingsMsg.FindBool(fieldName, &tempBool) == B_OK)
sWrapMode = tempBool;
} else if (errorCode == B_OK)
errorCode = settingsMsg.AddBool(fieldName, sWrapMode);
fieldName = "PreferencesWindowLocation"; BPoint point;
if (loadThem) { if (settings.FindPoint("PreferencesWindowLocation", &point) == B_OK)
if (settingsMsg.FindPoint(fieldName, &tempPoint) == B_OK) prefs_window = point;
prefs_window = tempPoint;
} else if (errorCode == B_OK)
errorCode = settingsMsg.AddPoint(fieldName, prefs_window);
fieldName = "SignatureText"; const char *string;
if (loadThem) { if (settings.FindString("SignatureText", &string) == B_OK) {
if (settingsMsg.FindString(fieldName, &tempString) == B_OK) { free(signature);
free(signature); signature = strdup(string);
signature = (char *) malloc(strlen(tempString) + 1);
if (signature != NULL)
strcpy (signature, tempString);
}
} else if (errorCode == B_OK && signature != NULL)
errorCode = settingsMsg.AddString(fieldName, signature);
fieldName = "CharacterSet";
if (loadThem) {
if (settingsMsg.FindInt32(fieldName, &tempInt32) == B_OK)
gMailCharacterSet = tempInt32;
if ((gMailCharacterSet != B_MAIL_UTF8_CONVERSION) &&
(gMailCharacterSet != B_MAIL_US_ASCII_CONVERSION) &&
(BCharacterSetRoster::GetCharacterSetByConversionID(gMailCharacterSet) == NULL)) {
gMailCharacterSet = B_MS_WINDOWS_CONVERSION;
}
} else if (errorCode == B_OK)
errorCode = settingsMsg.AddInt32(fieldName, gMailCharacterSet);
fieldName = "FindString";
if (loadThem) {
if (settingsMsg.FindString(fieldName, &tempString) == B_OK)
FindWindow::SetFindString(tempString);
} else if (errorCode == B_OK)
errorCode = settingsMsg.AddString(fieldName, FindWindow::GetFindString());
fieldName = "ShowButtonBar";
if (loadThem) {
int8 value;
if (settingsMsg.FindInt8(fieldName, &value) == B_OK)
sShowButtonBar = value;
} else if (errorCode == B_OK)
errorCode = settingsMsg.AddInt8(fieldName, sShowButtonBar);
fieldName = "UseAccountFrom";
if (loadThem) {
if (settingsMsg.FindInt32(fieldName, &tempInt32) == B_OK)
gUseAccountFrom = tempInt32;
if (gUseAccountFrom < ACCOUNT_USE_DEFAULT
|| gUseAccountFrom > ACCOUNT_FROM_MAIL)
gUseAccountFrom = ACCOUNT_USE_DEFAULT;
} else if (errorCode == B_OK)
errorCode = settingsMsg.AddInt32(fieldName, gUseAccountFrom);
fieldName = "ColoredQuotes";
if (loadThem) {
if (settingsMsg.FindBool(fieldName, &tempBool) == B_OK)
gColoredQuotes = tempBool;
} else if (errorCode == B_OK)
errorCode = settingsMsg.AddBool(fieldName, gColoredQuotes);
fieldName = "ReplyPreamble";
if (loadThem) {
if (settingsMsg.FindString(fieldName, &tempString) == B_OK) {
free(gReplyPreamble);
gReplyPreamble = (char *)malloc(strlen(tempString) + 1);
if (gReplyPreamble != NULL)
strcpy (gReplyPreamble, tempString);
}
} else if (errorCode == B_OK)
errorCode = settingsMsg.AddString(fieldName, gReplyPreamble);
fieldName = "AttachAttributes";
if (loadThem) {
if (settingsMsg.FindBool(fieldName, &tempBool) == B_OK)
attachAttributes_mode = tempBool;
} else if (errorCode == B_OK)
errorCode = settingsMsg.AddBool(fieldName, attachAttributes_mode);
fieldName = "WarnAboutUnencodableCharacters";
if (loadThem) {
if (settingsMsg.FindBool(fieldName, &tempBool) == B_OK)
gWarnAboutUnencodableCharacters = tempBool;
} else if (errorCode == B_OK)
errorCode = settingsMsg.AddBool(fieldName, gWarnAboutUnencodableCharacters);
fieldName = "StartWithSpellCheck";
if (loadThem) {
if (settingsMsg.FindBool(fieldName, &tempBool) == B_OK)
gStartWithSpellCheckOn = tempBool;
} else if (errorCode == B_OK)
errorCode = settingsMsg.AddBool(fieldName, gStartWithSpellCheckOn);
// Save the settings BMessage to the settings file.
if (!loadThem && errorCode == B_OK) {
settingsMsg.what = 'BeMl';
errorCode = settingsMsg.Flatten (&prefsFile);
} }
if (settings.FindInt32("CharacterSet", &int32Value) == B_OK)
gMailCharacterSet = int32Value;
if (gMailCharacterSet != B_MAIL_UTF8_CONVERSION
&& gMailCharacterSet != B_MAIL_US_ASCII_CONVERSION
&& BCharacterSetRoster::GetCharacterSetByConversionID(gMailCharacterSet) == NULL)
gMailCharacterSet = B_MS_WINDOWS_CONVERSION;
if (settings.FindString("FindString", &string) == B_OK)
FindWindow::SetFindString(string);
int8 int8Value;
if (settings.FindInt8("ShowButtonBar", &int8Value) == B_OK)
sShowButtonBar = int8Value;
if (settings.FindInt32("UseAccountFrom", &int32Value) == B_OK)
gUseAccountFrom = int32Value;
if (gUseAccountFrom < ACCOUNT_USE_DEFAULT
|| gUseAccountFrom > ACCOUNT_FROM_MAIL)
gUseAccountFrom = ACCOUNT_USE_DEFAULT;
if (settings.FindBool("ColoredQuotes", &boolValue) == B_OK)
gColoredQuotes = boolValue;
if (settings.FindString("ReplyPreamble", &string) == B_OK) {
free(gReplyPreamble);
gReplyPreamble = strdup(string);
}
if (settings.FindBool("AttachAttributes", &boolValue) == B_OK)
attachAttributes_mode = boolValue;
if (settings.FindBool("WarnAboutUnencodableCharacters", &boolValue) == B_OK)
gWarnAboutUnencodableCharacters = boolValue;
if (settings.FindBool("StartWithSpellCheck", &boolValue) == B_OK)
gStartWithSpellCheckOn = boolValue;
return B_OK;
} }
@@ -2684,9 +2615,7 @@ TMailWindow::QuitRequested()
be_app->PostMessage(&message); be_app->PostMessage(&message);
if ((CurrentMessage()) && (CurrentMessage()->HasString("status"))) { if ((CurrentMessage()) && (CurrentMessage()->HasString("status"))) {
//
// User explicitly requests a status to set this message to. // User explicitly requests a status to set this message to.
//
if (!CurrentMessage()->HasString("same")) { if (!CurrentMessage()->HasString("same")) {
const char *status = CurrentMessage()->FindString("status"); const char *status = CurrentMessage()->FindString("status");
if (status != NULL) { if (status != NULL) {
@@ -2698,9 +2627,7 @@ TMailWindow::QuitRequested()
} }
} }
} else if (fRef) { } else if (fRef) {
//
// ...Otherwise just set the message read // ...Otherwise just set the message read
//
SetCurrentMessageRead(); SetCurrentMessageRead();
} }
+6 -2
View File
@@ -199,8 +199,12 @@ class TMailApp : public BApplication {
private: private:
void ClearPrintSettings(); void ClearPrintSettings();
void CheckForSpamFilterExistence(); void CheckForSpamFilterExistence();
void LoadSavePrefs (bool loadThem);
status_t GetSettingsPath(BPath &path);
status_t LoadOldSettings();
status_t SaveSettings();
status_t LoadSettings();
BList fWindowList; BList fWindowList;
int32 fWindowCount; int32 fWindowCount;
TPrefsWindow *fPrefsWindow; TPrefsWindow *fPrefsWindow;