OSDN Git Service

Add url error message at syncdlg
authorFrank Li <lznuaa@gmail.com>
Mon, 20 Jul 2009 14:12:40 +0000 (22:12 +0800)
committerFrank Li <lznuaa@gmail.com>
Mon, 20 Jul 2009 14:12:40 +0000 (22:12 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/TortoiseProc/SyncDlg.cpp
src/TortoiseProc/SyncDlg.h

index 11231a8..0d5c108 100644 (file)
@@ -63,6 +63,8 @@ BEGIN_MESSAGE_MAP(CSyncDlg, CResizableStandAloneDialog)
        ON_BN_CLICKED(IDC_BUTTON_EMAIL, &CSyncDlg::OnBnClickedButtonEmail)\r
        ON_BN_CLICKED(IDC_BUTTON_MANAGE, &CSyncDlg::OnBnClickedButtonManage)\r
        BRANCH_COMBOX_EVENT\r
        ON_BN_CLICKED(IDC_BUTTON_EMAIL, &CSyncDlg::OnBnClickedButtonEmail)\r
        ON_BN_CLICKED(IDC_BUTTON_MANAGE, &CSyncDlg::OnBnClickedButtonManage)\r
        BRANCH_COMBOX_EVENT\r
+       ON_NOTIFY(CBEN_ENDEDIT, IDC_COMBOBOXEX_URL, &CSyncDlg::OnCbenEndeditComboboxexUrl)\r
+       ON_CBN_EDITCHANGE(IDC_COMBOBOXEX_URL, &CSyncDlg::OnCbnEditchangeComboboxexUrl)\r
 END_MESSAGE_MAP()\r
 \r
 \r
 END_MESSAGE_MAP()\r
 \r
 \r
@@ -206,5 +208,69 @@ BOOL CSyncDlg::PreTranslateMessage(MSG* pMsg)
 }\r
 void CSyncDlg::FetchOutList()\r
 {\r
 }\r
 void CSyncDlg::FetchOutList()\r
 {\r
+       m_OutChangeFileList.Clear();\r
+       this->m_OutLogList.Clear();\r
+\r
+       CString remote;\r
+       this->m_ctrlURL.GetWindowText(remote);\r
+       CString remotebranch;\r
+       this->m_ctrlRemoteBranch.GetWindowText(remotebranch);\r
+       remotebranch=remote+_T("/")+remotebranch;\r
+\r
+       if(IsURL())\r
+       {\r
+               CString str;\r
+               str=_T("Don't know what will push befause you enter URL");\r
+               m_OutLogList.ShowText(str);\r
+               this->m_ctrlTabCtrl.ShowTab(m_OutChangeFileList.GetDlgCtrlID()-1,FALSE);\r
+               m_OutLocalBranch.Empty();\r
+               m_OutRemoteBranch.Empty();\r
+               return ;\r
        \r
        \r
+       }else if(g_Git.GetHash(remotebranch).GetLength()<40)\r
+       {\r
+               CString str;\r
+               str.Format(_T("Don't know what will push befause unkown \"%s\""),remotebranch);\r
+               m_OutLogList.ShowText(str);\r
+               this->m_ctrlTabCtrl.ShowTab(m_OutChangeFileList.GetDlgCtrlID()-1,FALSE);\r
+               m_OutLocalBranch.Empty();\r
+               m_OutRemoteBranch.Empty();\r
+               return ;\r
+       }\r
+       else\r
+       {\r
+               CString localbranch;\r
+               localbranch=this->m_ctrlLocalBranch.GetString();\r
+\r
+               if(localbranch != m_OutLocalBranch && m_OutRemoteBranch != remotebranch)\r
+               {\r
+                       m_OutLogList.ClearText();\r
+                       m_OutLogList.FillGitLog(NULL,CGit::     LOG_INFO_STAT| CGit::LOG_INFO_FILESTATE | CGit::LOG_INFO_SHOW_MERGEDFILE,\r
+                               &remotebranch,&localbranch);\r
+               }\r
+               this->m_OutLocalBranch=localbranch;\r
+               this->m_OutRemoteBranch=remotebranch;\r
+       }\r
+\r
+}\r
+\r
+bool CSyncDlg::IsURL()\r
+{\r
+       CString str;\r
+       this->m_ctrlURL.GetWindowText(str);\r
+       if(str.Find(_T('\\'))>=0 || str.Find(_T('/'))>=0)\r
+               return true;\r
+       else\r
+               return false;\r
+}\r
+void CSyncDlg::OnCbenEndeditComboboxexUrl(NMHDR *pNMHDR, LRESULT *pResult)\r
+{\r
+       // TODO: Add your control notification handler code here\r
+       *pResult = 0;\r
+}\r
+\r
+void CSyncDlg::OnCbnEditchangeComboboxexUrl()\r
+{\r
+       this->FetchOutList();\r
+       // TODO: Add your control notification handler code here\r
 }\r
 }\r
index b5b2e49..1ca5fa1 100644 (file)
@@ -59,8 +59,13 @@ protected:
        CGitStatusListCtrl m_InChangeFileList;\r
        CGitStatusListCtrl m_ConflictFileList;\r
 \r
        CGitStatusListCtrl m_InChangeFileList;\r
        CGitStatusListCtrl m_ConflictFileList;\r
 \r
+       virtual void LocalBranchChange(){FetchOutList();};\r
+       virtual void RemoteBranchChange(){FetchOutList();};\r
+\r
        void FetchOutList();\r
 \r
        void FetchOutList();\r
 \r
+       bool IsURL();\r
+\r
        void SetRemote(CString remote)\r
        {\r
                if(!remote.IsEmpty())\r
        void SetRemote(CString remote)\r
        {\r
                if(!remote.IsEmpty())\r
@@ -68,6 +73,10 @@ protected:
                        this->m_ctrlURL.AddString(remote);\r
                }\r
        }\r
                        this->m_ctrlURL.AddString(remote);\r
                }\r
        }\r
+       \r
+       CString m_OutLocalBranch;\r
+       CString m_OutRemoteBranch;\r
+\r
        DECLARE_MESSAGE_MAP()\r
 public:\r
        BOOL m_bAutoLoadPuttyKey;\r
        DECLARE_MESSAGE_MAP()\r
 public:\r
        BOOL m_bAutoLoadPuttyKey;\r
@@ -86,4 +95,6 @@ public:
        virtual BOOL OnInitDialog();\r
        afx_msg void OnBnClickedButtonManage();\r
        virtual BOOL PreTranslateMessage(MSG* pMsg);\r
        virtual BOOL OnInitDialog();\r
        afx_msg void OnBnClickedButtonManage();\r
        virtual BOOL PreTranslateMessage(MSG* pMsg);\r
+       afx_msg void OnCbenEndeditComboboxexUrl(NMHDR *pNMHDR, LRESULT *pResult);\r
+       afx_msg void OnCbnEditchangeComboboxexUrl();\r
 };\r
 };\r