1 // SettingGitConfig.cpp : implementation file
\r
5 #include "TortoiseProc.h"
\r
6 #include "SettingGitConfig.h"
\r
8 #include "Settings.h"
\r
9 #include "GitAdminDir.h"
\r
10 // CSettingGitConfig dialog
\r
12 IMPLEMENT_DYNAMIC(CSettingGitConfig, ISettingsPropPage)
\r
14 CSettingGitConfig::CSettingGitConfig()
\r
15 : ISettingsPropPage(CSettingGitConfig::IDD)
\r
16 , m_UserName(_T(""))
\r
17 , m_UserEmail(_T(""))
\r
23 CSettingGitConfig::~CSettingGitConfig()
\r
27 void CSettingGitConfig::DoDataExchange(CDataExchange* pDX)
\r
29 CPropertyPage::DoDataExchange(pDX);
\r
30 DDX_Text(pDX, IDC_GIT_USERNAME, m_UserName);
\r
31 DDX_Text(pDX, IDC_GIT_USEREMAIL, m_UserEmail);
\r
32 DDX_Check(pDX, IDC_CHECK_GLOBAL, m_bGlobal);
\r
36 BEGIN_MESSAGE_MAP(CSettingGitConfig, CPropertyPage)
\r
37 ON_BN_CLICKED(IDC_CHECK_GLOBAL, &CSettingGitConfig::OnBnClickedCheckGlobal)
\r
38 ON_EN_CHANGE(IDC_GIT_USERNAME, &CSettingGitConfig::OnEnChangeGitUsername)
\r
39 ON_EN_CHANGE(IDC_GIT_USEREMAIL, &CSettingGitConfig::OnEnChangeGitUseremail)
\r
42 BOOL CSettingGitConfig::OnInitDialog()
\r
44 ISettingsPropPage::OnInitDialog();
\r
46 m_UserName=g_Git.GetUserName();
\r
47 m_UserEmail=g_Git.GetUserEmail();
\r
49 CString str=((CSettings*)GetParent())->m_CmdPath.GetWinPath();
\r
51 if( g_GitAdminDir.HasAdminDir(str,&proj) )
\r
53 this->SetWindowText(CString(_T("Config - "))+proj);
\r
54 this->GetDlgItem(IDC_CHECK_GLOBAL)->EnableWindow(TRUE);
\r
59 this->GetDlgItem(IDC_CHECK_GLOBAL)->EnableWindow(FALSE);
\r
62 this->UpdateData(FALSE);
\r
65 // CSettingGitConfig message handlers
\r
67 void CSettingGitConfig::OnBnClickedCheckGlobal()
\r
69 // TODO: Add your control notification handler code here
\r
73 void CSettingGitConfig::OnEnChangeGitUsername()
\r
75 // TODO: If this is a RICHEDIT control, the control will not
\r
76 // send this notification unless you override the ISettingsPropPage::OnInitDialog()
\r
77 // function and call CRichEditCtrl().SetEventMask()
\r
78 // with the ENM_CHANGE flag ORed into the mask.
\r
80 // TODO: Add your control notification handler code here
\r
84 void CSettingGitConfig::OnEnChangeGitUseremail()
\r
86 // TODO: If this is a RICHEDIT control, the control will not
\r
87 // send this notification unless you override the ISettingsPropPage::OnInitDialog()
\r
88 // function and call CRichEditCtrl().SetEventMask()
\r
89 // with the ENM_CHANGE flag ORed into the mask.
\r
91 // TODO: Add your control notification handler code here
\r
95 BOOL CSettingGitConfig::OnApply()
\r
98 this->UpdateData(FALSE);
\r
100 cmd.Format(_T("git.exe config user.name %s"),this->m_UserName);
\r
101 cmd.Format(_T("git.exe config user.email %s"),this->m_UserEmail);
\r
103 SetModified(FALSE);
\r
104 return ISettingsPropPage::OnApply();
\r