/* * Copyright 2004 Perforce Software. All rights reserved. * * Developed by Data Shades Ltd. */ #include "PasswordDialog.h" PasswordDialog::PasswordDialog( PluginOperations *ops, const TCHAR *user, const TCHAR *port ) : Dialog( ops, IDD_PASSWORD_DIALOG, DialogWndProc ), password( NULL ) { this->user = user; this->port = port; } PasswordDialog::~PasswordDialog() { if ( password != NULL ) { delete []password; } } BOOL CALLBACK PasswordDialog::DialogWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { HWND userPort = GetDlgItem( hWnd, IDC_USER_PORT_TEXT1 ); HWND passwordEdit = GetDlgItem( hWnd, IDC_PASSWORD_EDIT ); switch(uMsg) { case WM_INITDIALOG: { PasswordDialog *dialog = ( PasswordDialog * )lParam; SaveDialogObject( hWnd, dialog ); UniStrBuf buff; buff.Set( _T("A password is required for user '") ); buff.Append( dialog->GetUser() ); buff.Append( _T("' on server '") ); buff.Append( dialog->GetPort() ); buff.Append( _T("'.") ); SetWindowText( userPort, buff.Text() ); SetFocus( passwordEdit ); Centre( hWnd ); return true; break; } case WM_COMMAND: switch ( LOWORD( wParam ) ) { case IDOK: { PasswordDialog *dialog = ( PasswordDialog * )DialogObject( hWnd ); int len = SendMessage( passwordEdit, WM_GETTEXTLENGTH, 0, 0 ) + 1; TCHAR *text = new TCHAR[ len ]; GetWindowText( passwordEdit, text, len ); dialog->SetPassword( text ); EndDialog( hWnd, TRUE ); return true; } case IDCANCEL: EndDialog( hWnd, FALSE ); return true; } } return false; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 11314 | Robert Cowham | Initial population of perforce_software version of P4OFC | ||
//guest/robert_cowham/perforce/P4OFC/main/libp4gt/PasswordDialog.cpp | |||||
#1 | 10843 | Robert Cowham |
Initial version of P4OFC source code. See README.txt (and LICENSE.txt and doc\P4OFC-Design.docx) |