* When activating the "Shutdown" menu (instead of one of its items), we now
get the old shutdown dialog back, but with the additional option to reboot instead. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30731 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+28
-24
@@ -164,11 +164,11 @@ TBarApp::~TBarApp()
|
||||
bool
|
||||
TBarApp::QuitRequested()
|
||||
{
|
||||
if (CurrentMessage() && CurrentMessage()->FindBool("shortcut"))
|
||||
if (CurrentMessage() && CurrentMessage()->FindBool("shortcut"))
|
||||
// don't allow user quitting
|
||||
return false;
|
||||
|
||||
// system quitting, call inherited to notify all loopers
|
||||
// system quitting, call inherited to notify all loopers
|
||||
fBarWindow->SaveSettings();
|
||||
BApplication::QuitRequested();
|
||||
return true;
|
||||
@@ -268,7 +268,7 @@ TBarApp::InitSettings()
|
||||
fSettingsFile->Read(&settings.recentDocsCount, sizeof(int32));
|
||||
}
|
||||
if (size >= kValidSettingsSize4) {
|
||||
fSettingsFile->Read(&settings.timeShowSeconds, sizeof(bool));
|
||||
fSettingsFile->Read(&settings.timeShowSeconds, sizeof(bool));
|
||||
fSettingsFile->Read(&settings.timeShowMil, sizeof(bool));
|
||||
}
|
||||
if (size >= kValidSettingsSize5)
|
||||
@@ -344,13 +344,13 @@ TBarApp::MessageReceived(BMessage *message)
|
||||
break;
|
||||
|
||||
case kConfigClose:
|
||||
if (message->FindInt32("applications", &count) == B_OK)
|
||||
if (message->FindInt32("applications", &count) == B_OK)
|
||||
fSettings.recentAppsCount = count;
|
||||
if (message->FindInt32("folders", &count) == B_OK)
|
||||
if (message->FindInt32("folders", &count) == B_OK)
|
||||
fSettings.recentFoldersCount = count;
|
||||
if (message->FindInt32("documents", &count) == B_OK)
|
||||
if (message->FindInt32("documents", &count) == B_OK)
|
||||
fSettings.recentDocsCount = count;
|
||||
|
||||
|
||||
fConfigWindow = NULL;
|
||||
break;
|
||||
|
||||
@@ -364,7 +364,7 @@ TBarApp::MessageReceived(BMessage *message)
|
||||
|
||||
const char *sig = NULL;
|
||||
message->FindString("be:signature", &sig);
|
||||
|
||||
|
||||
entry_ref ref;
|
||||
message->FindRef("be:ref", &ref);
|
||||
|
||||
@@ -373,7 +373,7 @@ TBarApp::MessageReceived(BMessage *message)
|
||||
}
|
||||
|
||||
case B_SOME_APP_QUIT:
|
||||
{
|
||||
{
|
||||
team_id team = -1;
|
||||
message->FindInt32("be:team", &team);
|
||||
RemoveTeam(team);
|
||||
@@ -389,7 +389,7 @@ TBarApp::MessageReceived(BMessage *message)
|
||||
case msg_Be:
|
||||
__set_window_decor(0);
|
||||
break;
|
||||
|
||||
|
||||
case msg_Win95:
|
||||
__set_window_decor(2);
|
||||
break;
|
||||
@@ -408,11 +408,11 @@ TBarApp::MessageReceived(BMessage *message)
|
||||
else
|
||||
BDragger::ShowAllDraggers();
|
||||
break;
|
||||
|
||||
|
||||
case msg_AlwaysTop:
|
||||
fSettings.alwaysOnTop = !fSettings.alwaysOnTop;
|
||||
|
||||
fBarWindow->SetFeel(fSettings.alwaysOnTop ?
|
||||
fBarWindow->SetFeel(fSettings.alwaysOnTop ?
|
||||
B_FLOATING_ALL_WINDOW_FEEL : B_NORMAL_WINDOW_FEEL);
|
||||
break;
|
||||
|
||||
@@ -456,7 +456,7 @@ TBarApp::MessageReceived(BMessage *message)
|
||||
Unsubscribe(messenger);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case msg_superExpando:
|
||||
{
|
||||
fSettings.superExpando = !fSettings.superExpando;
|
||||
@@ -467,7 +467,7 @@ TBarApp::MessageReceived(BMessage *message)
|
||||
fBarWindow->Unlock();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case msg_expandNewTeams:
|
||||
{
|
||||
fSettings.expandNewTeams = !fSettings.expandNewTeams;
|
||||
@@ -479,7 +479,7 @@ TBarApp::MessageReceived(BMessage *message)
|
||||
break;
|
||||
}
|
||||
|
||||
case 'TASK':
|
||||
case 'TASK':
|
||||
fSwitcherMessenger.SendMessage(message);
|
||||
break;
|
||||
|
||||
@@ -488,11 +488,15 @@ TBarApp::MessageReceived(BMessage *message)
|
||||
break;
|
||||
|
||||
case CMD_REBOOT_SYSTEM:
|
||||
case CMD_SHUTDOWN_SYSTEM: {
|
||||
case CMD_SHUTDOWN_SYSTEM:
|
||||
{
|
||||
bool reboot = (message->what == CMD_REBOOT_SYSTEM);
|
||||
bool confirm;
|
||||
message->FindBool("confirm", &confirm);
|
||||
|
||||
BRoster roster;
|
||||
BRoster::Private rosterPrivate(roster);
|
||||
status_t error = rosterPrivate.ShutDown(reboot, false, false);
|
||||
status_t error = rosterPrivate.ShutDown(reboot, confirm, false);
|
||||
if (error != B_OK)
|
||||
fprintf(stderr, "Shutdown failed: %s\n", strerror(error));
|
||||
|
||||
@@ -509,7 +513,7 @@ TBarApp::MessageReceived(BMessage *message)
|
||||
break;
|
||||
|
||||
default:
|
||||
BApplication::MessageReceived(message);
|
||||
BApplication::MessageReceived(message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -590,7 +594,7 @@ TBarApp::AddTeam(team_id team, uint32 flags, const char *sig, entry_ref *ref)
|
||||
if (!autolock.IsLocked())
|
||||
return;
|
||||
|
||||
// have we already seen this team, is this another instance of
|
||||
// have we already seen this team, is this another instance of
|
||||
// a known app?
|
||||
BarTeamInfo *multiLaunchTeam = NULL;
|
||||
int32 teamCount = sBarTeamInfoList.CountItems();
|
||||
@@ -612,7 +616,7 @@ TBarApp::AddTeam(team_id team, uint32 flags, const char *sig, entry_ref *ref)
|
||||
message.AddString("sig", multiLaunchTeam->sig);
|
||||
|
||||
for (int32 i = 0; i < subsCount; i++)
|
||||
((BMessenger *)sSubscribers.ItemAt(i))->SendMessage(&message);
|
||||
((BMessenger *)sSubscribers.ItemAt(i))->SendMessage(&message);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -620,7 +624,7 @@ TBarApp::AddTeam(team_id team, uint32 flags, const char *sig, entry_ref *ref)
|
||||
BFile file(ref, B_READ_ONLY);
|
||||
BAppFileInfo appMime(&file);
|
||||
|
||||
BarTeamInfo *barInfo = new BarTeamInfo(new BList(), flags, strdup(sig),
|
||||
BarTeamInfo *barInfo = new BarTeamInfo(new BList(), flags, strdup(sig),
|
||||
new BBitmap(kIconSize, kIconFormat), strdup(ref->name));
|
||||
|
||||
barInfo->teams->AddItem((void *)team);
|
||||
@@ -682,7 +686,7 @@ TBarApp::RemoveTeam(team_id team)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -697,8 +701,8 @@ TBarApp::ShowConfigWindow()
|
||||
BPath path;
|
||||
find_directory (B_USER_DESKBAR_DIRECTORY, &path);
|
||||
entry_ref startref;
|
||||
get_ref_for_path(path.Path(), &startref);
|
||||
|
||||
get_ref_for_path(path.Path(), &startref);
|
||||
|
||||
fConfigWindow = new TFavoritesConfigWindow(BRect(0, 0, 320, 240),
|
||||
#ifdef __HAIKU__
|
||||
"Configure Leaf Menu", false, B_ANY_NODE,
|
||||
|
||||
+16
-13
@@ -124,7 +124,7 @@ TBeMenu::DetachedFromWindow()
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
TBeMenu::StartBuildingItemList()
|
||||
{
|
||||
RemoveItems(0, CountItems(), true);
|
||||
@@ -145,9 +145,9 @@ TBeMenu::DoneBuildingItemList()
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
TBeMenu::AddNextItem()
|
||||
{
|
||||
{
|
||||
if (fAddState == kStart)
|
||||
return AddStandardBeMenuItems();
|
||||
|
||||
@@ -167,7 +167,7 @@ TBeMenu::AddNextItem()
|
||||
if (count > 0) {
|
||||
AddSeparatorItem();
|
||||
|
||||
for (int i = 0;i < recentTypes;i++) {
|
||||
for (int i = 0;i < recentTypes;i++) {
|
||||
if (!recentItem[i])
|
||||
continue;
|
||||
|
||||
@@ -290,7 +290,7 @@ TBeMenu::AddStandardBeMenuItems()
|
||||
subMenu->AddItem(item);
|
||||
|
||||
subMenu->AddSeparatorItem();
|
||||
|
||||
|
||||
TReplicantTray *replicantTray = ((TBarApp *)be_app)->BarView()->fReplicantTray;
|
||||
|
||||
item = new BMenuItem("24 Hour Clock", new BMessage(kMsgMilTime));
|
||||
@@ -386,10 +386,13 @@ TBeMenu::AddStandardBeMenuItems()
|
||||
|
||||
#ifdef __HAIKU__
|
||||
shutdownMenu->SetTargetForItems(be_app);
|
||||
BMessage* message = new BMessage(CMD_SHUTDOWN_SYSTEM);
|
||||
message->AddBool("confirm", true);
|
||||
AddItem(new BMenuItem(shutdownMenu, message));
|
||||
#else
|
||||
shutdownMenu->SetTargetForItems(BMessenger(ROSTER_SIG));
|
||||
#endif
|
||||
AddItem(shutdownMenu);
|
||||
#endif
|
||||
|
||||
fAddState = kAddingRecents;
|
||||
|
||||
@@ -397,7 +400,7 @@ TBeMenu::AddStandardBeMenuItems()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
TBeMenu::ClearMenuBuildingState()
|
||||
{
|
||||
fAddState = kDone;
|
||||
@@ -556,12 +559,12 @@ TRecentsMenu::DetachedFromWindow()
|
||||
{
|
||||
//
|
||||
// BNavMenu::DetachedFromWindow sets the TypesList to NULL
|
||||
//
|
||||
//
|
||||
BMenu::DetachedFromWindow();
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
TRecentsMenu::StartBuildingItemList()
|
||||
{
|
||||
RemoveItems(0, CountItems(), true);
|
||||
@@ -576,7 +579,7 @@ TRecentsMenu::StartBuildingItemList()
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
TRecentsMenu::AddNextItem()
|
||||
{
|
||||
if (fRecentsCount > 0 && AddRecents(fRecentsCount))
|
||||
@@ -681,7 +684,7 @@ TRecentsMenu::AddRecents(int32 count)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
TRecentsMenu::DoneBuildingItemList()
|
||||
{
|
||||
// !! note: don't call inherited here
|
||||
@@ -694,7 +697,7 @@ TRecentsMenu::DoneBuildingItemList()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
TRecentsMenu::ClearMenuBuildingState()
|
||||
{
|
||||
fMenuBuilt = false;
|
||||
@@ -705,7 +708,7 @@ TRecentsMenu::ClearMenuBuildingState()
|
||||
void
|
||||
TRecentsMenu::ResetTargets()
|
||||
{
|
||||
BNavMenu::ResetTargets();
|
||||
BNavMenu::ResetTargets();
|
||||
|
||||
// if we are dragging, set the target to whatever was set
|
||||
// else set it to the default (Tracker)
|
||||
|
||||
Reference in New Issue
Block a user