diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp index 6ebb5d9b34..19dc0d557e 100644 --- a/src/kits/tracker/ContainerWindow.cpp +++ b/src/kits/tracker/ContainerWindow.cpp @@ -1864,7 +1864,7 @@ BContainerWindow::SetCutItem(BMenu* menu) item->SetEnabled(false); } else { item->SetEnabled(PoseView()->CountSelected() > 0 - && !PoseView()->TargetVolumeIsReadOnly()); + && !PoseView()->SelectedVolumeIsReadOnly()); } } @@ -2710,7 +2710,7 @@ BContainerWindow::SetupMoveCopyMenus(const entry_ref* item_ref, BMenu* parent) } fMoveToItem->SetEnabled(PoseView()->CountSelected() > 0 - && !PoseView()->TargetVolumeIsReadOnly()); + && !PoseView()->SelectedVolumeIsReadOnly()); fCopyToItem->SetEnabled(PoseView()->CountSelected() > 0); fCreateLinkItem->SetEnabled(PoseView()->CountSelected() > 0); @@ -2758,7 +2758,7 @@ BContainerWindow::ShowDropContextMenu(BPoint where, BPoseView* source) break; if (item->Command() == kMoveSelectionTo && source != NULL) { - item->SetEnabled(!source->TargetVolumeIsReadOnly() + item->SetEnabled(!source->SelectedVolumeIsReadOnly() && !PoseView()->TargetVolumeIsReadOnly()); } else item->SetEnabled(!PoseView()->TargetVolumeIsReadOnly()); diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index afce345cc4..fab030fb17 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -8865,9 +8865,38 @@ bool BPoseView::SelectedVolumeIsReadOnly() const { BVolume volume; - BPose* firstPose = fSelectionList->FirstItem(); - if (firstPose != NULL) - volume.SetTo(firstPose->TargetModel()->NodeRef()->device); + BEntry entry; + BNode parent; + node_ref nref; + int32 selectCount = fSelectionList->CountItems(); + + if (selectCount > 1 && TargetModel()->IsQuery()) { + // multiple items selected in query, consider the whole selection + // to be read-only if any item's volume is read-only + for (int32 i = 0; i < selectCount; i++) { + BPose* pose = fSelectionList->ItemAt(i); + if (pose == NULL || pose->TargetModel() == NULL) + continue; + + entry.SetTo(pose->TargetModel()->EntryRef()); + if (FSGetParentVirtualDirectoryAware(entry, parent) == B_OK) { + parent.GetNodeRef(&nref); + volume.SetTo(nref.device); + if (volume.InitCheck() == B_OK && volume.IsReadOnly()) + return true; + } + } + } else if (selectCount > 0) { + // only check first item's volume, assume rest are the same + entry.SetTo(fSelectionList->FirstItem()->TargetModel()->EntryRef()); + if (FSGetParentVirtualDirectoryAware(entry, parent) == B_OK) { + parent.GetNodeRef(&nref); + volume.SetTo(nref.device); + } + } else { + // no items selected, check target volume instead + volume.SetTo(TargetModel()->NodeRef()->device); + } return volume.InitCheck() == B_OK && volume.IsReadOnly(); } @@ -8877,8 +8906,7 @@ bool BPoseView::TargetVolumeIsReadOnly() const { Model* target = TargetModel(); - BVolume volume; - volume.SetTo(target->NodeRef()->device); + BVolume volume(target->NodeRef()->device); return target->IsQuery() || target->IsQueryTemplate() || target->IsVirtualDirectory() diff --git a/src/kits/tracker/TextWidget.cpp b/src/kits/tracker/TextWidget.cpp index 514ee80fb4..6a8a7025e0 100644 --- a/src/kits/tracker/TextWidget.cpp +++ b/src/kits/tracker/TextWidget.cpp @@ -456,7 +456,7 @@ BTextWidget::StartEdit(BRect bounds, BPoseView* view, BPose* pose) textView->AddFilter(new BMessageFilter(B_KEY_DOWN, TextViewKeyDownFilter)); - if (view->TargetVolumeIsReadOnly()) { + if (view->SelectedVolumeIsReadOnly()) { textView->MakeEditable(false); textView->MakeSelectable(true); } else