Пример #1
0
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;
}
Пример #2
0
 virtual void StartTestCase( const TestCaseInfo& testInfo ) {
     openLabel( recordTestCases, testInfo.getName()  );
 }
Пример #3
0
 virtual void StartSection( const std::string& sectionName, const std::string& ) {
     openLabel( recordSections, sectionName );
 }
Пример #4
0
 virtual void StartGroup( const std::string& groupName ) {
     openLabel( recordGroups, groupName );
 }