Task #12: add confirmation dialog

This commit is contained in:
Ivan Gualandri 2015-09-29 08:59:40 +00:00
parent 6de2682326
commit fb5f1c38cf
3 changed files with 17 additions and 8 deletions

View File

@ -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;
}
} }

View File

@ -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);

2
configure vendored
View File

@ -145,4 +145,6 @@ CAYA_DIRECTORY = $(finddir B_USER_APPS_DIRECTORY)/Caya ;
DEFINES += ${defines} ; DEFINES += ${defines} ;
EOF EOF
echo $USER_CONFIG_DIRECTORY
echo $SYSTEM_DEVELOP_DIRECTORY
echo "Configuration done." echo "Configuration done."