From 798b19d47ef66726617c116804d8137748415b1f Mon Sep 17 00:00:00 2001 From: Frank Li Date: Sat, 24 Apr 2010 12:02:45 +0800 Subject: [PATCH] Fix Issue #392: refresh branch info when press "F5" Signed-off-by: Frank Li --- src/Git/Git.cpp | 3 ++- src/TortoiseProc/BranchCombox.h | 4 ++++ src/TortoiseProc/SyncDlg.cpp | 19 +++++++++++++++++++ src/Utils/MiscUI/HistoryCombo.cpp | 1 + src/Utils/MiscUI/HistoryCombo.h | 4 +++- 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/Git/Git.cpp b/src/Git/Git.cpp index 2fc8b30d6..ab8b7423d 100644 --- a/src/Git/Git.cpp +++ b/src/Git/Git.cpp @@ -388,7 +388,8 @@ CString CGit::StripRefName(CString refName) refName = refName.Mid(11); else if(wcsncmp(refName, L"refs/", 5) == 0) refName = refName.Mid(5); - return refName; + int start =0; + return refName.Tokenize(_T("\n"),start); } int CGit::GetCurrentBranchFromFile(const CString &sProjectRoot, CString &sBranchOut) diff --git a/src/TortoiseProc/BranchCombox.h b/src/TortoiseProc/BranchCombox.h index 9cca0d080..f1cf8fc79 100644 --- a/src/TortoiseProc/BranchCombox.h +++ b/src/TortoiseProc/BranchCombox.h @@ -151,7 +151,11 @@ protected: STRING_VECTOR list; list.clear(); int current; + m_ctrlLocalBranch.Reset(); + m_ctrlRemoteBranch.Reset(); + g_Git.GetBranchList(list,¤t,CGit::BRANCH_LOCAL); + m_ctrlLocalBranch.AddString(list); CString currentBranch = g_Git.GetSymbolicRef(); diff --git a/src/TortoiseProc/SyncDlg.cpp b/src/TortoiseProc/SyncDlg.cpp index 78bda0eea..d1b3c4e00 100644 --- a/src/TortoiseProc/SyncDlg.cpp +++ b/src/TortoiseProc/SyncDlg.cpp @@ -721,6 +721,10 @@ BOOL CSyncDlg::OnInitDialog() m_ctrlTabCtrl.ShowTab(IDC_IN_CHANGELIST-1,false); m_ctrlTabCtrl.ShowTab(IDC_IN_CONFLICT-1,false); + + m_ctrlRemoteBranch.m_bWantReturn = TRUE; + m_ctrlURL.m_bWantReturn = TRUE; + return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } @@ -734,6 +738,20 @@ void CSyncDlg::OnBnClickedButtonManage() void CSyncDlg::Refresh() { theApp.DoWaitCursor(1); + + CString local; + CString remote; + CString url; + this->m_ctrlLocalBranch.GetWindowText(local); + this->m_ctrlRemoteBranch.GetWindowText(remote); + this->m_ctrlURL.GetWindowText(url); + + this->LoadBranchInfo(); + + this->m_ctrlLocalBranch.AddString(local); + this->m_ctrlRemoteBranch.AddString(remote); + this->m_ctrlURL.AddString(url); + m_OutLogList.ShowText(_T("Refresh ...")); this->FetchOutList(true); theApp.DoWaitCursor(-1); @@ -746,6 +764,7 @@ BOOL CSyncDlg::PreTranslateMessage(MSG* pMsg) { switch (pMsg->wParam) { + case VK_F5: { if (m_bBlock) diff --git a/src/Utils/MiscUI/HistoryCombo.cpp b/src/Utils/MiscUI/HistoryCombo.cpp index 9040a5f64..8f5a903f3 100644 --- a/src/Utils/MiscUI/HistoryCombo.cpp +++ b/src/Utils/MiscUI/HistoryCombo.cpp @@ -35,6 +35,7 @@ CHistoryCombo::CHistoryCombo(BOOL bAllowSortStyle /*=FALSE*/ ) m_hWndToolTip = NULL; m_ttShown = FALSE; m_bDyn = FALSE; + m_bWantReturn = FALSE; } CHistoryCombo::~CHistoryCombo() diff --git a/src/Utils/MiscUI/HistoryCombo.h b/src/Utils/MiscUI/HistoryCombo.h index 49354cbea..605a8c8e9 100644 --- a/src/Utils/MiscUI/HistoryCombo.h +++ b/src/Utils/MiscUI/HistoryCombo.h @@ -44,6 +44,7 @@ public: CHistoryCombo(BOOL bAllowSortStyle = FALSE); virtual ~CHistoryCombo(); + BOOL m_bWantReturn; // Operations public: /** @@ -52,6 +53,7 @@ public: * position, otherwise add it to the end of the list. */ int AddString(CString str, INT_PTR pos = -1); + void DisableTooltip(){m_bDyn = FALSE;} //because rebase need disable combox tooltip to show version info protected: DECLARE_MESSAGE_MAP() @@ -124,7 +126,7 @@ protected: * It must return true to prevent the default processing for the * return key. The default implementation returns false. */ - virtual bool OnReturnKeyPressed() { return false; } + virtual bool OnReturnKeyPressed() { return m_bWantReturn; } /** * Removes the selected item from the combo box and updates -- 2.11.4.GIT