diff --git a/src/apps/mail/MailWindow.cpp b/src/apps/mail/MailWindow.cpp index 645472b4cc..c1af1f87cf 100644 --- a/src/apps/mail/MailWindow.cpp +++ b/src/apps/mail/MailWindow.cpp @@ -46,6 +46,7 @@ of their respective holders. All rights reserved. #include #include #include +#include #include #include #include @@ -90,6 +91,7 @@ of their respective holders. All rights reserved. #include "Prefs.h" #include "QueryMenu.h" #include "Signature.h" +#include "Settings.h" #include "Status.h" #include "String.h" #include "Utilities.h" @@ -720,6 +722,22 @@ TMailWindow::UpdateViews() if (showToolBar) { if (fToolBar->IsHidden()) fToolBar->Show(); + + bool showLabel = showToolBar == kShowToolBar; + _UpdateLabel(M_NEW, B_TRANSLATE("New"), showLabel); + _UpdateLabel(M_SEND_NOW, B_TRANSLATE("Send"), showLabel); + _UpdateLabel(M_SIG_MENU, B_TRANSLATE("Signature"), showLabel); + _UpdateLabel(M_SAVE_AS_DRAFT, B_TRANSLATE("Save"), showLabel); + _UpdateLabel(M_PRINT, B_TRANSLATE("Print"), showLabel); + _UpdateLabel(M_DELETE, B_TRANSLATE("Trash"), showLabel); + _UpdateLabel(M_REPLY, B_TRANSLATE("Reply"), showLabel); + _UpdateLabel(M_FORWARD, B_TRANSLATE("Forward"), showLabel); + _UpdateLabel(M_DELETE_NEXT, B_TRANSLATE("Trash"), showLabel); + _UpdateLabel(M_SPAM_BUTTON, B_TRANSLATE("Spam"), showLabel); + _UpdateLabel(M_NEXTMSG, B_TRANSLATE("Next"), showLabel); + _UpdateLabel(M_UNREAD, B_TRANSLATE("Unread"), showLabel); + _UpdateLabel(M_READ, B_TRANSLATE(" Read "), showLabel); + _UpdateLabel(M_PREVMSG, B_TRANSLATE("Previous"), showLabel); } else if (!fToolBar->IsHidden()) fToolBar->Hide(); } @@ -3187,6 +3205,17 @@ TMailWindow::_UpdateReadButton() } +void +TMailWindow::_UpdateLabel(uint32 command, const char* label, bool show) +{ + BButton* button = fToolBar->FindButton(command); + if (button != NULL) { + button->SetLabel(show ? label : NULL); + button->SetToolTip(show ? NULL : label); + } +} + + void TMailWindow::_SetDownloading(bool downloading) { diff --git a/src/apps/mail/MailWindow.h b/src/apps/mail/MailWindow.h index 5f34fa847d..fc3ca0e13a 100644 --- a/src/apps/mail/MailWindow.h +++ b/src/apps/mail/MailWindow.h @@ -130,6 +130,8 @@ private: void _AddReadButton(); void _UpdateReadButton(); + void _UpdateLabel(uint32 command, const char* label, + bool show); void _SetDownloading(bool downloading); uint32 _CurrentCharacterSet() const; diff --git a/src/apps/mail/Prefs.cpp b/src/apps/mail/Prefs.cpp index 66bedbf28a..806dd00387 100644 --- a/src/apps/mail/Prefs.cpp +++ b/src/apps/mail/Prefs.cpp @@ -58,6 +58,7 @@ using namespace BPrivate; #include "MailSupport.h" #include "MailWindow.h" #include "Messages.h" +#include "Settings.h" #include "Signature.h" @@ -902,20 +903,20 @@ TPrefsWindow::_BuildButtonBarMenu(uint8 show) BPopUpMenu* menu = new BPopUpMenu(""); msg = new BMessage(P_BUTTON_BAR); - msg->AddInt8("bar", 1); + msg->AddInt8("bar", kShowToolBar); menu->AddItem(item = new BMenuItem( B_TRANSLATE("Show icons & labels"), msg)); if (show & 1) item->SetMarked(true); msg = new BMessage(P_BUTTON_BAR); - msg->AddInt8("bar", 2); + msg->AddInt8("bar", kShowToolBarIconsOnly); menu->AddItem(item = new BMenuItem(B_TRANSLATE("Show icons only"), msg)); if (show & 2) item->SetMarked(true); msg = new BMessage(P_BUTTON_BAR); - msg->AddInt8("bar", 0); + msg->AddInt8("bar", kHideToolBar); menu->AddItem(item = new BMenuItem(B_TRANSLATE("Hide"), msg)); if (!show) item->SetMarked(true); diff --git a/src/apps/mail/Settings.cpp b/src/apps/mail/Settings.cpp index 77ffeb97c5..323286fca5 100644 --- a/src/apps/mail/Settings.cpp +++ b/src/apps/mail/Settings.cpp @@ -70,7 +70,7 @@ Settings::Settings() fWrapMode(true), fAttachAttributes(true), fColoredQuotes(true), - fShowButtonBar(true), + fShowButtonBar(kShowToolBar), fWarnAboutUnencodableCharacters(true), fStartWithSpellCheckOn(false), fShowSpamGUI(true), @@ -279,17 +279,12 @@ Settings::LoadSettings() } } - bool boolValue; - if (settings.FindBool("WordWrapMode", &boolValue) == B_OK) - fWrapMode = boolValue; - - if (settings.FindBool("AutoMarkRead", &boolValue) == B_OK) - fAutoMarkRead = boolValue; + fWrapMode = settings.GetBool("WordWrapMode", fWrapMode); + fAutoMarkRead = settings.GetBool("AutoMarkRead", fAutoMarkRead); BString string; - if (settings.FindString("SignatureText", &string) == B_OK) { + if (settings.FindString("SignatureText", &string) == B_OK) fSignature = string; - } if (settings.FindInt32("CharacterSet", &int32Value) == B_OK) fMailCharacterSet = int32Value; @@ -300,9 +295,7 @@ Settings::LoadSettings() fMailCharacterSet = B_MS_WINDOWS_CONVERSION; } - int8 int8Value; - if (settings.FindInt8("ShowButtonBar", &int8Value) == B_OK) - fShowButtonBar = int8Value; + fShowButtonBar = settings.GetInt8("ShowButtonBar", fShowButtonBar); if (settings.FindInt32("UseAccountFrom", &int32Value) == B_OK) fUseAccountFrom = int32Value; @@ -310,21 +303,16 @@ Settings::LoadSettings() || fUseAccountFrom > ACCOUNT_FROM_MAIL) fUseAccountFrom = ACCOUNT_USE_DEFAULT; - if (settings.FindBool("ColoredQuotes", &boolValue) == B_OK) - fColoredQuotes = boolValue; + fColoredQuotes = settings.GetBool("ColoredQuotes", fColoredQuotes); - if (settings.FindString("ReplyPreamble", &string) == B_OK) { + if (settings.FindString("ReplyPreamble", &string) == B_OK) fReplyPreamble = 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; + fAttachAttributes = settings.GetBool("AttachAttributes", fAttachAttributes); + fWarnAboutUnencodableCharacters = settings.GetBool( + "WarnAboutUnencodableCharacters", fWarnAboutUnencodableCharacters); + fStartWithSpellCheckOn = settings.GetBool("StartWithSpellCheck", + fStartWithSpellCheckOn); return B_OK; } diff --git a/src/apps/mail/Settings.h b/src/apps/mail/Settings.h index da9d18c892..75cc5fbb12 100644 --- a/src/apps/mail/Settings.h +++ b/src/apps/mail/Settings.h @@ -45,6 +45,10 @@ All rights reserved. #define ACCOUNT_USE_DEFAULT 0 #define ACCOUNT_FROM_MAIL 1 +static const uint8 kHideToolBar = 0; +static const uint8 kShowToolBar = 1; +static const uint8 kShowToolBarIconsOnly = 2; + class BMessage;