void TFilePanel::OpenParent() { if (!CanOpenParent()) return; BEntry parentEntry; BDirectory dir; Model oldModel(*PoseView()->TargetModel()); BEntry entry(oldModel.EntryRef()); if (entry.InitCheck() == B_OK && entry.GetParent(&dir) == B_OK && dir.GetEntry(&parentEntry) == B_OK && entry != parentEntry) { entry_ref ref; parentEntry.GetRef(&ref); PoseView()->SetIsDesktop(SwitchDirToDesktopIfNeeded(ref)); PoseView()->SwitchDir(&ref); SwitchDirMenuTo(&ref); // make sure the child get's selected in the new view once it // shows up fTaskLoop->RunLater(NewMemberFunctionObjectWithResult (&TFilePanel::SelectChildInParent, this, const_cast<const entry_ref*>(&ref), oldModel.NodeRef()), 100000, 200000, 5000000); } }
void TTracker::CloseParentWaitingForChildSoon(const entry_ref *child, const node_ref *parent) { fTaskLoop->RunLater(NewMemberFunctionObjectWithResult (&TTracker::CloseParentWaitingForChild, this, child, parent), 200000, 100000, 5000000); }
void TTracker::SelectChildInParentSoon(const entry_ref *parent, const node_ref *child) { fTaskLoop->RunLater(NewMemberFunctionObjectWithResult (&TTracker::SelectChildInParent, this, parent, child), 100000, 200000, 5000000); }
filter_result TFilePanel::MessageDropFilter(BMessage* message, BHandler**, BMessageFilter* filter) { if (message == NULL || !message->WasDropped()) return B_DISPATCH_MESSAGE; ASSERT(filter != NULL); if (filter == NULL) return B_DISPATCH_MESSAGE; TFilePanel* panel = dynamic_cast<TFilePanel*>(filter->Looper()); ASSERT(panel != NULL); if (panel == NULL) return B_DISPATCH_MESSAGE; uint32 type; int32 count; if (message->GetInfo("refs", &type, &count) != B_OK) return B_SKIP_MESSAGE; if (count != 1) return B_SKIP_MESSAGE; entry_ref ref; if (message->FindRef("refs", &ref) != B_OK) return B_SKIP_MESSAGE; BEntry entry(&ref); if (entry.InitCheck() != B_OK) return B_SKIP_MESSAGE; // if the entry is a symlink // resolve it and see if it is a directory // pass it on if it is if (entry.IsSymLink()) { entry_ref resolvedRef; entry.GetRef(&resolvedRef); BEntry resolvedEntry(&resolvedRef, true); if (resolvedEntry.IsDirectory()) { // both entry and ref need to be the correct locations // for the last setto resolvedEntry.GetRef(&ref); entry.SetTo(&ref); } } // if not a directory, set to the parent, and select the child if (!entry.IsDirectory()) { node_ref child; if (entry.GetNodeRef(&child) != B_OK) return B_SKIP_MESSAGE; BPath path(&entry); if (entry.GetParent(&entry) != B_OK) return B_SKIP_MESSAGE; entry.GetRef(&ref); panel->fTaskLoop->RunLater(NewMemberFunctionObjectWithResult (&TFilePanel::SelectChildInParent, panel, const_cast<const entry_ref*>(&ref), const_cast<const node_ref*>(&child)), ref == *panel->TargetModel()->EntryRef() ? 0 : 100000, 200000, 5000000); // if the target directory is already current, we won't // delay the initial selection try // also set the save name to the dragged in entry if (panel->IsSavePanel()) panel->SetSaveText(path.Leaf()); } panel->SetTo(&ref); return B_SKIP_MESSAGE; }