hrev45110 adds 1 changeset to branch 'master' old head: cb6daa41dbf5d3cb0f5cef1b92e0786bb339c59a new head: 776c58b2b56d8bcf33638a2ecb6c697f95a1cbf3 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=776c58b+%5Ecb6daa4 ---------------------------------------------------------------------------- 776c58b: 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. [ Humdinger <humdingerb@xxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev45110 Commit: 776c58b2b56d8bcf33638a2ecb6c697f95a1cbf3 URL: http://cgit.haiku-os.org/haiku/commit/?id=776c58b Author: Humdinger <humdingerb@xxxxxxxxx> Date: Sun Dec 30 19:22:12 2012 UTC ---------------------------------------------------------------------------- 9 files changed, 71 insertions(+), 51 deletions(-) src/apps/diskprobe/ProbeView.cpp | 14 +++++---- src/apps/icon-o-matic/MainWindow.cpp | 14 +++++---- src/apps/mail/MailWindow.cpp | 31 ++++++++++---------- src/apps/mail/Signature.cpp | 11 +++---- src/apps/people/PersonWindow.cpp | 9 ++++-- src/apps/resedit/ResWindow.cpp | 9 ++++-- src/apps/stylededit/StyledEditWindow.cpp | 2 +- .../filetypes/ApplicationTypeWindow.cpp | 15 ++++++---- src/preferences/shortcuts/ShortcutsWindow.cpp | 17 ++++++----- ---------------------------------------------------------------------------- diff --git a/src/apps/diskprobe/ProbeView.cpp b/src/apps/diskprobe/ProbeView.cpp index 4072057..2aef09d 100644 --- a/src/apps/diskprobe/ProbeView.cpp +++ b/src/apps/diskprobe/ProbeView.cpp @@ -1888,16 +1888,18 @@ ProbeView::QuitRequested() return true; BAlert* alert = new BAlert(B_TRANSLATE("DiskProbe request"), - B_TRANSLATE("Save changes before closing?"), B_TRANSLATE("Don't save"), - B_TRANSLATE("Cancel"), B_TRANSLATE("Save"), B_WIDTH_AS_USUAL, - B_WARNING_ALERT); - alert->SetShortcut(1, B_ESCAPE); + B_TRANSLATE("Save changes before closing?"), 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(1, 'd'); + alert->SetShortcut(2, 's'); int32 chosen = alert->Go(); if (chosen == 0) - return true; - if (chosen == 1) return false; + if (chosen == 1) + return true; return _Save() == B_OK; } diff --git a/src/apps/icon-o-matic/MainWindow.cpp b/src/apps/icon-o-matic/MainWindow.cpp index 5d7c015..d8ac569 100644 --- a/src/apps/icon-o-matic/MainWindow.cpp +++ b/src/apps/icon-o-matic/MainWindow.cpp @@ -1274,17 +1274,21 @@ MainWindow::_CheckSaveIcon(const BMessage* currentMessage) Activate(); BAlert* alert = new BAlert("save", - B_TRANSLATE("Save changes to current icon?"), B_TRANSLATE("Discard"), - B_TRANSLATE("Cancel"), B_TRANSLATE("Save")); + B_TRANSLATE("Save changes to current icon before closing?"), + 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(1, 'd'); + alert->SetShortcut(2, 's'); int32 choice = alert->Go(); switch (choice) { case 0: - // discard - return true; - case 1: // cancel return false; + case 1: + // don't save + return true; case 2: default: // cancel (save first) but pick up what we were doing before diff --git a/src/apps/mail/MailWindow.cpp b/src/apps/mail/MailWindow.cpp index 0537456..8a81cba 100644 --- a/src/apps/mail/MailWindow.cpp +++ b/src/apps/mail/MailWindow.cpp @@ -1697,40 +1697,41 @@ TMailWindow::QuitRequested() && fEnclosuresView->fList->CountItems()))) { if (fResending) { BAlert *alert = new BAlert("", B_TRANSLATE( - "Do you wish to send this message before closing?"), - B_TRANSLATE("Discard"), + "Send this message before closing?"), B_TRANSLATE("Cancel"), + B_TRANSLATE("Don't send"), B_TRANSLATE("Send"), B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); - alert->SetShortcut(0, 'd'); - alert->SetShortcut(1, B_ESCAPE); + alert->SetShortcut(0, B_ESCAPE); + alert->SetShortcut(1, 'd'); + alert->SetShortcut(2, 's'); result = alert->Go(); switch (result) { - case 0: // Discard - break; - case 1: // Cancel + case 0: // Cancel return false; + case 1: // Don't send + break; case 2: // Send Send(true); break; } } else { BAlert *alert = new BAlert("", - B_TRANSLATE("Do you wish to save this message as a draft " - "before closing?"), - B_TRANSLATE("Don't save"), + B_TRANSLATE("Save this message as a draft before closing?"), B_TRANSLATE("Cancel"), + B_TRANSLATE("Don't save"), B_TRANSLATE("Save"), B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); - alert->SetShortcut(0, 'd'); - alert->SetShortcut(1, B_ESCAPE); + alert->SetShortcut(0, B_ESCAPE); + alert->SetShortcut(1, 'd'); + alert->SetShortcut(2, 's'); result = alert->Go(); switch (result) { - case 0: // Don't Save - break; - case 1: // Cancel + case 0: // Cancel return false; + case 1: // Don't Save + break; case 2: // Save Send(false); break; diff --git a/src/apps/mail/Signature.cpp b/src/apps/mail/Signature.cpp index 7fd5ea8..48a0203 100644 --- a/src/apps/mail/Signature.cpp +++ b/src/apps/mail/Signature.cpp @@ -296,14 +296,15 @@ TSignatureWindow::Clear() beep(); BAlert *alert = new BAlert("", B_TRANSLATE("Save changes to this signature?"), - B_TRANSLATE("Don't save"), B_TRANSLATE("Cancel"), + B_TRANSLATE("Don't save"), B_TRANSLATE("Save"), - B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, 'd'); - alert->SetShortcut(1, B_ESCAPE); + B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); + alert->SetShortcut(0, B_ESCAPE); + alert->SetShortcut(1, 'd'); + alert->SetShortcut(2, 's'); result = alert->Go(); - if (result == 1) + if (result == 0) return false; if (result == 2) Save(); diff --git a/src/apps/people/PersonWindow.cpp b/src/apps/people/PersonWindow.cpp index 8c5511e..728482a 100644 --- a/src/apps/people/PersonWindow.cpp +++ b/src/apps/people/PersonWindow.cpp @@ -296,10 +296,13 @@ PersonWindow::QuitRequested() status_t result; if (!fView->IsSaved()) { - BAlert* alert = new BAlert("", B_TRANSLATE("Save changes before quitting?"), - B_TRANSLATE("Cancel"), B_TRANSLATE("Quit"), - B_TRANSLATE("Save")); + BAlert* alert = new BAlert("", + B_TRANSLATE("Save changes before closing?"), 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(1, 'd'); + alert->SetShortcut(2, 's'); result = alert->Go(); if (result == 2) { diff --git a/src/apps/resedit/ResWindow.cpp b/src/apps/resedit/ResWindow.cpp index 4f5fea5..83d1c92 100644 --- a/src/apps/resedit/ResWindow.cpp +++ b/src/apps/resedit/ResWindow.cpp @@ -34,10 +34,13 @@ bool ResWindow::QuitRequested(void) { if (fView->GetSaveStatus() == FILE_DIRTY) { - BAlert *alert = new BAlert("ResEdit", "Save your changes?", "Cancel", - "Don't Save", "Save"); + BAlert *alert = new BAlert("ResEdit", "Save changes before closing?", + "Cancel", "Don't save", "Save", + B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); alert->SetShortcut(0, B_ESCAPE); - + alert->SetShortcut(1, 'd'); + alert->SetShortcut(2, 's'); + switch (alert->Go()) { case 0: return false; diff --git a/src/apps/stylededit/StyledEditWindow.cpp b/src/apps/stylededit/StyledEditWindow.cpp index 0dfd0c9..3193bcf 100644 --- a/src/apps/stylededit/StyledEditWindow.cpp +++ b/src/apps/stylededit/StyledEditWindow.cpp @@ -751,7 +751,7 @@ StyledEditWindow::Save(BMessage* message) || (S_IWOTH & st.st_mode))) { BString alertText; 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"), B_TRANSLATE("Don't save"), B_TRANSLATE("Save"), B_WARNING_ALERT)) { diff --git a/src/preferences/filetypes/ApplicationTypeWindow.cpp b/src/preferences/filetypes/ApplicationTypeWindow.cpp index d556cd6..df1e7a4 100644 --- a/src/preferences/filetypes/ApplicationTypeWindow.cpp +++ b/src/preferences/filetypes/ApplicationTypeWindow.cpp @@ -1022,17 +1022,20 @@ ApplicationTypeWindow::QuitRequested() { if (_NeedsSaving(CHECK_ALL) != 0) { BAlert* alert = new BAlert(B_TRANSLATE("Save request"), - B_TRANSLATE("Do you want to save the changes?"), - B_TRANSLATE("Quit, don't save"), B_TRANSLATE("Cancel"), - B_TRANSLATE("Save"), B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(1, B_ESCAPE); + B_TRANSLATE("Save changes before closing?"), + 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(1, 'd'); + alert->SetShortcut(2, 's'); int32 choice = alert->Go(); switch (choice) { case 0: - break; - case 1: return false; + case 1: + break; case 2: _Save(); break; diff --git a/src/preferences/shortcuts/ShortcutsWindow.cpp b/src/preferences/shortcuts/ShortcutsWindow.cpp index e389a4d..5a5c678 100644 --- a/src/preferences/shortcuts/ShortcutsWindow.cpp +++ b/src/preferences/shortcuts/ShortcutsWindow.cpp @@ -283,15 +283,21 @@ ShortcutsWindow::QuitRequested() if (fKeySetModified) { BAlert* alert = new BAlert(WARNING, - B_TRANSLATE("Really quit without saving your changes?"), - B_TRANSLATE("Don't save"), B_TRANSLATE("Cancel"), + B_TRANSLATE("Save changes before closing?"), + B_TRANSLATE("Cancel"), B_TRANSLATE("Don't 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()) { - case 1: + case 0: ret = false; break; + case 1: + ret = true; + break; + case 2: // Save: automatically if possible, otherwise go back and open // up the file requester @@ -310,9 +316,6 @@ ShortcutsWindow::QuitRequested() ret = false; } break; - default: - ret = true; - break; } }