void OpenWithPoseView::OpenSelection(BPose *pose, int32 *) { OpenWithContainerWindow *window = ContainerWindow(); int32 count = fSelectionList->CountItems(); if (!count) return; if (!pose) pose = fSelectionList->FirstItem(); ASSERT(pose); BEntry entry(pose->TargetModel()->EntryRef()); if (entry.InitCheck() != B_OK) { BString errorString; errorString << "Could not find application \"" << pose->TargetModel()->Name() << "\""; (new BAlert("", errorString.String(), "OK", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); return; } if (OpenWithRelation(pose->TargetModel()) == kNoRelation) { if (!fIterator->GenericFilesOnly()) { BString warning; warning << "The application \"" << pose->TargetModel()->Name() << "\" does not support the type of document you are " "about to open. Are you sure you want to proceed? If you know that " "the application supports the document type, you should contact the " "publisher of the application and ask them to update their application " "to list the type of your document as supported."; if ((new BAlert("", warning.String(), "Cancel", "Open", 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go() == 0) return; } // else - once we have an extensible sniffer, tell users to ask // publishers to fix up sniffers } BMessage message(*window->EntryList()); // make a clone to send message.RemoveName("launchUsingSelector"); // make sure the old selector is not in the message message.AddRef("handler", pose->TargetModel()->EntryRef()); // add ref of the selected handler ASSERT(fSelectionHandler); if (fSelectionHandler) fSelectionHandler->PostMessage(&message); window->PostMessage(B_QUIT_REQUESTED); }
void OpenWithPoseView::OpenSelection(BPose* pose, int32*) { OpenWithContainerWindow* window = ContainerWindow(); int32 count = fSelectionList->CountItems(); if (count == 0) return; if (pose == NULL) pose = fSelectionList->FirstItem(); ASSERT(pose != NULL); BEntry entry(pose->TargetModel()->EntryRef()); if (entry.InitCheck() != B_OK) { BString errorString( B_TRANSLATE("Could not find application \"%appname\"")); errorString.ReplaceFirst("%appname", pose->TargetModel()->Name()); BAlert* alert = new BAlert("", errorString.String(), B_TRANSLATE("OK"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return; } if (OpenWithRelation(pose->TargetModel()) == kNoRelation) { if (!fIterator->GenericFilesOnly()) { BString warning(B_TRANSLATE( "The application \"%appname\" does not support the type of " "document you are about to open.\nAre you sure you want to " "proceed?\n\nIf you know that the application supports the " "document type, you should contact the publisher of the " "application and ask them to update their application to list " "the type of your document as supported.")); warning.ReplaceFirst("%appname", pose->TargetModel()->Name()); BAlert* alert = new BAlert("", warning.String(), B_TRANSLATE("Cancel"), B_TRANSLATE("Open"), 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->SetShortcut(0, B_ESCAPE); if (alert->Go() == 0) return; } // else - once we have an extensible sniffer, tell users to ask // publishers to fix up sniffers } BMessage message(*window->EntryList()); // make a clone to send message.RemoveName("launchUsingSelector"); // make sure the old selector is not in the message message.AddRef("handler", pose->TargetModel()->EntryRef()); // add ref of the selected handler ASSERT(fSelectionHandler != NULL); if (fSelectionHandler != NULL) fSelectionHandler->PostMessage(&message); window->PostMessage(B_QUIT_REQUESTED); }