Task #12: add confirmation dialog
This commit is contained in:
parent
6de2682326
commit
fb5f1c38cf
|
@ -125,12 +125,19 @@ MainWindow::Start()
|
||||||
bool
|
bool
|
||||||
MainWindow::QuitRequested()
|
MainWindow::QuitRequested()
|
||||||
{
|
{
|
||||||
|
BAlert* alert = new BAlert("Closing", "Are you sure you wan to quit?", "Yes", "No", NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
|
||||||
|
alert->SetShortcut(0, B_ESCAPE);
|
||||||
|
int32 button_index = alert->Go();
|
||||||
|
if(button_index == 0) {
|
||||||
fListView->MakeEmpty();
|
fListView->MakeEmpty();
|
||||||
fServer->Quit();
|
fServer->Quit();
|
||||||
CayaPreferences::Get()->Save();
|
CayaPreferences::Get()->Save();
|
||||||
ReplicantStatusView::RemoveReplicant();
|
ReplicantStatusView::RemoveReplicant();
|
||||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,9 +71,9 @@ PreferencesAccounts::PreferencesAccounts()
|
||||||
fProtosMenu->AddItem(item);
|
fProtosMenu->AddItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolButton* proto = new ToolButton("+", NULL);
|
ToolButton* proto = new ToolButton("Add", NULL);
|
||||||
proto->SetMenu(fProtosMenu);
|
proto->SetMenu(fProtosMenu);
|
||||||
fDelButton = new ToolButton("-", new BMessage(kDelAccount));
|
fDelButton = new ToolButton("Del", new BMessage(kDelAccount));
|
||||||
fEditButton = new ToolButton("Edit...", new BMessage(kEditAccount));
|
fEditButton = new ToolButton("Edit...", new BMessage(kEditAccount));
|
||||||
fDelButton->SetEnabled(false);
|
fDelButton->SetEnabled(false);
|
||||||
fEditButton->SetEnabled(false);
|
fEditButton->SetEnabled(false);
|
||||||
|
|
Ŝarĝante…
Reference in New Issue