Unifying the quit/save alerts.

Wherever I found an alert prompting to save changes, I used the
button labeling 'Cancel', 'Don't save', 'Save' with the first button
left aligned, 2nd and 3rd right aligned.

I added the shortcuts 'd' for 'Don't save, and 's' for 'Save' where
not already set.

The topic was discussed at
http://permalink.gmane.org/gmane.os.haiku.devel/23244
The discussion died down, I hope I made changes everyone can live with.
This commit is contained in:
Humdinger
2012-12-30 20:32:04 +01:00
parent cb6daa41db
commit 776c58b2b5
9 changed files with 71 additions and 51 deletions
+8 -6
View File
@@ -1888,16 +1888,18 @@ ProbeView::QuitRequested()
return true; return true;
BAlert* alert = new BAlert(B_TRANSLATE("DiskProbe request"), BAlert* alert = new BAlert(B_TRANSLATE("DiskProbe request"),
B_TRANSLATE("Save changes before closing?"), B_TRANSLATE("Don't save"), B_TRANSLATE("Save changes before closing?"), B_TRANSLATE("Cancel"),
B_TRANSLATE("Cancel"), B_TRANSLATE("Save"), B_WIDTH_AS_USUAL, B_TRANSLATE("Don't save"), B_TRANSLATE("Save"), B_WIDTH_AS_USUAL,
B_WARNING_ALERT); B_OFFSET_SPACING, B_WARNING_ALERT);
alert->SetShortcut(1, B_ESCAPE); alert->SetShortcut(0, B_ESCAPE);
alert->SetShortcut(1, 'd');
alert->SetShortcut(2, 's');
int32 chosen = alert->Go(); int32 chosen = alert->Go();
if (chosen == 0) if (chosen == 0)
return true;
if (chosen == 1)
return false; return false;
if (chosen == 1)
return true;
return _Save() == B_OK; return _Save() == B_OK;
} }
+9 -5
View File
@@ -1274,17 +1274,21 @@ MainWindow::_CheckSaveIcon(const BMessage* currentMessage)
Activate(); Activate();
BAlert* alert = new BAlert("save", BAlert* alert = new BAlert("save",
B_TRANSLATE("Save changes to current icon?"), B_TRANSLATE("Discard"), B_TRANSLATE("Save changes to current icon before closing?"),
B_TRANSLATE("Cancel"), B_TRANSLATE("Save")); B_TRANSLATE("Cancel"), B_TRANSLATE("Don't save"),
B_TRANSLATE("Save"), B_WIDTH_AS_USUAL, B_OFFSET_SPACING,
B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE); alert->SetShortcut(0, B_ESCAPE);
alert->SetShortcut(1, 'd');
alert->SetShortcut(2, 's');
int32 choice = alert->Go(); int32 choice = alert->Go();
switch (choice) { switch (choice) {
case 0: case 0:
// discard
return true;
case 1:
// cancel // cancel
return false; return false;
case 1:
// don't save
return true;
case 2: case 2:
default: default:
// cancel (save first) but pick up what we were doing before // cancel (save first) but pick up what we were doing before
+16 -15
View File
@@ -1697,40 +1697,41 @@ TMailWindow::QuitRequested()
&& fEnclosuresView->fList->CountItems()))) { && fEnclosuresView->fList->CountItems()))) {
if (fResending) { if (fResending) {
BAlert *alert = new BAlert("", B_TRANSLATE( BAlert *alert = new BAlert("", B_TRANSLATE(
"Do you wish to send this message before closing?"), "Send this message before closing?"),
B_TRANSLATE("Discard"),
B_TRANSLATE("Cancel"), B_TRANSLATE("Cancel"),
B_TRANSLATE("Don't send"),
B_TRANSLATE("Send"), B_TRANSLATE("Send"),
B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
alert->SetShortcut(0, 'd'); alert->SetShortcut(0, B_ESCAPE);
alert->SetShortcut(1, B_ESCAPE); alert->SetShortcut(1, 'd');
alert->SetShortcut(2, 's');
result = alert->Go(); result = alert->Go();
switch (result) { switch (result) {
case 0: // Discard case 0: // Cancel
break;
case 1: // Cancel
return false; return false;
case 1: // Don't send
break;
case 2: // Send case 2: // Send
Send(true); Send(true);
break; break;
} }
} else { } else {
BAlert *alert = new BAlert("", BAlert *alert = new BAlert("",
B_TRANSLATE("Do you wish to save this message as a draft " B_TRANSLATE("Save this message as a draft before closing?"),
"before closing?"),
B_TRANSLATE("Don't save"),
B_TRANSLATE("Cancel"), B_TRANSLATE("Cancel"),
B_TRANSLATE("Don't save"),
B_TRANSLATE("Save"), B_TRANSLATE("Save"),
B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
alert->SetShortcut(0, 'd'); alert->SetShortcut(0, B_ESCAPE);
alert->SetShortcut(1, B_ESCAPE); alert->SetShortcut(1, 'd');
alert->SetShortcut(2, 's');
result = alert->Go(); result = alert->Go();
switch (result) { switch (result) {
case 0: // Don't Save case 0: // Cancel
break;
case 1: // Cancel
return false; return false;
case 1: // Don't Save
break;
case 2: // Save case 2: // Save
Send(false); Send(false);
break; break;
+6 -5
View File
@@ -296,14 +296,15 @@ TSignatureWindow::Clear()
beep(); beep();
BAlert *alert = new BAlert("", BAlert *alert = new BAlert("",
B_TRANSLATE("Save changes to this signature?"), B_TRANSLATE("Save changes to this signature?"),
B_TRANSLATE("Don't save"),
B_TRANSLATE("Cancel"), B_TRANSLATE("Cancel"),
B_TRANSLATE("Don't save"),
B_TRANSLATE("Save"), B_TRANSLATE("Save"),
B_WIDTH_AS_USUAL, B_WARNING_ALERT); B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
alert->SetShortcut(0, 'd'); alert->SetShortcut(0, B_ESCAPE);
alert->SetShortcut(1, B_ESCAPE); alert->SetShortcut(1, 'd');
alert->SetShortcut(2, 's');
result = alert->Go(); result = alert->Go();
if (result == 1) if (result == 0)
return false; return false;
if (result == 2) if (result == 2)
Save(); Save();
+6 -3
View File
@@ -296,10 +296,13 @@ PersonWindow::QuitRequested()
status_t result; status_t result;
if (!fView->IsSaved()) { if (!fView->IsSaved()) {
BAlert* alert = new BAlert("", B_TRANSLATE("Save changes before quitting?"), BAlert* alert = new BAlert("",
B_TRANSLATE("Cancel"), B_TRANSLATE("Quit"), B_TRANSLATE("Save changes before closing?"), B_TRANSLATE("Cancel"),
B_TRANSLATE("Save")); B_TRANSLATE("Don't save"), B_TRANSLATE("Save"),
B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE); alert->SetShortcut(0, B_ESCAPE);
alert->SetShortcut(1, 'd');
alert->SetShortcut(2, 's');
result = alert->Go(); result = alert->Go();
if (result == 2) { if (result == 2) {
+6 -3
View File
@@ -34,10 +34,13 @@ bool
ResWindow::QuitRequested(void) ResWindow::QuitRequested(void)
{ {
if (fView->GetSaveStatus() == FILE_DIRTY) { if (fView->GetSaveStatus() == FILE_DIRTY) {
BAlert *alert = new BAlert("ResEdit", "Save your changes?", "Cancel", BAlert *alert = new BAlert("ResEdit", "Save changes before closing?",
"Don't Save", "Save"); "Cancel", "Don't save", "Save",
B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE); alert->SetShortcut(0, B_ESCAPE);
alert->SetShortcut(1, 'd');
alert->SetShortcut(2, 's');
switch (alert->Go()) { switch (alert->Go()) {
case 0: case 0:
return false; return false;
+1 -1
View File
@@ -751,7 +751,7 @@ StyledEditWindow::Save(BMessage* message)
|| (S_IWOTH & st.st_mode))) { || (S_IWOTH & st.st_mode))) {
BString alertText; BString alertText;
bs_printf(&alertText, B_TRANSLATE("This file is marked " bs_printf(&alertText, B_TRANSLATE("This file is marked "
"Read-Only. Save changes to the document \"%s\"? "), name); "read-only. Save changes to the document \"%s\"? "), name);
switch (_ShowAlert(alertText, B_TRANSLATE("Cancel"), switch (_ShowAlert(alertText, B_TRANSLATE("Cancel"),
B_TRANSLATE("Don't save"), B_TRANSLATE("Don't save"),
B_TRANSLATE("Save"), B_WARNING_ALERT)) { B_TRANSLATE("Save"), B_WARNING_ALERT)) {
@@ -1022,17 +1022,20 @@ ApplicationTypeWindow::QuitRequested()
{ {
if (_NeedsSaving(CHECK_ALL) != 0) { if (_NeedsSaving(CHECK_ALL) != 0) {
BAlert* alert = new BAlert(B_TRANSLATE("Save request"), BAlert* alert = new BAlert(B_TRANSLATE("Save request"),
B_TRANSLATE("Do you want to save the changes?"), B_TRANSLATE("Save changes before closing?"),
B_TRANSLATE("Quit, don't save"), B_TRANSLATE("Cancel"), B_TRANSLATE("Cancel"), B_TRANSLATE("Don't save"),
B_TRANSLATE("Save"), B_WIDTH_AS_USUAL, B_WARNING_ALERT); B_TRANSLATE("Save"), B_WIDTH_AS_USUAL, B_OFFSET_SPACING,
alert->SetShortcut(1, B_ESCAPE); B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->SetShortcut(1, 'd');
alert->SetShortcut(2, 's');
int32 choice = alert->Go(); int32 choice = alert->Go();
switch (choice) { switch (choice) {
case 0: case 0:
break;
case 1:
return false; return false;
case 1:
break;
case 2: case 2:
_Save(); _Save();
break; break;
+10 -7
View File
@@ -283,15 +283,21 @@ ShortcutsWindow::QuitRequested()
if (fKeySetModified) { if (fKeySetModified) {
BAlert* alert = new BAlert(WARNING, BAlert* alert = new BAlert(WARNING,
B_TRANSLATE("Really quit without saving your changes?"), B_TRANSLATE("Save changes before closing?"),
B_TRANSLATE("Don't save"), B_TRANSLATE("Cancel"), B_TRANSLATE("Cancel"), B_TRANSLATE("Don't save"),
B_TRANSLATE("Save")); B_TRANSLATE("Save"));
alert->SetShortcut(1, B_ESCAPE); alert->SetShortcut(0, B_ESCAPE);
alert->SetShortcut(1, 'd');
alert->SetShortcut(2, 's');
switch(alert->Go()) { switch(alert->Go()) {
case 1: case 0:
ret = false; ret = false;
break; break;
case 1:
ret = true;
break;
case 2: case 2:
// Save: automatically if possible, otherwise go back and open // Save: automatically if possible, otherwise go back and open
// up the file requester // up the file requester
@@ -310,9 +316,6 @@ ShortcutsWindow::QuitRequested()
ret = false; ret = false;
} }
break; break;
default:
ret = true;
break;
} }
} }