"Close and Leave As ***" menu handling improved.
* Check for real e-mail status before activating corresponding "Close and Leave as <Status>" popup menu entries and modifying them correspondently; * That was implemented as GCI 2011 task. Fixes #5251. Signed-off-by: Siarzhuk Zharski <zharik@gmx.li>
This commit is contained in:
parent
b63d0f0c44
commit
a7c3ac5527
@ -157,6 +157,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
|
||||
fRef(NULL),
|
||||
fFieldState(0),
|
||||
fPanel(NULL),
|
||||
fLeaveStatusMenu(NULL),
|
||||
fSendButton(NULL),
|
||||
fSaveButton(NULL),
|
||||
fPrintButton(NULL),
|
||||
@ -244,7 +245,9 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
|
||||
read_read_attr(file, flag);
|
||||
|
||||
if (flag == B_UNREAD) {
|
||||
subMenu->AddItem(item = new BMenuItem(B_TRANSLATE("Leave as New"),
|
||||
subMenu->AddItem(item = new BMenuItem(
|
||||
B_TRANSLATE_COMMENT("Leave as 'New'",
|
||||
"Do not translate New - this is non-localizable e-mail status"),
|
||||
new BMessage(kMsgQuitAndKeepAllStatus), 'W', B_SHIFT_KEY));
|
||||
} else {
|
||||
BString status;
|
||||
@ -287,6 +290,8 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
|
||||
new BMessage(M_CLOSE_CUSTOM)));
|
||||
#endif
|
||||
menu->AddItem(subMenu);
|
||||
|
||||
fLeaveStatusMenu = subMenu;
|
||||
} else {
|
||||
menu->AddSeparatorItem();
|
||||
menu->AddItem(new BMenuItem(B_TRANSLATE("Close"),
|
||||
@ -906,6 +911,22 @@ TMailWindow::MenusBeginning()
|
||||
// fUndo->SetLabel((isRedo)
|
||||
// ? kRedoStrings[undoState] : kUndoStrings[undoState]);
|
||||
fUndo->SetEnabled(undoState != B_UNDO_UNAVAILABLE);
|
||||
|
||||
if (fLeaveStatusMenu != NULL && fRef != NULL) {
|
||||
BFile file(fRef, B_READ_ONLY);
|
||||
BString status;
|
||||
file.ReadAttrString(B_MAIL_ATTR_STATUS, &status);
|
||||
|
||||
BMenuItem* LeaveStatus = fLeaveStatusMenu->FindItem(B_QUIT_REQUESTED);
|
||||
if (LeaveStatus == NULL)
|
||||
LeaveStatus = fLeaveStatusMenu->FindItem(kMsgQuitAndKeepAllStatus);
|
||||
|
||||
if (LeaveStatus != NULL && status.Length() > 0) {
|
||||
BString label;
|
||||
label.SetToFormat(B_TRANSLATE("Leave as '%s'"), status.String());
|
||||
LeaveStatus->SetLabel(label.String());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -163,6 +163,7 @@ class TMailWindow : public BWindow {
|
||||
BMenu* fSaveAddrMenu;
|
||||
|
||||
BMenu* fQueryMenu;
|
||||
BMenu* fLeaveStatusMenu;
|
||||
|
||||
ButtonBar* fButtonBar;
|
||||
BmapButton* fSendButton;
|
||||
|
Loading…
Reference in New Issue
Block a user