[haiku-commits] BRANCH axeld-github.mail-layout [1a9aaaad8e9a] in src: apps/mail kits/shared

  • From: axeld-github.mail-layout <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 4 Sep 2015 17:31:59 +0200 (CEST)

added 5 changesets to branch 'refs/remotes/axeld-github/mail-layout'
old head: 3fe7551be01df2106ae49b5942a764781efd4c2a
new head: 1a9aaaad8e9aa572927334ad3ce1cae1f743945f
overview: https://github.com/axeld/haiku/compare/3fe7551be01d...1a9aaaad8e9a

----------------------------------------------------------------------------

d3712fe9377f: BMailSettings: removed debug message dump.

42dfabf0966d: Mail: fixed crash on resend.

* Seems to have been there for quite some time. Probably a good
reason to remove that feature altogether.

0c35a301cd33: Mail: use layout version of BMenuBar.

* Fixes layout issue: the minimal size was incorrect.
* Moved variable declaration to where it is actually used.

ed59019fe98e: BToolBar: made FindButton() public.

1a9aaaad8e9a: Mail: show icons only setting works again.

* It will show the label as tool tip when the labels are hidden.

[ Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

8 files changed, 88 insertions(+), 68 deletions(-)
headers/private/shared/ToolBar.h | 3 +-
src/apps/mail/MailWindow.cpp | 56 ++++++++++++++++++++++++++----------
src/apps/mail/MailWindow.h | 2 ++
src/apps/mail/Prefs.cpp | 7 +++--
src/apps/mail/Settings.cpp | 36 ++++++++---------------
src/apps/mail/Settings.h | 4 +++
src/kits/mail/MailSettings.cpp | 2 --
src/kits/shared/ToolBar.cpp | 46 ++++++++++++++---------------

############################################################################

Commit: d3712fe9377f5ddeddb87ac5ceb341d11243bb4e
Author: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date: Wed Sep 2 18:40:32 2015 UTC

BMailSettings: removed debug message dump.

----------------------------------------------------------------------------

diff --git a/src/kits/mail/MailSettings.cpp b/src/kits/mail/MailSettings.cpp
index 26f8bd1..9898420 100644
--- a/src/kits/mail/MailSettings.cpp
+++ b/src/kits/mail/MailSettings.cpp
@@ -459,8 +459,6 @@ BMailAddOnSettings::Load(const BMessage& message)

MakeEmpty();
Append(settings);
-puts("settings:");
-settings.PrintToStream();

fOriginalSettings = *this;
fOriginalRef = fRef;

############################################################################

Commit: 42dfabf0966d4e67a56c6cb80f92f1c50151af55
Author: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date: Wed Sep 2 18:54:59 2015 UTC

Mail: fixed crash on resend.

* Seems to have been there for quite some time. Probably a good
reason to remove that feature altogether.

----------------------------------------------------------------------------

diff --git a/src/apps/mail/MailWindow.cpp b/src/apps/mail/MailWindow.cpp
index e02f89f..ee062a5 100644
--- a/src/apps/mail/MailWindow.cpp
+++ b/src/apps/mail/MailWindow.cpp
@@ -184,6 +184,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title,
TMailApp* app,
fRef(NULL),
fFieldState(0),
fPanel(NULL),
+ fSaveAddrMenu(NULL),
fLeaveStatusMenu(NULL),
fEncodingMenu(NULL),
fZoom(rect),
@@ -434,9 +435,6 @@ TMailWindow::TMailWindow(BRect rect, const char* title,
TMailApp* app,
fNextMsg = new BMenuItem(B_TRANSLATE("Next message"),
new BMessage(M_NEXTMSG), B_DOWN_ARROW);
menu->AddItem(fNextMsg);
- menu->AddSeparatorItem();
- fSaveAddrMenu = subMenu = new BMenu(B_TRANSLATE("Save
address"));
- menu->AddItem(subMenu);
} else {
menu->AddItem(fSendNow = new BMenuItem(B_TRANSLATE("Send
message"),
new BMessage(M_SEND_NOW), 'M'));
@@ -459,6 +457,11 @@ TMailWindow::TMailWindow(BRect rect, const char* title,
TMailApp* app,
new BMessage(M_REMOVE), 'T'));
}
}
+ if (fIncoming) {
+ menu->AddSeparatorItem();
+ fSaveAddrMenu = new BMenu(B_TRANSLATE("Save address"));
+ menu->AddItem(fSaveAddrMenu);
+ }

// Encoding menu


############################################################################

Commit: 0c35a301cd33cf3bf1534681b26182ce535af2f9
Author: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date: Wed Sep 2 18:56:08 2015 UTC

Mail: use layout version of BMenuBar.

* Fixes layout issue: the minimal size was incorrect.
* Moved variable declaration to where it is actually used.

----------------------------------------------------------------------------

diff --git a/src/apps/mail/MailWindow.cpp b/src/apps/mail/MailWindow.cpp
index ee062a5..645472b 100644
--- a/src/apps/mail/MailWindow.cpp
+++ b/src/apps/mail/MailWindow.cpp
@@ -206,12 +206,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title,
TMailApp* app,
if (messenger != NULL)
fTrackerMessenger = *messenger;

- BMenu* menu;
- BMenu* subMenu;
- BMenuItem* item;
- BMessage* msg;
BFile file(ref, B_READ_ONLY);
-
if (ref) {
fRef = new entry_ref(*ref);
fIncoming = true;
@@ -219,17 +214,16 @@ TMailWindow::TMailWindow(BRect rect, const char* title,
TMailApp* app,
fIncoming = false;

fAutoMarkRead = fApp->AutoMarkRead();
- BRect r(0, 0, RIGHT_BOUNDARY, 15);
- fMenuBar = new BMenuBar(r, "");
+ fMenuBar = new BMenuBar("menuBar");

// File Menu

- menu = new BMenu(B_TRANSLATE("File"));
+ BMenu* menu = new BMenu(B_TRANSLATE("File"));

- msg = new BMessage(M_NEW);
+ BMessage* msg = new BMessage(M_NEW);
msg->AddInt32("type", M_NEW);
- menu->AddItem(item = new BMenuItem(B_TRANSLATE("New mail message"),
- msg, 'N'));
+ BMenuItem* item = new BMenuItem(B_TRANSLATE("New mail message"), msg,
'N');
+ menu->AddItem(item);
item->SetTarget(be_app);

// Cheap hack - only show the drafts menu when composing messages.
Insert
@@ -259,7 +253,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title,
TMailApp* app,
if (!resending && fIncoming) {
menu->AddSeparatorItem();

- subMenu = new BMenu(B_TRANSLATE("Close and "));
+ BMenu* subMenu = new BMenu(B_TRANSLATE("Close and "));

read_flags flag;
read_read_attr(file, flag);

############################################################################

Commit: ed59019fe98e271381cbcd2ed5df1b3ea959e2e2
Author: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date: Wed Sep 2 19:31:09 2015 UTC

BToolBar: made FindButton() public.

----------------------------------------------------------------------------

diff --git a/headers/private/shared/ToolBar.h b/headers/private/shared/ToolBar.h
index 57d9ff9..b546885 100644
--- a/headers/private/shared/ToolBar.h
+++ b/headers/private/shared/ToolBar.h
@@ -39,12 +39,13 @@ public:
void SetActionPressed(uint32
command, bool pressed);
void SetActionVisible(uint32
command, bool visible);

+ BButton* FindButton(uint32
command) const;
+
private:
virtual void Pulse();
virtual void FrameResized(float width, float
height);

void _Init();
- BButton* _FindButton(uint32
command) const;
void _HideToolTips() const;

orientation fOrientation;
diff --git a/src/kits/shared/ToolBar.cpp b/src/kits/shared/ToolBar.cpp
index daabc66..e29fe50 100644
--- a/src/kits/shared/ToolBar.cpp
+++ b/src/kits/shared/ToolBar.cpp
@@ -136,7 +136,7 @@ BToolBar::AddView(BView* view)
void
BToolBar::SetActionEnabled(uint32 command, bool enabled)
{
- if (BButton* button = _FindButton(command))
+ if (BButton* button = FindButton(command))
button->SetEnabled(enabled);
}

@@ -144,7 +144,7 @@ BToolBar::SetActionEnabled(uint32 command, bool enabled)
void
BToolBar::SetActionPressed(uint32 command, bool pressed)
{
- if (BButton* button = _FindButton(command))
+ if (BButton* button = FindButton(command))
button->SetValue(pressed);
}

@@ -152,7 +152,7 @@ BToolBar::SetActionPressed(uint32 command, bool pressed)
void
BToolBar::SetActionVisible(uint32 command, bool visible)
{
- BButton* button = _FindButton(command);
+ BButton* button = FindButton(command);
if (button == NULL)
return;
for (int32 i = 0; BLayoutItem* item = GroupLayout()->ItemAt(i); i++) {
@@ -164,6 +164,26 @@ BToolBar::SetActionVisible(uint32 command, bool visible)
}


+BButton*
+BToolBar::FindButton(uint32 command) const
+{
+ for (int32 i = 0; BView* view = ChildAt(i); i++) {
+ BButton* button = dynamic_cast<BButton*>(view);
+ if (button == NULL)
+ continue;
+ BMessage* message = button->Message();
+ if (message == NULL)
+ continue;
+ if (message->what == command) {
+ return button;
+ // Assumes there is only one button with this message...
+ break;
+ }
+ }
+ return NULL;
+}
+
+
// #pragma mark - Private methods


@@ -197,26 +217,6 @@ BToolBar::_Init()
}


-BButton*
-BToolBar::_FindButton(uint32 command) const
-{
- for (int32 i = 0; BView* view = ChildAt(i); i++) {
- BButton* button = dynamic_cast<BButton*>(view);
- if (button == NULL)
- continue;
- BMessage* message = button->Message();
- if (message == NULL)
- continue;
- if (message->what == command) {
- return button;
- // Assumes there is only one button with this message...
- break;
- }
- }
- return NULL;
-}
-
-
void
BToolBar::_HideToolTips() const
{

############################################################################

Commit: 1a9aaaad8e9aa572927334ad3ce1cae1f743945f
Author: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date: Wed Sep 2 19:31:33 2015 UTC

Mail: show icons only setting works again.

* It will show the label as tool tip when the labels are hidden.

----------------------------------------------------------------------------

diff --git a/src/apps/mail/MailWindow.cpp b/src/apps/mail/MailWindow.cpp
index 645472b..c1af1f8 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 <AppFileInfo.h>
#include <Autolock.h>
#include <Bitmap.h>
+#include <Button.h>
#include <CharacterSet.h>
#include <CharacterSetRoster.h>
#include <Clipboard.h>
@@ -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();
}
@@ -3188,6 +3206,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)
{
fDownloading = downloading;
diff --git a/src/apps/mail/MailWindow.h b/src/apps/mail/MailWindow.h
index 5f34fa8..fc3ca0e 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 66bedbf..806dd00 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 77ffeb9..323286f 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 da9d18c..75cc5fb 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;



Other related posts:

  • » [haiku-commits] BRANCH axeld-github.mail-layout [1a9aaaad8e9a] in src: apps/mail kits/shared - axeld-github . mail-layout