Add LPCTSTR casts where needed
[TortoiseGit.git] / src / TortoiseProc / Commands / ResolveCommand.cpp
blob206351a708ce7b8f982b243729558b37a56919fd
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2009-2015 - TortoiseGit
4 // Copyright (C) 2007-2008,2012 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "stdafx.h"
21 #include "ResolveCommand.h"
22 #include "AppUtils.h"
23 #include "MessageBox.h"
24 #include "ResolveDlg.h"
25 #include "GitProgressDlg.h"
26 #include "ProgressCommands/ResolveProgressCommand.h"
28 bool ResolveCommand::Execute()
30 CResolveDlg dlg;
31 dlg.m_pathList = pathList;
32 INT_PTR ret = IDOK;
33 if (!parser.HasKey(_T("noquestion")))
34 ret = dlg.DoModal();
35 if (ret == IDOK)
37 if (!dlg.m_pathList.IsEmpty())
39 if (parser.HasKey(L"silent"))
41 for (int i = 0; i < dlg.m_pathList.GetCount(); ++i)
43 CString cmd, out;
44 cmd.Format(_T("git.exe add -f -- \"%s\""), (LPCTSTR)dlg.m_pathList[i].GetGitPathString());
45 if (g_Git.Run(cmd, &out, CP_UTF8))
47 CMessageBox::Show(NULL, out, _T("TortoiseGit"), MB_OK | MB_ICONERROR);
48 return false;
51 CAppUtils::RemoveTempMergeFile((CTGitPath &)dlg.m_pathList[i]);
54 HWND resolveMsgWnd = parser.HasVal(L"resolvemsghwnd") ? (HWND)parser.GetLongLongVal(L"resolvemsghwnd") : 0;
55 if (resolveMsgWnd && CRegDWORD(_T("Software\\TortoiseGit\\RefreshFileListAfterResolvingConflict"), TRUE) == TRUE)
57 static UINT WM_REVERTMSG = RegisterWindowMessage(_T("GITSLNM_NEEDSREFRESH"));
58 ::PostMessage(resolveMsgWnd, WM_REVERTMSG, NULL, NULL);
60 return true;
62 else
64 CGitProgressDlg progDlg(CWnd::FromHandle(hWndExplorer));
65 theApp.m_pMainWnd = &progDlg;
66 ResolveProgressCommand resolveProgressCommand;
67 progDlg.SetCommand(&resolveProgressCommand);
68 resolveProgressCommand.SetPathList(dlg.m_pathList);
69 progDlg.DoModal();
70 return !progDlg.DidErrorsOccur();
74 return false;