1 // PullFetchDlg.cpp : implementation file
5 #include "TortoiseProc.h"
6 #include "PullFetchDlg.h"
10 // CPullFetchDlg dialog
12 IMPLEMENT_DYNAMIC(CPullFetchDlg
, CResizableStandAloneDialog
)
14 CPullFetchDlg::CPullFetchDlg(CWnd
* pParent
/*=NULL*/)
15 : CResizableStandAloneDialog(CPullFetchDlg::IDD
, pParent
)
18 m_bAutoLoad
= CAppUtils::IsSSHPutty();
19 m_bAutoLoadEnable
=true;
22 CPullFetchDlg::~CPullFetchDlg()
26 void CPullFetchDlg::DoDataExchange(CDataExchange
* pDX
)
28 CDialog::DoDataExchange(pDX
);
29 DDX_Control(pDX
, IDC_REMOTE_COMBO
, this->m_Remote
);
30 DDX_Control(pDX
, IDC_OTHER
, this->m_Other
);
31 DDX_Control(pDX
, IDC_REMOTE_BRANCH
, this->m_RemoteBranch
);
32 DDX_Control(pDX
,IDC_REMOTE_MANAGE
, this->m_RemoteManage
);
33 DDX_Check(pDX
,IDC_PUTTYKEY_AUTOLOAD
,m_bAutoLoad
);
38 BEGIN_MESSAGE_MAP(CPullFetchDlg
,CResizableStandAloneDialog
)
39 ON_BN_CLICKED(IDC_REMOTE_RD
, &CPullFetchDlg::OnBnClickedRd
)
40 ON_BN_CLICKED(IDC_OTHER_RD
, &CPullFetchDlg::OnBnClickedRd
)
41 ON_BN_CLICKED(IDOK
, &CPullFetchDlg::OnBnClickedOk
)
42 ON_STN_CLICKED(IDC_REMOTE_MANAGE
, &CPullFetchDlg::OnStnClickedRemoteManage
)
45 BOOL
CPullFetchDlg::OnInitDialog()
47 CResizableStandAloneDialog::OnInitDialog();
48 AddAnchor(IDC_REMOTE_COMBO
, TOP_LEFT
, TOP_RIGHT
);
49 AddAnchor(IDC_OTHER
, TOP_LEFT
,TOP_RIGHT
);
51 AddAnchor(IDC_REMOTE_BRANCH
, TOP_LEFT
,TOP_RIGHT
);
53 AddAnchor(IDOK
,BOTTOM_RIGHT
);
54 AddAnchor(IDCANCEL
,BOTTOM_RIGHT
);
55 AddAnchor(IDC_GROUPT_REMOTE
,TOP_LEFT
,BOTTOM_RIGHT
);
56 AddAnchor(IDC_PUTTYKEY_AUTOLOAD
,BOTTOM_LEFT
);
57 AddAnchor(IDC_REMOTE_MANAGE
,BOTTOM_LEFT
);
59 this->AddOthersToAnchor();
61 this->GetDlgItem(IDC_PUTTYKEY_AUTOLOAD
)->EnableWindow(m_bAutoLoadEnable
);
63 CheckRadioButton(IDC_REMOTE_RD
,IDC_OTHER_RD
,IDC_REMOTE_RD
);
64 m_Remote
.EnableWindow(TRUE
);
65 m_Other
.EnableWindow(FALSE
);
66 m_RemoteBranch
.EnableWindow(FALSE
);
68 m_Other
.SetURLHistory(TRUE
);
69 m_Other
.LoadHistory(_T("Software\\TortoiseGit\\History\\PullURLS"), _T("url"));
70 CString clippath
=CAppUtils::GetClipboardLink();
71 if(clippath
.IsEmpty())
74 m_Other
.SetWindowText(clippath
);
76 m_RemoteBranch
.LoadHistory(_T("Software\\TortoiseGit\\History\\PullRemoteBranch"), _T("br"));
77 m_RemoteBranch
.SetCurSel(0);
79 CString WorkingDir
=g_Git
.m_CurrentDir
;
82 this->SetWindowTextW(CString(_T("Pull - "))+WorkingDir
);
84 this->SetWindowTextW(CString(_T("Fetch - "))+WorkingDir
);
88 CRegString
remote(CString(_T("Software\\TortoiseGit\\History\\PullRemote\\")+WorkingDir
));
92 if(!g_Git
.GetRemoteList(list
))
94 for(unsigned int i
=0;i
<list
.size();i
++)
96 m_Remote
.AddString(list
[i
]);
101 m_Remote
.SetCurSel(sel
);
103 EnableSaveRestore(_T("PullFetchDlg"));
104 this->m_RemoteManage
.SetURL(CString());
107 // CPullFetchDlg message handlers
109 void CPullFetchDlg::OnBnClickedRd()
112 // TODO: Add your control notification handler code here
113 if( GetCheckedRadioButton(IDC_REMOTE_RD
,IDC_OTHER_RD
) == IDC_REMOTE_RD
)
115 m_Remote
.EnableWindow(TRUE
);
116 m_Other
.EnableWindow(FALSE
);
117 m_RemoteBranch
.EnableWindow(FALSE
);
120 if( GetCheckedRadioButton(IDC_REMOTE_RD
,IDC_OTHER_RD
) == IDC_OTHER_RD
)
122 m_Remote
.EnableWindow(FALSE
);
123 m_Other
.EnableWindow(TRUE
);;
124 m_RemoteBranch
.EnableWindow(TRUE
);
130 void CPullFetchDlg::OnBnClickedOk()
132 // TODO: Add your control notification handler code here
133 if( GetCheckedRadioButton(IDC_REMOTE_RD
,IDC_OTHER_RD
) == IDC_REMOTE_RD
)
135 m_RemoteURL
=m_Remote
.GetString();
136 m_RemoteBranchName
.Empty();
139 if( GetCheckedRadioButton(IDC_REMOTE_RD
,IDC_OTHER_RD
) == IDC_OTHER_RD
)
141 m_Other
.GetWindowTextW(m_RemoteURL
);
142 m_RemoteBranchName
=m_RemoteBranch
.GetString();
146 m_RemoteReg
= m_Remote
.GetString();
148 m_Other
.SaveHistory();
149 m_RemoteBranch
.SaveHistory();
153 void CPullFetchDlg::OnStnClickedRemoteManage()
155 // TODO: Add your control notification handler code here
156 CAppUtils::LaunchRemoteSetting();