* Added the option to the shutdown confirmation dialog to perform the "other"

shutdown, ie. either reboot or shutdown.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30730 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-05-12 21:17:25 +00:00
parent 593ee7bbc3
commit d48fe2445b
1 changed files with 10 additions and 6 deletions

View File

@ -1255,19 +1255,23 @@ ShutdownProcess::_WorkerDoShutdown()
// ask the user to confirm the shutdown, if desired
bool askUser;
if (fHasGUI && fRequest->FindBool("confirm", &askUser) == B_OK && askUser) {
const char *title = (fReboot ? "Restart?" : "Shut Down?");
const char *text = (fReboot
const char* title = fReboot ? "Restart?" : "Shut Down?";
const char* text = fReboot
? "Do you really want to restart the system?"
: "Do you really want to shut down the system?");
const char *buttonText = (fReboot ? "Restart" : "Shut Down");
BAlert *alert = new BAlert(title, text, "Cancel", buttonText, NULL,
: "Do you really want to shut down the system?";
const char* defaultText = fReboot ? "Restart" : "Shut Down";
const char* otherText = fReboot ? "Shut Down" : "Restart";
BAlert* alert = new BAlert(title, text, "Cancel", otherText, defaultText,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->SetFeel(B_NORMAL_WINDOW_FEEL);
alert->SetWorkspaces(B_ALL_WORKSPACES);
int32 result = alert->Go();
if (result != 1)
if (result == 1) {
// Toggle shutdown method
fReboot = !fReboot;
} else if (result < 1)
throw_error(B_SHUTDOWN_CANCELLED);
}