"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),
|
fRef(NULL),
|
||||||
fFieldState(0),
|
fFieldState(0),
|
||||||
fPanel(NULL),
|
fPanel(NULL),
|
||||||
|
fLeaveStatusMenu(NULL),
|
||||||
fSendButton(NULL),
|
fSendButton(NULL),
|
||||||
fSaveButton(NULL),
|
fSaveButton(NULL),
|
||||||
fPrintButton(NULL),
|
fPrintButton(NULL),
|
||||||
@ -244,7 +245,9 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
|
|||||||
read_read_attr(file, flag);
|
read_read_attr(file, flag);
|
||||||
|
|
||||||
if (flag == B_UNREAD) {
|
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));
|
new BMessage(kMsgQuitAndKeepAllStatus), 'W', B_SHIFT_KEY));
|
||||||
} else {
|
} else {
|
||||||
BString status;
|
BString status;
|
||||||
@ -287,6 +290,8 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
|
|||||||
new BMessage(M_CLOSE_CUSTOM)));
|
new BMessage(M_CLOSE_CUSTOM)));
|
||||||
#endif
|
#endif
|
||||||
menu->AddItem(subMenu);
|
menu->AddItem(subMenu);
|
||||||
|
|
||||||
|
fLeaveStatusMenu = subMenu;
|
||||||
} else {
|
} else {
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
menu->AddItem(new BMenuItem(B_TRANSLATE("Close"),
|
menu->AddItem(new BMenuItem(B_TRANSLATE("Close"),
|
||||||
@ -906,6 +911,22 @@ TMailWindow::MenusBeginning()
|
|||||||
// fUndo->SetLabel((isRedo)
|
// fUndo->SetLabel((isRedo)
|
||||||
// ? kRedoStrings[undoState] : kUndoStrings[undoState]);
|
// ? kRedoStrings[undoState] : kUndoStrings[undoState]);
|
||||||
fUndo->SetEnabled(undoState != B_UNDO_UNAVAILABLE);
|
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* fSaveAddrMenu;
|
||||||
|
|
||||||
BMenu* fQueryMenu;
|
BMenu* fQueryMenu;
|
||||||
|
BMenu* fLeaveStatusMenu;
|
||||||
|
|
||||||
ButtonBar* fButtonBar;
|
ButtonBar* fButtonBar;
|
||||||
BmapButton* fSendButton;
|
BmapButton* fSendButton;
|
||||||
|
Loading…
Reference in New Issue
Block a user