Mail: Fix "Close and set to…" for multiple mails
Before, when you got multiple emails open, doing e.g. a "Close and leave as New" (SHIFT + ALT + W) would correctly leave the active email with status "New", but the other open Mail windows were closed as well and got the status "Read"! Now we only close the current Mail window, not the whole app and with it all open email windows. The currently somewhat hidden command "SHIFT + ALT + Q" now issues a message to all open Mail windows to close and keep their mails' status, i.e. the same as invoking SHIFT + ALT + W in all open email windows. Change-Id: I0402a1e39ce58b53eca2c3bfe8f8becd5529c566 Reviewed-on: https://review.haiku-os.org/c/haiku/+/9305 Reviewed-by: waddlesplash <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
@@ -413,6 +413,14 @@ TMailApp::MessageReceived(BMessage *msg)
|
|||||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kMsgQuitAndKeepAllStatus:
|
||||||
|
{
|
||||||
|
for (int32 i = 0; i < fWindowList.CountItems(); i++) {
|
||||||
|
TMailWindow* window = (TMailWindow*)fWindowList.ItemAt(i);
|
||||||
|
window->PostMessage(new BMessage(kMsgCloseAndKeepAllStatus));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case B_REFS_RECEIVED:
|
case B_REFS_RECEIVED:
|
||||||
RefsReceived(msg);
|
RefsReceived(msg);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -134,7 +134,6 @@ static const char* kSpamMenuItemTextArray[] = {
|
|||||||
"Mark as genuine" // M_TRAIN_GENUINE
|
"Mark as genuine" // M_TRAIN_GENUINE
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32 kMsgQuitAndKeepAllStatus = 'Casm';
|
|
||||||
|
|
||||||
static const char* kQueriesDirectory = "mail/queries";
|
static const char* kQueriesDirectory = "mail/queries";
|
||||||
static const char* kAttrQueryInitialMode = "_trk/qryinitmode";
|
static const char* kAttrQueryInitialMode = "_trk/qryinitmode";
|
||||||
@@ -212,7 +211,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
|
|||||||
|
|
||||||
fDownloading(false)
|
fDownloading(false)
|
||||||
{
|
{
|
||||||
fKeepStatusOnQuit = false;
|
fKeepStatusOnClose = false;
|
||||||
|
|
||||||
if (messenger != NULL)
|
if (messenger != NULL)
|
||||||
fTrackerMessenger = *messenger;
|
fTrackerMessenger = *messenger;
|
||||||
@@ -273,7 +272,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
|
|||||||
subMenu->AddItem(new BMenuItem(
|
subMenu->AddItem(new BMenuItem(
|
||||||
B_TRANSLATE_COMMENT("Leave as 'New'",
|
B_TRANSLATE_COMMENT("Leave as 'New'",
|
||||||
"Do not translate New - this is non-localizable e-mail status"),
|
"Do not translate New - this is non-localizable e-mail status"),
|
||||||
new BMessage(kMsgQuitAndKeepAllStatus), 'W', B_SHIFT_KEY));
|
new BMessage(kMsgCloseAndKeepAllStatus), 'W', B_SHIFT_KEY));
|
||||||
} else {
|
} else {
|
||||||
BString status;
|
BString status;
|
||||||
file.ReadAttrString(B_MAIL_ATTR_STATUS, &status);
|
file.ReadAttrString(B_MAIL_ATTR_STATUS, &status);
|
||||||
@@ -288,7 +287,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
|
|||||||
subMenu->AddItem(new BMenuItem(label.String(),
|
subMenu->AddItem(new BMenuItem(label.String(),
|
||||||
new BMessage(B_QUIT_REQUESTED), 'W'));
|
new BMessage(B_QUIT_REQUESTED), 'W'));
|
||||||
AddShortcut('W', B_COMMAND_KEY | B_SHIFT_KEY,
|
AddShortcut('W', B_COMMAND_KEY | B_SHIFT_KEY,
|
||||||
new BMessage(kMsgQuitAndKeepAllStatus));
|
new BMessage(kMsgCloseAndKeepAllStatus));
|
||||||
}
|
}
|
||||||
|
|
||||||
subMenu->AddItem(new BMenuItem(B_TRANSLATE("Move to trash"),
|
subMenu->AddItem(new BMenuItem(B_TRANSLATE("Move to trash"),
|
||||||
@@ -1025,7 +1024,7 @@ TMailWindow::MenusBeginning()
|
|||||||
|
|
||||||
BMenuItem* LeaveStatus = fLeaveStatusMenu->FindItem(B_QUIT_REQUESTED);
|
BMenuItem* LeaveStatus = fLeaveStatusMenu->FindItem(B_QUIT_REQUESTED);
|
||||||
if (LeaveStatus == NULL)
|
if (LeaveStatus == NULL)
|
||||||
LeaveStatus = fLeaveStatusMenu->FindItem(kMsgQuitAndKeepAllStatus);
|
LeaveStatus = fLeaveStatusMenu->FindItem(kMsgCloseAndKeepAllStatus);
|
||||||
|
|
||||||
if (LeaveStatus != NULL && status.Length() > 0) {
|
if (LeaveStatus != NULL && status.Length() > 0) {
|
||||||
BString label;
|
BString label;
|
||||||
@@ -1314,14 +1313,19 @@ TMailWindow::MessageReceived(BMessage* msg)
|
|||||||
}
|
}
|
||||||
case M_CLOSE_SAVED:
|
case M_CLOSE_SAVED:
|
||||||
{
|
{
|
||||||
BMessage message(B_QUIT_REQUESTED);
|
BMessage message(B_CLOSE_REQUESTED);
|
||||||
message.AddString("status", "Saved");
|
message.AddString("status", "Saved");
|
||||||
PostMessage(&message);
|
PostMessage(&message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kMsgQuitAndKeepAllStatus:
|
case kMsgQuitAndKeepAllStatus:
|
||||||
fKeepStatusOnQuit = true;
|
{
|
||||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
be_app->PostMessage(msg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case kMsgCloseAndKeepAllStatus:
|
||||||
|
fKeepStatusOnClose = true;
|
||||||
|
PostMessage(B_CLOSE_REQUESTED);
|
||||||
break;
|
break;
|
||||||
case M_CLOSE_CUSTOM:
|
case M_CLOSE_CUSTOM:
|
||||||
if (msg->HasString("status")) {
|
if (msg->HasString("status")) {
|
||||||
@@ -1860,7 +1864,7 @@ TMailWindow::QuitRequested()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (fRef != NULL && !fKeepStatusOnQuit) {
|
} else if (fRef != NULL && !fKeepStatusOnClose) {
|
||||||
// ...Otherwise just set the message read
|
// ...Otherwise just set the message read
|
||||||
if (fAutoMarkRead == true)
|
if (fAutoMarkRead == true)
|
||||||
MarkMessageRead(fRef, B_READ);
|
MarkMessageRead(fRef, B_READ);
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ class BMenuBar;
|
|||||||
class BMenuItem;
|
class BMenuItem;
|
||||||
class Words;
|
class Words;
|
||||||
|
|
||||||
|
static const uint32 kMsgQuitAndKeepAllStatus = 'Qasm';
|
||||||
|
static const uint32 kMsgCloseAndKeepAllStatus = 'Casm';
|
||||||
|
|
||||||
|
|
||||||
class TMailWindow : public BWindow {
|
class TMailWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
@@ -216,7 +219,7 @@ private:
|
|||||||
BMessenger* fOriginatingWindow;
|
BMessenger* fOriginatingWindow;
|
||||||
|
|
||||||
bool fAutoMarkRead : 1;
|
bool fAutoMarkRead : 1;
|
||||||
bool fKeepStatusOnQuit;
|
bool fKeepStatusOnClose;
|
||||||
|
|
||||||
bool fDownloading;
|
bool fDownloading;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user