Improved TeamManager default button behaviour, closing #6051.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37063 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Joachim Seemer 2010-06-08 16:43:14 +00:00
parent 2434bdc4d9
commit 2d192e7a80
2 changed files with 11 additions and 3 deletions

View File

@ -115,16 +115,17 @@ TeamMonitorWindow::TeamMonitorWindow()
fRestartButton = new BButton("restart", "Restart the Desktop",
new BMessage(TM_RESTART_DESKTOP));
fRestartButton->Hide();
SetDefaultButton(fRestartButton);
groupView->GroupLayout()->AddView(fRestartButton);
glue = BSpaceLayoutItem::CreateGlue();
glue->SetExplicitMinSize(BSize(inset, -1));
groupView->GroupLayout()->AddItem(glue);
BButton *cancel = new BButton("cancel", "Cancel",
fCancelButton = new BButton("cancel", "Cancel",
new BMessage(TM_CANCEL));
groupView->GroupLayout()->AddView(cancel);
SetDefaultButton(fCancelButton);
groupView->GroupLayout()->AddView(fCancelButton);
BSize preferredSize = layout->View()->PreferredSize();
if (preferredSize.width > Bounds().Width())
@ -143,6 +144,8 @@ TeamMonitorWindow::TeamMonitorWindow()
SetSizeLimits(Bounds().Width(), Bounds().Width() * 2,
Bounds().Height(), screenFrame.Height());
fRestartButton->Hide();
AddShortcut('T', B_COMMAND_KEY | B_OPTION_KEY,
new BMessage(kMsgLaunchTerminal));
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
@ -181,6 +184,7 @@ TeamMonitorWindow::MessageReceived(BMessage *msg)
case TM_FORCE_REBOOT:
_kern_shutdown(true);
break;
case TM_KILL_APPLICATION:
{
TeamListItem* item = (TeamListItem*)fListView->ItemAt(
@ -197,6 +201,8 @@ TeamMonitorWindow::MessageReceived(BMessage *msg)
be_roster->Launch(kTrackerSignature);
if (!be_roster->IsRunning(kDeskbarSignature))
be_roster->Launch(kDeskbarSignature);
fRestartButton->Hide();
SetDefaultButton(fCancelButton);
break;
}
case TM_SELECTED_TEAM:
@ -281,6 +287,7 @@ TeamMonitorWindow::UpdateList()
&& be_roster->IsRunning(kDeskbarSignature);
if (!desktopRunning && fRestartButton->IsHidden()) {
fRestartButton->Show();
SetDefaultButton(fRestartButton);
fRestartButton->Parent()->Layout(true);
}

View File

@ -37,6 +37,7 @@ private:
bool fQuitting;
BMessageRunner* fUpdateRunner;
BListView* fListView;
BButton* fCancelButton;
BButton* fKillButton;
BButton* fRestartButton;
TeamDescriptionView* fDescriptionView;