1 // PullFetchDlg.cpp : implementation file
\r
5 #include "TortoiseProc.h"
\r
6 #include "PullFetchDlg.h"
\r
8 #include "AppUtils.h"
\r
10 // CPullFetchDlg dialog
\r
12 IMPLEMENT_DYNAMIC(CPullFetchDlg, CResizableStandAloneDialog)
\r
14 CPullFetchDlg::CPullFetchDlg(CWnd* pParent /*=NULL*/)
\r
15 : CResizableStandAloneDialog(CPullFetchDlg::IDD, pParent)
\r
18 m_bAutoLoad = CAppUtils::IsSSHPutty();
\r
19 m_bAutoLoadEnable=true;
\r
22 CPullFetchDlg::~CPullFetchDlg()
\r
26 void CPullFetchDlg::DoDataExchange(CDataExchange* pDX)
\r
28 CDialog::DoDataExchange(pDX);
\r
29 DDX_Control(pDX, IDC_REMOTE_COMBO, this->m_Remote);
\r
30 DDX_Control(pDX, IDC_OTHER, this->m_Other);
\r
31 DDX_Control(pDX, IDC_REMOTE_BRANCH, this->m_RemoteBranch);
\r
32 DDX_Control(pDX,IDC_REMOTE_MANAGE, this->m_RemoteManage);
\r
33 DDX_Check(pDX,IDC_PUTTYKEY_AUTOLOAD,m_bAutoLoad);
\r
38 BEGIN_MESSAGE_MAP(CPullFetchDlg,CResizableStandAloneDialog )
\r
39 ON_BN_CLICKED(IDC_REMOTE_RD, &CPullFetchDlg::OnBnClickedRd)
\r
40 ON_BN_CLICKED(IDC_OTHER_RD, &CPullFetchDlg::OnBnClickedRd)
\r
41 ON_BN_CLICKED(IDOK, &CPullFetchDlg::OnBnClickedOk)
\r
42 ON_STN_CLICKED(IDC_REMOTE_MANAGE, &CPullFetchDlg::OnStnClickedRemoteManage)
\r
45 BOOL CPullFetchDlg::OnInitDialog()
\r
47 CResizableStandAloneDialog::OnInitDialog();
\r
48 AddAnchor(IDC_REMOTE_COMBO, TOP_LEFT, TOP_RIGHT);
\r
49 AddAnchor(IDC_OTHER, TOP_LEFT,TOP_RIGHT);
\r
51 AddAnchor(IDC_REMOTE_BRANCH, TOP_LEFT,TOP_RIGHT);
\r
53 AddAnchor(IDOK,BOTTOM_RIGHT);
\r
54 AddAnchor(IDCANCEL,BOTTOM_RIGHT);
\r
55 AddAnchor(IDC_GROUPT_REMOTE,TOP_LEFT,BOTTOM_RIGHT);
\r
56 AddAnchor(IDC_PUTTYKEY_AUTOLOAD,BOTTOM_LEFT);
\r
57 AddAnchor(IDC_REMOTE_MANAGE,BOTTOM_LEFT);
\r
59 this->AddOthersToAnchor();
\r
61 this->GetDlgItem(IDC_PUTTYKEY_AUTOLOAD)->EnableWindow(m_bAutoLoadEnable);
\r
63 CheckRadioButton(IDC_REMOTE_RD,IDC_OTHER_RD,IDC_REMOTE_RD);
\r
64 m_Remote.EnableWindow(TRUE);
\r
65 m_Other.EnableWindow(FALSE);
\r
66 m_RemoteBranch.EnableWindow(FALSE);
\r
68 m_Other.SetURLHistory(TRUE);
\r
69 m_Other.LoadHistory(_T("Software\\TortoiseGit\\History\\PullURLS"), _T("url"));
\r
70 m_Other.SetCurSel(0);
\r
72 m_RemoteBranch.LoadHistory(_T("Software\\TortoiseGit\\History\\PullRemoteBranch"), _T("br"));
\r
73 m_RemoteBranch.SetCurSel(0);
\r
76 this->SetWindowTextW(_T("Pull"));
\r
78 this->SetWindowTextW(_T("Fetch"));
\r
82 if(!g_Git.GetRemoteList(list))
\r
84 for(unsigned int i=0;i<list.size();i++)
\r
85 m_Remote.AddString(list[i]);
\r
87 EnableSaveRestore(_T("PullFetchDlg"));
\r
88 this->m_RemoteManage.SetURL(CString());
\r
91 // CPullFetchDlg message handlers
\r
93 void CPullFetchDlg::OnBnClickedRd()
\r
96 // TODO: Add your control notification handler code here
\r
97 if( GetCheckedRadioButton(IDC_REMOTE_RD,IDC_OTHER_RD) == IDC_REMOTE_RD)
\r
99 m_Remote.EnableWindow(TRUE);
\r
100 m_Other.EnableWindow(FALSE);
\r
101 m_RemoteBranch.EnableWindow(FALSE);
\r
104 if( GetCheckedRadioButton(IDC_REMOTE_RD,IDC_OTHER_RD) == IDC_OTHER_RD)
\r
106 m_Remote.EnableWindow(FALSE);
\r
107 m_Other.EnableWindow(TRUE);;
\r
108 m_RemoteBranch.EnableWindow(TRUE);
\r
114 void CPullFetchDlg::OnBnClickedOk()
\r
116 // TODO: Add your control notification handler code here
\r
117 if( GetCheckedRadioButton(IDC_REMOTE_RD,IDC_OTHER_RD) == IDC_REMOTE_RD)
\r
119 m_RemoteURL=m_Remote.GetString();
\r
120 m_RemoteBranchName.Empty();
\r
123 if( GetCheckedRadioButton(IDC_REMOTE_RD,IDC_OTHER_RD) == IDC_OTHER_RD)
\r
125 m_Other.GetWindowTextW(m_RemoteURL);
\r
126 m_RemoteBranchName=m_RemoteBranch.GetString();
\r
130 m_Other.SaveHistory();
\r
131 m_RemoteBranch.SaveHistory();
\r
135 void CPullFetchDlg::OnStnClickedRemoteManage()
\r
137 // TODO: Add your control notification handler code here
\r
138 CAppUtils::LaunchRemoteSetting();
\r