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