Extend static functions in CAppUtils with a window handle parameter
[TortoiseGit.git] / src / TortoiseProc / Commands / AddCommand.cpp
blob7c2447b15ca80fe9804e36b4a7b6cbd581615e3b
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2013, 2016 - TortoiseGit
4 // Copyright (C) 2007-2008 - 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 "AddCommand.h"
23 #include "AddDlg.h"
24 #include "GitProgressDlg.h"
25 #include "ProgressCommands/AddProgressCommand.h"
26 #include "ShellUpdater.h"
28 bool AddCommand::Execute()
30 bool bRet = false;
31 if (parser.HasKey(L"noui"))
33 #if 0
34 SVN svn;
35 ProjectProperties props;
36 props.ReadPropsPathList(pathList);
37 bRet = !!svn.Add(pathList, &props, svn_depth_empty, FALSE, FALSE, TRUE);
38 CShellUpdater::Instance().AddPathsForUpdate(pathList);
39 #endif
41 else
43 if (pathList.AreAllPathsFiles())
45 CGitProgressDlg progDlg;
46 theApp.m_pMainWnd = &progDlg;
47 AddProgressCommand addCommand;
48 progDlg.SetCommand(&addCommand);
49 addCommand.SetPathList(pathList);
50 progDlg.SetItemCount(pathList.GetCount());
51 progDlg.DoModal();
53 bRet = !progDlg.DidErrorsOccur();
55 else
57 CAddDlg dlg;
58 dlg.m_pathList = pathList;
59 if (dlg.DoModal() == IDOK)
61 if (dlg.m_pathList.IsEmpty())
62 return FALSE;
63 CGitProgressDlg progDlg;
64 theApp.m_pMainWnd = &progDlg;
65 AddProgressCommand addCommand;
66 progDlg.SetCommand(&addCommand);
67 addCommand.SetPathList(dlg.m_pathList);
68 progDlg.SetItemCount(dlg.m_pathList.GetCount());
69 progDlg.DoModal();
71 bRet = !progDlg.DidErrorsOccur();
76 CShellUpdater::Instance().Flush();
77 return bRet;