BPopUpMenu * URLView::CreatePopupMenu() { // Create the right-click popup menu. BPopUpMenu *returnMe = new BPopUpMenu( "URLView Popup", false, false ); returnMe->SetAsyncAutoDestruct( true ); entry_ref app; // Set the text of the first item according to the link type. if( IsEmailLink() ) { // Find the name of the default e-mail client. if( be_roster->FindApp( "text/x-email", &app ) == B_OK ) { BEntry entry( &app ); BString openLabel( _T("Send e-mail to this address using ") ); char name[B_FILE_NAME_LENGTH]; entry.GetName( name ); openLabel.Append( name ); returnMe->AddItem( new BMenuItem( openLabel.String(), NULL ) ); } } else if( IsFTPLink() ) { // Find the name of the default FTP client. if( be_roster->FindApp( "application/x-vnd.Be.URL.ftp", &app ) == B_OK ) { BEntry entry( &app ); BString openLabel( _T("Connect to this server using ") ); char name[B_FILE_NAME_LENGTH]; entry.GetName( name ); openLabel.Append( name ); returnMe->AddItem( new BMenuItem( openLabel.String(), NULL ) ); } } else { // Find the name of the default HTML handler (browser). if( be_roster->FindApp( "text/html", &app ) == B_OK ) { BEntry entry( &app ); BString openLabel( _T("Open this link using ") ); char name[B_FILE_NAME_LENGTH]; entry.GetName( name ); openLabel.Append( name ); returnMe->AddItem( new BMenuItem( openLabel.String(), NULL ) ); } } returnMe->AddItem( new BMenuItem( _T("Copy this link to the clipboard"), NULL ) ); return returnMe; }
virtual void StartTestCase( const TestCaseInfo& testInfo ) { openLabel( recordTestCases, testInfo.getName() ); }
virtual void StartSection( const std::string& sectionName, const std::string& ) { openLabel( recordSections, sectionName ); }
virtual void StartGroup( const std::string& groupName ) { openLabel( recordGroups, groupName ); }