Add another option to the mail app. When you switch "Automaticly mark mail as readed" off a new Read / Unread button appears and a mail is only marked as readed when you push this button. On default the old behaviour is used.
This is once again a opera feature I like very much and I haven't found in any other email client yet. E.g. you can start a query on unreaded mails and take a short look at the mails without the mails are disappearing from the query. If you read the mail you press "Readed" and the mail is gone from the query. This is e.g an advantage if you have less time, take a look at a mail and found that the mail is very long but potentially intressting. In this case you just press next or close the window and the mail is still in the unreaded query, ready to be readed at another time. The unreaded flag becomes something like a automatic important flag. You don't have to mark / unmark the mails as important and still don't forget to process any mail. I think this is a different way how most people read mails so I hope you like the patch. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30437 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -76,19 +76,42 @@ ButtonBar::~ButtonBar()
|
|||||||
|
|
||||||
|
|
||||||
BmapButton*
|
BmapButton*
|
||||||
ButtonBar::AddButton(const char *label, int32 baseID, BMessage *msg)
|
ButtonBar::AddButton(const char *label, int32 baseID, BMessage *msg,
|
||||||
|
int32 position)
|
||||||
{
|
{
|
||||||
BmapButton* button = new BmapButton(BRect(0, 0, 31, 31), label, label,
|
BmapButton* button = new BmapButton(BRect(0, 0, 31, 31), label, label,
|
||||||
baseID + fEnabledOffset, baseID + fDisabledOffset, baseID + fRollOffset,
|
baseID + fEnabledOffset, baseID + fDisabledOffset, baseID + fRollOffset,
|
||||||
baseID + fPressedOffset, fShowLabels, msg,
|
baseID + fPressedOffset, fShowLabels, msg,
|
||||||
B_FOLLOW_LEFT | B_FOLLOW_TOP);
|
B_FOLLOW_LEFT | B_FOLLOW_TOP);
|
||||||
|
|
||||||
|
if (position > 0)
|
||||||
|
fButtonList.AddItem(button, position);
|
||||||
|
else
|
||||||
fButtonList.AddItem(button);
|
fButtonList.AddItem(button);
|
||||||
AddChild(button);
|
AddChild(button);
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
ButtonBar::RemoveButton(BmapButton *button)
|
||||||
|
{
|
||||||
|
if (fButtonList.RemoveItem(button)) {
|
||||||
|
RemoveChild(button);
|
||||||
|
delete button;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
ButtonBar::IndexOf(BmapButton *button)
|
||||||
|
{
|
||||||
|
return fButtonList.IndexOf(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ButtonBar::Arrange(bool fixedWidth)
|
ButtonBar::Arrange(bool fixedWidth)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,7 +57,10 @@ public:
|
|||||||
|
|
||||||
void ShowLabels(bool show);
|
void ShowLabels(bool show);
|
||||||
void Arrange(bool fixedWidth = true);
|
void Arrange(bool fixedWidth = true);
|
||||||
BmapButton *AddButton(const char *label, int32 baseID, BMessage *msg);
|
BmapButton *AddButton(const char *label, int32 baseID, BMessage *msg,
|
||||||
|
int32 position = -1);
|
||||||
|
bool RemoveButton(BmapButton *button);
|
||||||
|
int32 IndexOf(BmapButton *button);
|
||||||
void AddDivider(float vmargin);
|
void AddDivider(float vmargin);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ TMailApp::TMailApp()
|
|||||||
{
|
{
|
||||||
// set default values
|
// set default values
|
||||||
fContentFont.SetSize(12.0);
|
fContentFont.SetSize(12.0);
|
||||||
|
fAutoMarkReaded = true;
|
||||||
fSignature = (char *)malloc(strlen(SIG_NONE) + 1);
|
fSignature = (char *)malloc(strlen(SIG_NONE) + 1);
|
||||||
strcpy(fSignature, SIG_NONE);
|
strcpy(fSignature, SIG_NONE);
|
||||||
fReplyPreamble = (char *)malloc(1);
|
fReplyPreamble = (char *)malloc(1);
|
||||||
@@ -348,25 +349,24 @@ TMailApp::MessageReceived(BMessage *msg)
|
|||||||
&fColoredQuotes, &fDefaultChain, &fUseAccountFrom,
|
&fColoredQuotes, &fDefaultChain, &fUseAccountFrom,
|
||||||
&fReplyPreamble, &fSignature, &fMailCharacterSet,
|
&fReplyPreamble, &fSignature, &fMailCharacterSet,
|
||||||
&fWarnAboutUnencodableCharacters,
|
&fWarnAboutUnencodableCharacters,
|
||||||
&fStartWithSpellCheckOn, &fShowButtonBar);
|
&fStartWithSpellCheckOn, &fAutoMarkReaded,
|
||||||
|
&fShowButtonBar);
|
||||||
fPrefsWindow->Show();
|
fPrefsWindow->Show();
|
||||||
fPreviousShowButtonBar = fShowButtonBar;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PREFS_CHANGED:
|
case PREFS_CHANGED:
|
||||||
{
|
{
|
||||||
// Do we need to update the state of the button bars?
|
|
||||||
if (fPreviousShowButtonBar != fShowButtonBar) {
|
|
||||||
// Notify all Mail windows
|
// Notify all Mail windows
|
||||||
TMailWindow *window;
|
TMailWindow *window;
|
||||||
for (int32 i = 0; (window=(TMailWindow *)fWindowList.ItemAt(i)) != NULL; i++) {
|
for (int32 i = 0; (window=(TMailWindow *)fWindowList.ItemAt(i))
|
||||||
|
!= NULL; i++)
|
||||||
|
{
|
||||||
window->Lock();
|
window->Lock();
|
||||||
|
window->UpdatePreferences();
|
||||||
window->UpdateViews();
|
window->UpdateViews();
|
||||||
window->Unlock();
|
window->Unlock();
|
||||||
}
|
}
|
||||||
fPreviousShowButtonBar = fShowButtonBar;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -912,6 +912,7 @@ TMailApp::SaveSettings()
|
|||||||
settings.AddRect("SignatureWindowSize", fSignatureWindowFrame);
|
settings.AddRect("SignatureWindowSize", fSignatureWindowFrame);
|
||||||
settings.AddBool("WordWrapMode", fWrapMode);
|
settings.AddBool("WordWrapMode", fWrapMode);
|
||||||
settings.AddPoint("PreferencesWindowLocation", fPrefsWindowPos);
|
settings.AddPoint("PreferencesWindowLocation", fPrefsWindowPos);
|
||||||
|
settings.AddBool("AutoMarkReaded", fAutoMarkReaded);
|
||||||
settings.AddString("SignatureText", fSignature);
|
settings.AddString("SignatureText", fSignature);
|
||||||
settings.AddInt32("CharacterSet", fMailCharacterSet);
|
settings.AddInt32("CharacterSet", fMailCharacterSet);
|
||||||
settings.AddString("FindString", FindWindow::GetFindString());
|
settings.AddString("FindString", FindWindow::GetFindString());
|
||||||
@@ -1000,6 +1001,9 @@ TMailApp::LoadSettings()
|
|||||||
if (settings.FindPoint("PreferencesWindowLocation", &point) == B_OK)
|
if (settings.FindPoint("PreferencesWindowLocation", &point) == B_OK)
|
||||||
fPrefsWindowPos = point;
|
fPrefsWindowPos = point;
|
||||||
|
|
||||||
|
if (settings.FindBool("AutoMarkReaded", &boolValue) == B_OK)
|
||||||
|
fAutoMarkReaded = boolValue;
|
||||||
|
|
||||||
const char *string;
|
const char *string;
|
||||||
if (settings.FindString("SignatureText", &string) == B_OK) {
|
if (settings.FindString("SignatureText", &string) == B_OK) {
|
||||||
free(fSignature);
|
free(fSignature);
|
||||||
@@ -1137,6 +1141,14 @@ TMailApp::NewWindow(const entry_ref* ref, const char* to, bool resend,
|
|||||||
// #pragma mark - settings
|
// #pragma mark - settings
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
TMailApp::AutoMarkReaded()
|
||||||
|
{
|
||||||
|
BAutolock _(this);
|
||||||
|
return fAutoMarkReaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BString
|
BString
|
||||||
TMailApp::Signature()
|
TMailApp::Signature()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ class TMailApp : public BApplication {
|
|||||||
void SetLastWindowFrame(BRect frame);
|
void SetLastWindowFrame(BRect frame);
|
||||||
|
|
||||||
// TODO: move these into a MailSettings class
|
// TODO: move these into a MailSettings class
|
||||||
|
bool AutoMarkReaded();
|
||||||
BString Signature();
|
BString Signature();
|
||||||
BString ReplyPreamble();
|
BString ReplyPreamble();
|
||||||
bool WrapMode();
|
bool WrapMode();
|
||||||
@@ -103,8 +104,6 @@ class TMailApp : public BApplication {
|
|||||||
TPrefsWindow* fPrefsWindow;
|
TPrefsWindow* fPrefsWindow;
|
||||||
TSignatureWindow* fSigWindow;
|
TSignatureWindow* fSigWindow;
|
||||||
|
|
||||||
uint8 fPreviousShowButtonBar;
|
|
||||||
|
|
||||||
BRect fMailWindowFrame;
|
BRect fMailWindowFrame;
|
||||||
BRect fLastMailWindowFrame;
|
BRect fLastMailWindowFrame;
|
||||||
BRect fSignatureWindowFrame;
|
BRect fSignatureWindowFrame;
|
||||||
@@ -115,6 +114,7 @@ class TMailApp : public BApplication {
|
|||||||
bool fPrintHelpAndExit;
|
bool fPrintHelpAndExit;
|
||||||
|
|
||||||
// TODO: these should go into a settings class
|
// TODO: these should go into a settings class
|
||||||
|
bool fAutoMarkReaded;
|
||||||
char* fSignature;
|
char* fSignature;
|
||||||
char* fReplyPreamble;
|
char* fReplyPreamble;
|
||||||
bool fWrapMode;
|
bool fWrapMode;
|
||||||
|
|||||||
+108
-21
@@ -166,7 +166,9 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
|
|||||||
fDraft(false),
|
fDraft(false),
|
||||||
fChanged(false),
|
fChanged(false),
|
||||||
fStartingText(NULL),
|
fStartingText(NULL),
|
||||||
fOriginatingWindow(NULL)
|
fOriginatingWindow(NULL),
|
||||||
|
fReadedButton(NULL),
|
||||||
|
fNextButton(NULL)
|
||||||
{
|
{
|
||||||
if (messenger != NULL)
|
if (messenger != NULL)
|
||||||
fTrackerMessenger = *messenger;
|
fTrackerMessenger = *messenger;
|
||||||
@@ -192,6 +194,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
|
|||||||
fIncoming = false;
|
fIncoming = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fAutoMarkReaded = fApp->AutoMarkReaded();
|
||||||
BRect r(0, 0, RIGHT_BOUNDARY, 15);
|
BRect r(0, 0, RIGHT_BOUNDARY, 15);
|
||||||
fMenuBar = new BMenuBar(r, "");
|
fMenuBar = new BMenuBar(r, "");
|
||||||
|
|
||||||
@@ -585,46 +588,64 @@ TMailWindow::BuildButtonBar()
|
|||||||
{
|
{
|
||||||
ButtonBar *bbar;
|
ButtonBar *bbar;
|
||||||
|
|
||||||
bbar = new ButtonBar(BRect(0, 0, 100, 100), "ButtonBar", 2, 3, 0, 1, 10, 2);
|
bbar = new ButtonBar(BRect(0, 0, 100, 100), "ButtonBar", 2, 3, 0, 1, 10,
|
||||||
|
2);
|
||||||
bbar->AddButton(MDR_DIALECT_CHOICE ("New","新規"), 28, new BMessage(M_NEW));
|
bbar->AddButton(MDR_DIALECT_CHOICE ("New","新規"), 28, new BMessage(M_NEW));
|
||||||
bbar->AddDivider(5);
|
bbar->AddDivider(5);
|
||||||
|
fButtonBar = bbar;
|
||||||
|
|
||||||
if (fResending) {
|
if (fResending) {
|
||||||
fSendButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Send","送信"), 8, new BMessage(M_SEND_NOW));
|
fSendButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Send","送信"), 8,
|
||||||
|
new BMessage(M_SEND_NOW));
|
||||||
bbar->AddDivider(5);
|
bbar->AddDivider(5);
|
||||||
} else if (!fIncoming) {
|
} else if (!fIncoming) {
|
||||||
fSendButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Send","送信"), 8, new BMessage(M_SEND_NOW));
|
fSendButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Send","送信"), 8,
|
||||||
|
new BMessage(M_SEND_NOW));
|
||||||
fSendButton->SetEnabled(false);
|
fSendButton->SetEnabled(false);
|
||||||
fSigButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Signature","署名"), 4, new BMessage(M_SIG_MENU));
|
fSigButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Signature","署名"), 4,
|
||||||
|
new BMessage(M_SIG_MENU));
|
||||||
fSigButton->InvokeOnButton(B_SECONDARY_MOUSE_BUTTON);
|
fSigButton->InvokeOnButton(B_SECONDARY_MOUSE_BUTTON);
|
||||||
fSaveButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Save","保存"), 44, new BMessage(M_SAVE_AS_DRAFT));
|
fSaveButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Save","保存"), 44,
|
||||||
|
new BMessage(M_SAVE_AS_DRAFT));
|
||||||
fSaveButton->SetEnabled(false);
|
fSaveButton->SetEnabled(false);
|
||||||
fPrintButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Print","印刷"), 16, new BMessage(M_PRINT));
|
fPrintButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Print","印刷"), 16,
|
||||||
|
new BMessage(M_PRINT));
|
||||||
fPrintButton->SetEnabled(false);
|
fPrintButton->SetEnabled(false);
|
||||||
bbar->AddButton(MDR_DIALECT_CHOICE ("Trash","削除"), 0, new BMessage(M_DELETE));
|
bbar->AddButton(MDR_DIALECT_CHOICE ("Trash","削除"), 0,
|
||||||
|
new BMessage(M_DELETE));
|
||||||
bbar->AddDivider(5);
|
bbar->AddDivider(5);
|
||||||
} else {
|
} else {
|
||||||
BmapButton *button = bbar->AddButton(MDR_DIALECT_CHOICE ("Reply","返信"), 12, new BMessage(M_REPLY));
|
BmapButton *button = bbar->AddButton(MDR_DIALECT_CHOICE ("Reply","返信"),
|
||||||
|
12, new BMessage(M_REPLY));
|
||||||
button->InvokeOnButton(B_SECONDARY_MOUSE_BUTTON);
|
button->InvokeOnButton(B_SECONDARY_MOUSE_BUTTON);
|
||||||
button = bbar->AddButton(MDR_DIALECT_CHOICE ("Forward","転送"), 40, new BMessage(M_FORWARD));
|
button = bbar->AddButton(MDR_DIALECT_CHOICE ("Forward","転送"), 40,
|
||||||
|
new BMessage(M_FORWARD));
|
||||||
button->InvokeOnButton(B_SECONDARY_MOUSE_BUTTON);
|
button->InvokeOnButton(B_SECONDARY_MOUSE_BUTTON);
|
||||||
fPrintButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Print","印刷"), 16, new BMessage(M_PRINT));
|
fPrintButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Print","印刷"), 16,
|
||||||
bbar->AddButton(MDR_DIALECT_CHOICE ("Trash","削除"), 0, new BMessage(M_DELETE_NEXT));
|
new BMessage(M_PRINT));
|
||||||
|
bbar->AddButton(MDR_DIALECT_CHOICE ("Trash","削除"), 0,
|
||||||
|
new BMessage(M_DELETE_NEXT));
|
||||||
if (fApp->ShowSpamGUI()) {
|
if (fApp->ShowSpamGUI()) {
|
||||||
button = bbar->AddButton("Spam", 48, new BMessage(M_SPAM_BUTTON));
|
button = bbar->AddButton("Spam", 48, new BMessage(M_SPAM_BUTTON));
|
||||||
button->InvokeOnButton(B_SECONDARY_MOUSE_BUTTON);
|
button->InvokeOnButton(B_SECONDARY_MOUSE_BUTTON);
|
||||||
}
|
}
|
||||||
bbar->AddDivider(5);
|
bbar->AddDivider(5);
|
||||||
bbar->AddButton(MDR_DIALECT_CHOICE ("Next","次へ"), 24, new BMessage(M_NEXTMSG));
|
fNextButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Next","次へ"), 24,
|
||||||
bbar->AddButton(MDR_DIALECT_CHOICE ("Previous","前へ"), 20, new BMessage(M_PREVMSG));
|
new BMessage(M_NEXTMSG));
|
||||||
|
bbar->AddButton(MDR_DIALECT_CHOICE ("Previous","前へ"), 20,
|
||||||
|
new BMessage(M_PREVMSG));
|
||||||
|
if (!fAutoMarkReaded) {
|
||||||
|
_AddReadedButton();
|
||||||
}
|
}
|
||||||
bbar->AddButton(MDR_DIALECT_CHOICE ("Inbox","受信箱"), 36, new BMessage(M_OPEN_MAIL_BOX));
|
}
|
||||||
bbar->AddButton(MDR_DIALECT_CHOICE ("Mail","メール"), 32, new BMessage(M_OPEN_MAIL_FOLDER));
|
bbar->AddButton(MDR_DIALECT_CHOICE ("Inbox","受信箱"), 36,
|
||||||
|
new BMessage(M_OPEN_MAIL_BOX));
|
||||||
|
bbar->AddButton(MDR_DIALECT_CHOICE ("Mail","メール"), 32,
|
||||||
|
new BMessage(M_OPEN_MAIL_FOLDER));
|
||||||
|
|
||||||
bbar->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
bbar->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
bbar->Hide();
|
bbar->Hide();
|
||||||
AddChild(bbar);
|
AddChild(bbar);
|
||||||
fButtonBar = bbar;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -641,6 +662,7 @@ TMailWindow::UpdateViews()
|
|||||||
// Create the Button Bar if needed
|
// Create the Button Bar if needed
|
||||||
if (!fButtonBar)
|
if (!fButtonBar)
|
||||||
BuildButtonBar();
|
BuildButtonBar();
|
||||||
|
|
||||||
fButtonBar->ShowLabels(showButtonBar);
|
fButtonBar->ShowLabels(showButtonBar);
|
||||||
fButtonBar->Arrange(/* True for all buttons same size, false to just fit */
|
fButtonBar->Arrange(/* True for all buttons same size, false to just fit */
|
||||||
MDR_DIALECT_CHOICE (true, true));
|
MDR_DIALECT_CHOICE (true, true));
|
||||||
@@ -652,6 +674,7 @@ TMailWindow::UpdateViews()
|
|||||||
fButtonBar->Show();
|
fButtonBar->Show();
|
||||||
else
|
else
|
||||||
fButtonBar->Invalidate();
|
fButtonBar->Invalidate();
|
||||||
|
|
||||||
} else if (fButtonBar)
|
} else if (fButtonBar)
|
||||||
fButtonBar->Hide();
|
fButtonBar->Hide();
|
||||||
|
|
||||||
@@ -670,6 +693,15 @@ TMailWindow::UpdateViews()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TMailWindow::UpdatePreferences()
|
||||||
|
{
|
||||||
|
fAutoMarkReaded = fApp->AutoMarkReaded();
|
||||||
|
|
||||||
|
_UpdateReadButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TMailWindow::~TMailWindow()
|
TMailWindow::~TMailWindow()
|
||||||
{
|
{
|
||||||
fApp->SetLastWindowFrame(Frame());
|
fApp->SetLastWindowFrame(Frame());
|
||||||
@@ -785,16 +817,21 @@ TMailWindow::SetTrackerSelectionToCurrent()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TMailWindow::SetCurrentMessageRead()
|
TMailWindow::SetCurrentMessageRead(bool readed)
|
||||||
{
|
{
|
||||||
BNode node(fRef);
|
BNode node(fRef);
|
||||||
if (node.InitCheck() == B_NO_ERROR) {
|
if (node.InitCheck() == B_NO_ERROR) {
|
||||||
BString status;
|
BString status;
|
||||||
if (ReadAttrString(&node, B_MAIL_ATTR_STATUS, &status) == B_NO_ERROR
|
if (ReadAttrString(&node, B_MAIL_ATTR_STATUS, &status) == B_NO_ERROR) {
|
||||||
&& !status.ICompare("New")) {
|
if (readed && !status.ICompare("New")) {
|
||||||
node.RemoveAttr(B_MAIL_ATTR_STATUS);
|
node.RemoveAttr(B_MAIL_ATTR_STATUS);
|
||||||
WriteAttrString(&node, B_MAIL_ATTR_STATUS, "Read");
|
WriteAttrString(&node, B_MAIL_ATTR_STATUS, "Read");
|
||||||
}
|
}
|
||||||
|
if (!readed && !status.ICompare("Read")) {
|
||||||
|
node.RemoveAttr(B_MAIL_ATTR_STATUS);
|
||||||
|
WriteAttrString(&node, B_MAIL_ATTR_STATUS, "New");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1079,7 +1116,7 @@ TMailWindow::MessageReceived(BMessage *msg)
|
|||||||
foundRef = GetTrackerWindowFile(&nextRef, msg->what ==
|
foundRef = GetTrackerWindowFile(&nextRef, msg->what ==
|
||||||
M_DELETE_NEXT);
|
M_DELETE_NEXT);
|
||||||
}
|
}
|
||||||
if (fIncoming)
|
if (fIncoming && fAutoMarkReaded)
|
||||||
SetCurrentMessageRead();
|
SetCurrentMessageRead();
|
||||||
|
|
||||||
if (!fTrackerMessenger.IsValid() || !fIncoming) {
|
if (!fTrackerMessenger.IsValid() || !fIncoming) {
|
||||||
@@ -1400,6 +1437,13 @@ TMailWindow::MessageReceived(BMessage *msg)
|
|||||||
//
|
//
|
||||||
// Navigation Messages
|
// Navigation Messages
|
||||||
//
|
//
|
||||||
|
case M_UNREAD:
|
||||||
|
SetCurrentMessageRead(false);
|
||||||
|
_UpdateReadButton();
|
||||||
|
break;
|
||||||
|
case M_READED:
|
||||||
|
SetCurrentMessageRead();
|
||||||
|
msg->what = M_NEXTMSG;
|
||||||
case M_PREVMSG:
|
case M_PREVMSG:
|
||||||
case M_NEXTMSG:
|
case M_NEXTMSG:
|
||||||
if (fRef)
|
if (fRef)
|
||||||
@@ -1408,6 +1452,7 @@ TMailWindow::MessageReceived(BMessage *msg)
|
|||||||
if (GetTrackerWindowFile(&nextRef, (msg->what == M_NEXTMSG))) {
|
if (GetTrackerWindowFile(&nextRef, (msg->what == M_NEXTMSG))) {
|
||||||
TMailWindow *window = static_cast<TMailApp *>(be_app)->FindWindow(nextRef);
|
TMailWindow *window = static_cast<TMailApp *>(be_app)->FindWindow(nextRef);
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
|
if (fAutoMarkReaded)
|
||||||
SetCurrentMessageRead();
|
SetCurrentMessageRead();
|
||||||
OpenMessage(&nextRef, fHeaderView->fCharacterSetUserSees);
|
OpenMessage(&nextRef, fHeaderView->fCharacterSetUserSees);
|
||||||
} else {
|
} else {
|
||||||
@@ -1662,6 +1707,7 @@ TMailWindow::QuitRequested()
|
|||||||
}
|
}
|
||||||
} else if (fRef && !sKeepStatusOnQuit) {
|
} else if (fRef && !sKeepStatusOnQuit) {
|
||||||
// ...Otherwise just set the message read
|
// ...Otherwise just set the message read
|
||||||
|
if (fAutoMarkReaded)
|
||||||
SetCurrentMessageRead();
|
SetCurrentMessageRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2835,6 +2881,9 @@ TMailWindow::OpenMessage(entry_ref *ref, uint32 characterSetForDecoding)
|
|||||||
fContentView->fTextView->SetText("", (int32)0);
|
fContentView->fTextView->SetText("", (int32)0);
|
||||||
|
|
||||||
fContentView->fTextView->LoadMessage(fMail, false, NULL);
|
fContentView->fTextView->LoadMessage(fMail, false, NULL);
|
||||||
|
|
||||||
|
if (fApp->ShowButtonBar())
|
||||||
|
_UpdateReadButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -3082,3 +3131,41 @@ TMailWindow::_BuildQueryString(BEntry* entry) const
|
|||||||
return strdup(queryString.String());
|
return strdup(queryString.String());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TMailWindow::_AddReadedButton()
|
||||||
|
{
|
||||||
|
bool newMail = false;
|
||||||
|
BNode node(fRef);
|
||||||
|
if (node.InitCheck() == B_NO_ERROR) {
|
||||||
|
BString status;
|
||||||
|
if (ReadAttrString(&node, B_MAIL_ATTR_STATUS, &status) == B_NO_ERROR
|
||||||
|
&& !status.ICompare("New")) {
|
||||||
|
newMail = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 buttonIndex = fButtonBar->IndexOf(fNextButton);
|
||||||
|
if (newMail)
|
||||||
|
fReadedButton = fButtonBar->AddButton(
|
||||||
|
MDR_DIALECT_CHOICE (" Read ", " Read "), 24,
|
||||||
|
new BMessage(M_READED), buttonIndex);
|
||||||
|
else
|
||||||
|
fReadedButton = fButtonBar->AddButton(
|
||||||
|
MDR_DIALECT_CHOICE ("Unread", "Unread"), 28,
|
||||||
|
new BMessage(M_UNREAD), buttonIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TMailWindow::_UpdateReadButton()
|
||||||
|
{
|
||||||
|
if (fApp->ShowButtonBar()) {
|
||||||
|
fButtonBar->RemoveButton(fReadedButton);
|
||||||
|
fReadedButton = NULL;
|
||||||
|
if (!fAutoMarkReaded && !fReadedButton) {
|
||||||
|
_AddReadedButton();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UpdateViews();
|
||||||
|
}
|
||||||
|
|||||||
@@ -107,10 +107,11 @@ class TMailWindow : public BWindow {
|
|||||||
void SaveTrackerPosition(entry_ref*);
|
void SaveTrackerPosition(entry_ref*);
|
||||||
void SetOriginatingWindow(BWindow* window);
|
void SetOriginatingWindow(BWindow* window);
|
||||||
|
|
||||||
void SetCurrentMessageRead();
|
void SetCurrentMessageRead(bool readed = true);
|
||||||
void SetTrackerSelectionToCurrent();
|
void SetTrackerSelectionToCurrent();
|
||||||
TMailWindow* FrontmostWindow();
|
TMailWindow* FrontmostWindow();
|
||||||
void UpdateViews();
|
void UpdateViews();
|
||||||
|
void UpdatePreferences();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetTitleForMessage();
|
void SetTitleForMessage();
|
||||||
@@ -125,6 +126,9 @@ class TMailWindow : public BWindow {
|
|||||||
void _RebuildQueryMenu(bool firstTime = false);
|
void _RebuildQueryMenu(bool firstTime = false);
|
||||||
char* _BuildQueryString(BEntry* entry) const;
|
char* _BuildQueryString(BEntry* entry) const;
|
||||||
|
|
||||||
|
void _AddReadedButton();
|
||||||
|
void _UpdateReadButton();
|
||||||
|
|
||||||
TMailApp* fApp;
|
TMailApp* fApp;
|
||||||
|
|
||||||
BEmailMessage* fMail;
|
BEmailMessage* fMail;
|
||||||
@@ -193,6 +197,10 @@ class TMailWindow : public BWindow {
|
|||||||
char* fStartingText;
|
char* fStartingText;
|
||||||
entry_ref fRepliedMail;
|
entry_ref fRepliedMail;
|
||||||
BMessenger* fOriginatingWindow;
|
BMessenger* fOriginatingWindow;
|
||||||
|
|
||||||
|
bool fAutoMarkReaded : 1;
|
||||||
|
BmapButton* fReadedButton;
|
||||||
|
BmapButton* fNextButton;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _MAIL_WINDOW_H
|
#endif // _MAIL_WINDOW_H
|
||||||
|
|||||||
@@ -113,6 +113,8 @@ enum MENUS {
|
|||||||
M_COPY,
|
M_COPY,
|
||||||
|
|
||||||
// nav
|
// nav
|
||||||
|
M_READED,
|
||||||
|
M_UNREAD,
|
||||||
M_NEXTMSG,
|
M_NEXTMSG,
|
||||||
M_PREVMSG,
|
M_PREVMSG,
|
||||||
M_SAVE_POSITION,
|
M_SAVE_POSITION,
|
||||||
|
|||||||
+33
-4
@@ -82,6 +82,7 @@ using namespace BPrivate;
|
|||||||
#define ENCODING_TEXT MDR_DIALECT_CHOICE ("Encoding:", "エンコード形式:")
|
#define ENCODING_TEXT MDR_DIALECT_CHOICE ("Encoding:", "エンコード形式:")
|
||||||
#define WARN_UNENCODABLE_TEXT MDR_DIALECT_CHOICE ("Warn Unencodable:", "警告: エンコードできません")
|
#define WARN_UNENCODABLE_TEXT MDR_DIALECT_CHOICE ("Warn Unencodable:", "警告: エンコードできません")
|
||||||
#define SPELL_CHECK_START_ON_TEXT MDR_DIALECT_CHOICE ("Initial Spell Check Mode:", "編集時スペルチェック:")
|
#define SPELL_CHECK_START_ON_TEXT MDR_DIALECT_CHOICE ("Initial Spell Check Mode:", "編集時スペルチェック:")
|
||||||
|
#define AUTO_MARK_READED_TEXT MDR_DIALECT_CHOICE ("Automaticly mark mail as readed:", "Automaticly mark mail as readed:")
|
||||||
|
|
||||||
#define BUTTONBAR_TEXT MDR_DIALECT_CHOICE ("Button Bar:", "ボタンバー:")
|
#define BUTTONBAR_TEXT MDR_DIALECT_CHOICE ("Button Bar:", "ボタンバー:")
|
||||||
|
|
||||||
@@ -99,7 +100,7 @@ enum P_MESSAGES {P_OK = 128, P_CANCEL, P_REVERT, P_FONT,
|
|||||||
P_SIG, P_ENC, P_WARN_UNENCODABLE,
|
P_SIG, P_ENC, P_WARN_UNENCODABLE,
|
||||||
P_SPELL_CHECK_START_ON, P_BUTTON_BAR,
|
P_SPELL_CHECK_START_ON, P_BUTTON_BAR,
|
||||||
P_ACCOUNT, P_REPLYTO, P_REPLY_PREAMBLE,
|
P_ACCOUNT, P_REPLYTO, P_REPLY_PREAMBLE,
|
||||||
P_COLORED_QUOTES};
|
P_COLORED_QUOTES, P_MARK_READED};
|
||||||
|
|
||||||
#define ICON_LABEL_TEXT MDR_DIALECT_CHOICE ("Show Icons & Labels", "アイコンとラベル")
|
#define ICON_LABEL_TEXT MDR_DIALECT_CHOICE ("Show Icons & Labels", "アイコンとラベル")
|
||||||
#define ICON_TEXT MDR_DIALECT_CHOICE ("Show Icons Only", "アイコンのみ")
|
#define ICON_TEXT MDR_DIALECT_CHOICE ("Show Icons Only", "アイコンのみ")
|
||||||
@@ -136,7 +137,7 @@ add_menu_to_layout(BMenuField* menu, BGridLayout* layout, int32& row)
|
|||||||
TPrefsWindow::TPrefsWindow(BRect rect, BFont* font, int32* level, bool* wrap,
|
TPrefsWindow::TPrefsWindow(BRect rect, BFont* font, int32* level, bool* wrap,
|
||||||
bool* attachAttributes, bool* cquotes, uint32* account, int32* replyTo,
|
bool* attachAttributes, bool* cquotes, uint32* account, int32* replyTo,
|
||||||
char** preamble, char** sig, uint32* encoding, bool* warnUnencodable,
|
char** preamble, char** sig, uint32* encoding, bool* warnUnencodable,
|
||||||
bool* spellCheckStartOn, uint8* buttonBar)
|
bool* spellCheckStartOn, bool* autoMarkReaded, uint8* buttonBar)
|
||||||
:
|
:
|
||||||
#if USE_LAYOUT_MANAGEMENT
|
#if USE_LAYOUT_MANAGEMENT
|
||||||
BWindow(rect, MDR_DIALECT_CHOICE ("Mail Preferences", "Mailの設定"),
|
BWindow(rect, MDR_DIALECT_CHOICE ("Mail Preferences", "Mailの設定"),
|
||||||
@@ -180,7 +181,10 @@ TPrefsWindow::TPrefsWindow(BRect rect, BFont* font, int32* level, bool* wrap,
|
|||||||
fWarnUnencodable(*fNewWarnUnencodable),
|
fWarnUnencodable(*fNewWarnUnencodable),
|
||||||
|
|
||||||
fNewSpellCheckStartOn(spellCheckStartOn),
|
fNewSpellCheckStartOn(spellCheckStartOn),
|
||||||
fSpellCheckStartOn(*fNewSpellCheckStartOn)
|
fSpellCheckStartOn(*fNewSpellCheckStartOn),
|
||||||
|
|
||||||
|
fNewAutoMarkReaded(autoMarkReaded),
|
||||||
|
fAutoMarkReaded(*fNewAutoMarkReaded)
|
||||||
{
|
{
|
||||||
strcpy(fSignature, *fNewSignature);
|
strcpy(fSignature, *fNewSignature);
|
||||||
|
|
||||||
@@ -242,7 +246,10 @@ TPrefsWindow::TPrefsWindow(BRect rect, BFont* font, int32* level, bool* wrap,
|
|||||||
fSpellCheckStartOnMenu, NULL);
|
fSpellCheckStartOnMenu, NULL);
|
||||||
add_menu_to_layout(menu, interfaceLayout, layoutRow);
|
add_menu_to_layout(menu, interfaceLayout, layoutRow);
|
||||||
|
|
||||||
|
fAutoMarkReadedMenu = _BuildAutoMarkReadedMenu(fAutoMarkReaded);
|
||||||
|
menu = new BMenuField("autoMarkReaded", AUTO_MARK_READED_TEXT,
|
||||||
|
fAutoMarkReadedMenu, NULL);
|
||||||
|
add_menu_to_layout(menu, interfaceLayout, layoutRow);
|
||||||
// Mail Accounts
|
// Mail Accounts
|
||||||
|
|
||||||
layoutRow = 0;
|
layoutRow = 0;
|
||||||
@@ -406,6 +413,13 @@ TPrefsWindow::TPrefsWindow(BRect rect, BFont* font, int32* level, bool* wrap,
|
|||||||
menu->SetAlignment(B_ALIGN_RIGHT);
|
menu->SetAlignment(B_ALIGN_RIGHT);
|
||||||
interfaceBox->AddChild(menu);
|
interfaceBox->AddChild(menu);
|
||||||
|
|
||||||
|
r.OffsetBy(0, height + ITEM_SPACE);
|
||||||
|
fAutoMarkReadedMenu = _BuildAutoMarkReadedMenu(fAutoMarkReaded);
|
||||||
|
menu = new BMenuField("autoMarkReaded", AUTO_MARK_READED_TEXT,
|
||||||
|
fAutoMarkReadedMenu, NULL);
|
||||||
|
menu->SetDivider(labelWidth);
|
||||||
|
menu->SetAlignment(B_ALIGN_RIGHT);
|
||||||
|
interfaceBox->AddChild(menu);
|
||||||
|
|
||||||
// Mail Accounts
|
// Mail Accounts
|
||||||
|
|
||||||
@@ -579,6 +593,7 @@ TPrefsWindow::MessageReceived(BMessage* msg)
|
|||||||
*fNewEncoding = fEncoding;
|
*fNewEncoding = fEncoding;
|
||||||
*fNewWarnUnencodable = fWarnUnencodable;
|
*fNewWarnUnencodable = fWarnUnencodable;
|
||||||
*fNewSpellCheckStartOn = fSpellCheckStartOn;
|
*fNewSpellCheckStartOn = fSpellCheckStartOn;
|
||||||
|
*fNewAutoMarkReaded = fAutoMarkReaded;
|
||||||
*fNewButtonBar = fButtonBar;
|
*fNewButtonBar = fButtonBar;
|
||||||
|
|
||||||
be_app->PostMessage(PREFS_CHANGED);
|
be_app->PostMessage(PREFS_CHANGED);
|
||||||
@@ -719,6 +734,10 @@ TPrefsWindow::MessageReceived(BMessage* msg)
|
|||||||
case P_SPELL_CHECK_START_ON:
|
case P_SPELL_CHECK_START_ON:
|
||||||
msg->FindBool("spellCheckStartOn", fNewSpellCheckStartOn);
|
msg->FindBool("spellCheckStartOn", fNewSpellCheckStartOn);
|
||||||
break;
|
break;
|
||||||
|
case P_MARK_READED:
|
||||||
|
msg->FindBool("autoMarkReaded", fNewAutoMarkReaded);
|
||||||
|
be_app->PostMessage(PREFS_CHANGED);
|
||||||
|
break;
|
||||||
case P_BUTTON_BAR:
|
case P_BUTTON_BAR:
|
||||||
msg->FindInt8("bar", (int8 *)fNewButtonBar);
|
msg->FindInt8("bar", (int8 *)fNewButtonBar);
|
||||||
be_app->PostMessage(PREFS_CHANGED);
|
be_app->PostMessage(PREFS_CHANGED);
|
||||||
@@ -745,6 +764,7 @@ TPrefsWindow::MessageReceived(BMessage* msg)
|
|||||||
|| fEncoding != *fNewEncoding
|
|| fEncoding != *fNewEncoding
|
||||||
|| fWarnUnencodable != *fNewWarnUnencodable
|
|| fWarnUnencodable != *fNewWarnUnencodable
|
||||||
|| fSpellCheckStartOn != *fNewSpellCheckStartOn
|
|| fSpellCheckStartOn != *fNewSpellCheckStartOn
|
||||||
|
|| fAutoMarkReaded != *fNewAutoMarkReaded
|
||||||
|| fButtonBar != *fNewButtonBar;
|
|| fButtonBar != *fNewButtonBar;
|
||||||
fRevert->SetEnabled(changed);
|
fRevert->SetEnabled(changed);
|
||||||
}
|
}
|
||||||
@@ -1103,6 +1123,14 @@ TPrefsWindow::_BuildSpellCheckStartOnMenu(bool spellCheckStartOn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BPopUpMenu*
|
||||||
|
TPrefsWindow::_BuildAutoMarkReadedMenu(bool autoMarkReaded)
|
||||||
|
{
|
||||||
|
return _BuildBoolMenu(P_MARK_READED, "autoMarkReaded",
|
||||||
|
autoMarkReaded);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BPopUpMenu*
|
BPopUpMenu*
|
||||||
TPrefsWindow::_BuildButtonBarMenu(uint8 show)
|
TPrefsWindow::_BuildButtonBarMenu(uint8 show)
|
||||||
{
|
{
|
||||||
@@ -1130,3 +1158,4 @@ TPrefsWindow::_BuildButtonBarMenu(uint8 show)
|
|||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ public:
|
|||||||
uint32* account, int32* replyTo,
|
uint32* account, int32* replyTo,
|
||||||
char** preamble, char** sig,
|
char** preamble, char** sig,
|
||||||
uint32* encoding, bool* warnUnencodable,
|
uint32* encoding, bool* warnUnencodable,
|
||||||
bool* spellCheckStartOn, uint8* buttonBar);
|
bool* spellCheckStartOn,
|
||||||
|
bool* autoMarkReaded, uint8* buttonBar);
|
||||||
virtual ~TPrefsWindow();
|
virtual ~TPrefsWindow();
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
@@ -90,6 +91,8 @@ private:
|
|||||||
bool warnUnencodable);
|
bool warnUnencodable);
|
||||||
BPopUpMenu* _BuildSpellCheckStartOnMenu(
|
BPopUpMenu* _BuildSpellCheckStartOnMenu(
|
||||||
bool spellCheckStartOn);
|
bool spellCheckStartOn);
|
||||||
|
BPopUpMenu* _BuildAutoMarkReadedMenu(
|
||||||
|
bool autoMarkReaded);
|
||||||
BPopUpMenu* _BuildButtonBarMenu(uint8 show);
|
BPopUpMenu* _BuildButtonBarMenu(uint8 show);
|
||||||
|
|
||||||
BPopUpMenu* _BuildBoolMenu(uint32 msg,
|
BPopUpMenu* _BuildBoolMenu(uint32 msg,
|
||||||
@@ -120,6 +123,8 @@ private:
|
|||||||
bool fWarnUnencodable;
|
bool fWarnUnencodable;
|
||||||
bool* fNewSpellCheckStartOn;
|
bool* fNewSpellCheckStartOn;
|
||||||
bool fSpellCheckStartOn;
|
bool fSpellCheckStartOn;
|
||||||
|
bool* fNewAutoMarkReaded;
|
||||||
|
bool fAutoMarkReaded;
|
||||||
|
|
||||||
BButton* fRevert;
|
BButton* fRevert;
|
||||||
|
|
||||||
@@ -137,6 +142,7 @@ private:
|
|||||||
BPopUpMenu* fWarnUnencodableMenu;
|
BPopUpMenu* fWarnUnencodableMenu;
|
||||||
BPopUpMenu* fSpellCheckStartOnMenu;
|
BPopUpMenu* fSpellCheckStartOnMenu;
|
||||||
BPopUpMenu* fButtonBarMenu;
|
BPopUpMenu* fButtonBarMenu;
|
||||||
|
BPopUpMenu* fAutoMarkReadedMenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _PREFS_H */
|
#endif /* _PREFS_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user