From df8364f149a0874a7f450b3cb3c616ee6d0ba9a5 Mon Sep 17 00:00:00 2001 From: Frank Li Date: Mon, 20 Jul 2009 22:12:40 +0800 Subject: [PATCH] Add url error message at syncdlg Signed-off-by: Frank Li --- src/TortoiseProc/SyncDlg.cpp | 66 ++++++++++++++++++++++++++++++++++++++++++++ src/TortoiseProc/SyncDlg.h | 11 ++++++++ 2 files changed, 77 insertions(+) diff --git a/src/TortoiseProc/SyncDlg.cpp b/src/TortoiseProc/SyncDlg.cpp index 11231a8..0d5c108 100644 --- a/src/TortoiseProc/SyncDlg.cpp +++ b/src/TortoiseProc/SyncDlg.cpp @@ -63,6 +63,8 @@ BEGIN_MESSAGE_MAP(CSyncDlg, CResizableStandAloneDialog) ON_BN_CLICKED(IDC_BUTTON_EMAIL, &CSyncDlg::OnBnClickedButtonEmail) ON_BN_CLICKED(IDC_BUTTON_MANAGE, &CSyncDlg::OnBnClickedButtonManage) BRANCH_COMBOX_EVENT + ON_NOTIFY(CBEN_ENDEDIT, IDC_COMBOBOXEX_URL, &CSyncDlg::OnCbenEndeditComboboxexUrl) + ON_CBN_EDITCHANGE(IDC_COMBOBOXEX_URL, &CSyncDlg::OnCbnEditchangeComboboxexUrl) END_MESSAGE_MAP() @@ -206,5 +208,69 @@ BOOL CSyncDlg::PreTranslateMessage(MSG* pMsg) } void CSyncDlg::FetchOutList() { + m_OutChangeFileList.Clear(); + this->m_OutLogList.Clear(); + + CString remote; + this->m_ctrlURL.GetWindowText(remote); + CString remotebranch; + this->m_ctrlRemoteBranch.GetWindowText(remotebranch); + remotebranch=remote+_T("/")+remotebranch; + + if(IsURL()) + { + CString str; + str=_T("Don't know what will push befause you enter URL"); + m_OutLogList.ShowText(str); + this->m_ctrlTabCtrl.ShowTab(m_OutChangeFileList.GetDlgCtrlID()-1,FALSE); + m_OutLocalBranch.Empty(); + m_OutRemoteBranch.Empty(); + return ; + }else if(g_Git.GetHash(remotebranch).GetLength()<40) + { + CString str; + str.Format(_T("Don't know what will push befause unkown \"%s\""),remotebranch); + m_OutLogList.ShowText(str); + this->m_ctrlTabCtrl.ShowTab(m_OutChangeFileList.GetDlgCtrlID()-1,FALSE); + m_OutLocalBranch.Empty(); + m_OutRemoteBranch.Empty(); + return ; + } + else + { + CString localbranch; + localbranch=this->m_ctrlLocalBranch.GetString(); + + if(localbranch != m_OutLocalBranch && m_OutRemoteBranch != remotebranch) + { + m_OutLogList.ClearText(); + m_OutLogList.FillGitLog(NULL,CGit:: LOG_INFO_STAT| CGit::LOG_INFO_FILESTATE | CGit::LOG_INFO_SHOW_MERGEDFILE, + &remotebranch,&localbranch); + } + this->m_OutLocalBranch=localbranch; + this->m_OutRemoteBranch=remotebranch; + } + +} + +bool CSyncDlg::IsURL() +{ + CString str; + this->m_ctrlURL.GetWindowText(str); + if(str.Find(_T('\\'))>=0 || str.Find(_T('/'))>=0) + return true; + else + return false; +} +void CSyncDlg::OnCbenEndeditComboboxexUrl(NMHDR *pNMHDR, LRESULT *pResult) +{ + // TODO: Add your control notification handler code here + *pResult = 0; +} + +void CSyncDlg::OnCbnEditchangeComboboxexUrl() +{ + this->FetchOutList(); + // TODO: Add your control notification handler code here } diff --git a/src/TortoiseProc/SyncDlg.h b/src/TortoiseProc/SyncDlg.h index b5b2e49..1ca5fa1 100644 --- a/src/TortoiseProc/SyncDlg.h +++ b/src/TortoiseProc/SyncDlg.h @@ -59,8 +59,13 @@ protected: CGitStatusListCtrl m_InChangeFileList; CGitStatusListCtrl m_ConflictFileList; + virtual void LocalBranchChange(){FetchOutList();}; + virtual void RemoteBranchChange(){FetchOutList();}; + void FetchOutList(); + bool IsURL(); + void SetRemote(CString remote) { if(!remote.IsEmpty()) @@ -68,6 +73,10 @@ protected: this->m_ctrlURL.AddString(remote); } } + + CString m_OutLocalBranch; + CString m_OutRemoteBranch; + DECLARE_MESSAGE_MAP() public: BOOL m_bAutoLoadPuttyKey; @@ -86,4 +95,6 @@ public: virtual BOOL OnInitDialog(); afx_msg void OnBnClickedButtonManage(); virtual BOOL PreTranslateMessage(MSG* pMsg); + afx_msg void OnCbenEndeditComboboxexUrl(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnCbnEditchangeComboboxexUrl(); }; -- 2.11.0