From 8e87099cc3ad4f2550727b9201725accb2a1396d Mon Sep 17 00:00:00 2001 From: Johan 't Hart Date: Mon, 8 Jun 2009 23:40:13 +0200 Subject: [PATCH] StatusListCtrl: Implemented delete unversioned file. --- src/Git/GitStatusListCtrl.cpp | 66 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/Git/GitStatusListCtrl.cpp b/src/Git/GitStatusListCtrl.cpp index 077b775..58463a7 100644 --- a/src/Git/GitStatusListCtrl.cpp +++ b/src/Git/GitStatusListCtrl.cpp @@ -2475,6 +2475,11 @@ void CGitStatusListCtrl::OnContextMenuList(CWnd * pWnd, CPoint point) popup.AppendMenuIcon(IDSVNLC_ADD, IDS_STATUSLIST_CONTEXT_ADD, IDI_ADD); } } + + if (m_dwContextMenus & SVNSLC_POPDELETE) + { + popup.AppendMenuIcon(IDSVNLC_DELETE, IDS_MENUREMOVE, IDI_DELETE); + } //} //if ( (wcStatus == git_wc_status_unversioned) || (wcStatus == git_wc_status_deleted) ) //{ @@ -2717,6 +2722,67 @@ void CGitStatusListCtrl::OnContextMenuList(CWnd * pWnd, CPoint point) } break; + case IDSVNLC_DELETE: + { + //Collect paths + std::vector selectIndex; + + POSITION pos = GetFirstSelectedItemPosition(); + int index; + while ((index = GetNextSelectedItem(pos)) >= 0) + { + selectIndex.push_back(index); + } + + //Create file-list ('\0' separated) for SHFileOperation + CString filelist; + for(int i=0;iGetWinPathString(); + filelist += _T("|"); + } + filelist += _T("|"); + int len = filelist.GetLength(); + TCHAR * buf = new TCHAR[len+2]; + _tcscpy_s(buf, len+2, filelist); + for (int i=0; im_hWnd; + fileop.wFunc = FO_DELETE; + fileop.pFrom = buf; + fileop.pTo = NULL; + fileop.fFlags = FOF_NO_CONNECTED_ELEMENTS | ((GetAsyncKeyState(VK_SHIFT) & 0x8000) ? 0 : FOF_ALLOWUNDO); + fileop.lpszProgressTitle = _T("deleting file"); + int result = SHFileOperation(&fileop); + delete [] buf; + + if ( (result==0) && (!fileop.fAnyOperationsAborted) ) + { + SetRedraw(FALSE); + POSITION pos = NULL; + while ((pos = GetFirstSelectedItemPosition()) != 0) + { + int index = GetNextSelectedItem(pos); + if (GetCheck(index)) + m_nSelected--; + m_nTotal--; + + RemoveListEntry(index); + } + SetRedraw(TRUE); + } + } + break; + case IDSVNLC_BLAME: { CString sCmd; -- 2.11.0