void OpenWithContainerWindow::MakeDefaultAndOpen() { int32 count = PoseView()->SelectionList()->CountItems(); ASSERT(count == 1); if (count == 0) return; BPose* selectedAppPose = PoseView()->SelectionList()->FirstItem(); ASSERT(selectedAppPose != NULL); if (selectedAppPose == NULL) return; // collect all the types of all the opened documents into a list BObjectList<BString> openedFileTypes(10, true); EachEntryRef(EntryList(), AddOneUniqueDocumentType, &openedFileTypes, 100); // set the default application to be the selected pose for all the // mime types in the list openedFileTypes.EachElement(SetDefaultAppForOneType, (void*)selectedAppPose->TargetModel()->EntryRef()); // done setting the default application, now launch the app with the // documents OpenWithSelection(); }
void OpenWithContainerWindow::MessageReceived(BMessage* message) { switch (message->what) { case kDefaultButton: OpenWithSelection(); PostMessage(B_QUIT_REQUESTED); return; case kOpenAndMakeDefault: MakeDefaultAndOpen(); PostMessage(B_QUIT_REQUESTED); return; case kCancelButton: PostMessage(B_QUIT_REQUESTED); return; case B_OBSERVER_NOTICE_CHANGE: return; case kResizeToFit: ResizeToFit(); break; } _inherited::MessageReceived(message); }
void OpenWithContainerWindow::MessageReceived(BMessage *message) { switch (message->what) { case kDefaultButton: OpenWithSelection(); PostMessage(B_QUIT_REQUESTED); return; case kOpenAndMakeDefault: MakeDefaultAndOpen(); PostMessage(B_QUIT_REQUESTED); return; case kCancelButton: PostMessage(B_QUIT_REQUESTED); return; } _inherited::MessageReceived(message); }