Ticket #3385: trackersinglewindownavpatch.diff
File trackersinglewindownavpatch.diff, 11.2 KB (added by , 14 years ago) |
---|
-
VolumeWindow.cpp
61 61 if (!fMenuBar) 62 62 return; 63 63 64 BVolume boot;65 BVolumeRoster().GetBootVolume(&boot);66 67 bool ejectableVolumeSelected = false;68 69 int32 count = PoseView()->SelectionList()->CountItems();70 for (int32 index = 0; index < count; index++) {71 Model *model = PoseView()->SelectionList()->ItemAt(index)->TargetModel();72 if (model->IsVolume()) {73 BVolume volume;74 volume.SetTo(model->NodeRef()->device);75 if (volume != boot) {76 ejectableVolumeSelected = true;77 break;78 }79 }80 }81 82 BMenuItem *item = fMenuBar->FindItem("Unmount");83 if (item)84 item->SetEnabled(ejectableVolumeSelected);85 64 } 86 65 87 66 -
PoseView.cpp
7897 7897 7898 7898 7899 7899 void 7900 BPoseView::OpenParent() 7900 BPoseView::OpenParent() 7901 7901 { 7902 if (!TargetModel() || TargetModel()->IsRoot() || IsDesktopWindow())7902 if (!TargetModel() || IsDesktopWindow() || TargetModel()->IsRoot() ) 7903 7903 return; 7904 7904 7905 7905 BEntry entry(TargetModel()->EntryRef()); … … 7911 7911 || entry.GetRef(&ref) != B_OK) 7912 7912 return; 7913 7913 7914 BEntry root("/"); 7914 // this fuctionality, if desired, is incomplete. 7915 // blocks move a 'up' to root "/" if Disks Icon not on Desktop 7916 // however, related parts of code also need updating to support this behavior. 7917 /* BEntry root("/"); 7915 7918 if (!TrackerSettings().ShowDisksIcon() && entry == root 7916 7919 && (modifiers() & B_CONTROL_KEY) == 0) 7917 7920 return; 7918 7921 */ 7919 7922 Model parentModel(&ref); 7920 7923 7921 7924 BMessage message(B_REFS_RECEIVED); 7922 7925 message.AddRef("refs", &ref); 7923 7926 7924 if (dynamic_cast<TTracker *>(be_app)) { 7925 // add information about the child, so that we can select it 7926 // in the parent view 7927 message.AddData("nodeRefToSelect", B_RAW_TYPE, TargetModel()->NodeRef(), 7928 sizeof (node_ref)); 7929 7930 if ((modifiers() & B_OPTION_KEY) != 0 && !IsFilePanel()) 7931 // if option down, add instructions to close the parent 7932 message.AddData("nodeRefsToClose", B_RAW_TYPE, TargetModel()->NodeRef(), 7927 if (!ContainerWindow()->Navigator()){ 7928 if (dynamic_cast<TTracker *>(be_app)) { 7929 // add information about the child, so that we can select it 7930 // in the parent view 7931 message.AddData("nodeRefToSelect", B_RAW_TYPE, TargetModel()->NodeRef(), 7933 7932 sizeof (node_ref)); 7933 7934 if ((modifiers() & B_OPTION_KEY) != 0 && !IsFilePanel()) 7935 // if option down, add instructions to close the parent 7936 message.AddData("nodeRefsToClose", B_RAW_TYPE, TargetModel()->NodeRef(), 7937 sizeof (node_ref)); 7938 } 7939 7940 be_app->PostMessage(&message); 7934 7941 } 7935 7936 be_app->PostMessage(&message); 7942 else { 7943 message.what = kSwitchDirectory; 7944 Window()->PostMessage(&message); 7945 UnlockLooper(); 7946 if (TargetModel()->NodeRef()) 7947 dynamic_cast<TTracker *>(be_app)->SelectChildInParentSoon(&ref, TargetModel()->NodeRef()); 7948 LockLooper(); 7949 } 7937 7950 } 7938 7951 7939 7952 -
ContainerWindow.cpp
353 353 return; 354 354 355 355 // we don't like the Trash icon (because it cannot be moved) 356 if (window->IsTrash() || window->IsPrintersDir() )356 if (window->IsTrash() || window->IsPrintersDir() || window->TargetModel()->IsRoot()) 357 357 return; 358 358 359 359 uint32 buttons; … … 746 746 fIsTrash = model->IsTrash(); 747 747 fInTrash = FSInTrashDir(model->EntryRef()); 748 748 fIsPrinters = FSIsPrintersDir(&entry); 749 749 750 } 750 751 } 751 752 … … 927 928 fPoseView->VScrollBar()->ResizeBy(0, -(KeyMenuBar()->Bounds().Height())); 928 929 } 929 930 930 // add folder icon to menu bar 931 if (!TargetModel()->IsRoot() && !IsTrash()) { 931 if (!TargetModel()->IsRoot() && !IsTrash()) { 932 932 float iconSize = fMenuBar->Bounds().Height() - 2; 933 933 if (iconSize < 16) 934 934 iconSize = 16; … … 1062 1062 1063 1063 if (Navigator()) 1064 1064 Navigator()->UpdateLocation(PoseView()->TargetModel(), kActionUpdatePath); 1065 1065 1066 } 1066 1067 1067 1068 … … 1511 1512 1512 1513 if (wasInTrash ^ (IsTrash() || InTrash()) 1513 1514 || isRoot != PoseView()->TargetModel()->IsRoot()) 1514 RepopulateMenus(); 1515 RepopulateMenus(); 1515 1516 1516 1517 // Update Navigation bar 1517 1518 if (Navigator()) { … … 1529 1530 SetPathWatchingEnabled(true); 1530 1531 1531 1532 // Update draggable folder icon 1532 BView *view = FindView("MenuBar"); 1533 if (view != NULL) { 1534 view = view->FindView("ThisContainer"); 1535 if (view != NULL) { 1533 BView *fMenuBar = FindView("MenuBar"); 1534 1535 if ((fMenuBar != NULL) && (!TargetModel()->IsRoot() && !IsTrash())) { 1536 BView *view = fMenuBar->FindView("ThisContainer"); 1537 1538 if (view != NULL) { 1536 1539 IconCache::sIconCache->IconChanged(TargetModel()); 1537 1540 view->Invalidate(); 1538 1541 } 1539 } 1540 1542 else if (!TargetModel()->IsRoot() && !IsTrash()) { 1543 float iconSize = fMenuBar->Bounds().Height() - 2; 1544 if (iconSize < 16) 1545 iconSize = 16; 1546 float iconPosY = 1 + (fMenuBar->Bounds().Height() - 2 - iconSize) / 2; 1547 BView *icon = new DraggableContainerIcon(BRect(Bounds().Width() - 4 - iconSize + 1, 1548 iconPosY, Bounds().Width() - 4, iconPosY + iconSize - 1), 1549 "ThisContainer", B_FOLLOW_RIGHT); 1550 fMenuBar->AddChild(icon); 1551 1552 view = fMenuBar->FindView("ThisContainer"); 1553 if (view != NULL) { 1554 IconCache::sIconCache->IconChanged(TargetModel()); 1555 view->Invalidate(); 1556 } 1557 } 1558 } 1559 else { 1560 BView *view = fMenuBar->FindView("ThisContainer"); 1561 if (view != NULL) { 1562 view->RemoveSelf(); 1563 fMenuBar->Invalidate(); 1564 } 1565 } 1541 1566 // Update window title 1542 1567 UpdateTitle(); 1543 1568 } … … 1553 1578 // 1554 1579 entry_ref ref; 1555 1580 if (message->FindRef("refs", &ref) == B_OK) { 1556 //printf("BContainerWindow::MessageReceived - refs received\n");1557 1581 fWaitingForRefs = false; 1558 1582 BEntry entry(&ref, true); 1559 1583 // … … 1821 1845 if (!PoseView()->IsFilePanel()) 1822 1846 menu->AddItem(new BMenuItem("Find"B_UTF8_ELLIPSIS, 1823 1847 new BMessage(kFindButton), 'F')); 1824 1825 if (!TargetModel()->IsQuery() && !IsTrash() && !IsPrintersDir() ) {1848 1849 if (!TargetModel()->IsQuery() && !IsTrash() && !IsPrintersDir() && !TargetModel()->IsRoot()) { 1826 1850 if (!PoseView()->IsFilePanel()) { 1827 1851 TemplatesMenu *templateMenu = new TemplatesMenu(PoseView()); 1828 1852 menu->AddItem(templateMenu); … … 1849 1873 menu->AddItem(new BSeparatorItem(), 1); 1850 1874 menu->AddItem(new BMenuItem("Make active printer", 1851 1875 new BMessage(kMakeActivePrinter))); 1852 } else { 1876 } else if (TargetModel()->IsRoot()) { 1877 menu->AddItem(new BMenuItem("Unmount", new BMessage(kUnmountVolume), 'U')); 1878 menu->AddItem(new BMenuItem("Mount settings" B_UTF8_ELLIPSIS, new BMessage(kRunAutomounterSettings))); 1879 1880 } else { 1853 1881 menu->AddItem(new BMenuItem("Duplicate",new BMessage(kDuplicateSelection), 'D')); 1854 1882 1855 1883 menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash() ? … … 1857 1885 new BMessage(kMoveToTrash), 'T')); 1858 1886 1859 1887 menu->AddSeparatorItem(); 1860 1861 // The "Move To", "Copy To", "Create Link" menus are inserted 1862 // at this place, have a look at: 1863 // BContainerWindow::SetupMoveCopyMenus() 1888 1864 1889 } 1865 1866 1890 BMenuItem *cutItem = NULL, *copyItem = NULL, *pasteItem = NULL; 1867 if (!IsPrintersDir() ) {1891 if (!IsPrintersDir() && !TargetModel()->IsRoot()) { 1868 1892 menu->AddSeparatorItem(); 1869 1893 1870 1894 menu->AddItem(cutItem = new BMenuItem("Cut", new BMessage(B_CUT), 'X')); 1871 1895 menu->AddItem(copyItem = new BMenuItem("Copy", new BMessage(B_COPY), 'C')); 1872 1896 menu->AddItem(pasteItem = new BMenuItem("Paste", new BMessage(B_PASTE), 'V')); 1873 1897 } 1874 1898 menu->AddSeparatorItem(); 1875 1899 1900 if (!IsPrintersDir() && !TargetModel()->IsRoot()) { 1876 1901 menu->AddItem(new BMenuItem("Identify", new BMessage(kIdentifyEntry))); 1902 } 1903 1904 if (!IsPrintersDir()) { 1877 1905 BMenu *addOnMenuItem = new BMenu(kAddOnsMenuName); 1878 1906 addOnMenuItem->SetFont(be_plain_font); 1879 1907 menu->AddItem(addOnMenuItem); … … 1886 1914 copyItem->SetTarget(this); 1887 1915 if (pasteItem) 1888 1916 pasteItem->SetTarget(this); 1917 1889 1918 } 1890 1919 1891 1920 … … 1972 2001 item->SetTarget(PoseView()); 1973 2002 menu->AddItem(item); 1974 2003 1975 if (!IsTrash()) {2004 // if (!IsTrash()) { 1976 2005 item = new BMenuItem("Open parent", new BMessage(kOpenParentDir), 1977 2006 B_UP_ARROW); 1978 2007 item->SetTarget(PoseView()); 1979 2008 menu->AddItem(item); 1980 }2009 // } 1981 2010 1982 2011 item = new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED), 'W'); 1983 2012 item->SetTarget(this); … … 2052 2081 2053 2082 if (IsPrintersDir()) 2054 2083 EnableNamedMenuItem(fFileMenu, "Make active printer", selectCount == 1); 2084 2085 if (TargetModel()->IsRoot()) { 2086 2087 BVolume boot; 2088 BVolumeRoster().GetBootVolume(&boot); 2089 2090 bool ejectableVolumeSelected = false; 2091 2092 int32 count = PoseView()->SelectionList()->CountItems(); 2093 for (int32 index = 0; index < count; index++) { 2094 Model *model = PoseView()->SelectionList()->ItemAt(index)->TargetModel(); 2095 if (model->IsVolume()) { 2096 BVolume volume; 2097 volume.SetTo(model->NodeRef()->device); 2098 if (volume != boot) { 2099 ejectableVolumeSelected = true; 2100 break; 2101 } 2102 } 2103 } 2104 2105 BMenuItem *item = fMenuBar->FindItem("Unmount"); 2106 if (item) 2107 item->SetEnabled(ejectableVolumeSelected); 2108 } 2109 2055 2110 } 2056 2111 2057 2112 … … 2337 2392 void 2338 2393 BContainerWindow::SetupMoveCopyMenus(const entry_ref *item_ref, BMenu *parent) 2339 2394 { 2340 if (IsTrash() || InTrash() || IsPrintersDir() || !fMoveToItem || !fCopyToItem || !fCreateLinkItem )2341 return; 2395 if (IsTrash() || InTrash() || IsPrintersDir() || !fMoveToItem || !fCopyToItem || !fCreateLinkItem || PoseView()->TargetModel()->IsRoot()) 2396 return; 2342 2397 2343 2398 // Grab the modifiers state since we use it twice 2344 2399 uint32 modifierKeys = modifiers(); … … 2513 2568 // see the notes in SlowContextPopup::AttachedToWindow 2514 2569 2515 2570 if (!FSIsPrintersDir(&entry) && !fDragContextMenu->IsShowing()) { 2516 // printf("ShowContextMenu - target is %s %i\n", ref->name, IsShowing(ref));2517 2571 fDragContextMenu->ClearMenu(); 2518 2572 2519 2573 // in case the ref is a symlink, resolve it … … 2611 2665 menu->AddItem(new BMenuItem("Get info", new BMessage(kGetInfo), 'I')); 2612 2666 menu->AddItem(new BMenuItem("Edit name", new BMessage(kEditItem), 'E')); 2613 2667 2614 if (!IsTrash() && !InTrash() && !IsPrintersDir() )2668 if (!IsTrash() && !InTrash() && !IsPrintersDir() && !TargetModel()->IsRoot()) 2615 2669 menu->AddItem(new BMenuItem("Duplicate", 2616 2670 new BMessage(kDuplicateSelection), 'D')); 2617 2671 2618 if (!IsTrash() && !InTrash() ) {2672 if (!IsTrash() && !InTrash() && !TargetModel()->IsRoot()) { 2619 2673 menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash() ? 2620 2674 "Delete" : "Move to Trash", 2621 2675 new BMessage(kMoveToTrash), 'T')); -
Tracker.cpp
884 884 // clone the message, window adopts it for it's own use 885 885 refList = new BMessage(*originalRefsList); 886 886 window = new OpenWithContainerWindow(refList, &fWindowList); 887 } else if (model->IsRoot()) {888 // window will adopt the model889 window = new BVolumeWindow(&fWindowList, openFlags);890 887 } else if (model->IsQuery()) { 891 888 // window will adopt the model 892 889 window = new BQueryContainerWindow(&fWindowList, openFlags);