No need to explicitly initialize CString and use Empty() for clearing CString
[TortoiseGit.git] / src / TortoiseProc / UserPassword.cpp
blobafc1f298360ef06447fdc43dae9f6f802b814137
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2013, 2015 - TortoiseGit
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // UserPassword.cpp : implementation file
21 #include "stdafx.h"
22 #include "resource.h"
23 #include "UserPassword.h"
25 // CUserPassword dialog
27 IMPLEMENT_DYNAMIC(CUserPassword, CDialog)
29 CUserPassword::CUserPassword(CWnd* pParent /*=NULL*/)
30 : CDialog(CUserPassword::IDD, pParent)
35 CUserPassword::~CUserPassword()
39 void CUserPassword::DoDataExchange(CDataExchange* pDX)
41 CDialog::DoDataExchange(pDX);
42 DDX_Text(pDX, IDC_USER_NAME, m_UserName);
43 DDX_Text(pDX, IDC_USER_PASSWORD, m_Password);
46 BEGIN_MESSAGE_MAP(CUserPassword, CDialog)
47 END_MESSAGE_MAP()
49 // CUserPassword message handlers
51 BOOL CUserPassword::OnInitDialog()
53 CDialog::OnInitDialog();
54 if (!m_URL.IsEmpty())
56 CString title;
57 this->GetWindowText(title);
58 title += _T(" - ");
59 title += m_URL;
60 this->SetWindowText(title);
62 if (GetDlgItem(IDC_USER_NAME)->GetWindowTextLength())
63 GetDlgItem(IDC_USER_PASSWORD)->SetFocus();
64 else
65 GetDlgItem(IDC_USER_NAME)->SetFocus();
66 return FALSE; // we set focus to the username/password textfield