Mail: save vertical space in the header when reading mail

The layout is unchanged for writing an email.

Changes when reading an email:

* decrease vertical spacing between rows
* move "To" to the right of "From" in the first row
* move "CC" to the right of "Date" in the second row
* move "Subject" down to the last, 3rd row

"CC" still only shows when it contains data.

This is a comparison of the old (left) and new (right) layout:
https://linx.li/new-mail.png

TODO:
It would be nice if the "To" and "CC" were right-aligned.

Change-Id: I89c758bc16af03838e6e3206b2983f451f6044b2
Reviewed-on: https://review.haiku-os.org/753
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Humdinger 2018-12-05 17:48:38 +01:00 committed by waddlesplash
parent 6e48605b8f
commit dbbac33163

View File

@ -402,9 +402,11 @@ THeaderView::THeaderView(bool incoming, bool resending, int32 defaultAccount)
BGridLayout* layout = GridLayout();
if (fIncoming)
if (fIncoming) {
layout->SetHorizontalSpacing(0);
layout->SetVerticalSpacing(B_USE_HALF_ITEM_SPACING);
layout->SetVerticalSpacing(0);
} else
layout->SetVerticalSpacing(B_USE_HALF_ITEM_SPACING);
int32 row = 0;
if (fromField != NULL) {
@ -412,14 +414,31 @@ THeaderView::THeaderView(bool incoming, bool resending, int32 defaultAccount)
layout->AddItem(fromField->CreateMenuBarLayoutItem(), 1, row++, 3, 1);
} else if (fFromControl != NULL) {
layout->AddItem(fFromControl->CreateLabelLayoutItem(), 0, row);
layout->AddItem(fFromControl->CreateTextViewLayoutItem(), 1, row++,
3, 1);
layout->AddItem(fFromControl->CreateTextViewLayoutItem(), 1, row);
}
layout->AddView(fToLabel, 0, row);
layout->AddView(fToControl, 1, row++, 3, 1);
layout->AddView(fCcLabel, 0, row);
layout->AddView(fCcControl, 1, row, fIncoming ? 3 : 1, 1);
if (fIncoming) {
layout->AddView(fToLabel, 2, row);
layout->AddView(fToControl, 3, row++);
} else {
row++;
layout->AddView(fToLabel, 0, row);
layout->AddView(fToControl, 1, row++, 3, 1);
}
if (fDateControl != NULL) {
layout->AddItem(fDateControl->CreateLabelLayoutItem(), 0, row);
layout->AddItem(fDateControl->CreateTextViewLayoutItem(), 1, row);
}
if (fIncoming && (fCcControl != NULL)) {
layout->AddView(fCcLabel, 2, row);
layout->AddView(fCcControl, 3, row++);
} else {
row++;
layout->AddView(fCcLabel, 0, row);
layout->AddView(fCcControl, 1, row, 1, 1);
}
if (fBccControl != NULL) {
layout->AddView(new LabelView(B_TRANSLATE("Bcc:")), 2, row);
layout->AddView(fBccControl, 3, row++);
@ -428,12 +447,6 @@ THeaderView::THeaderView(bool incoming, bool resending, int32 defaultAccount)
layout->AddItem(fSubjectControl->CreateLabelLayoutItem(), 0, row);
layout->AddItem(fSubjectControl->CreateTextViewLayoutItem(), 1, row++,
3, 1);
if (fDateControl != NULL) {
layout->AddItem(fDateControl->CreateLabelLayoutItem(), 0, row);
layout->AddItem(fDateControl->CreateTextViewLayoutItem(), 1, row++,
3, 1);
}
}