void URLView::MouseUp( BPoint point ) { // If the link isn't enabled, don't do anything. if( !IsEnabled() ) return; // Do we want to show the right-click menu? if( inPopup && GetTextRect().Contains( point ) ) { BPopUpMenu *popup = CreatePopupMenu(); // Work around a current bug in Be's popup menus. point.y = point.y - 6; // Display the popup menu. BMenuItem *selected = popup->Go( ConvertToScreen( point ) , false, true ); // Did the user select an item? if( selected ) { BString label( selected->Label() ); // Did the user select the first item? If so, launch the URL. if( label.FindFirst( "Open" ) != B_ERROR || label.FindFirst( "Send" ) != B_ERROR || label.FindFirst( "Connect" ) != B_ERROR ) { LaunchURL(); } // Did the user select the second item? else if( label.FindFirst( "Copy" ) != B_ERROR ) { CopyToClipboard(); } } // If not, restore the normal link color. else { SetHighColor( color ); Redraw(); } } // If the link was clicked on (and not dragged), run the program // that should handle the URL. if( selected && GetTextRect().Contains( point ) && !draggedOut && !inPopup ) { LaunchURL(); } selected = false; draggedOut = false; inPopup = false; // Should we restore the hovering-highlighted color or the original // link color? if( GetTextRect().Contains( point ) && !draggedOut && !inPopup && hoverEnabled ) { SetHighColor( hoverColor ); } else if( !hovering ) SetHighColor( color ); Redraw(); }
HRESULT HandleNoRights( HRESULT hrStatus, WCHAR *wszChallengeURL) { USES_CONVERSION; HRESULT hr = S_OK; LPWSTR pszEscapedURL = NULL; WCHAR pszURL[MAX_PATH]; if( NULL == wszChallengeURL ) { return E_INVALIDARG; } if( FAILED( hrStatus ) ) { Msg(TEXT("Unable to obtain proper license!! (hrStatus = 0x%x) Aborting playback...\r\n"), hrStatus); return hr; } // Convert filename to wide character string wcsncpy(pszURL, T2W(g_szFileName), NUMELMS(pszURL)-1); pszURL[MAX_PATH-1] = 0; hr = MakeEscapedURL(pszURL, &pszEscapedURL); if( SUCCEEDED(hr) ) { WCHAR szURL[ 0x1000 ]; BSTR bstrChallengeURL = SysAllocString(wszChallengeURL); if (!bstrChallengeURL) return E_OUTOFMEMORY; swprintf(szURL, L"%s&filename=%s&embedded=false", bstrChallengeURL, pszEscapedURL); hr = LaunchURL(szURL); if( FAILED(hr)) { Msg(TEXT("Unable to launch web browser to retrieve playback license (err = %#X)\n"), hr); } delete [] pszEscapedURL; SysFreeString(bstrChallengeURL); } return hr; }
void UILogin::on_btnRegister_clicked() { LaunchURL( WWW_HOST_REGISTER_URL ); }