The "Show Header" option is no longer persistent, and will only affect the

currently shown mail when checked.
It just didn't make any sense the way it was before, and was inconsistent, too,
as it only affected mails opened after the current one.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26112 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-06-23 21:00:48 +00:00
parent 40bbe4ecf9
commit 8f0dc0c0d8
3 changed files with 67 additions and 122 deletions

View File

@ -119,7 +119,6 @@ TMailApp::TMailApp()
fPrintHelpAndExit(false),
fWrapMode(true),
fShowHeader(false),
fAttachAttributes(true),
fColoredQuotes(true),
fShowButtonBar(true),
@ -819,7 +818,7 @@ TMailApp::LoadOldSettings()
fContentFont.SetFamilyAndStyle(fontFamily, fontStyle);
file.Read(&fSignatureWindowFrame, sizeof(BRect));
file.Read(&fShowHeader, sizeof(bool));
file.Seek(1, SEEK_CUR); // ignore (bool) show header
file.Read(&fWrapMode, sizeof(bool));
file.Read(&fPrefsWindowPos, sizeof(BPoint));
@ -915,7 +914,6 @@ TMailApp::SaveSettings()
settings.AddFloat("FontSize", fContentFont.Size());
settings.AddRect("SignatureWindowSize", fSignatureWindowFrame);
settings.AddBool("ShowHeadersMode", fShowHeader);
settings.AddBool("WordWrapMode", fWrapMode);
settings.AddPoint("PreferencesWindowLocation", fPrefsWindowPos);
settings.AddString("SignatureText", fSignature);
@ -999,9 +997,6 @@ TMailApp::LoadSettings()
fSignatureWindowFrame = rect;
bool boolValue;
if (settings.FindBool("ShowHeadersMode", &boolValue) == B_OK)
fShowHeader = boolValue;
if (settings.FindBool("WordWrapMode", &boolValue) == B_OK)
fWrapMode = boolValue;
@ -1157,22 +1152,6 @@ TMailApp::WrapMode()
}
void
TMailApp::SetShowHeader(bool show)
{
BAutolock _(this);
fShowHeader = show;
}
bool
TMailApp::ShowHeader()
{
BAutolock _(this);
return fShowHeader;
}
bool
TMailApp::AttachAttributes()
{

View File

@ -76,8 +76,6 @@ class TMailApp : public BApplication {
BString Signature();
BString ReplyPreamble();
bool WrapMode();
void SetShowHeader(bool show);
bool ShowHeader();
bool AttachAttributes();
bool ColoredQuotes();
uint8 ShowButtonBar();
@ -120,7 +118,6 @@ class TMailApp : public BApplication {
char* fSignature;
char* fReplyPreamble;
bool fWrapMode;
bool fShowHeader;
bool fAttachAttributes;
bool fColoredQuotes;
uint8 fShowButtonBar;

View File

@ -173,7 +173,6 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
float height;
BMenu* menu;
BMenu* subMenu;
BMenuBar *menu_bar;
BMenuItem* item;
BMessage* msg;
attr_info info;
@ -190,13 +189,10 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
}
BRect r(0, 0, RIGHT_BOUNDARY, 15);
fMenuBar = new BMenuBar(r, "");
// Create real menu bar
fMenuBar = menu_bar = new BMenuBar(r, "");
//
// File Menu
//
menu = new BMenu(MDR_DIALECT_CHOICE ("File","F) ファイル"));
msg = new BMessage(M_NEW);
@ -297,7 +293,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
menu->AddItem(fPrint = new BMenuItem(
MDR_DIALECT_CHOICE ("Print", "P) 印刷") B_UTF8_ELLIPSIS,
new BMessage(M_PRINT), 'P'));
menu_bar->AddItem(menu);
fMenuBar->AddItem(menu);
menu->AddSeparatorItem();
menu->AddItem(item = new BMenuItem(
@ -311,9 +307,8 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
new BMessage(B_QUIT_REQUESTED), 'Q'));
item->SetTarget(be_app);
//
// Edit Menu
//
menu = new BMenu(MDR_DIALECT_CHOICE ("Edit","E) 編集"));
menu->AddItem(fUndo = new BMenuItem(MDR_DIALECT_CHOICE ("Undo","Z) 元に戻す"), new BMessage(B_UNDO), 'Z', 0));
fUndo->SetTarget(NULL, this);
@ -353,28 +348,23 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
MDR_DIALECT_CHOICE ("Preferences","P) Mailの設定") B_UTF8_ELLIPSIS,
new BMessage(M_PREFS),','));
item->SetTarget(be_app);
menu_bar->AddItem(menu);
fMenuBar->AddItem(menu);
menu->AddItem(item = new BMenuItem(
MDR_DIALECT_CHOICE ("Accounts","Accounts") B_UTF8_ELLIPSIS,
new BMessage(M_ACCOUNTS),'-'));
item->SetTarget(be_app);
//
// View Menu
//
if (!resending && fIncoming) {
menu = new BMenu("View");
menu->AddItem(fHeader = new BMenuItem(MDR_DIALECT_CHOICE ("Show Header","H) ヘッダーを表示"), new BMessage(M_HEADER), 'H'));
if (fApp->ShowHeader())
fHeader->SetMarked(true);
menu->AddItem(fRaw = new BMenuItem(MDR_DIALECT_CHOICE ("Show Raw Message"," メッセージを生で表示"), new BMessage(M_RAW)));
menu_bar->AddItem(menu);
fMenuBar->AddItem(menu);
}
//
// Message Menu
//
menu = new BMenu(MDR_DIALECT_CHOICE ("Message", "M) メッセージ"));
if (!resending && fIncoming) {
@ -438,7 +428,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
}
menu->AddItem(subMenu);
menu_bar->AddItem(menu);
fMenuBar->AddItem(menu);
// Spam Menu
@ -454,7 +444,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Mark as Genuine",
new BMessage(M_TRAIN_GENUINE), 'K', B_SHIFT_KEY));
menu_bar->AddItem(menu);
fMenuBar->AddItem(menu);
}
} else {
menu->AddItem(fSendNow = new BMenuItem(
@ -475,26 +465,23 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
menu->AddItem(fAdd = new BMenuItem(MDR_DIALECT_CHOICE ("Add Enclosure","E) 追加")B_UTF8_ELLIPSIS, new BMessage(M_ADD), 'E'));
menu->AddItem(fRemove = new BMenuItem(MDR_DIALECT_CHOICE ("Remove Enclosure","T) 削除"), new BMessage(M_REMOVE), 'T'));
}
menu_bar->AddItem(menu);
fMenuBar->AddItem(menu);
}
//
// Queries Menu
//
fQueryMenu = new BMenu(MDR_DIALECT_CHOICE("Queries","???"));
menu_bar->AddItem(fQueryMenu);
fMenuBar->AddItem(fQueryMenu);
_RebuildQueryMenu(true);
//
// Menu Bar
//
AddChild(menu_bar);
height = menu_bar->Bounds().bottom + 1;
//
AddChild(fMenuBar);
height = fMenuBar->Bounds().bottom + 1;
// Button Bar
//
float bbwidth = 0, bbheight = 0;
bool showButtonBar = fApp->ShowButtonBar();
@ -522,7 +509,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
r.OffsetTo(0, 0);
r.top = fHeaderView->Frame().bottom - 1;
fContentView = new TContentView(r, fIncoming, fMail,
const_cast<BFont *>(font), fApp->ShowHeader(), fApp->ColoredQuotes());
const_cast<BFont *>(font), false, fApp->ColoredQuotes());
// TContentView needs to be properly const, for now cast away constness
AddChild(fHeaderView);
@ -530,15 +517,12 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
AddChild(fEnclosuresView);
AddChild(fContentView);
if (to) {
if (to)
fHeaderView->fTo->SetText(to);
}
AddShortcut('n', B_COMMAND_KEY, new BMessage(M_NEW));
//
// If auto-signature, add signature to the text here.
//
BString signature = fApp->Signature();
@ -546,9 +530,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
if (strcmp(signature.String(), SIG_RANDOM) == 0)
PostMessage(M_RANDOM_SIG);
else {
//
// Create a query to find this signature
//
BVolume volume;
BVolumeRoster().GetBootVolume(&volume);
@ -559,9 +541,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
query.PushOp(B_EQ);
query.Fetch();
//
// If we find the named query, add it to the text.
//
BEntry entry;
if (query.GetNextEntry(&entry) == B_NO_ERROR) {
off_t size;
@ -713,13 +693,11 @@ bool
TMailWindow::GetTrackerWindowFile(entry_ref *ref, bool next) const
{
// Position was already saved
if (next && fNextTrackerPositionSaved)
{
if (next && fNextTrackerPositionSaved) {
*ref = fNextRef;
return true;
}
if (!next && fPrevTrackerPositionSaved)
{
if (!next && fPrevTrackerPositionSaved) {
*ref = fPrevRef;
return true;
}
@ -727,15 +705,12 @@ TMailWindow::GetTrackerWindowFile(entry_ref *ref, bool next) const
if (!fTrackerMessenger.IsValid())
return false;
//
// Ask the tracker what the next/prev file in the window is.
// Continue asking for the next reference until a valid
// email file is found (ignoring other types).
//
entry_ref nextRef = *ref;
bool foundRef = false;
while (!foundRef)
{
while (!foundRef) {
BMessage request(B_GET_PROPERTY);
BMessage spc;
if (next)
@ -808,12 +783,10 @@ void
TMailWindow::SetCurrentMessageRead()
{
BNode node(fRef);
if (node.InitCheck() == B_NO_ERROR)
{
if (node.InitCheck() == B_NO_ERROR) {
BString status;
if (ReadAttrString(&node, B_MAIL_ATTR_STATUS, &status) == B_NO_ERROR
&& !status.ICompare("New"))
{
&& !status.ICompare("New")) {
node.RemoveAttr(B_MAIL_ATTR_STATUS);
WriteAttrString(&node, B_MAIL_ATTR_STATUS, "Read");
}
@ -1217,7 +1190,6 @@ TMailWindow::MessageReceived(BMessage *msg)
case M_HEADER:
{
bool showHeader = !fHeader->IsMarked();
fApp->SetShowHeader(showHeader);
fHeader->SetMarked(showHeader);
BMessage message(M_HEADER);
@ -1573,8 +1545,7 @@ TMailWindow::MessageReceived(BMessage *msg)
void
TMailWindow::AddEnclosure(BMessage *msg)
{
if (fEnclosuresView == NULL && !fIncoming)
{
if (fEnclosuresView == NULL && !fIncoming) {
BRect r;
r.left = 0;
r.top = fHeaderView->Frame().bottom - 1;
@ -2978,7 +2949,6 @@ TMailWindow::_RebuildQueryMenu(bool firstTime)
// If we find the named query, add it to the menu.
BEntry entry;
while (queryDir.GetNextEntry(&entry) == B_OK) {
char name[B_FILE_NAME_LENGTH + 1];
entry.GetName(name);
@ -3053,13 +3023,12 @@ TMailWindow::_BuildQueryString(BEntry* entry) const
BMessage message;
if (message.Unflatten(buffer) == B_OK) {
for (int32 index = 0; /*index < count*/; index++) {
const char *field;
const char *value;
if (message.FindString("menuSelection",
index, &field) != B_OK
|| message.FindString("attrViewText",
index, &value) != B_OK) {
if (message.FindString("menuSelection", index, &field)
!= B_OK
|| message.FindString("attrViewText", index, &value)
!= B_OK) {
break;
}