diff --git a/src/add-ons/input_server/filters/shortcut_catcher/CommandActuators.cpp b/src/add-ons/input_server/filters/shortcut_catcher/CommandActuators.cpp index 6f72dfcf29..84d63c5c97 100644 --- a/src/add-ons/input_server/filters/shortcut_catcher/CommandActuators.cpp +++ b/src/add-ons/input_server/filters/shortcut_catcher/CommandActuators.cpp @@ -195,8 +195,11 @@ LaunchCommandActuator::KeyEventAsync(const BMessage* keyMsg, str << " Please check your Shortcuts settings."; } - if (fArgc < 1 || err != B_NO_ERROR) - (new BAlert(str1.String(), str.String(), "OK"))->Go(NULL); + if (fArgc < 1 || err != B_NO_ERROR) { + BAlert* alert = new BAlert(str1.String(), str.String(), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(NULL); + } } } @@ -1015,7 +1018,9 @@ MIMEHandlerCommandActuator::KeyEventAsync(const BMessage* keyMsg, str << "Can't launch handler for "; str << ", no such MIME type exists. Please check your Shortcuts"; str << " settings."; - (new BAlert(str1.String(), str.String(), "OK"))->Go(NULL); + BAlert* alert = new BAlert(str1.String(), str.String(), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(NULL); } } } @@ -1693,7 +1698,9 @@ SendMessageCommandActuator::KeyEventAsync(const BMessage* keyMsg, BString str1("Shortcuts SendMessage error"); if (fSignature.Length() == 0) { str << "SendMessage: Target application signature not specified"; - (new BAlert(str1.String(), str.String(), "OK"))->Go(NULL); + BAlert* alert = new BAlert(str1.String(), str.String(), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(NULL); } else { status_t error = B_OK; BMessenger msngr(fSignature.String(), -1, &error); diff --git a/src/add-ons/input_server/methods/canna/CannaLooper.cpp b/src/add-ons/input_server/methods/canna/CannaLooper.cpp index db7fc806e4..4fbfa5099e 100644 --- a/src/add-ons/input_server/methods/canna/CannaLooper.cpp +++ b/src/add-ons/input_server/methods/canna/CannaLooper.cpp @@ -178,6 +178,7 @@ CannaLooper::MessageReceived(BMessage* msg) " Copyright 1992 NEC Corporation, Tokyo, Japan\n" " Special thanks to T.Murai for porting\n", "OK"); + panel->SetFlags(panel->Flags() | B_CLOSE_ON_ESCAPE); panel->Go(); break; } diff --git a/src/add-ons/input_server/methods/pen/PenInputServerMethod.cpp b/src/add-ons/input_server/methods/pen/PenInputServerMethod.cpp index d47b21c7ba..b67a68a28d 100644 --- a/src/add-ons/input_server/methods/pen/PenInputServerMethod.cpp +++ b/src/add-ons/input_server/methods/pen/PenInputServerMethod.cpp @@ -53,6 +53,7 @@ PenInputServerMethod::PenInputServerMethod() //fDebugFile.SetTo("/tmp/PenInputMethodMessages.txt", B_READ_WRITE|B_CREATE_FILE); fDebugAlert = new BAlert("PenInput Debug", "Plip \n\n\n\n\n\n\n\n\n\n\n\n\n", "OK"); fDebugAlert->SetLook(B_TITLED_WINDOW_LOOK); + fDebugAlert->SetFlags(fDebugAlert->Flags() | B_CLOSE_ON_ESCAPE); fDebugAlert->TextView()->MakeSelectable(); fDebugAlert->TextView()->SelectAll(); fDebugAlert->TextView()->Delete(); diff --git a/src/add-ons/input_server/methods/t9/DictionaryInputServerMethod.cpp b/src/add-ons/input_server/methods/t9/DictionaryInputServerMethod.cpp index f6a75ee727..dbfc470f12 100644 --- a/src/add-ons/input_server/methods/t9/DictionaryInputServerMethod.cpp +++ b/src/add-ons/input_server/methods/t9/DictionaryInputServerMethod.cpp @@ -178,6 +178,7 @@ void T9InputServerMethod::MessageReceived(BMessage *message) s << " - "; s << (long) fDeskbarMenu->ItemAt(v); BAlert *a = new BAlert("Plop", s.String(), "OK"); + a->SetFlags(a->Flags() | B_CLOSE_ON_ESCAPE); a->Go(NULL); }*/ break; diff --git a/src/add-ons/input_server/methods/t9/T9InputServerMethod.cpp b/src/add-ons/input_server/methods/t9/T9InputServerMethod.cpp index 0b102923bf..3699cd1962 100644 --- a/src/add-ons/input_server/methods/t9/T9InputServerMethod.cpp +++ b/src/add-ons/input_server/methods/t9/T9InputServerMethod.cpp @@ -179,6 +179,7 @@ void T9InputServerMethod::MessageReceived(BMessage *message) s << " - "; s << (long) fDeskbarMenu->ItemAt(v); BAlert *a = new BAlert("Plop", s.String(), "OK"); + a->SetFlags(a->Flags() | B_CLOSE_ON_ESCAPE); a->Go(NULL); }*/ break; diff --git a/src/add-ons/mail_daemon/inbound_filters/notifier/filter.cpp b/src/add-ons/mail_daemon/inbound_filters/notifier/filter.cpp index 4e3311685b..d417ed7a7a 100644 --- a/src/add-ons/mail_daemon/inbound_filters/notifier/filter.cpp +++ b/src/add-ons/mail_daemon/inbound_filters/notifier/filter.cpp @@ -79,6 +79,7 @@ NotifyFilter::MailboxSynced(status_t status) BAlert *alert = new BAlert(B_TRANSLATE("New messages"), text.String(), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->SetFeel(B_NORMAL_WINDOW_FEEL); alert->Go(NULL); } diff --git a/src/add-ons/mail_daemon/inbound_filters/spam_filter/SpamFilterConfig.cpp b/src/add-ons/mail_daemon/inbound_filters/spam_filter/SpamFilterConfig.cpp index 253134dd12..bc71405e1d 100644 --- a/src/add-ons/mail_daemon/inbound_filters/spam_filter/SpamFilterConfig.cpp +++ b/src/add-ons/mail_daemon/inbound_filters/spam_filter/SpamFilterConfig.cpp @@ -421,9 +421,11 @@ AGMSBayesianSpamFilterConfig::ShowSpamServerConfigurationWindow () { return; // Successful. ErrorExit: - (new BAlert ("SpamFilterConfig Error", B_TRANSLATE("Sorry, unable to " - "launch the spamdbm program to let you edit the server settings."), - B_TRANSLATE("Close")))->Go (); + BAlert* alert = new BAlert ("SpamFilterConfig Error", B_TRANSLATE("Sorry, " + "unable to launch the spamdbm program to let you edit the server " + "settings."), B_TRANSLATE("Close")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go (); return; } diff --git a/src/add-ons/print/drivers/canon_lips/lips3/Lips3.cpp b/src/add-ons/print/drivers/canon_lips/lips3/Lips3.cpp index 5195c539cf..1e219f673d 100644 --- a/src/add-ons/print/drivers/canon_lips/lips3/Lips3.cpp +++ b/src/add-ons/print/drivers/canon_lips/lips3/Lips3.cpp @@ -190,6 +190,7 @@ LIPS3Driver::NextBand(BBitmap* bitmap, BPoint* offset) } else if (compressedSize > out_size) { BAlert* alert = new BAlert("memory overrun!!!", "warning", "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; } else { @@ -224,6 +225,7 @@ LIPS3Driver::NextBand(BBitmap* bitmap, BPoint* offset) } catch (TransportException& err) { BAlert* alert = new BAlert("", err.What(), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; } diff --git a/src/add-ons/print/drivers/canon_lips/lips4/Lips4.cpp b/src/add-ons/print/drivers/canon_lips/lips4/Lips4.cpp index faa1d5412d..8f9fd51cc6 100644 --- a/src/add-ons/print/drivers/canon_lips/lips4/Lips4.cpp +++ b/src/add-ons/print/drivers/canon_lips/lips4/Lips4.cpp @@ -200,6 +200,7 @@ LIPS4Driver::NextBand(BBitmap* bitmap, BPoint* offset) buffer = out_buffer; } else if (compressed_size > out_size) { BAlert* alert = new BAlert("memory overrun!!!", "warning", "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; } else { @@ -234,6 +235,7 @@ LIPS4Driver::NextBand(BBitmap* bitmap, BPoint* offset) } catch (TransportException& err) { BAlert* alert = new BAlert("", err.What(), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; } diff --git a/src/add-ons/print/drivers/gutenprint/GPDriver.cpp b/src/add-ons/print/drivers/gutenprint/GPDriver.cpp index 434467a428..ce1f041719 100644 --- a/src/add-ons/print/drivers/gutenprint/GPDriver.cpp +++ b/src/add-ons/print/drivers/gutenprint/GPDriver.cpp @@ -308,5 +308,6 @@ GPDriver::ShowError(const char* message) text << "\n"; text << message; BAlert* alert = new BAlert("", text.String(), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } diff --git a/src/add-ons/print/drivers/pcl5/PCL5.cpp b/src/add-ons/print/drivers/pcl5/PCL5.cpp index e00947673f..518c27a518 100644 --- a/src/add-ons/print/drivers/pcl5/PCL5.cpp +++ b/src/add-ons/print/drivers/pcl5/PCL5.cpp @@ -213,6 +213,7 @@ PCL5Driver::NextBand(BBitmap* bitmap, BPoint* offset) } catch (TransportException& err) { BAlert* alert = new BAlert("", err.What(), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; } diff --git a/src/add-ons/print/drivers/pcl6/PCL6.cpp b/src/add-ons/print/drivers/pcl6/PCL6.cpp index ec951eccc2..a953e871e1 100644 --- a/src/add-ons/print/drivers/pcl6/PCL6.cpp +++ b/src/add-ons/print/drivers/pcl6/PCL6.cpp @@ -176,6 +176,7 @@ PCL6Driver::NextBand(BBitmap* bitmap, BPoint* offset) } catch (TransportException& err) { BAlert* alert = new BAlert("", err.What(), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; } diff --git a/src/add-ons/print/drivers/pdf/source/MessagePrinter.cpp b/src/add-ons/print/drivers/pdf/source/MessagePrinter.cpp index 2e9e69ae65..3cd43b00fc 100644 --- a/src/add-ons/print/drivers/pdf/source/MessagePrinter.cpp +++ b/src/add-ons/print/drivers/pdf/source/MessagePrinter.cpp @@ -53,14 +53,18 @@ status_t MessagePrinter::Print(BMessage* msg) // open a file to print message on the desktop status = find_directory(B_DESKTOP_DIRECTORY, &settingsPath); if (status != B_OK) { - (new BAlert("","find directory error", "Doh!"))->Go(); + BAlert* alert = new BAlert("","Find directory error", "Doh!"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return status; } settingsPath.Append(msgFileName); status = file.SetTo(settingsPath.Path(), B_WRITE_ONLY | B_CREATE_FILE); if (status != B_OK) { - (new BAlert("","file write error", "Doh!"))->Go(); + BAlert* alert = new BAlert("","File write error", "Doh!"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return status; } @@ -73,14 +77,18 @@ status_t MessagePrinter::Print(BMessage* msg) // count out << i; if (file.Write(out.String(), out.Length()) < 0) { - (new BAlert("","count write error", "Doh!"))->Go(); + BAlert* alert = new BAlert("","Count write error", "Doh!"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return B_ERROR; } // name out = " "; out << name; if (file.Write(out.String(), out.Length()) < 0) { - (new BAlert("","name write error", "Doh!"))->Go(); + BAlert* alert = new BAlert("","Name write error", "Doh!"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return B_ERROR; } @@ -164,7 +172,9 @@ status_t MessagePrinter::Print(BMessage* msg) break; } if (file.Write(out.String(), out.Length()) < 0) { - (new BAlert("","value write error", "Doh!"))->Go(); + BAlert* alert = new BAlert("","Value write error", "Doh!"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return B_ERROR; } } diff --git a/src/add-ons/print/drivers/pdf/source/PrinterDriver.cpp b/src/add-ons/print/drivers/pdf/source/PrinterDriver.cpp index d00d2078c0..9bdb410445 100644 --- a/src/add-ons/print/drivers/pdf/source/PrinterDriver.cpp +++ b/src/add-ons/print/drivers/pdf/source/PrinterDriver.cpp @@ -203,6 +203,7 @@ PrinterDriver::PrintPage(int32 pageNumber, int32 pageCount) sprintf(text, "Faking print of page %ld/%ld...", pageNumber, pageCount); BAlert *alert = new BAlert("PrinterDriver::PrintPage()", text, "Hmm?"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return B_OK; } diff --git a/src/add-ons/print/drivers/postscript/PS.cpp b/src/add-ons/print/drivers/postscript/PS.cpp index fd518e754d..5be890a2b0 100644 --- a/src/add-ons/print/drivers/postscript/PS.cpp +++ b/src/add-ons/print/drivers/postscript/PS.cpp @@ -336,6 +336,7 @@ PSDriver::NextBand(BBitmap* bitmap, BPoint* offset) } catch (TransportException& err) { BAlert* alert = new BAlert("", err.What(), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; } diff --git a/src/add-ons/print/transports/hp_jetdirect/HPJetDirectTransport.cpp b/src/add-ons/print/transports/hp_jetdirect/HPJetDirectTransport.cpp index 42b4a35c1a..71f3f72b8f 100644 --- a/src/add-ons/print/transports/hp_jetdirect/HPJetDirectTransport.cpp +++ b/src/add-ons/print/transports/hp_jetdirect/HPJetDirectTransport.cpp @@ -55,6 +55,7 @@ HPJetDirectPort::HPJetDirectPort(BDirectory* printer, BMessage *msg) fEndpoint = new BNetEndpoint(SOCK_STREAM); if ((fReady = fEndpoint->InitCheck()) != B_OK) { BAlert *alert = new BAlert("", "Fail to create the NetEndpoint!", "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return; } @@ -66,6 +67,7 @@ HPJetDirectPort::HPJetDirectPort(BDirectory* printer, BMessage *msg) } else { BAlert *alert = new BAlert("", "Can't connect to HP JetDirect printer port!", "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); fReady = B_ERROR; } diff --git a/src/add-ons/print/transports/hp_jetdirect/SetupWindow.cpp b/src/add-ons/print/transports/hp_jetdirect/SetupWindow.cpp index 099f37d487..6a2f89ff23 100644 --- a/src/add-ons/print/transports/hp_jetdirect/SetupWindow.cpp +++ b/src/add-ons/print/transports/hp_jetdirect/SetupWindow.cpp @@ -135,8 +135,9 @@ SetupView::CheckSetup() if (ep->Connect(fServerAddress->Text(), port) != B_OK) { BString text; - text << "Fail to connect to " << fServerAddress->Text() << ":" << (int) port << "!"; + text << "Failed to connect to " << fServerAddress->Text() << ":" << (int) port << "!"; BAlert* alert = new BAlert("", text.String(), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; }; @@ -149,7 +150,8 @@ SetupView::CheckSetup() }; }; - BAlert* alert = new BAlert("", "please input parameters.", "OK"); + BAlert* alert = new BAlert("", "Please input parameters.", "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; } diff --git a/src/add-ons/print/transports/ipp/IppSetupDlg.cpp b/src/add-ons/print/transports/ipp/IppSetupDlg.cpp index ad2cfd545f..295c573460 100644 --- a/src/add-ons/print/transports/ipp/IppSetupDlg.cpp +++ b/src/add-ons/print/transports/ipp/IppSetupDlg.cpp @@ -141,6 +141,7 @@ bool IppSetupView::UpdateViewData() } BAlert *alert = new BAlert("", error_msg.c_str(), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; } diff --git a/src/add-ons/print/transports/ipp/IppTransport.cpp b/src/add-ons/print/transports/ipp/IppTransport.cpp index 1c4f6a967f..64814f1502 100644 --- a/src/add-ons/print/transports/ipp/IppTransport.cpp +++ b/src/add-ons/print/transports/ipp/IppTransport.cpp @@ -129,6 +129,7 @@ IppTransport::~IppTransport() if (__error) { BAlert *alert = new BAlert("", error_msg.c_str(), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } } diff --git a/src/add-ons/print/transports/lpr/LprSetupDlg.cpp b/src/add-ons/print/transports/lpr/LprSetupDlg.cpp index 5d82f588ae..4fbf395f73 100644 --- a/src/add-ons/print/transports/lpr/LprSetupDlg.cpp +++ b/src/add-ons/print/transports/lpr/LprSetupDlg.cpp @@ -142,6 +142,7 @@ LprSetupView::UpdateViewData() catch (LPSException &err) { BAlert *alert = new BAlert("", err.what(), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; } @@ -155,6 +156,7 @@ LprSetupView::UpdateViewData() BAlert *alert = new BAlert("", "Please enter server address and printer" "queue name.", "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; } diff --git a/src/add-ons/print/transports/lpr/LprTransport.cpp b/src/add-ons/print/transports/lpr/LprTransport.cpp index 7f0b89aa29..8ac8daf536 100644 --- a/src/add-ons/print/transports/lpr/LprTransport.cpp +++ b/src/add-ons/print/transports/lpr/LprTransport.cpp @@ -129,6 +129,7 @@ LprTransport::_SendFile() catch (LPSException &err) { DBGMSG(("error: %s\n", err.what())); BAlert *alert = new BAlert("", err.what(), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } } diff --git a/src/add-ons/tracker/iconvader/IconVader.cpp b/src/add-ons/tracker/iconvader/IconVader.cpp index 42226a9b69..0b3b3bf15a 100644 --- a/src/add-ons/tracker/iconvader/IconVader.cpp +++ b/src/add-ons/tracker/iconvader/IconVader.cpp @@ -18,6 +18,7 @@ static void Error(BView *view, status_t status, bool unlock=false) view->UnlockLooper(); BString s(strerror(status)); alert = new BAlert("Error", s.String(), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } @@ -80,7 +81,9 @@ process_refs(entry_ref dir, BMessage* refs, void* /*reserved*/) - alert = new BAlert("Error", "IconVader:\nClick on the icons to get points.\nAvoid symlinks!", "OK"); + alert = new BAlert("Error", "IconVader:\nClick on the icons to get points." + "\nAvoid symlinks!", "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); @@ -133,6 +136,7 @@ process_refs(entry_ref dir, BMessage* refs, void* /*reserved*/) BString scoreStr("You scored "); scoreStr << score << " points!"; alert = new BAlert("Error", scoreStr.String(), "Cool!"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); diff --git a/src/add-ons/tracker/opentargetfolder/opentargetfolder.cpp b/src/add-ons/tracker/opentargetfolder/opentargetfolder.cpp index 9e65ae3acf..e3d6174568 100644 --- a/src/add-ons/tracker/opentargetfolder/opentargetfolder.cpp +++ b/src/add-ons/tracker/opentargetfolder/opentargetfolder.cpp @@ -38,9 +38,11 @@ process_refs(entry_ref directoryRef, BMessage *msg, void *) if (link.MakeLinkedPath(&directory, &path) < B_OK || targetEntry.SetTo(path.Path()) != B_OK || targetEntry.GetParent(&targetEntry) != B_OK) { - (new BAlert("Open Target Folder", + BAlert* alert = new BAlert("Open Target Folder", "Cannot open target folder. Maybe this link is broken?", - "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL); + "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(NULL); continue; } @@ -59,10 +61,12 @@ process_refs(entry_ref directoryRef, BMessage *msg, void *) } if (errors) { - (new BAlert("Open Target Folder", + BAlert* alert = new BAlert("Open Target Folder", "This add-on can only be used on symbolic links.\n" "It opens the folder of the link target in Tracker.", - "OK"))->Go(NULL); + "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(NULL); } } diff --git a/src/add-ons/translators/ppm/PPMMain.cpp b/src/add-ons/translators/ppm/PPMMain.cpp index 6b4da65991..7a226055ce 100644 --- a/src/add-ons/translators/ppm/PPMMain.cpp +++ b/src/add-ons/translators/ppm/PPMMain.cpp @@ -51,6 +51,7 @@ main() BAlert * err = new BAlert("Error", B_TRANSLATE("Something is wrong with the PPMTranslator!"), B_TRANSLATE("OK")); + err->SetFlags(err->Flags() | B_CLOSE_ON_ESCAPE); err->Go(); return 1; } diff --git a/src/add-ons/translators/shared/TranslatorWindow.cpp b/src/add-ons/translators/shared/TranslatorWindow.cpp index 8e075d445a..824dcb4f5c 100644 --- a/src/add-ons/translators/shared/TranslatorWindow.cpp +++ b/src/add-ons/translators/shared/TranslatorWindow.cpp @@ -88,6 +88,7 @@ LaunchTranslatorWindow(BTranslator *translator, const char *title, BRect rect) if (translator->MakeConfigurationView(NULL, &view, &rect)) { BAlert *err = new BAlert(B_TRANSLATE("Error"), B_TRANSLATE("Unable to create the view."), B_TRANSLATE("OK")); + err->SetFlags(err->Flags() | B_CLOSE_ON_ESCAPE); err->Go(); return B_ERROR; } diff --git a/src/apps/autoraise/AutoRaiseApp.cpp b/src/apps/autoraise/AutoRaiseApp.cpp index 8bcd92e518..edd7790626 100644 --- a/src/apps/autoraise/AutoRaiseApp.cpp +++ b/src/apps/autoraise/AutoRaiseApp.cpp @@ -70,6 +70,7 @@ void AutoRaiseApp::ReadyToRun() BAlert *alert = new BAlert("usage box", APP_NAME ", (c) 2002, mmu_man\nUsage: " APP_NAME " [options]\n\t--deskbar\twill not open window, will just put " APP_NAME " into tray\n\t--persist will put "APP_NAME" into tray such that it remains between bootings\n", "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_INFO_ALERT); alert->SetShortcut(0, B_ENTER); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); be_app_messenger.SendMessage(B_QUIT_REQUESTED); } diff --git a/src/apps/autoraise/AutoRaiseIcon.cpp b/src/apps/autoraise/AutoRaiseIcon.cpp index 2755a0d8f3..51b1e03f0e 100644 --- a/src/apps/autoraise/AutoRaiseIcon.cpp +++ b/src/apps/autoraise/AutoRaiseIcon.cpp @@ -542,6 +542,7 @@ void TrayView::MessageReceived(BMessage* message) alert = new BAlert("about box", "AutoRaise, (c) 2002, mmu_man\nEnjoy :-)", "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_INFO_ALERT); alert->SetShortcut(0, B_ENTER); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); // use asynchronous version break; case OPEN_SETTINGS: diff --git a/src/apps/bootmanager/BootManagerController.cpp b/src/apps/bootmanager/BootManagerController.cpp index f8b1bdbb9e..7cc5fcdf5e 100644 --- a/src/apps/bootmanager/BootManagerController.cpp +++ b/src/apps/bootmanager/BootManagerController.cpp @@ -177,6 +177,7 @@ BootManagerController::_HasSelectedPartitions() BAlert* alert = new BAlert("info", B_TRANSLATE("At least one partition must be selected!"), B_TRANSLATE_COMMENT("OK", "Button")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; diff --git a/src/apps/bsnow/SnowView.cpp b/src/apps/bsnow/SnowView.cpp index 8625d1560d..a203ded88b 100644 --- a/src/apps/bsnow/SnowView.cpp +++ b/src/apps/bsnow/SnowView.cpp @@ -214,7 +214,7 @@ void SnowView::MessageReceived(BMessage *msg) "Where is Santa ??"); info->SetFeel(B_NORMAL_WINDOW_FEEL); info->SetLook(B_FLOATING_WINDOW_LOOK); - info->SetFlags(info->Flags()|B_NOT_ZOOMABLE); + info->SetFlags(info->Flags()|B_NOT_ZOOMABLE|B_CLOSE_ON_ESCAPE); info->Go(NULL); break; default: diff --git a/src/apps/cdplayer/CDDBSupport.cpp b/src/apps/cdplayer/CDDBSupport.cpp index e595223e05..4e6875ce60 100644 --- a/src/apps/cdplayer/CDDBSupport.cpp +++ b/src/apps/cdplayer/CDDBSupport.cpp @@ -1121,6 +1121,7 @@ CDDBQuery::_ParseData(const BString &data) // TODO: finish, once I find an entry which actually has a year in it BAlert *alert = new BAlert("SimplyVorbis", "DYEAR entry found\n", "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } diff --git a/src/apps/cdplayer/CDPlayer.cpp b/src/apps/cdplayer/CDPlayer.cpp index 5117b1f061..b4304b3b7d 100644 --- a/src/apps/cdplayer/CDPlayer.cpp +++ b/src/apps/cdplayer/CDPlayer.cpp @@ -88,6 +88,7 @@ CDPlayer::CDPlayer(BRect frame, const char *name, uint32 resizeMask, "It appears that there are no CD" " drives on your computer or there is no system software to " "support one. Sorry."), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } diff --git a/src/apps/clock/cl_view.cpp b/src/apps/clock/cl_view.cpp index ea702a1961..d0605d95e4 100644 --- a/src/apps/clock/cl_view.cpp +++ b/src/apps/clock/cl_view.cpp @@ -361,7 +361,7 @@ TOnscreenView::MessageReceived(BMessage *msg) "Clock (The Replicant version)\n\n(C)2002, 2003 OpenBeOS,\n" "2004 - 2007, Haiku, Inc.\n\nOriginally coded by the folks " "at Be.\n Copyright Be Inc., 1991 - 1998", "OK"); - + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } break; diff --git a/src/apps/codycam/CodyCam.cpp b/src/apps/codycam/CodyCam.cpp index a00dfd80d3..6c4038c003 100644 --- a/src/apps/codycam/CodyCam.cpp +++ b/src/apps/codycam/CodyCam.cpp @@ -62,6 +62,7 @@ ErrorAlert(const char* message, status_t err, BWindow *window = NULL) B_TRANSLATE("OK")); if (window != NULL) alert->CenterIn(window->Frame()); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); printf("%s\n%s [%lx]", message, strerror(err), err); diff --git a/src/apps/cortex/AddOnHost/AddOnHostApp.cpp b/src/apps/cortex/AddOnHost/AddOnHostApp.cpp index 5d3251bf5f..e481c4aa69 100644 --- a/src/apps/cortex/AddOnHost/AddOnHostApp.cpp +++ b/src/apps/cortex/AddOnHost/AddOnHostApp.cpp @@ -170,11 +170,13 @@ main(int argc, char** argv) { App app; if (argc < 2 || strcmp(argv[1], "--addon-host") != 0) { - int32 response = (new BAlert( - "Cortex AddOnHost", + BAlert* alert = new BAlert("Cortex AddOnHost", "This program runs in the background, and is started automatically " "by Cortex when necessary. You probably don't want to start it manually.", - "Continue", "Quit"))->Go(); + "Continue", "Quit"); + alert->SetShortcut(1, B_ESCAPE); + int32 response = alert->Go(); + if(response == 1) return 0; } diff --git a/src/apps/cortex/MediaRoutingView/MediaRoutingView.cpp b/src/apps/cortex/MediaRoutingView/MediaRoutingView.cpp index 3e4b2cac39..b2290a03fe 100644 --- a/src/apps/cortex/MediaRoutingView/MediaRoutingView.cpp +++ b/src/apps/cortex/MediaRoutingView/MediaRoutingView.cpp @@ -988,6 +988,7 @@ void MediaRoutingView::showErrorMessage( || (messenger.SendMessage(&message) != B_OK)) { BAlert *alert = new BAlert("Error", text.String(), "OK", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } } diff --git a/src/apps/cortex/ParameterView/ParameterWindow.cpp b/src/apps/cortex/ParameterView/ParameterWindow.cpp index 3f82c1c101..8a8b963636 100644 --- a/src/apps/cortex/ParameterView/ParameterWindow.cpp +++ b/src/apps/cortex/ParameterView/ParameterWindow.cpp @@ -162,6 +162,7 @@ void ParameterWindow::MessageReceived( s << " (" << strerror(error) << ")"; BAlert *alert = new BAlert("", s.String(), "OK", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(0); } bool replace = false; diff --git a/src/apps/cortex/RouteApp/RouteWindow.cpp b/src/apps/cortex/RouteApp/RouteWindow.cpp index eb6c1648c0..ae5fd26ca3 100644 --- a/src/apps/cortex/RouteApp/RouteWindow.cpp +++ b/src/apps/cortex/RouteApp/RouteWindow.cpp @@ -372,9 +372,12 @@ RouteWindow::MessageReceived(BMessage* pMsg) // switch (pMsg->what) { case B_ABOUT_REQUESTED: - (new BAlert("About", g_aboutText, "OK"))->Go(); + { + BAlert* alert = new BAlert("About", g_aboutText, "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); break; - + } case MediaRoutingView::M_GROUP_SELECTED: _handleGroupSelected(pMsg); break; diff --git a/src/apps/cortex/addons/common/MediaNodeControlApp.cpp b/src/apps/cortex/addons/common/MediaNodeControlApp.cpp index d90db03881..d0326ebbfb 100644 --- a/src/apps/cortex/addons/common/MediaNodeControlApp.cpp +++ b/src/apps/cortex/addons/common/MediaNodeControlApp.cpp @@ -84,7 +84,9 @@ MediaNodeControlApp::MediaNodeControlApp( sprintf(buffer, "MediaNodeControlApp: couldn't find node (%ld):\n%s\n", nodeID, strerror(err)); - (new BAlert("error", buffer, "OK"))->Go(); + BAlert* alert = new BAlert("error", buffer, "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return; } @@ -96,7 +98,9 @@ MediaNodeControlApp::MediaNodeControlApp( sprintf(buffer, "MediaNodeControlApp: couldn't get node info (%ld):\n%s\n", nodeID, strerror(err)); - (new BAlert("error", buffer, "OK"))->Go(); + BAlert* alert = new BAlert("error", buffer, "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return; } @@ -111,7 +115,9 @@ MediaNodeControlApp::MediaNodeControlApp( sprintf(buffer, "MediaNodeControlApp: no parameters for node (%ld):\n%s\n", nodeID, strerror(err)); - (new BAlert("error", buffer, "OK"))->Go(); + BAlert* alert = new BAlert("error", buffer, "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return; } diff --git a/src/apps/diskprobe/AttributeWindow.cpp b/src/apps/diskprobe/AttributeWindow.cpp index 595d6ca399..04d844f6db 100644 --- a/src/apps/diskprobe/AttributeWindow.cpp +++ b/src/apps/diskprobe/AttributeWindow.cpp @@ -278,14 +278,18 @@ AttributeWindow::MessageReceived(BMessage *message) case kMsgRemoveAttribute: { char buffer[1024]; + snprintf(buffer, sizeof(buffer), B_TRANSLATE("Do you really want to remove the attribute \"%s\" from " "the file \"%s\"?\n\nYou cannot undo this action."), fAttribute, Ref().name); - int32 chosen = (new BAlert(B_TRANSLATE("DiskProbe request"), + BAlert* alert = new BAlert(B_TRANSLATE("DiskProbe request"), buffer, B_TRANSLATE("Cancel"), B_TRANSLATE("Remove"), NULL, - B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); + B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetShortcut(0, B_ESCAPE); + int32 chosen = alert->Go(); + if (chosen == 1) { BNode node(&Ref()); if (node.InitCheck() == B_OK) diff --git a/src/apps/diskprobe/DiskProbe.cpp b/src/apps/diskprobe/DiskProbe.cpp index 600a8b90eb..7cfc9958cb 100644 --- a/src/apps/diskprobe/DiskProbe.cpp +++ b/src/apps/diskprobe/DiskProbe.cpp @@ -367,9 +367,11 @@ DiskProbe::RefsReceived(BMessage *message) "error message is shown."), ref.name, strerror(status)); - (new BAlert(B_TRANSLATE("DiskProbe request"), + BAlert* alert = new BAlert(B_TRANSLATE("DiskProbe request"), buffer, B_TRANSLATE("OK"), NULL, NULL, - B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); + B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } } } diff --git a/src/apps/diskprobe/ProbeView.cpp b/src/apps/diskprobe/ProbeView.cpp index 2fcaea48d7..4072057a8a 100644 --- a/src/apps/diskprobe/ProbeView.cpp +++ b/src/apps/diskprobe/ProbeView.cpp @@ -1105,10 +1105,12 @@ EditorLooper::Find(off_t startAt, const uint8 *data, size_t dataSize, if (system_time() > startTime + 8000000LL) { // If the user had to wait more than 8 seconds for the result, // we are trying to please him with a requester... - (new BAlert(B_TRANSLATE("DiskProbe request"), + BAlert* alert = new BAlert(B_TRANSLATE("DiskProbe request"), B_TRANSLATE("Could not find search string."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, - B_WARNING_ALERT))->Go(NULL); + B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(NULL); } else beep(); } @@ -1867,9 +1869,11 @@ ProbeView::_Save() "All changes will be lost when you quit."), strerror(status)); - (new BAlert(B_TRANSLATE("DiskProbe request"), + BAlert* alert = new BAlert(B_TRANSLATE("DiskProbe request"), buffer, B_TRANSLATE("OK"), NULL, NULL, - B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL); + B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(NULL); return status; } @@ -1883,9 +1887,12 @@ ProbeView::QuitRequested() if (!fEditor.IsModified()) return true; - int32 chosen = (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))->Go(); + 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); + int32 chosen = alert->Go(); if (chosen == 0) return true; diff --git a/src/apps/drivesetup/MainWindow.cpp b/src/apps/drivesetup/MainWindow.cpp index e51cb36da0..3197a6f170 100644 --- a/src/apps/drivesetup/MainWindow.cpp +++ b/src/apps/drivesetup/MainWindow.cpp @@ -657,6 +657,7 @@ MainWindow::_DisplayPartitionError(BString _message, BAlert* alert = new BAlert("error", message, B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_FROM_WIDEST, error < B_OK ? B_STOP_ALERT : B_INFO_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } @@ -853,6 +854,7 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id selectedPartition, BAlert* alert = new BAlert("first notice", message, B_TRANSLATE("Continue"), B_TRANSLATE("Cancel"), NULL, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT); + alert->SetShortcut(1, B_ESCAPE); int32 choice = alert->Go(); if (choice == 1) @@ -933,6 +935,7 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id selectedPartition, alert = new BAlert("final notice", message, B_TRANSLATE("Write changes"), B_TRANSLATE("Cancel"), NULL, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT); + alert->SetShortcut(1, B_ESCAPE); choice = alert->Go(); if (choice == 1) @@ -1050,6 +1053,7 @@ MainWindow::_Create(BDiskDevice* disk, partition_id selectedPartition) "All data on the partition will be irretrievably lost if you do " "so!"), B_TRANSLATE("Write changes"), B_TRANSLATE("Cancel"), NULL, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT); + alert->SetShortcut(1, B_ESCAPE); int32 choice = alert->Go(); if (choice == 1) @@ -1130,6 +1134,7 @@ MainWindow::_Delete(BDiskDevice* disk, partition_id selectedPartition) "All data on the partition will be irretrievably lost if you " "do so!"), B_TRANSLATE("Delete partition"), B_TRANSLATE("Cancel"), NULL, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT); + alert->SetShortcut(1, B_ESCAPE); int32 choice = alert->Go(); if (choice == 1) diff --git a/src/apps/expander/ExpanderWindow.cpp b/src/apps/expander/ExpanderWindow.cpp index 7355ce5e51..9ea6fdc8ae 100644 --- a/src/apps/expander/ExpanderWindow.cpp +++ b/src/apps/expander/ExpanderWindow.cpp @@ -153,19 +153,24 @@ ExpanderWindow::ValidateDest() B_TRANSLATE("The destination folder does not exist."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; } else if (!entry.IsDirectory()) { - (new BAlert("destAlert", + BAlert* alert = new BAlert("destAlert", B_TRANSLATE("The destination is not a folder."), B_TRANSLATE("Cancel"), NULL, NULL, - B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT))->Go(); + B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return false; } else if (entry.GetVolume(&volume) != B_OK || volume.IsReadOnly()) { - (new BAlert("destAlert", + BAlert* alert = new BAlert("destAlert", B_TRANSLATE("The destination is read only."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, - B_EVEN_SPACING, B_WARNING_ALERT))->Go(); + B_EVEN_SPACING, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return false; } else { entry.GetRef(&fDestRef); @@ -246,6 +251,7 @@ ExpanderWindow::MessageReceived(BMessage* msg) "archive? The expanded items may not be complete."), B_TRANSLATE("Stop"), B_TRANSLATE("Continue"), NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); + alert->SetShortcut(0, B_ESCAPE); if (alert->Go() == 0) { fExpandingThread->ResumeExternalExpander(); StopExpanding(); @@ -280,6 +286,7 @@ ExpanderWindow::MessageReceived(BMessage* msg) B_TRANSLATE("The file doesn't exist"), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); break; } @@ -303,6 +310,7 @@ ExpanderWindow::MessageReceived(BMessage* msg) BAlert* alert = new BAlert("srcAlert", string.String(), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_INFO_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); fShowContents->SetEnabled(false); @@ -369,6 +377,7 @@ ExpanderWindow::MessageReceived(BMessage* msg) BAlert* alert = new BAlert("stopAlert", string, B_TRANSLATE("Stop"), B_TRANSLATE("Continue"), NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); + alert->SetShortcut(0, B_ESCAPE); if (alert->Go() == 0) { fExpandingThread->ResumeExternalExpander(); StopExpanding(); @@ -422,6 +431,7 @@ ExpanderWindow::CanQuit() "archive? The expanded items may not be complete."), B_TRANSLATE("Stop"), B_TRANSLATE("Continue"), NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); + alert->SetShortcut(0, B_ESCAPE); if (alert->Go() == 0) { fExpandingThread->ResumeExternalExpander(); StopExpanding(); @@ -558,6 +568,7 @@ ExpanderWindow::StartExpanding() B_TRANSLATE("The folder was either moved, renamed or not\nsupported."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return; } diff --git a/src/apps/glteapot/ObjectView.cpp b/src/apps/glteapot/ObjectView.cpp index bf14e13d76..35dd22609d 100644 --- a/src/apps/glteapot/ObjectView.cpp +++ b/src/apps/glteapot/ObjectView.cpp @@ -177,6 +177,7 @@ ObjectView::ObjectView(BRect rect, const char *name, ulong resizingMode, BAlert *NoResourceAlert = new BAlert(B_TRANSLATE("Error"), kNoResourceError, B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_STOP_ALERT); + NoResourceAlert->SetFlags(NoResourceAlert->Flags() | B_CLOSE_ON_ESCAPE); NoResourceAlert->Go(); delete Tri; } @@ -323,6 +324,7 @@ ObjectView::MessageReceived(BMessage* msg) BAlert *NoResourceAlert = new BAlert(B_TRANSLATE("Error"), kNoResourceError, B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_STOP_ALERT); + NoResourceAlert->SetFlags(NoResourceAlert->Flags() | B_CLOSE_ON_ESCAPE); NoResourceAlert->Go(); delete Tri; } diff --git a/src/apps/icon-o-matic/MainWindow.cpp b/src/apps/icon-o-matic/MainWindow.cpp index 51692f559f..4842e5ed46 100644 --- a/src/apps/icon-o-matic/MainWindow.cpp +++ b/src/apps/icon-o-matic/MainWindow.cpp @@ -718,6 +718,7 @@ MainWindow::Open(const entry_ref& ref, bool append) "Cancel button - error alert"), NULL, NULL); // launch alert asynchronously + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); delete icon; @@ -796,6 +797,7 @@ MainWindow::Open(const BMessenger& externalObserver, const uint8* data, "Cancel button - error alert"), NULL, NULL); // launch alert asynchronously + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); delete icon; @@ -1273,7 +1275,8 @@ MainWindow::_CheckSaveIcon(const BMessage* currentMessage) BAlert* alert = new BAlert("save", B_TRANSLATE("Save changes to current icon?"), B_TRANSLATE("Discard"), - B_TRANSLATE("Cancel"), B_TRANSLATE("Save")); + B_TRANSLATE("Cancel"), B_TRANSLATE("Save")); + alert->SetShortcut(0, B_ESCAPE); int32 choice = alert->Go(); switch (choice) { case 0: diff --git a/src/apps/icon-o-matic/gui/SavePanel.cpp b/src/apps/icon-o-matic/gui/SavePanel.cpp index a131378cdc..a3d107a68d 100644 --- a/src/apps/icon-o-matic/gui/SavePanel.cpp +++ b/src/apps/icon-o-matic/gui/SavePanel.cpp @@ -365,6 +365,7 @@ SavePanel::_ExportSettings() // status_t err = roster->MakeConfigurationView(item->id, NULL, &view, &rect); // if (err < B_OK || view == NULL) { // BAlert *alert = new BAlert(NULL, strerror(err), "OK"); +// alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); // alert->Go(); // } else { // if (fConfigWindow != NULL) { diff --git a/src/apps/icon-o-matic/import_export/Exporter.cpp b/src/apps/icon-o-matic/import_export/Exporter.cpp index 725148b94f..6440fdd95f 100644 --- a/src/apps/icon-o-matic/import_export/Exporter.cpp +++ b/src/apps/icon-o-matic/import_export/Exporter.cpp @@ -116,6 +116,7 @@ Exporter::_ExportThread() "Exporter - Continue in error dialog"), NULL, NULL); // launch alert asynchronously + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } else { // success diff --git a/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp b/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp index 029b6b7035..0b57dc7bc0 100644 --- a/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp +++ b/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp @@ -164,6 +164,7 @@ SVGExporter::_DisplayWarning() const "be lost."), B_TRANSLATE("Cancel"), B_TRANSLATE("Overwrite")); + alert->SetShortcut(0, B_ESCAPE); return alert->Go() == 1; } diff --git a/src/apps/icon-o-matic/import_export/svg/SVGImporter.cpp b/src/apps/icon-o-matic/import_export/svg/SVGImporter.cpp index 1faf39b974..f26c460ac3 100644 --- a/src/apps/icon-o-matic/import_export/svg/SVGImporter.cpp +++ b/src/apps/icon-o-matic/import_export/svg/SVGImporter.cpp @@ -80,6 +80,7 @@ SVGImporter::Import(Icon* icon, const entry_ref* ref) BAlert* alert = new BAlert(B_TRANSLATE("load error"), error, B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); ret = B_ERROR; } diff --git a/src/apps/installedpackages/UninstallView.cpp b/src/apps/installedpackages/UninstallView.cpp index 794440b97d..28a847430e 100644 --- a/src/apps/installedpackages/UninstallView.cpp +++ b/src/apps/installedpackages/UninstallView.cpp @@ -257,7 +257,7 @@ UninstallView::MessageReceived(BMessage* msg) "been corrupted."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); } - + notify->SetFlags(notify->Flags() | B_CLOSE_ON_ESCAPE); notify->Go(); } default: diff --git a/src/apps/installer/InstallerApp.cpp b/src/apps/installer/InstallerApp.cpp index 431ea2507a..22b7ee6e1b 100644 --- a/src/apps/installer/InstallerApp.cpp +++ b/src/apps/installer/InstallerApp.cpp @@ -82,6 +82,7 @@ InstallerApp::AboutRequested() BAlert *alert = new BAlert("about", B_TRANSLATE("Installer\n" "\twritten by Jérôme Duval and Stephan Aßmus\n" "\tCopyright 2005-2010, Haiku.\n\n"), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); BTextView *view = alert->TextView(); BFont font; diff --git a/src/apps/installer/InstallerWindow.cpp b/src/apps/installer/InstallerWindow.cpp index 707e03dc5d..cc639ea12a 100644 --- a/src/apps/installer/InstallerWindow.cpp +++ b/src/apps/installer/InstallerWindow.cpp @@ -346,7 +346,9 @@ InstallerWindow::MessageReceived(BMessage *msg) B_TRANSLATE("An error was encountered and the " "installation was not completed:\n\n" "Error: %s"), strerror(error)); - (new BAlert("error", errorMessage, B_TRANSLATE("OK")))->Go(); + BAlert* alert = new BAlert("error", errorMessage, B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } _DisableInterface(false); @@ -426,10 +428,12 @@ InstallerWindow::MessageReceived(BMessage *msg) } case ENCOURAGE_DRIVESETUP: { - (new BAlert("use drive setup", B_TRANSLATE("No partitions have " + BAlert* alert = new BAlert("use drive setup", B_TRANSLATE("No partitions have " "been found that are suitable for installation. Please set " "up partitions and initialize at least one partition with the " - "Be File System."), B_TRANSLATE("OK")))->Go(); + "Be File System."), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); break; } case MSG_STATUS_MESSAGE: @@ -575,39 +579,48 @@ InstallerWindow::QuitRequested() // thing on the screen and we will reboot the machine once it quits. if (fDriveSetupLaunched && fBootManagerLaunched) { - (new BAlert(B_TRANSLATE("Quit Boot Manager and DriveSetup"), - B_TRANSLATE("Please close the Boot Manager and DriveSetup " - "windows before closing the Installer window."), - B_TRANSLATE("OK")))->Go(); + BAlert* alert = new BAlert(B_TRANSLATE("Quit Boot Manager and " + "DriveSetup"), B_TRANSLATE("Please close the Boot Manager " + "and DriveSetup windows before closing the Installer window."), + B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return false; } if (fDriveSetupLaunched) { - (new BAlert(B_TRANSLATE("Quit DriveSetup"), - B_TRANSLATE("Please close the DriveSetup window before closing " - "the Installer window."), B_TRANSLATE("OK")))->Go(); + BAlert* alert = new BAlert(B_TRANSLATE("Quit DriveSetup"), + B_TRANSLATE("Please close the DriveSetup window before " + "closing the Installer window."), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return false; } if (fBootManagerLaunched) { - (new BAlert(B_TRANSLATE("Quit Boot Manager"), + BAlert* alert = new BAlert(B_TRANSLATE("Quit Boot Manager"), B_TRANSLATE("Please close the Boot Manager window before " - "closing the Installer window."), B_TRANSLATE("OK")))->Go(); + "closing the Installer window."), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return false; } - - if (fInstallStatus != kFinished - && (new BAlert(B_TRANSLATE_SYSTEM_NAME("Installer"), - B_TRANSLATE("Are you sure you want to abort the " - "installation and restart the system?"), - B_TRANSLATE("Cancel"), B_TRANSLATE("Restart system"), NULL, - B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go() == 0) { - return false; + if (fInstallStatus != kFinished) { + BAlert* alert = new BAlert(B_TRANSLATE_SYSTEM_NAME("Installer"), + B_TRANSLATE("Are you sure you want to abort the " + "installation and restart the system?"), + B_TRANSLATE("Cancel"), B_TRANSLATE("Restart system"), NULL, + B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetShortcut(0, B_ESCAPE); + if (alert->Go() == 0) + return false; } - } else if (fInstallStatus == kInstalling - && (new BAlert(B_TRANSLATE_SYSTEM_NAME("Installer"), - B_TRANSLATE("Are you sure you want to abort the installation?"), - B_TRANSLATE("Cancel"), B_TRANSLATE("Abort"), NULL, - B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go() == 0) { - return false; + } else if (fInstallStatus == kInstalling) { + BAlert* alert = new BAlert(B_TRANSLATE_SYSTEM_NAME("Installer"), + B_TRANSLATE("Are you sure you want to abort the installation?"), + B_TRANSLATE("Cancel"), B_TRANSLATE("Abort"), NULL, + B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetShortcut(0, B_ESCAPE); + if (alert->Go() == 0) + return false; } _QuitCopyEngine(false); @@ -648,6 +661,7 @@ InstallerWindow::_LaunchDriveSetup() BAlert* alert = new BAlert("error", B_TRANSLATE("DriveSetup, the " "application to configure disk partitions, could not be " "launched."), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } } @@ -676,6 +690,7 @@ InstallerWindow::_LaunchBootManager() BAlert* alert = new BAlert("error", B_TRANSLATE("BootManager, the " "application to configure the Haiku boot menu, could not be " "launched."), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } } @@ -876,11 +891,13 @@ InstallerWindow::_QuitCopyEngine(bool askUser) bool quit = true; if (askUser) { - quit = (new BAlert("cancel", + BAlert* alert = new BAlert("cancel", B_TRANSLATE("Are you sure you want to to stop the installation?"), B_TRANSLATE_COMMENT("Continue", "In alert after pressing Stop"), B_TRANSLATE_COMMENT("Stop", "In alert after pressing Stop"), 0, - B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go() != 0; + B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetShortcut(1, B_ESCAPE); + quit = alert->Go(); } if (quit) { diff --git a/src/apps/installer/WorkerThread.cpp b/src/apps/installer/WorkerThread.cpp index 73abd112a1..fbb4727430 100644 --- a/src/apps/installer/WorkerThread.cpp +++ b/src/apps/installer/WorkerThread.cpp @@ -316,13 +316,15 @@ WorkerThread::_PerformInstall(BMenu* srcMenu, BMenu* targetMenu) goto error; // shouldn't happen // check if target has enough space - if ((fSpaceRequired > 0 && targetVolume.FreeBytes() < fSpaceRequired) - && ((new BAlert("", B_TRANSLATE("The destination disk may not have " - "enough space. Try choosing a different disk or choose to not " - "install optional items."), B_TRANSLATE("Try installing anyway"), - B_TRANSLATE("Cancel"), 0, - B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go() != 0)) { - goto error; + if (fSpaceRequired > 0 && targetVolume.FreeBytes() < fSpaceRequired) { + BAlert* alert = new BAlert("", B_TRANSLATE("The destination disk may " + "not have enough space. Try choosing a different disk or choose " + "to not install optional items."), + B_TRANSLATE("Try installing anyway"), B_TRANSLATE("Cancel"), 0, + B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetShortcut(1, B_ESCAPE); + if (alert->Go() != 0) + goto error; } if (fDDRoster.GetPartitionWithID(srcItem->ID(), &device, &partition) == B_OK) { @@ -346,14 +348,16 @@ WorkerThread::_PerformInstall(BMenu* srcMenu, BMenu* targetMenu) } // check not installing on boot volume - if ((strncmp(BOOT_PATH, targetDirectory.Path(), strlen(BOOT_PATH)) == 0) - && ((new BAlert("", B_TRANSLATE("Are you sure you want to install " - "onto the current boot disk? The Installer will have to reboot " - "your machine if you proceed."), B_TRANSLATE("OK"), - B_TRANSLATE("Cancel"), 0, - B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go() != 0)) { - _SetStatusMessage("Installation stopped."); - goto error; + if (strncmp(BOOT_PATH, targetDirectory.Path(), strlen(BOOT_PATH)) == 0) { + BAlert* alert = new BAlert("", B_TRANSLATE("Are you sure you want to " + "install onto the current boot disk? The Installer will have to " + "reboot your machine if you proceed."), B_TRANSLATE("OK"), + B_TRANSLATE("Cancel"), 0, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetShortcut(1, B_ESCAPE); + if (alert->Go() != 0) { + _SetStatusMessage("Installation stopped."); + goto error; + } } // check if target volume's trash dir has anything in it @@ -376,19 +380,22 @@ WorkerThread::_PerformInstall(BMenu* srcMenu, BMenu* targetMenu) entries++; } - if (entries != 0 - && ((new BAlert("", B_TRANSLATE("The target volume is not empty. Are " - "you sure you want to install anyway?\n\nNote: The 'system' folder " - "will be a clean copy from the source volume, all other folders " - "will be merged, whereas files and links that exist on both the " - "source and target volume will be overwritten with the source " - "volume version."), + if (entries != 0) { + BAlert* alert = new BAlert("", B_TRANSLATE("The target volume is not " + "empty. Are you sure you want to install anyway?\n\nNote: The " + "'system' folder will be a clean copy from the source volume, all " + "other folders will be merged, whereas files and links that exist " + "on both the source and target volume will be overwritten with " + "the source volume version."), B_TRANSLATE("Install anyway"), B_TRANSLATE("Cancel"), 0, - B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go() != 0)) { + B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetShortcut(1, B_ESCAPE); + if (alert->Go() != 0) { // TODO: Would be cool to offer the option here to clean additional // folders at the user's choice (like /boot/common and /boot/develop). - err = B_CANCELED; - goto error; + err = B_CANCELED; + goto error; + } } // Begin actual installation diff --git a/src/apps/launchbox/MainWindow.cpp b/src/apps/launchbox/MainWindow.cpp index 448a99e97a..3d3edd8af8 100644 --- a/src/apps/launchbox/MainWindow.cpp +++ b/src/apps/launchbox/MainWindow.cpp @@ -98,6 +98,7 @@ MainWindow::QuitRequested() B_TRANSLATE("Really close this pad?\n" "(The pad will not be remembered.)"), B_TRANSLATE("Close"), B_TRANSLATE("Cancel"), NULL); + alert->SetShortcut(1, B_ESCAPE); if (alert->Go() == 1) return false; } @@ -172,6 +173,7 @@ MainWindow::MessageReceived(BMessage* message) if (errorMessage.Length() > 0) { BAlert* alert = new BAlert("error", errorMessage.String(), B_TRANSLATE("Bummer"), NULL, NULL, B_WIDTH_FROM_WIDEST); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } break; diff --git a/src/apps/login/LoginApp.cpp b/src/apps/login/LoginApp.cpp index a8771b1a67..6945f6d555 100644 --- a/src/apps/login/LoginApp.cpp +++ b/src/apps/login/LoginApp.cpp @@ -51,12 +51,14 @@ LoginApp::ReadyToRun() BScreen screen; if (fEditShelfMode) { - (new BAlert(B_TRANSLATE("Info"), B_TRANSLATE("You can customize the " + BAlert* alert = new BAlert(B_TRANSLATE("Info"), B_TRANSLATE("You can customize the " "desktop shown behind the Login application by dropping replicants" " onto it.\n" "\n" "When you are finished just quit the application (Alt-Q)."), - B_TRANSLATE("OK")))->Go(NULL); + B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(NULL); } else { BRect frame(0, 0, 450, 150); frame.OffsetBySelf(screen.Frame().Width()/2 - frame.Width()/2, @@ -94,14 +96,21 @@ LoginApp::MessageReceived(BMessage *message) if (error < B_OK) { BString msg(B_TRANSLATE("Error: %1")); msg.ReplaceFirst("%1", strerror(error)); - (new BAlert(("Error"), msg.String(), B_TRANSLATE("OK")))->Go(); + BAlert* alert = new BAlert(("Error"), msg.String(), + B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } break; } case kSuspendAction: - (new BAlert(B_TRANSLATE("Error"), B_TRANSLATE("Unimplemented"), - B_TRANSLATE("OK")))->Go(); + { + BAlert* alert = new BAlert(B_TRANSLATE("Error"), + B_TRANSLATE("Unimplemented"), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); break; + } #endif default: BApplication::MessageReceived(message); diff --git a/src/apps/mail/Content.cpp b/src/apps/mail/Content.cpp index e3390d23be..c4f40717f7 100644 --- a/src/apps/mail/Content.cpp +++ b/src/apps/mail/Content.cpp @@ -755,10 +755,11 @@ TContentView::MessageReceived(BMessage *msg) free (signature); } else { beep(); - (new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("An error occurred trying to open this " - "signature."), - B_TRANSLATE("Sorry")))->Go(); + "signature."), B_TRANSLATE("Sorry")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } break; } @@ -1914,10 +1915,11 @@ TTextView::Open(hyper_text *enclosure) status_t result = be_roster->Launch(handlerToLaunch, 1, &enclosure->name); if (result != B_NO_ERROR && result != B_ALREADY_RUNNING) { beep(); - (new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("There is no installed handler for " - "URL links."), - "Sorry"))->Go(); + "URL links."), B_TRANSLATE("Sorry")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } break; } @@ -2065,9 +2067,10 @@ TTextView::Save(BMessage *msg, bool makeNewFile) if (result != B_NO_ERROR) { beep(); - (new BAlert("", B_TRANSLATE("An error occurred trying to save " - "the attachment."), - B_TRANSLATE("Sorry")))->Go(); + BAlert* alert = new BAlert("", B_TRANSLATE("An error occurred trying to save " + "the attachment."), B_TRANSLATE("Sorry")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } return result; @@ -3337,10 +3340,11 @@ TTextView::Undo(BClipboard */*clipboard*/) Select(offset, offset + length); } else { ::beep(); - (new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("Inconsistency occurred in the undo/redo " - "buffer."), - B_TRANSLATE("OK")))->Go(); + "buffer."), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } break; } @@ -3384,10 +3388,11 @@ TTextView::Redo() case K_REPLACED: ::beep(); - (new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("Inconsistency occurred in the undo/redo " - "buffer."), - B_TRANSLATE("OK")))->Go(); + "buffer."), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); break; } ScrollToSelection(); diff --git a/src/apps/mail/Enclosures.cpp b/src/apps/mail/Enclosures.cpp index 469fa1d155..f6ea5d0df9 100644 --- a/src/apps/mail/Enclosures.cpp +++ b/src/apps/mail/Enclosures.cpp @@ -249,10 +249,12 @@ TEnclosuresView::MessageReceived(BMessage *msg) if (window && window->Mail()) window->Mail()->RemoveComponent(item->Component()); - (new BAlert("", B_TRANSLATE( + BAlert* alert = new BAlert("", B_TRANSLATE( "Removing attachments from a forwarded mail is not yet " "implemented!\nIt will not yet work correctly."), - B_TRANSLATE("OK")))->Go(); + B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } else watch_node(item->NodeRef(), B_STOP_WATCHING, this); @@ -302,9 +304,11 @@ TEnclosuresView::MessageReceived(BMessage *msg) if (badType) { beep(); - (new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("Only files can be added as attachments."), - B_TRANSLATE("OK")))->Go(); + B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } } break; diff --git a/src/apps/mail/MailWindow.cpp b/src/apps/mail/MailWindow.cpp index d06867f427..99daf47071 100644 --- a/src/apps/mail/MailWindow.cpp +++ b/src/apps/mail/MailWindow.cpp @@ -1177,9 +1177,11 @@ TMailWindow::MessageReceived(BMessage *msg) msg.AddRef("refs", fRef); tracker.SendMessage(&msg); } else { - (new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("Need Tracker to move items to trash"), - B_TRANSLATE("Sorry")))->Go(); + B_TRANSLATE("Sorry")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } } } else { @@ -1344,14 +1346,14 @@ TMailWindow::MessageReceived(BMessage *msg) 1, &arg); if (result != B_NO_ERROR) { - (new BAlert("", B_TRANSLATE( + BAlert* alert = new BAlert("", B_TRANSLATE( "Sorry, could not find an application that " "supports the 'Person' data type."), - B_TRANSLATE("OK")))->Go(); + B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } - } - free(arg); break; } @@ -1581,10 +1583,12 @@ TMailWindow::MessageReceived(BMessage *msg) snooze (1500000); if (!gDictCount) { beep(); - (new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("Mail couldn't find its dictionary."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, - B_OFFSET_SPACING, B_STOP_ALERT))->Go(); + B_OFFSET_SPACING, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } else { fSpelling->SetMarked(!fSpelling->IsMarked()); fContentView->fTextView->EnableSpellCheck( @@ -1626,6 +1630,7 @@ TMailWindow::MessageReceived(BMessage *msg) B_TRANSLATE("Put your favorite e-mail queries and query " "templates in this folder."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_IDEA_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } @@ -2225,8 +2230,10 @@ TMailWindow::Send(bool now) status_t status = SaveAsDraft(); if (status != B_OK) { beep(); - (new BAlert("", B_TRANSLATE("E-mail draft could not be saved!"), - B_TRANSLATE("OK")))->Go(); + BAlert* alert = new BAlert("", B_TRANSLATE("E-mail draft could " + "not be saved!"), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } return status; } @@ -2315,11 +2322,14 @@ TMailWindow::Send(bool now) "the unencodable ones), or choose Cancel to go back " "and try fixing it up."); messageString.ReplaceFirst("%ld", countString); - userAnswer = (new BAlert("Question", messageString.String(), + BAlert* alert = new BAlert("Question", messageString.String(), B_TRANSLATE("Send"), B_TRANSLATE("Cancel"), NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, - B_WARNING_ALERT))->Go(); + B_WARNING_ALERT); + alert->SetShortcut(1, B_ESCAPE); + userAnswer = alert->Go(); + if (userAnswer == 1) { // Cancel was picked. return -1; @@ -2450,11 +2460,13 @@ TMailWindow::Send(bool now) close = true; fSent = true; - int32 start = (new BAlert("no daemon", + BAlert* alert = new BAlert("no daemon", B_TRANSLATE("The mail_daemon is not running. The message is " "queued and will be sent when the mail_daemon is started."), - B_TRANSLATE("Start now"), B_TRANSLATE("OK")))->Go(); - + B_TRANSLATE("Start now"), B_TRANSLATE("OK")); + alert->SetShortcut(1, B_ESCAPE); + int32 start = alert->Go(); + if (start == 0) { result = be_roster->Launch("application/x-vnd.Be-POST"); if (result == B_OK) { @@ -2489,7 +2501,9 @@ TMailWindow::Send(bool now) if (result != B_NO_ERROR && result != B_MAIL_NO_DAEMON) { beep(); - (new BAlert("", errorMessage.String(), B_TRANSLATE("OK")))->Go(); + BAlert* alert = new BAlert("", errorMessage.String(), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } if (close) { PostMessage(B_QUIT_REQUESTED); @@ -2721,8 +2735,10 @@ ErrorExit: sprintf(errorString, "Unable to train the message file \"%s\" as %s. " "Possibly useful error code: %s (%ld).", filePath.Path(), CommandWord, strerror (errorCode), errorCode); - (new BAlert("", errorString, - B_TRANSLATE("OK")))->Go(); + BAlert* alert = new BAlert("", errorString, B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); + return errorCode; } diff --git a/src/apps/mail/Signature.cpp b/src/apps/mail/Signature.cpp index 405bb69525..7fd5ea867e 100644 --- a/src/apps/mail/Signature.cpp +++ b/src/apps/mail/Signature.cpp @@ -192,13 +192,17 @@ TSignatureWindow::MessageReceived(BMessage* msg) Save(); break; - case M_DELETE: - if (!(new BAlert("", + case M_DELETE: { + BAlert* alert = new BAlert("", B_TRANSLATE("Really delete this signature? This cannot " "be undone."), B_TRANSLATE("Cancel"), B_TRANSLATE("Delete"), - NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go()) + NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetShortcut(0, B_ESCAPE); + int32 choice = alert->Go(); + + if (choice == 0) break; if (fFile) { @@ -210,7 +214,7 @@ TSignatureWindow::MessageReceived(BMessage* msg) fSigView->fName->MakeFocus(true); } break; - + } case M_SIGNATURE: if (Clear()) { msg->FindRef("ref", &ref); @@ -231,9 +235,11 @@ TSignatureWindow::MessageReceived(BMessage* msg) else { fFile = NULL; beep(); - (new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("Couldn't open this signature. Sorry."), - B_TRANSLATE("OK")))->Go(); + B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } } break; @@ -385,9 +391,11 @@ TSignatureWindow::Save() err_exit: beep(); - (new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("An error occurred trying to save this signature."), - B_TRANSLATE("Sorry")))->Go(); + B_TRANSLATE("Sorry")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } diff --git a/src/apps/mediaconverter/MediaConverterApp.cpp b/src/apps/mediaconverter/MediaConverterApp.cpp index f9397d5d2f..67af42588b 100644 --- a/src/apps/mediaconverter/MediaConverterApp.cpp +++ b/src/apps/mediaconverter/MediaConverterApp.cpp @@ -146,7 +146,7 @@ MediaConverterApp::RefsReceived(BMessage* msg) BAlert* alert = new BAlert((errors > 1) ? B_TRANSLATE("Error loading files") : B_TRANSLATE("Error loading a file"), - alertText.String(), B_TRANSLATE("Continue") , NULL, NULL, + alertText.String(), B_TRANSLATE("Continue"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); alert->Go(); } diff --git a/src/apps/mediaconverter/MediaConverterWindow.cpp b/src/apps/mediaconverter/MediaConverterWindow.cpp index c6288660d2..c835ec8fc0 100644 --- a/src/apps/mediaconverter/MediaConverterWindow.cpp +++ b/src/apps/mediaconverter/MediaConverterWindow.cpp @@ -428,8 +428,10 @@ MediaConverterWindow::MessageReceived(BMessage* msg) if (status != B_OK && status != B_ALREADY_RUNNING) { BString errorString(B_TRANSLATE("Error launching: %strError%")); errorString.ReplaceFirst("%strError%", strerror(status)); - (new BAlert(B_TRANSLATE("Error"), errorString.String(), - B_TRANSLATE("OK")))->Go(); + BAlert* alert = new BAlert(B_TRANSLATE("Error"), + errorString.String(), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } break; } diff --git a/src/apps/mediaconverter/MediaFileInfoView.cpp b/src/apps/mediaconverter/MediaFileInfoView.cpp index 6cd20e5d00..0aa2de7277 100644 --- a/src/apps/mediaconverter/MediaFileInfoView.cpp +++ b/src/apps/mediaconverter/MediaFileInfoView.cpp @@ -165,6 +165,7 @@ MediaFileInfoView::Update(BMediaFile* file, entry_ref* ref) BAlert* alert = new BAlert( B_TRANSLATE("File Error"), error.String(), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } } else { diff --git a/src/apps/mediaplayer/MainApp.cpp b/src/apps/mediaplayer/MainApp.cpp index 427de760d8..4b435d74ea 100644 --- a/src/apps/mediaplayer/MainApp.cpp +++ b/src/apps/mediaplayer/MainApp.cpp @@ -93,6 +93,8 @@ MainApp::MainApp() "Would you like to start it ?"), B_TRANSLATE("Quit"), B_TRANSLATE("Start media server"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetShortcut(0, B_ESCAPE); + if (alert->Go() == 0) { PostMessage(B_QUIT_REQUESTED); return; diff --git a/src/apps/mediaplayer/MainWin.cpp b/src/apps/mediaplayer/MainWin.cpp index e9ebd34da0..bdce0485db 100644 --- a/src/apps/mediaplayer/MainWin.cpp +++ b/src/apps/mediaplayer/MainWin.cpp @@ -633,6 +633,7 @@ MainWin::MessageReceived(BMessage* msg) BAlert* alert = new BAlert(B_TRANSLATE("Nothing to Play"), B_TRANSLATE("None of the files you wanted to play appear " "to be media files."), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); fControls->SetDisabledString(kDisabledSeekMessage); break; @@ -1090,8 +1091,10 @@ MainWin::OpenPlaylistItem(const PlaylistItemRef& item) BString message = B_TRANSLATE("%app% encountered an internal error. " "The file could not be opened."); message.ReplaceFirst("%app%", kApplicationName); - (new BAlert(kApplicationName, message.String(), - B_TRANSLATE("OK")))->Go(); + BAlert* alert = new BAlert(kApplicationName, message.String(), + B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); _PlaylistItemOpened(item, ret); } else { BString string; @@ -1337,7 +1340,10 @@ MainWin::_PlaylistItemOpened(const PlaylistItemRef& item, status_t result) } else { message << B_TRANSLATE("Error: ") << strerror(result); } - (new BAlert("error", message.String(), B_TRANSLATE("OK")))->Go(); + BAlert* alert = new BAlert("error", message.String(), + B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); fControls->SetDisabledString(kDisabledSeekMessage); } else { // Just go to the next file and don't bother user (yet) diff --git a/src/apps/mediaplayer/playlist/PlaylistWindow.cpp b/src/apps/mediaplayer/playlist/PlaylistWindow.cpp index 8e4d9f1499..8aab7168f3 100644 --- a/src/apps/mediaplayer/playlist/PlaylistWindow.cpp +++ b/src/apps/mediaplayer/playlist/PlaylistWindow.cpp @@ -57,6 +57,7 @@ display_save_alert(const char* message) { BAlert* alert = new BAlert(B_TRANSLATE("Save error"), message, B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } diff --git a/src/apps/mediaplayer/playlist/RemovePLItemsCommand.cpp b/src/apps/mediaplayer/playlist/RemovePLItemsCommand.cpp index a872bc3167..7b1a0d2b1c 100644 --- a/src/apps/mediaplayer/playlist/RemovePLItemsCommand.cpp +++ b/src/apps/mediaplayer/playlist/RemovePLItemsCommand.cpp @@ -118,9 +118,11 @@ RemovePLItemsCommand::Perform() message << B_TRANSLATE("Some files could not be moved into Trash."); message << "\n\n" << B_TRANSLATE("Error: ") << strerror(moveError); - (new BAlert(B_TRANSLATE("Move Into Trash Error"), message.String(), - B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, - B_WARNING_ALERT))->Go(NULL); + BAlert* alert = new BAlert(B_TRANSLATE("Move into trash error"), + message.String(), B_TRANSLATE("OK"), NULL, NULL, + B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(NULL); } } diff --git a/src/apps/midiplayer/MidiPlayerApp.cpp b/src/apps/midiplayer/MidiPlayerApp.cpp index 0450d2790c..e557482382 100644 --- a/src/apps/midiplayer/MidiPlayerApp.cpp +++ b/src/apps/midiplayer/MidiPlayerApp.cpp @@ -48,14 +48,16 @@ MidiPlayerApp::ReadyToRun() void MidiPlayerApp::AboutRequested() { - (new BAlert( - NULL, + BAlert* alert = new BAlert(NULL, B_TRANSLATE_COMMENT("Haiku MIDI Player 1.0.0 beta\n\n" "This tiny program\n" "Knows how to play thousands of\n" - "Cheesy sounding songs", "This is a haiku. First line has five syllables, second has seven and last has five again. Create your own."), - "Okay", NULL, NULL, - B_WIDTH_AS_USUAL, B_INFO_ALERT))->Go(); + "Cheesy sounding songs", "This is a haiku. First line has five " + "syllables, second has seven and last has five again. " + "Create your own."), B_TRANSLATE("OK"), NULL, NULL, + B_WIDTH_AS_USUAL, B_INFO_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } diff --git a/src/apps/midiplayer/MidiPlayerWindow.cpp b/src/apps/midiplayer/MidiPlayerWindow.cpp index 3479e8f53a..e098f584a0 100644 --- a/src/apps/midiplayer/MidiPlayerWindow.cpp +++ b/src/apps/midiplayer/MidiPlayerWindow.cpp @@ -381,9 +381,11 @@ MidiPlayerWindow::LoadFile(entry_ref* ref) scopeView->SetPlaying(false); scopeView->Invalidate(); - (new BAlert(NULL, B_TRANSLATE("Could not load song"), + BAlert* alert = new BAlert(NULL, B_TRANSLATE("Could not load song"), B_TRANSLATE("OK"), NULL, NULL, - B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); + B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } } diff --git a/src/apps/networkstatus/NetworkStatus.cpp b/src/apps/networkstatus/NetworkStatus.cpp index b7a9897ec6..557523b03f 100644 --- a/src/apps/networkstatus/NetworkStatus.cpp +++ b/src/apps/networkstatus/NetworkStatus.cpp @@ -156,7 +156,6 @@ NetworkStatus::ReadyToRun() "in a window or install it in the Deskbar."), B_TRANSLATE("Run in window"), B_TRANSLATE("Install in Deskbar"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); if (alert->Go() == 1) { _InstallReplicantInDeskbar(); diff --git a/src/apps/networkstatus/NetworkStatusView.cpp b/src/apps/networkstatus/NetworkStatusView.cpp index f3490d9bb5..626cb60757 100644 --- a/src/apps/networkstatus/NetworkStatusView.cpp +++ b/src/apps/networkstatus/NetworkStatusView.cpp @@ -298,6 +298,7 @@ NetworkStatusView::MessageReceived(BMessage* message) BAlert* alert = new BAlert(name, text.String(), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } } @@ -401,6 +402,7 @@ NetworkStatusView::_ShowConfiguration(BMessage* message) } BAlert* alert = new BAlert(name, text.String(), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); BTextView* view = alert->TextView(); BFont font; @@ -509,6 +511,7 @@ NetworkStatusView::_AboutRequested() about.ReplaceFirst("%2", "Copyright 2007-2010"); // Append a new year here BAlert* alert = new BAlert("about", about, B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); BTextView *view = alert->TextView(); BFont font; @@ -602,6 +605,7 @@ NetworkStatusView::_OpenNetworksPreferences() errorMessage << strerror(status); BAlert* alert = new BAlert("launch error", errorMessage.String(), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); // asynchronous alert in order to not block replicant host application alert->Go(NULL); diff --git a/src/apps/overlayimage/OverlayView.cpp b/src/apps/overlayimage/OverlayView.cpp index 9efac70e15..8bc37bcddd 100644 --- a/src/apps/overlayimage/OverlayView.cpp +++ b/src/apps/overlayimage/OverlayView.cpp @@ -159,8 +159,7 @@ OverlayView::OverlayAboutRequested() "originally by Seth Flaxman\n\t" "modified by Hartmuth Reh\n\t" "further modified by Humdinger\n", - "OK"); - + "OK"); BTextView *view = alert->TextView(); BFont font; view->SetStylable(true); @@ -168,6 +167,6 @@ OverlayView::OverlayAboutRequested() font.SetSize(font.Size() + 7.0f); font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, 12, &font); - + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } diff --git a/src/apps/packageinstaller/PackageInfo.cpp b/src/apps/packageinstaller/PackageInfo.cpp index d8bfdd0f6f..22cfe55e35 100644 --- a/src/apps/packageinstaller/PackageInfo.cpp +++ b/src/apps/packageinstaller/PackageInfo.cpp @@ -1044,6 +1044,7 @@ PackageInfo::Parse() B_TRANSLATE("Continue"), B_TRANSLATE("Abort"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + warning->SetShortcut(1, B_ESCAPE); selection = warning->Go(); if (selection == 1) { diff --git a/src/apps/packageinstaller/PackageInstall.cpp b/src/apps/packageinstaller/PackageInstall.cpp index a779e1b6b1..c4b4b2fa7d 100644 --- a/src/apps/packageinstaller/PackageInstall.cpp +++ b/src/apps/packageinstaller/PackageInstall.cpp @@ -125,6 +125,7 @@ PackageInstall::_Install() "and continue the installation?"), B_TRANSLATE("Continue"), B_TRANSLATE("Abort")); + reinstall->SetShortcut(1, B_ESCAPE); if (reinstall->Go() == 0) { // Uninstall the package diff --git a/src/apps/packageinstaller/PackageView.cpp b/src/apps/packageinstaller/PackageView.cpp index 8575454e33..1005e58fa7 100644 --- a/src/apps/packageinstaller/PackageView.cpp +++ b/src/apps/packageinstaller/PackageView.cpp @@ -98,6 +98,7 @@ PackageView::AttachedToWindow() "possible reasons for this might be that the requested file " "is not a valid BeOS .pkg package."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + warning->SetFlags(warning->Flags() | B_CLOSE_ON_ESCAPE); warning->Go(); Window()->PostMessage(B_QUIT_REQUESTED); @@ -195,6 +196,7 @@ PackageView::MessageReceived(BMessage *msg) B_TRANSLATE("The package you requested has been successfully " "installed on your system."), B_TRANSLATE("OK")); + notify->SetFlags(notify->Flags() | B_CLOSE_ON_ESCAPE); notify->Go(); fStatusWindow->Hide(); @@ -214,6 +216,7 @@ PackageView::MessageReceived(BMessage *msg) B_TRANSLATE( "The installation of the package has been aborted."), B_TRANSLATE("OK")); + notify->SetFlags(notify->Flags() | B_CLOSE_ON_ESCAPE); notify->Go(); fStatusWindow->Hide(); fInstall->SetEnabled(true); @@ -234,6 +237,7 @@ PackageView::MessageReceived(BMessage *msg) NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); fprintf(stderr, B_TRANSLATE("Error while installing the package\n")); + notify->SetFlags(notify->Flags() | B_CLOSE_ON_ESCAPE); notify->Go(); fStatusWindow->Hide(); fInstall->SetEnabled(true); @@ -354,7 +358,8 @@ PackageView::ItemExists(PackageItem &item, BPath &path, int32 &policy) B_TRANSLATE("Replace"), B_TRANSLATE("Skip"), B_TRANSLATE("Abort")); - + alert->SetShortcut(2, B_ESCAPE); + choice = alert->Go(); switch (choice) { case 0: diff --git a/src/apps/pairs/PairsView.cpp b/src/apps/pairs/PairsView.cpp index 5a68a38bdb..569832c59b 100644 --- a/src/apps/pairs/PairsView.cpp +++ b/src/apps/pairs/PairsView.cpp @@ -175,7 +175,7 @@ PairsView::_ReadRandomIcons() BAlert* alert = new BAlert("Fatal", msgStr.String(), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_FROM_WIDEST, B_STOP_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); exit(1); } diff --git a/src/apps/people/PeopleApp.cpp b/src/apps/people/PeopleApp.cpp index 41a3a36436..c1e14424b6 100644 --- a/src/apps/people/PeopleApp.cpp +++ b/src/apps/people/PeopleApp.cpp @@ -247,6 +247,7 @@ TPeopleApp::MessageReceived(BMessage* message) BAlert* alert = new BAlert(B_TRANSLATE("Error"), errorMsg.String(), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } break; diff --git a/src/apps/people/PersonWindow.cpp b/src/apps/people/PersonWindow.cpp index 291b1df6b9..8c5511e92c 100644 --- a/src/apps/people/PersonWindow.cpp +++ b/src/apps/people/PersonWindow.cpp @@ -216,7 +216,9 @@ PersonWindow::MessageReceived(BMessage* msg) } else { sprintf(str, B_TRANSLATE("Could not create %s."), name); - (new BAlert("", str, B_TRANSLATE("Sorry")))->Go(); + BAlert* alert = new BAlert("", str, B_TRANSLATE("Sorry")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } } } @@ -294,9 +296,12 @@ PersonWindow::QuitRequested() status_t result; if (!fView->IsSaved()) { - result = (new BAlert("", B_TRANSLATE("Save changes before quitting?"), + BAlert* alert = new BAlert("", B_TRANSLATE("Save changes before quitting?"), B_TRANSLATE("Cancel"), B_TRANSLATE("Quit"), - B_TRANSLATE("Save")))->Go(); + B_TRANSLATE("Save")); + alert->SetShortcut(0, B_ESCAPE); + result = alert->Go(); + if (result == 2) { if (fRef) fView->Save(); diff --git a/src/apps/people/PictureView.cpp b/src/apps/people/PictureView.cpp index 90b97b5605..837bd7df99 100644 --- a/src/apps/people/PictureView.cpp +++ b/src/apps/people/PictureView.cpp @@ -564,6 +564,7 @@ PictureView::_HandleDrop(BMessage* msg) text.ReplaceFirst("%name%", name); BAlert* alert = new BAlert(B_TRANSLATE("Error"), text.String(), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } } diff --git a/src/apps/poorman/PoorManWindow.cpp b/src/apps/poorman/PoorManWindow.cpp index 019ecc1e8a..ef572846ec 100644 --- a/src/apps/poorman/PoorManWindow.cpp +++ b/src/apps/poorman/PoorManWindow.cpp @@ -545,6 +545,7 @@ PoorManWindow::DefaultSettings() { BAlert* serverAlert = new BAlert(B_TRANSLATE("Error Server"), STR_ERR_CANT_START, B_TRANSLATE("OK")); + serverAlert->SetFlags(serverAlert->Flags() | B_CLOSE_ON_ESCAPE); BAlert* dirAlert = new BAlert(B_TRANSLATE("Error Dir"), STR_ERR_WEB_DIR, B_TRANSLATE("Cancel"), B_TRANSLATE("Select"), B_TRANSLATE("Default"), B_WIDTH_AS_USUAL, B_OFFSET_SPACING); @@ -576,6 +577,7 @@ PoorManWindow::DefaultSettings() BAlert* dirCreatedAlert = new BAlert(B_TRANSLATE("Dir Created"), STR_DIR_CREATED, B_TRANSLATE("OK")); + dirCreatedAlert->SetFlags(dirCreatedAlert->Flags() | B_CLOSE_ON_ESCAPE); dirCreatedAlert->Go(); SetWebDir(STR_DEFAULT_WEB_DIRECTORY); be_app->PostMessage(kStartServer); diff --git a/src/apps/powerstatus/PowerStatus.cpp b/src/apps/powerstatus/PowerStatus.cpp index ebaefb73da..06b9355e28 100644 --- a/src/apps/powerstatus/PowerStatus.cpp +++ b/src/apps/powerstatus/PowerStatus.cpp @@ -90,7 +90,6 @@ PowerStatus::ReadyToRun() "or install it in the Deskbar."), B_TRANSLATE("Run in window"), B_TRANSLATE("Install in Deskbar"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); if (alert->Go()) { image_info info; diff --git a/src/apps/powerstatus/PowerStatusView.cpp b/src/apps/powerstatus/PowerStatusView.cpp index 647dae5399..0d540f60cc 100644 --- a/src/apps/powerstatus/PowerStatusView.cpp +++ b/src/apps/powerstatus/PowerStatusView.cpp @@ -635,6 +635,7 @@ PowerStatusReplicant::_AboutRequested() font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, strlen(B_TRANSLATE("PowerStatus")), &font); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } diff --git a/src/apps/processcontroller/PCWorld.cpp b/src/apps/processcontroller/PCWorld.cpp index d4b8c7dad8..d97d8b542f 100644 --- a/src/apps/processcontroller/PCWorld.cpp +++ b/src/apps/processcontroller/PCWorld.cpp @@ -93,7 +93,6 @@ PCApplication::ReadyToRun() " or install it in the Deskbar."), B_TRANSLATE("Run in window"), B_TRANSLATE("Install in Deskbar"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); if (alert->Go() != 0) { BDeskbar deskbar; @@ -107,7 +106,7 @@ PCApplication::ReadyToRun() B_TRANSLATE("ProcessController is already installed in Deskbar."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } diff --git a/src/apps/processcontroller/Preferences.cpp b/src/apps/processcontroller/Preferences.cpp index 8b4ca9b34d..3eb8d53bb9 100644 --- a/src/apps/processcontroller/Preferences.cpp +++ b/src/apps/processcontroller/Preferences.cpp @@ -115,8 +115,7 @@ Preferences::~Preferences() BAlert *alert = new BAlert(B_TRANSLATE("Error saving file"), error.String(), B_TRANSLATE("Damned!"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); - alert->SetShortcut(0, B_ESCAPE); - + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } } diff --git a/src/apps/processcontroller/ProcessController.cpp b/src/apps/processcontroller/ProcessController.cpp index 168a4ef78b..8f9417554c 100644 --- a/src/apps/processcontroller/ProcessController.cpp +++ b/src/apps/processcontroller/ProcessController.cpp @@ -280,7 +280,7 @@ ProcessController::MessageReceived(BMessage *message) B_TRANSLATE("This team is already gone"B_UTF8_ELLIPSIS), B_TRANSLATE("Ok!"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } } @@ -298,6 +298,8 @@ ProcessController::MessageReceived(BMessage *message) B_TRANSLATE("Cancel"), B_TRANSLATE("Debug this thread!"), B_TRANSLATE("Kill this thread!"), B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetShortcut(0, B_ESCAPE); + #define KILL 2 #else snprintf(question, sizeof(question), @@ -306,6 +308,8 @@ ProcessController::MessageReceived(BMessage *message) alert = new BAlert(B_TRANSLATE("Please confirm"), question, B_TRANSLATE("Cancel"), B_TRANSLATE("Kill this thread!"), NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetShortcut(0, B_ESCAPE); + #define KILL 1 #endif alert->SetShortcut(0, B_ESCAPE); @@ -330,7 +334,7 @@ ProcessController::MessageReceived(BMessage *message) B_TRANSLATE("This thread is already gone"B_UTF8_ELLIPSIS), B_TRANSLATE("Ok!"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } } @@ -408,7 +412,7 @@ ProcessController::MessageReceived(BMessage *message) "You can't turn it off!"), B_TRANSLATE("That's no Fun!"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } else _kern_set_cpu_enabled(cpu, !_kern_cpu_enabled(cpu)); @@ -893,6 +897,7 @@ thread_debug_thread(void *arg) alert = new BAlert("", "The semaphore wasn't released, " "because it wasn't necessary anymore!", "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } } diff --git a/src/apps/pulse/CPUButton.cpp b/src/apps/pulse/CPUButton.cpp index 2d18eedd6c..3852a85f45 100644 --- a/src/apps/pulse/CPUButton.cpp +++ b/src/apps/pulse/CPUButton.cpp @@ -243,7 +243,7 @@ CPUButton::Invoke(BMessage *message) BAlert *alert = new BAlert(B_TRANSLATE("Info"), B_TRANSLATE("You can't disable the last active CPU."), B_TRANSLATE("OK")); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); SetValue(!Value()); } diff --git a/src/apps/pulse/DeskbarPulseView.cpp b/src/apps/pulse/DeskbarPulseView.cpp index 802f7bb757..959c49daca 100644 --- a/src/apps/pulse/DeskbarPulseView.cpp +++ b/src/apps/pulse/DeskbarPulseView.cpp @@ -182,7 +182,7 @@ void DeskbarPulseView::Remove() { str.UnlockBuffer(); BAlert *alert = new BAlert(B_TRANSLATE("Info"), str.String(), B_TRANSLATE("OK")); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } delete deskbar; diff --git a/src/apps/pulse/PulseApp.cpp b/src/apps/pulse/PulseApp.cpp index 9006f2fbb3..659762c2ba 100644 --- a/src/apps/pulse/PulseApp.cpp +++ b/src/apps/pulse/PulseApp.cpp @@ -193,7 +193,7 @@ PulseApp::ShowAbout(bool asApplication) font.SetSize(18); font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, name.Length(), &font); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); // Use the asynchronous version so we don't block the window's thread alert->Go(NULL); } @@ -278,7 +278,7 @@ LoadInDeskbar() message.UnlockBuffer(); BAlert *alert = new BAlert(B_TRANSLATE("Error"), message.String(), B_TRANSLATE("OK")); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); return false; } diff --git a/src/apps/pulse/PulseView.cpp b/src/apps/pulse/PulseView.cpp index d14037a1c6..bc5969a0af 100644 --- a/src/apps/pulse/PulseView.cpp +++ b/src/apps/pulse/PulseView.cpp @@ -130,7 +130,7 @@ void PulseView::ChangeCPUState(BMessage *message) { BAlert *alert = new BAlert(B_TRANSLATE("Info"), B_TRANSLATE("You can't disable the last active CPU."), B_TRANSLATE("OK")); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } } diff --git a/src/apps/resedit/BitmapView.cpp b/src/apps/resedit/BitmapView.cpp index 57e928bc96..007fc60459 100644 --- a/src/apps/resedit/BitmapView.cpp +++ b/src/apps/resedit/BitmapView.cpp @@ -250,8 +250,9 @@ BitmapView::MessageReceived(BMessage *msg) switch (msg->what) { case M_REMOVE_IMAGE: { - BAlert *alert = new BAlert("Mr. Peeps!", "This cannot be undone. Remove the image?", - "Remove", "Cancel"); + BAlert *alert = new BAlert("Mr. Peeps!", "This cannot be undone. " + "Remove the image?", "Remove", "Cancel"); + alert->SetShortcut(1, B_ESCAPE); int32 value = alert->Go(); if (value == 0) { SetBitmap(NULL); diff --git a/src/apps/resedit/ResWindow.cpp b/src/apps/resedit/ResWindow.cpp index f306837293..4f5fea524a 100644 --- a/src/apps/resedit/ResWindow.cpp +++ b/src/apps/resedit/ResWindow.cpp @@ -34,7 +34,10 @@ 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 your changes?", "Cancel", + "Don't Save", "Save"); + alert->SetShortcut(0, B_ESCAPE); + switch (alert->Go()) { case 0: return false; diff --git a/src/apps/screenshot/ScreenshotWindow.cpp b/src/apps/screenshot/ScreenshotWindow.cpp index f3bee39381..4bca590da6 100644 --- a/src/apps/screenshot/ScreenshotWindow.cpp +++ b/src/apps/screenshot/ScreenshotWindow.cpp @@ -669,6 +669,7 @@ ScreenshotWindow::_ShowSettings(bool activate) &rect); if (err < B_OK || view == NULL) { BAlert *alert = new BAlert(NULL, strerror(err), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } else { if (fSettingsWindow) { diff --git a/src/apps/showimage/ShowImageView.cpp b/src/apps/showimage/ShowImageView.cpp index 86b3ee4c8a..e6d9a70ace 100644 --- a/src/apps/showimage/ShowImageView.cpp +++ b/src/apps/showimage/ShowImageView.cpp @@ -953,6 +953,7 @@ ShowImageView::SaveToFile(BDirectory* dir, const char* name, BBitmap* bitmap, snprintf(buffer, sizeof(buffer), B_TRANSLATE("The file '%s' could not " "be written."), name); BAlert* palert = new BAlert("", buffer, B_TRANSLATE("OK")); + palert->SetFlags(palert->Flags() | B_CLOSE_ON_ESCAPE); palert->Go(); } diff --git a/src/apps/showimage/ShowImageWindow.cpp b/src/apps/showimage/ShowImageWindow.cpp index 6aa6e9f613..22144762b3 100644 --- a/src/apps/showimage/ShowImageWindow.cpp +++ b/src/apps/showimage/ShowImageWindow.cpp @@ -1108,6 +1108,7 @@ ShowImageWindow::_LoadError(const entry_ref& ref) "LoadAlerts"), B_TRANSLATE_CONTEXT("OK", "Alerts"), NULL, NULL, B_WIDTH_AS_USUAL, B_INFO_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } @@ -1216,6 +1217,8 @@ ShowImageWindow::_ClosePrompt() BAlert* alert = new BAlert(B_TRANSLATE("Close document"), prompt.String(), B_TRANSLATE("Cancel"), B_TRANSLATE("Close")); + alert->SetShortcut(0, B_ESCAPE); + if (alert->Go() == 0) { // Cancel return false; diff --git a/src/apps/soundrecorder/RecorderWindow.cpp b/src/apps/soundrecorder/RecorderWindow.cpp index 11b5a92997..49a182b299 100644 --- a/src/apps/soundrecorder/RecorderWindow.cpp +++ b/src/apps/soundrecorder/RecorderWindow.cpp @@ -1175,7 +1175,9 @@ RecorderWindow::ErrorAlert(const char * action, status_t err) sprintf(msg, "%s: %s. [%lx]", action, strerror(err), (int32) err); else sprintf(msg, "%s.", action); - (new BAlert("", msg, B_TRANSLATE("Stop")))->Go(); + BAlert* alert = new BAlert("", msg, B_TRANSLATE("Stop")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } @@ -1334,15 +1336,20 @@ RecorderWindow::RefsReceived(BMessage *msg) } if (countBad > 0 && countGood == 0) { - (new BAlert(B_TRANSLATE("Nothing to play"), B_TRANSLATE("None of the " - "files appear to be audio files"), B_TRANSLATE("OK"), NULL, NULL, - B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); + BAlert* alert = new BAlert(B_TRANSLATE("Nothing to play"), + B_TRANSLATE("None of the files appear to be audio files"), + B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } else if (countGood > 0) { - if (countBad > 0) - (new BAlert(B_TRANSLATE("Invalid audio files"), B_TRANSLATE("Some " - "of the files don't appear to be audio files"), + if (countBad > 0) { + BAlert* alert = new BAlert(B_TRANSLATE("Invalid audio files"), + B_TRANSLATE("Some of the files don't appear to be audio files"), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, - B_WARNING_ALERT))->Go(); + B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); + } fSoundList->Select(fSoundList->CountItems() - 1); } } diff --git a/src/apps/stylededit/StyledEditWindow.cpp b/src/apps/stylededit/StyledEditWindow.cpp index 0601b0bdec..0789d3a754 100644 --- a/src/apps/stylededit/StyledEditWindow.cpp +++ b/src/apps/stylededit/StyledEditWindow.cpp @@ -1640,7 +1640,8 @@ StyledEditWindow::_ShowStatistics() BAlert* alert = new BAlert("Statistics", result, B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_INFO_ALERT); - + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + return alert->Go(); } diff --git a/src/apps/sudoku/SudokuWindow.cpp b/src/apps/sudoku/SudokuWindow.cpp index 9a7f9a713f..135568b12a 100644 --- a/src/apps/sudoku/SudokuWindow.cpp +++ b/src/apps/sudoku/SudokuWindow.cpp @@ -411,9 +411,11 @@ SudokuWindow::_MessageDropped(BMessage* message) strerror(status)); } - (new BAlert(B_TRANSLATE("Sudoku request"), + BAlert* alert = new BAlert(B_TRANSLATE("Sudoku request"), buffer, B_TRANSLATE("OK"), NULL, NULL, - B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); + B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } } @@ -554,11 +556,15 @@ SudokuWindow::MessageReceived(BMessage* message) } case kMsgSudokuSolved: - (new BAlert(B_TRANSLATE("Sudoku request"), + { + BAlert* alert = new BAlert(B_TRANSLATE("Sudoku request"), B_TRANSLATE("Sudoku solved - congratulations!\n"), B_TRANSLATE("OK"), NULL, NULL, - B_WIDTH_AS_USUAL, B_IDEA_ALERT))->Go(); + B_WIDTH_AS_USUAL, B_IDEA_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); break; + } case B_OBSERVER_NOTICE_CHANGE: { diff --git a/src/apps/terminal/TermApp.cpp b/src/apps/terminal/TermApp.cpp index 20436f2215..1f8cfb62cd 100644 --- a/src/apps/terminal/TermApp.cpp +++ b/src/apps/terminal/TermApp.cpp @@ -104,7 +104,7 @@ TermApp::ReadyToRun() B_TRANSLATE("Terminal couldn't start the shell. Sorry."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_FROM_LABEL, B_INFO_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); PostMessage(B_QUIT_REQUESTED); return; diff --git a/src/apps/terminal/TermWindow.cpp b/src/apps/terminal/TermWindow.cpp index be789f1fa3..8b1a2cecd4 100644 --- a/src/apps/terminal/TermWindow.cpp +++ b/src/apps/terminal/TermWindow.cpp @@ -711,7 +711,7 @@ TermWindow::MessageReceived(BMessage *message) BAlert* alert = new BAlert(B_TRANSLATE("Find failed"), errorMsg, B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); fFindPreviousMenuItem->SetEnabled(false); @@ -729,7 +729,7 @@ TermWindow::MessageReceived(BMessage *message) B_TRANSLATE("Text not found."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); fFindPreviousMenuItem->SetEnabled(false); fFindNextMenuItem->SetEnabled(false); @@ -751,7 +751,7 @@ TermWindow::MessageReceived(BMessage *message) BAlert* alert = new BAlert(B_TRANSLATE("Find failed"), B_TRANSLATE("Not found."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } break; diff --git a/src/apps/text_search/GrepWindow.cpp b/src/apps/text_search/GrepWindow.cpp index 928bd69501..bb6fc836fc 100644 --- a/src/apps/text_search/GrepWindow.cpp +++ b/src/apps/text_search/GrepWindow.cpp @@ -1290,6 +1290,7 @@ GrepWindow::_OnTrimSelection() text << "\n"; BAlert* alert = new BAlert(NULL, text.String(), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); return; } @@ -1382,6 +1383,7 @@ GrepWindow::_OnSelectInTracker() B_TRANSLATE("Please select the files you wish to have selected for you in " "Tracker."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); return; } @@ -1446,6 +1448,7 @@ GrepWindow::_OnSelectInTracker() str1.ReplaceFirst("%APP_NAME",APP_NAME); BAlert* alert = new BAlert(NULL, str1.String(), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); goto out; } diff --git a/src/apps/tv/MainWin.cpp b/src/apps/tv/MainWin.cpp index 63db99e696..e3283a9bdc 100644 --- a/src/apps/tv/MainWin.cpp +++ b/src/apps/tv/MainWin.cpp @@ -375,7 +375,9 @@ MainWin::SelectInterface(int i) BString s; s << B_TRANSLATE("Error, interface is busy:\n\n"); s << gDeviceRoster->DeviceName(i); - (new BAlert("error", s.String(), B_TRANSLATE("OK")))->Go(); + BAlert* alert = new BAlert("error", s.String(), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return; } @@ -384,7 +386,9 @@ MainWin::SelectInterface(int i) BString s; s << B_TRANSLATE("Error, connecting to interface failed:\n\n"); s << gDeviceRoster->DeviceName(i); - (new BAlert("error", s.String(), B_TRANSLATE("OK")))->Go(); + BAlert* alert = new BAlert("error", s.String(), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } done: diff --git a/src/apps/webpositive/BrowserApp.cpp b/src/apps/webpositive/BrowserApp.cpp index c4291675ff..02616b8bba 100644 --- a/src/apps/webpositive/BrowserApp.cpp +++ b/src/apps/webpositive/BrowserApp.cpp @@ -103,6 +103,7 @@ BrowserApp::AboutRequested() BAlert* alert = new BAlert("About WebPositive", aboutText.String(), "Sweet!"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } diff --git a/src/apps/webpositive/BrowserWindow.cpp b/src/apps/webpositive/BrowserWindow.cpp index 92bd86b8e9..3e4da40d18 100644 --- a/src/apps/webpositive/BrowserWindow.cpp +++ b/src/apps/webpositive/BrowserWindow.cpp @@ -680,6 +680,8 @@ BrowserWindow::MessageReceived(BMessage* message) B_TRANSLATE("Do you really want to " "clear the browsing history?"), B_TRANSLATE("Clear"), B_TRANSLATE("Cancel")); + alert->SetShortcut(1, B_ESCAPE); + if (alert->Go() == 0) history->Clear(); break; @@ -732,6 +734,7 @@ BrowserWindow::MessageReceived(BMessage* message) BAlert* alert = new BAlert(B_TRANSLATE("Open bookmarks confirmation"), string.String(), B_TRANSLATE("Cancel"), B_TRANSLATE("Open all")); + alert->SetShortcut(0, B_ESCAPE); if (alert->Go() == 0) break; } @@ -1586,6 +1589,7 @@ BrowserWindow::_CreateBookmark() BAlert* alert = new BAlert(B_TRANSLATE("Bookmark error"), message.String(), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return; } @@ -1615,6 +1619,7 @@ BrowserWindow::_CreateBookmark() message.ReplaceFirst("%bookmarkName", bookmarkName); BAlert* alert = new BAlert(B_TRANSLATE("Bookmark info"), message.String(), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return; } @@ -1709,6 +1714,7 @@ BrowserWindow::_CreateBookmark() BAlert* alert = new BAlert(B_TRANSLATE("Bookmark error"), message.String(), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return; } @@ -1734,6 +1740,7 @@ BrowserWindow::_ShowBookmarks() BAlert* alert = new BAlert(B_TRANSLATE("Bookmark error"), message.String(), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return; } @@ -2226,6 +2233,7 @@ BrowserWindow::_HandlePageSourceResult(const BMessage* message) "page source: %s\n", strerror(ret)); BAlert* alert = new BAlert(B_TRANSLATE("Page source error"), buffer, B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } } diff --git a/src/apps/webpositive/DownloadProgressView.cpp b/src/apps/webpositive/DownloadProgressView.cpp index 16c0ff103d..8bdbd69322 100644 --- a/src/apps/webpositive/DownloadProgressView.cpp +++ b/src/apps/webpositive/DownloadProgressView.cpp @@ -412,6 +412,7 @@ DownloadProgressView::MessageReceived(BMessage* message) BAlert* alert = new BAlert(B_TRANSLATE("Open download error"), B_TRANSLATE("The download could not be opened."), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } break; diff --git a/src/apps/webpositive/DownloadWindow.cpp b/src/apps/webpositive/DownloadWindow.cpp index 72c7663697..dee9867602 100644 --- a/src/apps/webpositive/DownloadWindow.cpp +++ b/src/apps/webpositive/DownloadWindow.cpp @@ -286,6 +286,7 @@ DownloadWindow::MessageReceived(BMessage* message) errorString.ReplaceFirst("%error", strerror(status)); BAlert* alert = new BAlert(B_TRANSLATE("Error opening downloads " "folder"), errorString.String(), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } break; diff --git a/src/apps/webwatch/WatchView.cpp b/src/apps/webwatch/WatchView.cpp index 99d889cef6..3488baecc4 100644 --- a/src/apps/webwatch/WatchView.cpp +++ b/src/apps/webwatch/WatchView.cpp @@ -159,7 +159,9 @@ void WatchView::OnAboutRequested() "mahlzeit@users.sourceforge.net\n\n" "Thanks to Jason Parks for his help.\n"); text.ReplaceFirst("%1", VERSION); - (new BAlert(NULL, text.String(), B_TRANSLATE("OK")))->Go(NULL); + BAlert* alert = new BAlert(NULL, text.String(), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(NULL); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/apps/workspaces/Workspaces.cpp b/src/apps/workspaces/Workspaces.cpp index 9ca9071754..0c3ea0fc75 100644 --- a/src/apps/workspaces/Workspaces.cpp +++ b/src/apps/workspaces/Workspaces.cpp @@ -420,6 +420,7 @@ WorkspacesView::_AboutRequested() font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, 10, &font); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } diff --git a/src/bin/checkitout.cpp b/src/bin/checkitout.cpp index 9de9bb7308..c068706b36 100644 --- a/src/bin/checkitout.cpp +++ b/src/bin/checkitout.cpp @@ -57,6 +57,7 @@ CheckItOut::_Warn(const char* url) message << "Proceed anyway?"; BAlert* alert = new BAlert("Warning", message.String(), "Proceed", "Stop", NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetShortcut(1, B_ESCAPE); int32 button; button = alert->Go(); if (button == 0) diff --git a/src/bin/desklink/MediaReplicant.cpp b/src/bin/desklink/MediaReplicant.cpp index f9a379accc..e408e25b85 100644 --- a/src/bin/desklink/MediaReplicant.cpp +++ b/src/bin/desklink/MediaReplicant.cpp @@ -390,8 +390,10 @@ MediaReplicant::_Launch(const char* prettyName, const char* signature, BString message = B_TRANSLATE("Couldn't launch "); message << prettyName; - (new BAlert(B_TRANSLATE("desklink"), message.String(), - B_TRANSLATE("OK")))->Go(); + BAlert* alert = new BAlert(B_TRANSLATE("desklink"), message.String(), + B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } } diff --git a/src/bin/mail_utils/spamdbm.cpp b/src/bin/mail_utils/spamdbm.cpp index ebe549b2f6..f483d06ca0 100644 --- a/src/bin/mail_utils/spamdbm.cpp +++ b/src/bin/mail_utils/spamdbm.cpp @@ -1503,8 +1503,10 @@ DisplayErrorMessage ( { AlertPntr = new BAlert (TitleString, MessageString, "Acknowledge", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); - if (AlertPntr != NULL) + if (AlertPntr != NULL) { + AlertPntr->SetFlags(AlertPntr->Flags() | B_CLOSE_ON_ESCAPE); AlertPntr->Go (); + } } } @@ -1839,8 +1841,10 @@ EstimateRefFilesAndDisplay (BMessage *MessagePntr) g_MaxInterestingWords - j); AlertPntr = new BAlert ("Estimate", TempString, "OK"); - if (AlertPntr != NULL) + if (AlertPntr != NULL) { + AlertPntr->SetFlags(AlertPntr->Flags() | B_CLOSE_ON_ESCAPE); AlertPntr->Go (); + } } } @@ -2533,7 +2537,7 @@ uses to extract words from messages. In particular, HTML is now handled.\n\n" "Compiled on " __DATE__ " at " __TIME__ ".", "Done"); if (AboutAlertPntr != NULL) { - AboutAlertPntr->SetShortcut (0, B_ESCAPE); + AboutAlertPntr->SetFlags(AboutAlertPntr->Flags() | B_CLOSE_ON_ESCAPE); AboutAlertPntr->Go (); } } diff --git a/src/bin/screenmode/screenmode.cpp b/src/bin/screenmode/screenmode.cpp index 512ac32996..f3127a18fa 100644 --- a/src/bin/screenmode/screenmode.cpp +++ b/src/bin/screenmode/screenmode.cpp @@ -335,6 +335,7 @@ main(int argc, char** argv) BAlert* alert = new BAlert("screenmode", "You have used the shortcut to reset the " "screen mode to a safe fallback.", "Keep", "Revert"); + alert->SetShortcut(1, B_ESCAPE); if (alert->Go() == 1) screenMode.Revert(); } diff --git a/src/bin/urlwrapper.cpp b/src/bin/urlwrapper.cpp index 6c610e99d5..57f9806d7f 100644 --- a/src/bin/urlwrapper.cpp +++ b/src/bin/urlwrapper.cpp @@ -58,6 +58,7 @@ UrlWrapper::_Warn(const char* url) message << "Proceed anyway?"; BAlert* alert = new BAlert("Warning", message.String(), "Proceed", "Stop", NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetShortcut(1, B_ESCAPE); int32 button; button = alert->Go(); if (button == 0) diff --git a/src/kits/app/Application.cpp b/src/kits/app/Application.cpp index 4d68d63422..386e7e50c8 100644 --- a/src/kits/app/Application.cpp +++ b/src/kits/app/Application.cpp @@ -649,6 +649,7 @@ BApplication::AboutRequested() thread_info info; if (get_thread_info(Thread(), &info) == B_OK) { BAlert *alert = new BAlert("_about_", info.name, "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } } diff --git a/src/kits/interface/Dragger.cpp b/src/kits/interface/Dragger.cpp index 37f92d68db..a61e552e66 100644 --- a/src/kits/interface/Dragger.cpp +++ b/src/kits/interface/Dragger.cpp @@ -303,11 +303,13 @@ BDragger::MessageReceived(BMessage* msg) if (fShelf != NULL) Window()->PostMessage(kDeleteReplicant, fTarget, NULL); else { - (new BAlert(B_TRANSLATE("Warning"), + BAlert* alert = new BAlert(B_TRANSLATE("Warning"), B_TRANSLATE("Can't delete this replicant from its original " "application. Life goes on."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_FROM_WIDEST, - B_WARNING_ALERT))->Go(NULL); + B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(NULL); } break; diff --git a/src/kits/interface/PrintJob.cpp b/src/kits/interface/PrintJob.cpp index d21f27fa09..e037fc9862 100644 --- a/src/kits/interface/PrintJob.cpp +++ b/src/kits/interface/PrintJob.cpp @@ -103,6 +103,7 @@ static void ShowError(const char* message) { BAlert* alert = new BAlert(B_TRANSLATE("Error"), message, B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } @@ -748,6 +749,7 @@ PrintServerMessenger::RejectUserInput() fHiddenApplicationModalWindow = new BAlert("bogus", "app_modal", "OK"); fHiddenApplicationModalWindow->DefaultButton()->SetEnabled(false); fHiddenApplicationModalWindow->SetDefaultButton(NULL); + fHiddenApplicationModalWindow->SetFlags(fHiddenApplicationModalWindow->Flags() | B_CLOSE_ON_ESCAPE); fHiddenApplicationModalWindow->MoveTo(-65000, -65000); fHiddenApplicationModalWindow->Go(NULL); } diff --git a/src/kits/interface/ZombieReplicantView.cpp b/src/kits/interface/ZombieReplicantView.cpp index 400a2db953..4e46884156 100644 --- a/src/kits/interface/ZombieReplicantView.cpp +++ b/src/kits/interface/ZombieReplicantView.cpp @@ -70,6 +70,7 @@ _BZombieReplicantView_::MessageReceived(BMessage* msg) BAlert* alert = new (std::nothrow) BAlert(B_TRANSLATE("Error"), error.String(), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); if (alert != NULL) alert->Go(); diff --git a/src/kits/shared/AboutWindow.cpp b/src/kits/shared/AboutWindow.cpp index c5dd25501e..07930ecc3d 100644 --- a/src/kits/shared/AboutWindow.cpp +++ b/src/kits/shared/AboutWindow.cpp @@ -88,6 +88,7 @@ BAboutWindow::Show() font.SetFace(B_BOLD_FACE); font.SetSize(font.Size() * 1.7); view->SetFontAndColor(0, fAppName->Length(), &font); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } diff --git a/src/kits/tracker/AutoMounterSettings.cpp b/src/kits/tracker/AutoMounterSettings.cpp index da9fed63d8..9b01563a11 100644 --- a/src/kits/tracker/AutoMounterSettings.cpp +++ b/src/kits/tracker/AutoMounterSettings.cpp @@ -335,10 +335,12 @@ AutomountSettingsDialog::RunAutomountSettings(const BMessenger& target) BMessage reply; status_t ret = target.SendMessage(&message, &reply, 2500000); if (ret != B_OK) { - (new BAlert(B_TRANSLATE("Mount server error"), + BAlert* alert = new BAlert(B_TRANSLATE("Mount server error"), B_TRANSLATE("The mount server could not be contacted."), B_TRANSLATE("OK"), - NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); + NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return; } diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp index 33ec87306f..fe161831e0 100644 --- a/src/kits/tracker/ContainerWindow.cpp +++ b/src/kits/tracker/ContainerWindow.cpp @@ -286,7 +286,7 @@ AddOnThread(BMessage* refsMessage, entry_ref addonRef, entry_ref dirRef) BAlert* alert = new BAlert("", buffer.String(), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return result; @@ -3213,7 +3213,7 @@ BContainerWindow::LoadAddOn(BMessage* message) BAlert* alert = new BAlert("", buffer.String(), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return; } diff --git a/src/kits/tracker/FSClipboard.cpp b/src/kits/tracker/FSClipboard.cpp index f250aa884a..00958c4e0d 100644 --- a/src/kits/tracker/FSClipboard.cpp +++ b/src/kits/tracker/FSClipboard.cpp @@ -479,7 +479,7 @@ FSClipboardPaste(Model* model, uint32 linksMode) B_TRANSLATE("You must drop items on one of the disk icons " "in the \"Disks\" window."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); okToMove = false; } @@ -493,7 +493,7 @@ FSClipboardPaste(Model* model, uint32 linksMode) B_TRANSLATE("Sorry, you can't copy items to the Trash."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); okToMove = false; } diff --git a/src/kits/tracker/FSUtils.cpp b/src/kits/tracker/FSUtils.cpp index 2e462e1ac7..021825dd24 100644 --- a/src/kits/tracker/FSUtils.cpp +++ b/src/kits/tracker/FSUtils.cpp @@ -357,7 +357,7 @@ TrackerCopyLoopControl::FileError(const char* message, const char* name, BAlert* alert = new BAlert("", buffer.String(), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_STOP_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; } @@ -736,7 +736,7 @@ InitCopy(CopyLoopControl* loopControl, uint32 moveMode, BAlert* alert = new BAlert("", B_TRANSLATE("You can't move or copy items to read-only volumes."), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return B_ERROR; } @@ -762,7 +762,7 @@ InitCopy(CopyLoopControl* loopControl, uint32 moveMode, BAlert* alert = new BAlert("", errorStr.String(), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return B_ERROR; } @@ -820,7 +820,7 @@ InitCopy(CopyLoopControl* loopControl, uint32 moveMode, B_TRANSLATE_NOCOLLECT(kNoFreeSpace), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return B_ERROR; } @@ -993,7 +993,7 @@ MoveTask(BObjectList* srcList, BEntry* destEntry, BList* pointList, BAlert* alert = new BAlert("", error.String(), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); break; } @@ -1012,7 +1012,7 @@ MoveTask(BObjectList* srcList, BEntry* destEntry, BList* pointList, BAlert* alert = new BAlert("", error.String(), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); break; } @@ -1742,8 +1742,10 @@ MoveItem(BEntry* entry, BDirectory* destDir, BPoint* loc, uint32 moveMode, } catch (MoveError error) { BString errorString(B_TRANSLATE("Error moving \"%name\"")); errorString.ReplaceFirst("%name", ref.name); - (new BAlert("", errorString.String(), B_TRANSLATE("OK"), 0, 0, - B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); + BAlert* alert = new BAlert("", errorString.String(), B_TRANSLATE("OK"), + 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return error.fError; } catch (FailWithAlert error) { BString buffer(error.fString); @@ -1751,8 +1753,10 @@ MoveItem(BEntry* entry, BDirectory* destDir, BPoint* loc, uint32 moveMode, buffer.ReplaceFirst("%name", error.fName); else buffer << error.fString; - (new BAlert("", buffer.String(), B_TRANSLATE("OK"), 0, 0, - B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); + BAlert* alert = new BAlert("", buffer.String(), B_TRANSLATE("OK"), + 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return error.fError; } @@ -1890,7 +1894,7 @@ MoveEntryToTrash(BEntry* entry, BPoint* loc, Undo &undo) BAlert* alert = new BAlert("", buffer.String(), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } else { BMessage message(kUnmountVolume); @@ -1910,11 +1914,13 @@ MoveEntryToTrash(BEntry* entry, BPoint* loc, Undo &undo) trash_dir.GetEntry(&trashEntry); if (dir == trash_dir || dir.Contains(&trashEntry)) { - (new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("You cannot put the Trash, home or Desktop " "directory into the trash."), B_TRANSLATE("OK"), - 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); + 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); // return no error so we don't get two dialogs return B_OK; @@ -2062,20 +2068,24 @@ CheckName(uint32 moveMode, const BEntry* sourceEntry, && moveMode != kCreateRelativeLink && (srcDirectory == *destDir || srcDirectory.Contains(&destEntry))) { - (new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("You can't move a folder into itself " "or any of its own sub-folders."), B_TRANSLATE("OK"), - 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); + 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return B_ERROR; } } if (FSIsTrashDir(sourceEntry) && moveMode != kCreateLink && moveMode != kCreateRelativeLink) { - (new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("You can't move or copy the trash."), B_TRANSLATE("OK"), 0, 0, B_WIDTH_AS_USUAL, - B_WARNING_ALERT))->Go(); + B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return B_ERROR; } @@ -2098,11 +2108,12 @@ CheckName(uint32 moveMode, const BEntry* sourceEntry, if (destIsDir) { BDirectory test_dir(&entry); if (test_dir.Contains(sourceEntry)) { - (new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("You can't replace a folder " "with one of its sub-folders."), - B_TRANSLATE("OK"), - 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); + B_TRANSLATE("OK"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return B_ERROR; } } @@ -2112,12 +2123,14 @@ CheckName(uint32 moveMode, const BEntry* sourceEntry, if (moveMode != kCreateLink && moveMode != kCreateRelativeLink && destIsDir != sourceIsDirectory) { - (new BAlert("", sourceIsDirectory + BAlert* alert = new BAlert("", sourceIsDirectory ? B_TRANSLATE("You cannot replace a file with a folder or a " "symbolic link.") : B_TRANSLATE("You cannot replace a folder or a symbolic link " "with a file."), B_TRANSLATE("OK"), 0, 0, B_WIDTH_AS_USUAL, - B_WARNING_ALERT))->Go(); + B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return B_ERROR; } @@ -2196,7 +2209,7 @@ CheckName(uint32 moveMode, const BEntry* sourceEntry, error.ReplaceFirst("%name", name);; BAlert* alert = new BAlert("", error.String(), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } @@ -2815,9 +2828,10 @@ empty_trash(void*) } if (err != B_OK && err != kTrashCanceled && err != kUserCanceled) { - (new BAlert("", B_TRANSLATE("Error emptying Trash"), - B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, - B_WARNING_ALERT))->Go(); + BAlert* alert = new BAlert("", B_TRANSLATE("Error emptying Trash"), + B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } return B_OK; @@ -2887,10 +2901,12 @@ _DeleteTask(BObjectList* list, bool confirm) err = entry.Remove(); } - if (err != kTrashCanceled && err != kUserCanceled && err != B_OK) - (new BAlert("", B_TRANSLATE("Error deleting items"), - B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, - B_WARNING_ALERT))->Go(); + if (err != kTrashCanceled && err != kUserCanceled && err != B_OK) { + BAlert* alert = new BAlert("", B_TRANSLATE("Error deleting items"), + B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); + } } delete list; @@ -3081,7 +3097,7 @@ FSCreateNewFolderIn(const node_ref* dirNode, entry_ref* newRef, BAlert* alert = new BAlert("", B_TRANSLATE("Sorry, could not create a new folder."), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return result; } @@ -3254,7 +3270,7 @@ _TrackerLaunchAppWithDocuments(const entry_ref* appRef, const BMessage* refs, BAlert* alert = new BAlert("", alertString.String(), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } } @@ -3557,7 +3573,7 @@ _TrackerLaunchDocuments(const entry_ref* /*doNotUse*/, const BMessage* refs, BAlert* alert = new BAlert("", alertString.String(), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } } diff --git a/src/kits/tracker/InfoWindow.cpp b/src/kits/tracker/InfoWindow.cpp index 15138419c0..7fd11debd1 100644 --- a/src/kits/tracker/InfoWindow.cpp +++ b/src/kits/tracker/InfoWindow.cpp @@ -1985,11 +1985,13 @@ AttributeView::FinishEditingTitle(bool commit) if (entry.InitCheck() == B_OK && entry.GetParent(&parent) == B_OK) { if (parent.Contains(text)) { - (new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("That name is already taken. " "Please type another one."), B_TRANSLATE("OK"), - 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); + 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); reopen = true; } else { if (fModel->IsVolume()) { @@ -2009,11 +2011,12 @@ AttributeView::FinishEditingTitle(bool commit) } } } else if (length >= B_FILE_NAME_LENGTH) { - (new BAlert("", - B_TRANSLATE("That name is too long. " - "Please type another one."), + BAlert* alert = new BAlert("", + B_TRANSLATE("That name is too long. Please type another one."), B_TRANSLATE("OK"), - 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); + 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); reopen = true; } diff --git a/src/kits/tracker/OpenWithWindow.cpp b/src/kits/tracker/OpenWithWindow.cpp index 7d5456dcb6..f14f59999e 100644 --- a/src/kits/tracker/OpenWithWindow.cpp +++ b/src/kits/tracker/OpenWithWindow.cpp @@ -672,8 +672,10 @@ OpenWithPoseView::OpenSelection(BPose* pose, int32*) B_TRANSLATE("Could not find application \"%appname\"")); errorString.ReplaceFirst("%appname", pose->TargetModel()->Name()); - (new BAlert("", errorString.String(), B_TRANSLATE("OK"), 0, 0, - B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); + BAlert* alert = new BAlert("", errorString.String(), B_TRANSLATE("OK"), + 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return; } diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index 7430bff230..7a8562f2c4 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -2609,7 +2609,7 @@ BPoseView::RemoveColumn(BColumn* columnToRemove, bool runAlert) BAlert* alert = new BAlert("", B_TRANSLATE("You must have at least one attribute showing."), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } @@ -4832,7 +4832,7 @@ BPoseView::MoveSelectionInto(Model* destFolder, BContainerWindow* srcWindow, B_TRANSLATE("You must drop items on one of the disk icons " "in the \"Disks\" window."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); okToMove = false; } @@ -4843,7 +4843,7 @@ BPoseView::MoveSelectionInto(Model* destFolder, BContainerWindow* srcWindow, B_TRANSLATE("Sorry, you can't copy items to the Trash."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); okToMove = false; } @@ -4854,7 +4854,7 @@ BPoseView::MoveSelectionInto(Model* destFolder, BContainerWindow* srcWindow, B_TRANSLATE("Sorry, you can't create links in the Trash."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); okToMove = false; } @@ -5744,7 +5744,7 @@ CheckVolumeReadOnly(const entry_ref* ref) B_TRANSLATE("Files cannot be moved or deleted from a read-only " "volume."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; } @@ -6084,8 +6084,10 @@ BPoseView::SelectMatchingEntries(const BMessage* message) BString message( B_TRANSLATE("Error in regular expression:\n\n'%errstring'")); message.ReplaceFirst("%errstring", regExpression.ErrorString()); - (new BAlert("", message.String(), B_TRANSLATE("OK"), NULL, NULL, - B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); + BAlert* alert = new BAlert("", message.String(), B_TRANSLATE("OK"), + NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return 0; } } @@ -8076,7 +8078,7 @@ BPoseView::OpenInfoWindows() B_TRANSLATE("The Tracker must be running to see Info windows."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return; } @@ -8093,7 +8095,7 @@ BPoseView::SetDefaultPrinter() B_TRANSLATE("The Tracker must be running to see set the default " "printer."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return; } diff --git a/src/kits/tracker/Tracker.cpp b/src/kits/tracker/Tracker.cpp index bf44a53b39..38e96e03d7 100644 --- a/src/kits/tracker/Tracker.cpp +++ b/src/kits/tracker/Tracker.cpp @@ -704,7 +704,7 @@ TTracker::OpenRef(const entry_ref* ref, const node_ref* nodeToClose, B_TRANSLATE("There was an error resolving the link."), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return result; } diff --git a/src/kits/tracker/TrackerInitialState.cpp b/src/kits/tracker/TrackerInitialState.cpp index 7bc3c893e8..f4e1c1847d 100644 --- a/src/kits/tracker/TrackerInitialState.cpp +++ b/src/kits/tracker/TrackerInitialState.cpp @@ -641,8 +641,10 @@ TTracker::InstallTemporaryBackgroundImages() "failed. \nReason: %error")); errorMessage.ReplaceFirst("%func", __PRETTY_FUNCTION__); errorMessage.ReplaceFirst("%error", strerror(status)); - (new BAlert("AlertError", errorMessage.String(), B_TRANSLATE("OK"), - NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); + BAlert* alert = new BAlert("AlertError", errorMessage.String(), + B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); return; } path.Append("artwork"); diff --git a/src/kits/tracker/WidgetAttributeText.cpp b/src/kits/tracker/WidgetAttributeText.cpp index 3e6c25d32c..deaa71be06 100644 --- a/src/kits/tracker/WidgetAttributeText.cpp +++ b/src/kits/tracker/WidgetAttributeText.cpp @@ -1661,7 +1661,7 @@ GenericAttributeText::CommitEditedTextFlavor(BTextView* textView) B_TRANSLATE("Sorry, you cannot edit that attribute."), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_STOP_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; } @@ -1698,7 +1698,7 @@ GenericAttributeText::CommitEditedTextFlavor(BTextView* textView) "attribute cannot store a multi-byte glyph."), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_STOP_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return false; } @@ -1806,7 +1806,7 @@ GenericAttributeText::CommitEditedTextFlavor(BTextView* textView) B_TRANSLATE("There was an error writing the attribute."), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); fValueIsDefined = false; diff --git a/src/libs/print/libprint/BlockingWindow.cpp b/src/libs/print/libprint/BlockingWindow.cpp index 82cb54620e..dfc4924fde 100644 --- a/src/libs/print/libprint/BlockingWindow.cpp +++ b/src/libs/print/libprint/BlockingWindow.cpp @@ -131,6 +131,7 @@ HWindow::AboutRequested() font.SetSize(12); // font.SetFace(B_OUTLINED_FACE); v->SetFontAndColor(0, s-text+1, &font, B_FONT_SIZE); }; + about->SetFlags(about->Flags() | B_CLOSE_ON_ESCAPE); about->Go(); } diff --git a/src/libs/print/libprint/GraphicsDriver.cpp b/src/libs/print/libprint/GraphicsDriver.cpp index 8340b8a29b..aa6994f95e 100644 --- a/src/libs/print/libprint/GraphicsDriver.cpp +++ b/src/libs/print/libprint/GraphicsDriver.cpp @@ -702,6 +702,7 @@ GraphicsDriver::_PrintJob(BFile* spoolFile) alert = new BAlert("", fTransport->LastError().c_str(), "OK"); else alert = new BAlert("", "Printer not responding.", "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } diff --git a/src/preferences/appearance/CurView.cpp b/src/preferences/appearance/CurView.cpp index f0340060fb..b13021c3d1 100644 --- a/src/preferences/appearance/CurView.cpp +++ b/src/preferences/appearance/CurView.cpp @@ -238,6 +238,7 @@ printf("Loading cursor sets from disk\n"); "Please contact OpenBeOS about Appearance Preferences::CurView::" "LoadCursorSets::B_NAME_TOO_LONG for a bugfix", "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + a->SetFlags(a->Flags() | B_CLOSE_ON_ESCAPE); a->Go(); break; } @@ -267,6 +268,7 @@ printf("Loading cursor sets from disk\n"); "because of a file error. Perhaps there is a file (instead of a folder) at " COLOR_SET_DIR "? You will be able to change system cursors, but be unable to save them to a cursor set. ", "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + a->SetFlags(a->Flags() | B_CLOSE_ON_ESCAPE); a->Go(); break; } @@ -276,6 +278,7 @@ printf("Loading cursor sets from disk\n"); "because there are too many open files. Please close some files and restart " " this application.", "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + a->SetFlags(a->Flags() | B_CLOSE_ON_ESCAPE); a->Go(); if(Window()) Window()->PostMessage(B_QUIT_REQUESTED); diff --git a/src/preferences/appearance/DecorSettingsView.cpp b/src/preferences/appearance/DecorSettingsView.cpp index 86882be123..711c534a7d 100644 --- a/src/preferences/appearance/DecorSettingsView.cpp +++ b/src/preferences/appearance/DecorSettingsView.cpp @@ -120,7 +120,7 @@ DecorSettingsView::MessageReceived(BMessage *msg) BAlert *infoAlert = new BAlert(B_TRANSLATE("About Decorator"), infoText.String(), B_TRANSLATE("OK")); - infoAlert->SetShortcut(0, B_ESCAPE); + infoAlert->SetFlags(infoAlert->Flags() | B_CLOSE_ON_ESCAPE); infoAlert->Go(); break; diff --git a/src/preferences/bluetooth/BluetoothMain.cpp b/src/preferences/bluetooth/BluetoothMain.cpp index c76142f883..0b71630b3f 100644 --- a/src/preferences/bluetooth/BluetoothMain.cpp +++ b/src/preferences/bluetooth/BluetoothMain.cpp @@ -27,13 +27,14 @@ void BluetoothApplication::ReadyToRun() { if (!be_roster->IsRunning(BLUETOOTH_SIGNATURE)) { - - int32 choice = (new BAlert("bluetooth_server not running", + BAlert* alert = new BAlert("bluetooth_server not running", B_TRANSLATE("bluetooth_server has not been found running on the " "system. Should be started, or stay offline"), B_TRANSLATE("Work offline"), B_TRANSLATE("Quit"), B_TRANSLATE("Start please"), B_WIDTH_AS_USUAL, - B_WARNING_ALERT))->Go(); + B_WARNING_ALERT); + alert->SetShortcut(2, B_ESCAPE); + int32 choice = alert->Go(); switch (choice) { @@ -90,8 +91,8 @@ BluetoothApplication::MessageReceived(BMessage* message) void BluetoothApplication::AboutRequested() { - - (new BAlert("about", B_TRANSLATE("Haiku Bluetooth system, (ARCE)\n\n" + BAlert* alert = new BAlert("about", B_TRANSLATE( + "Haiku Bluetooth system, (ARCE)\n\n" "Created by Oliver Ruiz Dorantes\n\n" "With support of:\n" " - Mika Lindqvist\n" @@ -121,8 +122,9 @@ BluetoothApplication::AboutRequested() " - Petter H. Juliussen\n" "Who gave me all the knowledge:\n" " - the yellowTAB team"), - B_TRANSLATE("OK")))->Go(); - + B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } diff --git a/src/preferences/cpufrequency/StatusView.cpp b/src/preferences/cpufrequency/StatusView.cpp index 3d7a651b66..9fc7e819a7 100644 --- a/src/preferences/cpufrequency/StatusView.cpp +++ b/src/preferences/cpufrequency/StatusView.cpp @@ -429,7 +429,7 @@ StatusView::_AboutRequested() BAlert *alert = new BAlert("about", B_TRANSLATE("CPUFrequency\n" "\twritten by Clemens Zeidler\n" "\tCopyright 2009, Haiku, Inc.\n"), - B_TRANSLATE("Ok")); + B_TRANSLATE("OK")); BTextView *view = alert->TextView(); BFont font; @@ -440,6 +440,7 @@ StatusView::_AboutRequested() font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, 13, &font); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } @@ -689,9 +690,10 @@ StatusView::_OpenPreferences() "Launching the CPU frequency preflet failed.\n\nError: ")); errorMessage << strerror(ret); BAlert* alert = new BAlert("launch error", errorMessage.String(), - "Ok"); + "OK"); // asynchronous alert in order to not block replicant host // application + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } } diff --git a/src/preferences/datatranslations/DataTranslations.cpp b/src/preferences/datatranslations/DataTranslations.cpp index 2c9ff0157e..4044a818fa 100644 --- a/src/preferences/datatranslations/DataTranslations.cpp +++ b/src/preferences/datatranslations/DataTranslations.cpp @@ -53,6 +53,7 @@ DataTranslationsApplication::_InstallError(const char* name, status_t status) text.UnlockBuffer(); BAlert* alert = new BAlert(B_TRANSLATE("DataTranslations - Error"), text.String(), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } @@ -83,7 +84,8 @@ DataTranslationsApplication::_NoTranslatorError(const char* name) B_TRANSLATE("The item '%name' does not appear to be a Translator and " "will not be installed.")); text.ReplaceAll("%name", name); - BAlert* alert = new BAlert("", text.String(), B_TRANSLATE("Ok")); + BAlert* alert = new BAlert("", text.String(), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } @@ -152,6 +154,7 @@ DataTranslationsApplication::RefsReceived(BMessage* message) BAlert* alert = new BAlert(B_TRANSLATE("DataTranslations - Note"), B_TRANSLATE("The new translator has been installed " "successfully."), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } else _InstallError(ref.name, status); diff --git a/src/preferences/datatranslations/DataTranslationsWindow.cpp b/src/preferences/datatranslations/DataTranslationsWindow.cpp index 41e8bb326d..7cf78d856a 100644 --- a/src/preferences/datatranslations/DataTranslationsWindow.cpp +++ b/src/preferences/datatranslations/DataTranslationsWindow.cpp @@ -282,6 +282,7 @@ DataTranslationsWindow::_ShowInfoAlert(int32 id) view->SetFontAndColor(index, index + strlen(labels[i]), &font); } + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } diff --git a/src/preferences/dun/DUNWindow.cpp b/src/preferences/dun/DUNWindow.cpp index f8d8f6c81d..f04c533b52 100644 --- a/src/preferences/dun/DUNWindow.cpp +++ b/src/preferences/dun/DUNWindow.cpp @@ -357,7 +357,7 @@ void DUNWindow::MessageReceived (BMessage *message) connectbutton->SetEnabled(false); //debug BAlert *errormsg = new BAlert("errormsg", "The hidden wispy bush\nOver the green flower\nThe sea and connection have stopped.", " Haiku Error ;) " , NULL, NULL, B_WIDTH_FROM_WIDEST, B_IDEA_ALERT); - errormsg->SetShortcut(0, B_ESCAPE); + errormsg->SetFlags(errormsg->Flags() | B_CLOSE_ON_ESCAPE); errormsg->Go(); } break; @@ -367,7 +367,7 @@ void DUNWindow::MessageReceived (BMessage *message) disconnectbutton->SetEnabled(false); connectbutton->SetEnabled(true); BAlert *errormsg = new BAlert("errormsg", "A late long rain\nOver an icy meadow\nBroken connection and dreams.", " Haiku Error ;) ", NULL , NULL, B_WIDTH_FROM_WIDEST, B_IDEA_ALERT); - errormsg->SetShortcut(0, B_ESCAPE); + errormsg->SetFlags(errormsg->Flags() | B_CLOSE_ON_ESCAPE); errormsg->Go(); } break; @@ -376,7 +376,7 @@ void DUNWindow::MessageReceived (BMessage *message) { // debug BAlert *errormsg = new BAlert("errormsg", "Hark! Something is wrong.\nFor this is not what I asked.\n\nMy life is somewhat ... Incomplete.\n", " Haiku Error ;) " , NULL, NULL, B_WIDTH_FROM_WIDEST, B_IDEA_ALERT); - errormsg->SetShortcut(0, B_ESCAPE); + errormsg->SetFlags(errormsg->Flags() | B_CLOSE_ON_ESCAPE); errormsg->Go(); } break; @@ -385,7 +385,7 @@ void DUNWindow::MessageReceived (BMessage *message) { // debug BAlert *errormsg = new BAlert("errormsg", "Lost Clouds.\nDisappear behind the mountains.\n\nFor an eternity must I wait ?\n", " Haiku Error ;) " , NULL, NULL, B_WIDTH_FROM_WIDEST, B_IDEA_ALERT); - errormsg->SetShortcut(0, B_ESCAPE); + errormsg->SetFlags(errormsg->Flags() | B_CLOSE_ON_ESCAPE); errormsg->Go(); } break; diff --git a/src/preferences/filetypes/ApplicationTypeWindow.cpp b/src/preferences/filetypes/ApplicationTypeWindow.cpp index 5ceaaed2c6..77fc74f06d 100644 --- a/src/preferences/filetypes/ApplicationTypeWindow.cpp +++ b/src/preferences/filetypes/ApplicationTypeWindow.cpp @@ -1025,6 +1025,8 @@ ApplicationTypeWindow::QuitRequested() 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); + int32 choice = alert->Go(); switch (choice) { case 0: diff --git a/src/preferences/filetypes/FileTypes.cpp b/src/preferences/filetypes/FileTypes.cpp index 91ec41bc2f..de5e722b22 100644 --- a/src/preferences/filetypes/FileTypes.cpp +++ b/src/preferences/filetypes/FileTypes.cpp @@ -227,9 +227,11 @@ FileTypes::RefsReceived(BMessage* message) "%s"), ref.name, strerror(status)); - (new BAlert(B_TRANSLATE("FileTypes request"), + BAlert* alert = new BAlert(B_TRANSLATE("FileTypes request"), buffer, B_TRANSLATE("OK"), NULL, NULL, - B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); + B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); message->RemoveData("refs", --index); continue; @@ -475,9 +477,11 @@ error_alert(const char* message, status_t status, alert_type type) strerror(status)); } - (new BAlert(B_TRANSLATE("FileTypes request"), + BAlert* alert = new BAlert(B_TRANSLATE("FileTypes request"), status == B_OK ? message : warning, - B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, type))->Go(); + B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, type); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } diff --git a/src/preferences/filetypes/FileTypesWindow.cpp b/src/preferences/filetypes/FileTypesWindow.cpp index 6d8d9defbb..ed2b153be3 100644 --- a/src/preferences/filetypes/FileTypesWindow.cpp +++ b/src/preferences/filetypes/FileTypesWindow.cpp @@ -679,12 +679,14 @@ FileTypesWindow::MessageReceived(BMessage* message) "group, hold down the Shift key and press \"Remove\"."), B_TRANSLATE("Remove"), B_SHIFT_KEY, B_TRANSLATE("Cancel"), 0, NULL, 0, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetShortcut(1, B_ESCAPE); } else { alert = new BAlert(B_TRANSLATE("FileTypes request"), B_TRANSLATE("Removing a file type cannot be reverted.\n" "Are you sure you want to remove it?"), B_TRANSLATE("Remove"), B_TRANSLATE("Cancel"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetShortcut(1, B_ESCAPE); } if (alert->Go()) break; diff --git a/src/preferences/filetypes/PreferredAppMenu.cpp b/src/preferences/filetypes/PreferredAppMenu.cpp index 55933b319a..2ff8154520 100644 --- a/src/preferences/filetypes/PreferredAppMenu.cpp +++ b/src/preferences/filetypes/PreferredAppMenu.cpp @@ -291,8 +291,9 @@ retrieve_preferred_app(BMessage* message, bool sameAs, const char* forType, description[0] ? description : preferred); BAlert* alert = new BAlert(B_TRANSLATE("FileTypes request"), warning, - B_TRANSLATE("Set Preferred Application"), B_TRANSLATE("Cancel"), + B_TRANSLATE("Set preferred application"), B_TRANSLATE("Cancel"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetShortcut(1, B_ESCAPE); if (alert->Go() == 1) return B_ERROR; } diff --git a/src/preferences/fonts/main.cpp b/src/preferences/fonts/main.cpp index c46fa4ab57..8736f47cc7 100644 --- a/src/preferences/fonts/main.cpp +++ b/src/preferences/fonts/main.cpp @@ -50,7 +50,8 @@ FontsApp::AboutRequested() font.SetSize(18); font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, 5, &font); - + + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } diff --git a/src/preferences/joysticks/JoyWin.cpp b/src/preferences/joysticks/JoyWin.cpp index fb03fea1c3..ed8b6388d0 100644 --- a/src/preferences/joysticks/JoyWin.cpp +++ b/src/preferences/joysticks/JoyWin.cpp @@ -49,7 +49,7 @@ static int ShowMessage(char* string) { BAlert *alert = new BAlert("Message", string, "OK"); - alert->SetShortcut(1, B_ESCAPE); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); return alert->Go(); } @@ -437,7 +437,7 @@ JoyWin::_ShowNoCompatibleJoystickMessage() str << " for a driver designed for Haiku or BeOS."; BAlert *alert = new BAlert("test1", str.String(), "OK"); - alert->SetShortcut(0, B_ENTER); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } @@ -448,7 +448,7 @@ JoyWin::_ShowNoDeviceConnectedMessage(const char* joy, const char* port) str << joy << " device connected to the port '" << port << "'."; BAlert *alert = new BAlert("test1", str.String(), "Stop"); - alert->SetShortcut(0, B_ENTER); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } diff --git a/src/preferences/keyboard/Keyboard.cpp b/src/preferences/keyboard/Keyboard.cpp index 91c8d74314..cbe1d6aa25 100644 --- a/src/preferences/keyboard/Keyboard.cpp +++ b/src/preferences/keyboard/Keyboard.cpp @@ -35,6 +35,7 @@ KeyboardApplication::MessageReceived(BMessage* message) B_TRANSLATE("Something has gone wrong!"), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); + errorAlert->SetFlags(errorAlert->Flags() | B_CLOSE_ON_ESCAPE); errorAlert->Go(); be_app->PostMessage(B_QUIT_REQUESTED); break; @@ -49,8 +50,10 @@ KeyboardApplication::MessageReceived(BMessage* message) void KeyboardApplication::AboutRequested() { - (new BAlert("about", B_TRANSLATE("Written by Andrew Edward McCall"), - B_TRANSLATE("OK")))->Go(); + BAlert* alert = new BAlert("about", + B_TRANSLATE("Written by Andrew Edward McCall"), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } diff --git a/src/preferences/locale/LocaleWindow.cpp b/src/preferences/locale/LocaleWindow.cpp index a112a9cffc..97933bd6e3 100644 --- a/src/preferences/locale/LocaleWindow.cpp +++ b/src/preferences/locale/LocaleWindow.cpp @@ -147,6 +147,7 @@ LocaleWindow::LocaleWindow() "use this preflet!"), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } diff --git a/src/preferences/mail/AutoConfigWindow.cpp b/src/preferences/mail/AutoConfigWindow.cpp index 2ffeb8d56b..6898cccc21 100644 --- a/src/preferences/mail/AutoConfigWindow.cpp +++ b/src/preferences/mail/AutoConfigWindow.cpp @@ -95,6 +95,7 @@ AutoConfigWindow::MessageReceived(BMessage* msg) invalidMailAlert = new BAlert("invalidMailAlert", B_TRANSLATE("Enter a valid e-mail address."), B_TRANSLATE("OK")); + invalidMailAlert->SetFlags(invalidMailAlert->Flags() | B_CLOSE_ON_ESCAPE); invalidMailAlert->Go(); return; } diff --git a/src/preferences/mail/ConfigWindow.cpp b/src/preferences/mail/ConfigWindow.cpp index e3b4ce3698..8007d45bff 100644 --- a/src/preferences/mail/ConfigWindow.cpp +++ b/src/preferences/mail/ConfigWindow.cpp @@ -866,8 +866,10 @@ ConfigWindow::_RevertToLastSettings() "\nThe general settings couldn't be reverted.\n\n" "Error retrieving general settings:\n%s\n"), strerror(status)); - (new BAlert(B_TRANSLATE("Error"), text, B_TRANSLATE("OK"), NULL, NULL, - B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); + BAlert* alert = new BAlert(B_TRANSLATE("Error"), text, + B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } // revert account data diff --git a/src/preferences/mail/FilterConfigView.cpp b/src/preferences/mail/FilterConfigView.cpp index ce330b8858..eb4f1272a5 100644 --- a/src/preferences/mail/FilterConfigView.cpp +++ b/src/preferences/mail/FilterConfigView.cpp @@ -460,8 +460,11 @@ FiltersConfigView::MessageReceived(BMessage *msg) MailAddonSettings* mailSettings = _GetCurrentMailSettings(); if (!mailSettings->MoveFilterSettings(from, to)) { - (new BAlert("E-mail", B_TRANSLATE("The filter could not be " - "moved. Deleting filter."), B_TRANSLATE("OK")))->Go(); + BAlert* alert = new BAlert("E-mail", + B_TRANSLATE("The filter could not be moved. Deleting " + "filter."), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); fListView->RemoveItem(to); break; } diff --git a/src/preferences/media/MediaWindow.cpp b/src/preferences/media/MediaWindow.cpp index a9efbc12ec..c283904d17 100644 --- a/src/preferences/media/MediaWindow.cpp +++ b/src/preferences/media/MediaWindow.cpp @@ -436,7 +436,8 @@ MediaWindow::InitMedia(bool first) B_TRANSLATE("Quit"), B_TRANSLATE("Start media server"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - if (alert->Go()==0) + alert->SetShortcut(0, B_ESCAPE); + if (alert->Go() == 0) return B_ERROR; fAlert = new MediaAlert(BRect(0, 0, 300, 60), @@ -565,6 +566,7 @@ ErrorAlert(char* errorMessage) { printf("%s\n", errorMessage); BAlert* alert = new BAlert("BAlert", errorMessage, B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); exit(1); } diff --git a/src/preferences/mouse/Mouse.cpp b/src/preferences/mouse/Mouse.cpp index e6a20e7895..17f796b3b7 100644 --- a/src/preferences/mouse/Mouse.cpp +++ b/src/preferences/mouse/Mouse.cpp @@ -34,8 +34,10 @@ MouseApplication::MouseApplication() void MouseApplication::AboutRequested() { - (new BAlert("about", B_TRANSLATE("...by Andrew Edward McCall"), - B_TRANSLATE("Dig Deal")))->Go(); + BAlert* alert = new BAlert("about", + B_TRANSLATE("...by Andrew Edward McCall"), B_TRANSLATE("Dig Deal")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } diff --git a/src/preferences/network/EthernetSettingsView.cpp b/src/preferences/network/EthernetSettingsView.cpp index 8a238938ba..f098797b0b 100644 --- a/src/preferences/network/EthernetSettingsView.cpp +++ b/src/preferences/network/EthernetSettingsView.cpp @@ -589,12 +589,16 @@ EthernetSettingsView::_TriggerAutoConfig(const char* device) status_t status = interface.AutoConfigure(AF_INET); if (status == B_BAD_PORT_ID) { - (new BAlert("error", B_TRANSLATE("The net_server needs to run for " - "the auto configuration!"), B_TRANSLATE("OK")))->Go(); + BAlert* alert = new BAlert("error", B_TRANSLATE("The net_server needs to run for " + "the auto configuration!"), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } else if (status != B_OK) { BString errorMessage(B_TRANSLATE("Auto-configuring failed: ")); errorMessage << strerror(status); - (new BAlert("error", errorMessage.String(), "OK"))->Go(); + BAlert* alert = new BAlert("error", errorMessage.String(), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } return status; diff --git a/src/preferences/network_old/BackupWindow.cpp b/src/preferences/network_old/BackupWindow.cpp index c494f67228..58ce15a5d2 100644 --- a/src/preferences/network_old/BackupWindow.cpp +++ b/src/preferences/network_old/BackupWindow.cpp @@ -63,6 +63,7 @@ BackupWin::MessageReceived(BMessage *message) } else { BAlert *alert = new BAlert("Backup Info Alert","You must specify a name.","OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } break; diff --git a/src/preferences/network_old/LoginInfo.cpp b/src/preferences/network_old/LoginInfo.cpp index 36d7d6f006..d14cf0f5b7 100644 --- a/src/preferences/network_old/LoginInfo.cpp +++ b/src/preferences/network_old/LoginInfo.cpp @@ -63,13 +63,17 @@ void LoginInfo::MessageReceived(BMessage *message) else { BAlert *alert = new BAlert("Login Info Alert", "Passwords don't match. Please try again","OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } } else { - BAlert *alert = new BAlert("Login Info Alert","You didn't fill all the fields","Oups...",NULL,NULL,B_WIDTH_FROM_WIDEST,B_INFO_ALERT); + BAlert *alert = new BAlert("Login Info Alert", + "You didn't fill in all the fields","Oops...", NULL, NULL, + B_WIDTH_FROM_WIDEST,B_INFO_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } break; diff --git a/src/preferences/network_old/NetworkWindow.cpp b/src/preferences/network_old/NetworkWindow.cpp index da8e5f3d17..c7dd8c697e 100644 --- a/src/preferences/network_old/NetworkWindow.cpp +++ b/src/preferences/network_old/NetworkWindow.cpp @@ -457,8 +457,9 @@ bool NetworkWindow::QuitRequested(void) { if (fSave->IsEnabled() == true) { - BAlert *alert = new BAlert("Save Info Alert","Save changes before quitting?", - "Don't Save","Cancel","Save"); + BAlert *alert = new BAlert("Save Info Alert", "Save changes before " + quitting?", "Don't Save", "Cancel", "Save"); + alert->SetShortcut(1, B_ESCAPE); int32 result = alert->Go(); switch (result) { @@ -486,8 +487,9 @@ NetworkWindow::QuitRequested(void) void NetworkWindow::DeleteConfigFile() { - BAlert *alert = new BAlert("Alert","Really delete networking configuration?", - "Delete","Cancel"); + BAlert *alert = new BAlert("Alert", "Really delete networking configuration?", + "Delete", "Cancel"); + alert->SetShortcut(1, B_ESCAPE); int32 result = alert->Go(); if (result == 0) { diff --git a/src/preferences/notifications/DisplayView.cpp b/src/preferences/notifications/DisplayView.cpp index cde5bcfe36..85e4a8589e 100644 --- a/src/preferences/notifications/DisplayView.cpp +++ b/src/preferences/notifications/DisplayView.cpp @@ -107,6 +107,7 @@ DisplayView::Load() "It's possible you don't have write access to the " "settings directory."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); (void)alert->Go(); } @@ -176,6 +177,7 @@ DisplayView::Save() B_TRANSLATE("Can't save preferenes, you probably don't have " "write access to the settings directory or the disk is full."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); (void)alert->Go(); return ret; } diff --git a/src/preferences/notifications/GeneralView.cpp b/src/preferences/notifications/GeneralView.cpp index 7d1eb8df6f..6145e8d3b9 100644 --- a/src/preferences/notifications/GeneralView.cpp +++ b/src/preferences/notifications/GeneralView.cpp @@ -136,6 +136,7 @@ GeneralView::MessageReceived(BMessage* msg) " found, this means your InfoPopper installation was" " not successfully completed."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); (void)alert->Go(); return; } @@ -153,6 +154,7 @@ GeneralView::MessageReceived(BMessage* msg) "cannot be stopped, because the server can't be" " reached."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); (void)alert->Go(); return; } @@ -164,6 +166,7 @@ GeneralView::MessageReceived(BMessage* msg) " notifications because the server can't be " "reached."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); (void)alert->Go(); return; } @@ -181,6 +184,7 @@ GeneralView::MessageReceived(BMessage* msg) " was not successfully completed."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); (void)alert->Go(); return; } @@ -215,6 +219,7 @@ GeneralView::Load() "It's possible you don't have write access to the " "settings directory."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); (void)alert->Go(); } @@ -270,6 +275,7 @@ GeneralView::Save() B_TRANSLATE("An error occurred saving the preferences.\n" "It's possible you are running out of disk space."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); (void)alert->Go(); return ret; } @@ -296,6 +302,7 @@ GeneralView::Save() "write access to the boot settings directory."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); (void)alert->Go(); return ret; } @@ -316,6 +323,7 @@ GeneralView::Save() "you probably don't have write permission to the boot settings" " directory."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); (void)alert->Go(); return ret; } diff --git a/src/preferences/notifications/NotificationsView.cpp b/src/preferences/notifications/NotificationsView.cpp index b032666a50..ea1a1b0b62 100644 --- a/src/preferences/notifications/NotificationsView.cpp +++ b/src/preferences/notifications/NotificationsView.cpp @@ -184,6 +184,7 @@ NotificationsView::_LoadAppUsage() "It's possible you don't have write access to the " "settings directory."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); (void)alert->Go(); return B_ERROR; } diff --git a/src/preferences/screen/ScreenApplication.cpp b/src/preferences/screen/ScreenApplication.cpp index fc87e7a33b..3461a77ee9 100644 --- a/src/preferences/screen/ScreenApplication.cpp +++ b/src/preferences/screen/ScreenApplication.cpp @@ -40,7 +40,7 @@ ScreenApplication::AboutRequested() BAlert *aboutAlert = new BAlert(B_TRANSLATE("About"), B_TRANSLATE("Screen preferences by the Haiku team"), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_INFO_ALERT); - aboutAlert->SetShortcut(0, B_OK); + aboutAlert->SetFlags(aboutAlert->Flags() | B_CLOSE_ON_ESCAPE); aboutAlert->Go(); } diff --git a/src/preferences/screen/ScreenWindow.cpp b/src/preferences/screen/ScreenWindow.cpp index f2199d9312..5055cdbfc7 100644 --- a/src/preferences/screen/ScreenWindow.cpp +++ b/src/preferences/screen/ScreenWindow.cpp @@ -520,8 +520,11 @@ ScreenWindow::QuitRequested() BString warning = B_TRANSLATE("Could not write VESA mode settings" " file:\n\t"); warning << strerror(status); - (new BAlert(B_TRANSLATE("Warning"), warning.String(), B_TRANSLATE("OK"), NULL, - NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); + BAlert* alert = new BAlert(B_TRANSLATE("Warning"), + warning.String(), B_TRANSLATE("OK"), NULL, + NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } } @@ -1303,6 +1306,7 @@ ScreenWindow::_Apply() BAlert* alert = new BAlert(B_TRANSLATE("Warning"), message, B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } } diff --git a/src/preferences/screensaver/PasswordWindow.cpp b/src/preferences/screensaver/PasswordWindow.cpp index 661ff4d18b..c845908a0f 100644 --- a/src/preferences/screensaver/PasswordWindow.cpp +++ b/src/preferences/screensaver/PasswordWindow.cpp @@ -184,6 +184,7 @@ PasswordWindow::MessageReceived(BMessage *message) BAlert *alert = new BAlert("noMatch", B_TRANSLATE("Passwords don't match. Please try again."), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); break; } diff --git a/src/preferences/shortcuts/ShortcutsWindow.cpp b/src/preferences/shortcuts/ShortcutsWindow.cpp index 6632f2e190..e389a4df94 100644 --- a/src/preferences/shortcuts/ShortcutsWindow.cpp +++ b/src/preferences/shortcuts/ShortcutsWindow.cpp @@ -286,6 +286,7 @@ ShortcutsWindow::QuitRequested() B_TRANSLATE("Really quit without saving your changes?"), B_TRANSLATE("Don't save"), B_TRANSLATE("Cancel"), B_TRANSLATE("Save")); + alert->SetShortcut(1, B_ESCAPE); switch(alert->Go()) { case 1: ret = false; @@ -296,10 +297,12 @@ ShortcutsWindow::QuitRequested() // up the file requester if (fLastSaved.InitCheck() == B_OK) { if (_SaveKeySet(fLastSaved) == false) { - (new BAlert(ERROR, + BAlert* alert = new BAlert(ERROR, B_TRANSLATE("Shortcuts was unable to save your " "KeySet file!"), - B_TRANSLATE("Oh no")))->Go(); + B_TRANSLATE("Oh no")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); ret = true; //quit anyway } } else { @@ -550,9 +553,11 @@ ShortcutsWindow::MessageReceived(BMessage* msg) fLastSaved = BEntry(&ref); break; } else { - (new BAlert(ERROR, + BAlert* alert = new BAlert(ERROR, B_TRANSLATE("Shortcuts was couldn't open your " - "KeySet file!"), B_TRANSLATE("OK")))->Go(NULL); + "KeySet file!"), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(NULL); break; } } @@ -576,10 +581,11 @@ ShortcutsWindow::MessageReceived(BMessage* msg) _GetSettingsFile(&eref); if (ref == eref) fKeySetModified = false; } else { - (new BAlert(ERROR, + BAlert* alert = new BAlert(ERROR, B_TRANSLATE("Shortcuts was unable to parse your " - "KeySet file!"), - B_TRANSLATE("OK")))->Go(NULL); + "KeySet file!"), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(NULL); break; } } @@ -629,9 +635,11 @@ ShortcutsWindow::MessageReceived(BMessage* msg) } else PostMessage(SAVE_KEYSET_AS); // open the save requester... if (showSaveError) { - (new BAlert(ERROR, + BAlert* alert = new BAlert(ERROR, B_TRANSLATE("Shortcuts wasn't able to save your keyset."), - B_TRANSLATE("OK")))->Go(NULL); + B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(NULL); } break; } diff --git a/src/preferences/sounds/HApp.cpp b/src/preferences/sounds/HApp.cpp index bdc2409b65..14efcbc68c 100644 --- a/src/preferences/sounds/HApp.cpp +++ b/src/preferences/sounds/HApp.cpp @@ -49,6 +49,7 @@ HApp::AboutRequested() " Original work from Atsushi Takamatsu.\n" "Copyright ©2003-2006 Haiku"), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } diff --git a/src/preferences/sounds/HEventList.cpp b/src/preferences/sounds/HEventList.cpp index afb04edc61..8c178ffd29 100644 --- a/src/preferences/sounds/HEventList.cpp +++ b/src/preferences/sounds/HEventList.cpp @@ -127,6 +127,7 @@ HEventList::SelectionChanged() BMediaFiles().RemoveRefFor(fType, row->Name(), ref); BAlert* alert = new BAlert("alert", B_TRANSLATE("No such file or directory"), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return; } diff --git a/src/preferences/sounds/HWindow.cpp b/src/preferences/sounds/HWindow.cpp index 06efd30f28..13b8503724 100644 --- a/src/preferences/sounds/HWindow.cpp +++ b/src/preferences/sounds/HWindow.cpp @@ -212,6 +212,7 @@ HWindow::MessageReceived(BMessage* message) B_TRANSLATE("This is not an audio file."), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); break; } diff --git a/src/preferences/time/NetworkTimeView.cpp b/src/preferences/time/NetworkTimeView.cpp index 49a34dd4e0..55efc8cc0a 100644 --- a/src/preferences/time/NetworkTimeView.cpp +++ b/src/preferences/time/NetworkTimeView.cpp @@ -377,8 +377,10 @@ NetworkTimeView::MessageReceived(BMessage* message) "while synchronizing:\r\n%s"), errorString); - (new BAlert(B_TRANSLATE("Time"), buffer, - B_TRANSLATE("OK")))->Go(); + BAlert* alert = new BAlert(B_TRANSLATE("Time"), buffer, + B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } break; } diff --git a/src/preferences/time/Time.cpp b/src/preferences/time/Time.cpp index 6fb180540e..10c462df03 100644 --- a/src/preferences/time/Time.cpp +++ b/src/preferences/time/Time.cpp @@ -59,6 +59,7 @@ TimeApplication::AboutRequested() "Time & Date, written by:\n\n\tAndrew Edward McCall\n\tMike Berg\n\t" "Julun\n\tPhilippe Saint-Pierre\n\nCopyright 2004-2012, Haiku."), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } diff --git a/src/preferences/touchpad/TouchpadPrefView.cpp b/src/preferences/touchpad/TouchpadPrefView.cpp index 713d92b1e6..b53ce2d029 100644 --- a/src/preferences/touchpad/TouchpadPrefView.cpp +++ b/src/preferences/touchpad/TouchpadPrefView.cpp @@ -106,6 +106,7 @@ TouchpadView::MouseUp(BPoint point) "normal mouse operation. Do you really want to change it?"), B_TRANSLATE("OK"), B_TRANSLATE("Cancel"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetShortcut(1, B_ESCAPE); result = alert->Go(); } if (result == 0) { diff --git a/src/preferences/virtualmemory/SettingsWindow.cpp b/src/preferences/virtualmemory/SettingsWindow.cpp index 7328806bd6..3443d9a31e 100644 --- a/src/preferences/virtualmemory/SettingsWindow.cpp +++ b/src/preferences/virtualmemory/SettingsWindow.cpp @@ -237,12 +237,14 @@ SettingsWindow::SettingsWindow() status_t result = fSettings.SwapVolume().InitCheck(); if (result != B_OK) { - int32 choice = (new BAlert("VirtualMemory", B_TRANSLATE( + BAlert* alert = new BAlert("VirtualMemory", B_TRANSLATE( "The swap volume specified in the settings file is invalid.\n" "You can keep the current setting or switch to the " "default swap volume."), B_TRANSLATE("Keep"), B_TRANSLATE("Switch"), NULL, - B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); + B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetShortcut(0, B_ESCAPE); + int32 choice = alert->Go(); if (choice == 1) { BVolumeRoster volumeRoster; BVolume bootVolume; @@ -293,7 +295,7 @@ SettingsWindow::MessageReceived(BMessage* message) // ToDo: maybe we want to remove this possibility in the GUI // as Be did, but I thought a proper warning could be helpful // (for those that want to change that anyway) - int32 choice = (new BAlert("VirtualMemory", + BAlert* alert = new BAlert("VirtualMemory", B_TRANSLATE( "Disabling virtual memory will have unwanted effects on " "system stability once the memory is used up.\n" @@ -301,7 +303,9 @@ SettingsWindow::MessageReceived(BMessage* message) "until this point is reached.\n\n" "Are you really sure you want to turn it off?"), B_TRANSLATE("Turn off"), B_TRANSLATE("Keep enabled"), NULL, - B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); + B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetShortcut(1, B_ESCAPE); + int32 choice = alert->Go(); if (choice == 1) { fSwapEnabledCheckBox->SetValue(1); break; diff --git a/src/preferences/virtualmemory/VirtualMemory.cpp b/src/preferences/virtualmemory/VirtualMemory.cpp index 60fdfdaeee..d599bc6376 100644 --- a/src/preferences/virtualmemory/VirtualMemory.cpp +++ b/src/preferences/virtualmemory/VirtualMemory.cpp @@ -50,6 +50,7 @@ VirtualMemory::AboutRequested() font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, 13, &font); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } diff --git a/src/servers/bluetooth/DeskbarReplicant.cpp b/src/servers/bluetooth/DeskbarReplicant.cpp index 67f999d717..b5a57e1272 100644 --- a/src/servers/bluetooth/DeskbarReplicant.cpp +++ b/src/servers/bluetooth/DeskbarReplicant.cpp @@ -242,6 +242,7 @@ DeskbarReplicant::_ShowErrorAlert(BString msg, status_t status) { msg << "\n\nError: " << strerror(status); BAlert* alert = new BAlert("Bluetooth error", msg.String(), "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } diff --git a/src/servers/debug/DebugServer.cpp b/src/servers/debug/DebugServer.cpp index 83e49709c5..26f542128b 100644 --- a/src/servers/debug/DebugServer.cpp +++ b/src/servers/debug/DebugServer.cpp @@ -689,6 +689,7 @@ TeamDebugHandler::_HandleMessage(DebugMessage *message) BAlert *alert = new BAlert(NULL, buffer.String(), B_TRANSLATE("Debug"), B_TRANSLATE("OK"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); int32 result = alert->Go(); kill = (result == 1); _NotifyRegistrar(fTeam, false, !kill); diff --git a/src/servers/input/MethodReplicant.cpp b/src/servers/input/MethodReplicant.cpp index 2a6c9dfc0e..9210cfc2da 100644 --- a/src/servers/input/MethodReplicant.cpp +++ b/src/servers/input/MethodReplicant.cpp @@ -137,11 +137,15 @@ MethodReplicant::MessageReceived(BMessage* message) switch (message->what) { case B_ABOUT_REQUESTED: - (new BAlert("About Method Replicant", + { + BAlert* alert = new BAlert("About Method Replicant", "Method Replicant (Replicant)\n" " Brought to you by Jérôme DUVAL.\n\n" - "Haiku, 2004-2009", "OK"))->Go(); + "Haiku, 2004-2009", "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); break; + } case IS_UPDATE_NAME: UpdateMethodName(message); break; diff --git a/src/servers/mail/MailDaemon.cpp b/src/servers/mail/MailDaemon.cpp index b12bcbe7fa..05586c5a5b 100644 --- a/src/servers/mail/MailDaemon.cpp +++ b/src/servers/mail/MailDaemon.cpp @@ -306,6 +306,7 @@ MailDaemonApp::MessageReceived(BMessage* msg) BAlert* alert = new BAlert(B_TRANSLATE("New Messages"), fAlertString.String(), "OK", NULL, NULL, B_WIDTH_AS_USUAL); alert->SetFeel(B_NORMAL_WINDOW_FEEL); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); fAlertString = B_EMPTY_STRING; } diff --git a/src/servers/media/media_server.cpp b/src/servers/media/media_server.cpp index fd51cf7742..f1cc958a97 100644 --- a/src/servers/media/media_server.cpp +++ b/src/servers/media/media_server.cpp @@ -219,8 +219,10 @@ ServerApp::_LaunchAddOnServer() if (err == B_OK) return; - (new BAlert("media_server", "Launching media_addon_server failed.\n\n" - "media_server will terminate", "OK"))->Go(); + BAlert* alert = new BAlert("media_server", "Launching media_addon_server " + "failed.\n\nmedia_server will terminate", "OK"); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); fprintf(stderr, "Launching media_addon_server (%s) failed: %s\n", B_MEDIA_ADDON_SERVER_SIGNATURE, strerror(err)); exit(1); diff --git a/src/servers/midi/MidiServerApp.cpp b/src/servers/midi/MidiServerApp.cpp index 28fa74ac7c..4e547c6268 100644 --- a/src/servers/midi/MidiServerApp.cpp +++ b/src/servers/midi/MidiServerApp.cpp @@ -62,13 +62,15 @@ MidiServerApp::~MidiServerApp() void MidiServerApp::AboutRequested() { - (new BAlert(0, + BAlert* alert = new BAlert(0, "Haiku midi_server 1.0.0 alpha\n\n" "notes disguised as bytes\n" "propagating to endpoints,\n" "an aural delight", - "Okay", 0, 0, B_WIDTH_AS_USUAL, - B_INFO_ALERT))->Go(); + "OK", 0, 0, B_WIDTH_AS_USUAL, + B_INFO_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(); } diff --git a/src/servers/mount/AutoMounter.cpp b/src/servers/mount/AutoMounter.cpp index 65afd9079a..cf6fb72163 100644 --- a/src/servers/mount/AutoMounter.cpp +++ b/src/servers/mount/AutoMounter.cpp @@ -569,8 +569,10 @@ AutoMounter::_MountVolume(const BMessage* message) char text[512]; snprintf(text, sizeof(text), B_TRANSLATE("Error mounting volume:\n\n%s"), strerror(status)); - (new BAlert(B_TRANSLATE("Mount error"), text, - B_TRANSLATE("OK")))->Go(NULL); + BAlert* alert = new BAlert(B_TRANSLATE("Mount error"), text, + B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(NULL); } } @@ -603,8 +605,10 @@ AutoMounter::_ReportUnmountError(const char* name, status_t error) snprintf(text, sizeof(text), B_TRANSLATE("Could not unmount disk " "\"%s\":\n\t%s"), name, strerror(error)); - (new BAlert(B_TRANSLATE("Unmount error"), text, B_TRANSLATE("OK"), - NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL); + BAlert* alert = new BAlert(B_TRANSLATE("Unmount error"), text, + B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + alert->Go(NULL); } diff --git a/src/servers/net/NetServer.cpp b/src/servers/net/NetServer.cpp index e30db4aa97..2e9c045f09 100644 --- a/src/servers/net/NetServer.cpp +++ b/src/servers/net/NetServer.cpp @@ -238,6 +238,7 @@ NetServer::AboutRequested() font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, 17, &font); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } diff --git a/src/servers/notification/NotificationWindow.cpp b/src/servers/notification/NotificationWindow.cpp index 39bdf1eaa8..5a901469b8 100644 --- a/src/servers/notification/NotificationWindow.cpp +++ b/src/servers/notification/NotificationWindow.cpp @@ -440,6 +440,7 @@ NotificationWindow::_LoadAppFilters(bool startMonitor) BAlert* alert = new BAlert(B_TRANSLATE("Warning"), B_TRANSLATE("Couldn't start filter monitor." " Live filter changes disabled."), B_TRANSLATE("Darn.")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } } @@ -504,6 +505,7 @@ NotificationWindow::_LoadGeneralSettings(bool startMonitor) BAlert* alert = new BAlert(B_TRANSLATE("Warning"), B_TRANSLATE("Couldn't start general settings monitor.\n" "Live filter changes disabled."), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } } @@ -555,6 +557,7 @@ NotificationWindow::_LoadDisplaySettings(bool startMonitor) BAlert* alert = new BAlert(B_TRANSLATE("Warning"), B_TRANSLATE("Couldn't start display settings monitor.\n" "Live filter changes disabled."), B_TRANSLATE("OK")); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); } } diff --git a/src/servers/print/ConfigWindow.cpp b/src/servers/print/ConfigWindow.cpp index a88ea61c1d..eebea2dee2 100644 --- a/src/servers/print/ConfigWindow.cpp +++ b/src/servers/print/ConfigWindow.cpp @@ -309,6 +309,7 @@ ConfigWindow::AboutRequested() BAlert *about = new BAlert("About printer server", text.String(), B_TRANSLATE("OK")); + about->SetFlags(about->Flags() | B_CLOSE_ON_ESCAPE); about->Go(); } diff --git a/src/servers/print/PrintServerApp.R5.cpp b/src/servers/print/PrintServerApp.R5.cpp index c89948f29a..bf466ae3a9 100644 --- a/src/servers/print/PrintServerApp.R5.cpp +++ b/src/servers/print/PrintServerApp.R5.cpp @@ -97,6 +97,7 @@ PrintServerApp::async_thread(void* data) B_TRANSLATE("Would you like to set one up now?")); BAlert* alert = new BAlert("Info", alertText.String(), B_TRANSLATE("No"), B_TRANSLATE("Yes")); + alert->SetShortcut(0, B_ESCAPE); if (alert->Go() == 1) { if (count == 0) run_add_printer_panel(); @@ -143,6 +144,7 @@ PrintServerApp::async_thread(void* data) text.ReplaceFirst("@", printerName.String()); BAlert* alert = new BAlert("", text.String(), B_TRANSLATE("No"), B_TRANSLATE("Yes")); + alert->SetShortcut(0, B_ESCAPE); if (alert->Go() == 1) p->app->SelectPrinter(printerName.String()); } diff --git a/src/servers/registrar/ShutdownProcess.cpp b/src/servers/registrar/ShutdownProcess.cpp index 02a2a719e1..e3d2ea21e5 100644 --- a/src/servers/registrar/ShutdownProcess.cpp +++ b/src/servers/registrar/ShutdownProcess.cpp @@ -1256,13 +1256,12 @@ ShutdownProcess::_WorkerDoShutdown() BAlert* alert = new BAlert(title.String(), text, B_TRANSLATE("Cancel"), otherText, defaultText, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - alert->SetShortcut(0, B_ESCAPE); // We want the alert to behave more like a regular window... alert->SetFeel(B_NORMAL_WINDOW_FEEL); // ...but not quit. Minimizing the alert would prevent the user from // finding it again, since registrar does not have an entry in the // Deskbar. - alert->SetFlags(alert->Flags() | B_NOT_MINIMIZABLE); + alert->SetFlags(alert->Flags() | B_NOT_MINIMIZABLE | B_CLOSE_ON_ESCAPE); alert->SetWorkspaces(B_ALL_WORKSPACES); int32 result = alert->Go(); diff --git a/src/servers/syslog_daemon/SyslogDaemon.cpp b/src/servers/syslog_daemon/SyslogDaemon.cpp index 993638df48..4a696d91e3 100644 --- a/src/servers/syslog_daemon/SyslogDaemon.cpp +++ b/src/servers/syslog_daemon/SyslogDaemon.cpp @@ -73,6 +73,7 @@ SyslogDaemon::AboutRequested() font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, name.Length(), &font); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); }