Automatic whitespace cleanup.

When in single window mode, also add opt+cmd+down as a shortcut to navigate to the selected folder in a new window. Fixes ticket #3548.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39551 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent 2010-11-21 02:29:38 +00:00
parent f088cd3e6e
commit 0741a7c295

View File

@ -2517,32 +2517,32 @@ BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref *ref, BView *)
if (ref) { if (ref) {
// clicked on a pose, show file or volume context menu // clicked on a pose, show file or volume context menu
Model model(ref); Model model(ref);
if (model.IsTrash()) { if (model.IsTrash()) {
if (fTrashContextMenu->Window() || Dragging()) if (fTrashContextMenu->Window() || Dragging())
return; return;
DeleteSubmenu(fNavigationItem); DeleteSubmenu(fNavigationItem);
// selected item was trash, show the trash context menu instead // selected item was trash, show the trash context menu instead
EnableNamedMenuItem(fTrashContextMenu, kEmptyTrash, EnableNamedMenuItem(fTrashContextMenu, kEmptyTrash,
static_cast<TTracker *>(be_app)->TrashFull()); static_cast<TTracker *>(be_app)->TrashFull());
SetupNavigationMenu(ref, fTrashContextMenu); SetupNavigationMenu(ref, fTrashContextMenu);
fTrashContextMenu->Go(global, true, true, true); fTrashContextMenu->Go(global, true, true, true);
} else { } else {
bool showAsVolume = false; bool showAsVolume = false;
bool filePanel = PoseView()->IsFilePanel(); bool filePanel = PoseView()->IsFilePanel();
if (Dragging()) { if (Dragging()) {
fContextMenu = NULL; fContextMenu = NULL;
BEntry entry; BEntry entry;
model.GetEntry(&entry); model.GetEntry(&entry);
// only show for directories (directory, volume, root) // only show for directories (directory, volume, root)
// //
// don't show a popup for the trash or printers // don't show a popup for the trash or printers
@ -2554,20 +2554,20 @@ BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref *ref, BView *)
// SlowContextPopup::AttachedToWindow and // SlowContextPopup::AttachedToWindow and
// reset in DetachedFromWindow // reset in DetachedFromWindow
// see the notes in SlowContextPopup::AttachedToWindow // see the notes in SlowContextPopup::AttachedToWindow
if (!FSIsPrintersDir(&entry) && !fDragContextMenu->IsShowing()) { if (!FSIsPrintersDir(&entry) && !fDragContextMenu->IsShowing()) {
// printf("ShowContextMenu - target is %s %i\n", ref->name, IsShowing(ref)); // printf("ShowContextMenu - target is %s %i\n", ref->name, IsShowing(ref));
fDragContextMenu->ClearMenu(); fDragContextMenu->ClearMenu();
// in case the ref is a symlink, resolve it // in case the ref is a symlink, resolve it
// only pop open for directories // only pop open for directories
BEntry resolvedEntry(ref, true); BEntry resolvedEntry(ref, true);
if (!resolvedEntry.IsDirectory()) if (!resolvedEntry.IsDirectory())
return; return;
entry_ref resolvedRef; entry_ref resolvedRef;
resolvedEntry.GetRef(&resolvedRef); resolvedEntry.GetRef(&resolvedRef);
// use the resolved ref for the menu // use the resolved ref for the menu
fDragContextMenu->SetNavDir(&resolvedRef); fDragContextMenu->SetNavDir(&resolvedRef);
fDragContextMenu->SetTypesList(fCachedTypesList); fDragContextMenu->SetTypesList(fCachedTypesList);
@ -2578,7 +2578,7 @@ BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref *ref, BView *)
fDragContextMenu->InitTrackingHook( fDragContextMenu->InitTrackingHook(
&BPoseView::MenuTrackingHook, &target, fDragMessage); &BPoseView::MenuTrackingHook, &target, fDragMessage);
} }
// this is now asynchronous so that we don't // this is now asynchronous so that we don't
// deadlock in Window::Quit, // deadlock in Window::Quit,
fDragContextMenu->Go(global, true, false, true); fDragContextMenu->Go(global, true, false, true);
@ -2589,45 +2589,45 @@ BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref *ref, BView *)
showAsVolume = true; showAsVolume = true;
} else } else
fContextMenu = fFileContextMenu; fContextMenu = fFileContextMenu;
// clean up items from last context menu // clean up items from last context menu
if (fContextMenu) { if (fContextMenu) {
if (fContextMenu->Window()) if (fContextMenu->Window())
return; return;
else else
MenusEnded(); MenusEnded();
if (model.InitCheck() == B_OK) { // ??? Do I need this ??? if (model.InitCheck() == B_OK) { // ??? Do I need this ???
if (showAsVolume) { if (showAsVolume) {
// non-volume enable/disable copy, move, identify // non-volume enable/disable copy, move, identify
EnableNamedMenuItem(fContextMenu, kDuplicateSelection, false); EnableNamedMenuItem(fContextMenu, kDuplicateSelection, false);
EnableNamedMenuItem(fContextMenu, kMoveToTrash, false); EnableNamedMenuItem(fContextMenu, kMoveToTrash, false);
EnableNamedMenuItem(fContextMenu, kIdentifyEntry, false); EnableNamedMenuItem(fContextMenu, kIdentifyEntry, false);
// volume model, enable/disable the Unmount item // volume model, enable/disable the Unmount item
bool ejectableVolumeSelected = false; bool ejectableVolumeSelected = false;
BVolume boot; BVolume boot;
BVolumeRoster().GetBootVolume(&boot); BVolumeRoster().GetBootVolume(&boot);
BVolume volume; BVolume volume;
volume.SetTo(model.NodeRef()->device); volume.SetTo(model.NodeRef()->device);
if (volume != boot) if (volume != boot)
ejectableVolumeSelected = true; ejectableVolumeSelected = true;
EnableNamedMenuItem(fContextMenu, EnableNamedMenuItem(fContextMenu,
B_TRANSLATE("Unmount"), ejectableVolumeSelected); B_TRANSLATE("Unmount"), ejectableVolumeSelected);
} }
} }
SetupNavigationMenu(ref, fContextMenu); SetupNavigationMenu(ref, fContextMenu);
if (!showAsVolume && !filePanel) { if (!showAsVolume && !filePanel) {
SetupMoveCopyMenus(ref, fContextMenu); SetupMoveCopyMenus(ref, fContextMenu);
SetupOpenWithMenu(fContextMenu); SetupOpenWithMenu(fContextMenu);
} }
UpdateMenu(fContextMenu, kPosePopUpContext); UpdateMenu(fContextMenu, kPosePopUpContext);
fContextMenu->Go(global, true, true, true); fContextMenu->Go(global, true, true, true);
} }
} }
@ -3917,6 +3917,8 @@ BContainerWindow::SetSingleWindowBrowseShortcuts(bool enabled)
new BMessage(kNavigatorCommandForward), Navigator()); new BMessage(kNavigatorCommandForward), Navigator());
AddShortcut(B_UP_ARROW, B_OPTION_KEY | B_COMMAND_KEY, AddShortcut(B_UP_ARROW, B_OPTION_KEY | B_COMMAND_KEY,
new BMessage(kNavigatorCommandUp), Navigator()); new BMessage(kNavigatorCommandUp), Navigator());
AddShortcut(B_DOWN_ARROW, B_OPTION_KEY | B_COMMAND_KEY,
new BMessage(kOpenSelection), PoseView());
} else { } else {
RemoveShortcut(B_LEFT_ARROW, B_COMMAND_KEY); RemoveShortcut(B_LEFT_ARROW, B_COMMAND_KEY);
@ -3927,6 +3929,7 @@ BContainerWindow::SetSingleWindowBrowseShortcuts(bool enabled)
RemoveShortcut(B_LEFT_ARROW, B_OPTION_KEY | B_COMMAND_KEY); RemoveShortcut(B_LEFT_ARROW, B_OPTION_KEY | B_COMMAND_KEY);
RemoveShortcut(B_RIGHT_ARROW, B_OPTION_KEY | B_COMMAND_KEY); RemoveShortcut(B_RIGHT_ARROW, B_OPTION_KEY | B_COMMAND_KEY);
RemoveShortcut(B_UP_ARROW, B_OPTION_KEY | B_COMMAND_KEY); RemoveShortcut(B_UP_ARROW, B_OPTION_KEY | B_COMMAND_KEY);
RemoveShortcut(B_DOWN_ARROW, B_COMMAND_KEY | B_OPTION_KEY);
// This also changes meaning, added again below. // This also changes meaning, added again below.
AddShortcut(B_DOWN_ARROW, B_COMMAND_KEY | B_OPTION_KEY, AddShortcut(B_DOWN_ARROW, B_COMMAND_KEY | B_OPTION_KEY,