OSDN Git Service

Finish Submodule Add Command
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / SubmoduleAddDlg.cpp
index 0e35064..13aa51b 100644 (file)
@@ -5,6 +5,7 @@
 #include "resource.h"\r
 #include "SubmoduleAddDlg.h"\r
 #include "BrowseFolder.h"\r
 #include "resource.h"\r
 #include "SubmoduleAddDlg.h"\r
 #include "BrowseFolder.h"\r
+#include "MessageBox.h"\r
 \r
 // CSubmoduleAddDlg dialog\r
 \r
 \r
 // CSubmoduleAddDlg dialog\r
 \r
@@ -65,8 +66,10 @@ BOOL CSubmoduleAddDlg::OnInitDialog()
 \r
        m_Repository.LoadHistory(_T("Software\\TortoiseGit\\History\\SubModuleRepoURLS"), _T("url"));\r
        m_PathCtrl.LoadHistory(_T("Software\\TortoiseGit\\History\\SubModulePath"), _T("url"));\r
 \r
        m_Repository.LoadHistory(_T("Software\\TortoiseGit\\History\\SubModuleRepoURLS"), _T("url"));\r
        m_PathCtrl.LoadHistory(_T("Software\\TortoiseGit\\History\\SubModulePath"), _T("url"));\r
+       m_PathCtrl.SetWindowText(m_strPath);\r
        m_Repository.SetCurSel(0);\r
 \r
        m_Repository.SetCurSel(0);\r
 \r
+       GetDlgItem(IDC_GROUP_SUBMODULE)->SetWindowText(CString(_T("Submodule of Project: "))+m_strProject);\r
        \r
        return TRUE;\r
 }\r
        \r
        return TRUE;\r
 }\r
@@ -88,7 +91,7 @@ void CSubmoduleAddDlg::OnPathBrowse()
        browseFolder.m_style = BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;\r
        CString strDirectory;\r
        this->m_PathCtrl.GetWindowTextW(strDirectory);\r
        browseFolder.m_style = BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;\r
        CString strDirectory;\r
        this->m_PathCtrl.GetWindowTextW(strDirectory);\r
-       if (browseFolder.Show(GetSafeHwnd(), strDirectory) == CBrowseFolder::OK) \r
+       if (browseFolder.Show(GetSafeHwnd(), strDirectory,g_Git.m_CurrentDir) == CBrowseFolder::OK) \r
        {\r
                this->m_PathCtrl.SetWindowTextW(strDirectory);\r
        }\r
        {\r
                this->m_PathCtrl.SetWindowTextW(strDirectory);\r
        }\r
@@ -107,7 +110,33 @@ void CSubmoduleAddDlg::OnBranchCheck()
 \r
 void CSubmoduleAddDlg::OnOK()\r
 {\r
 \r
 void CSubmoduleAddDlg::OnOK()\r
 {\r
+       this->UpdateData();\r
+       if(m_bBranch)\r
+       {\r
+               m_strBranch.Trim();\r
+               if(m_strBranch.IsEmpty())\r
+               {\r
+                       CMessageBox::Show(NULL,_T("Branch can't be empty"),_T("TortoiseGit"),MB_OK|MB_ICONERROR);\r
+                       return ;\r
+               }\r
+       }\r
        m_Repository.SaveHistory();\r
        m_PathCtrl.SaveHistory();\r
        m_Repository.SaveHistory();\r
        m_PathCtrl.SaveHistory();\r
+\r
+       this->m_strPath=m_PathCtrl.GetString();\r
+       this->m_strRepos=m_Repository.GetString();\r
+\r
+       m_strPath.Trim();\r
+       m_strRepos.Trim();\r
+       if(m_strPath.IsEmpty())\r
+       {\r
+               CMessageBox::Show(NULL,_T("Path can't be empty"),_T("TortoiseGit"),MB_OK|MB_ICONERROR);\r
+                       return ;\r
+       }\r
+       if(m_strRepos.IsEmpty())\r
+       {\r
+               CMessageBox::Show(NULL,_T("Repository can't be empty"),_T("TortoiseGit"),MB_OK|MB_ICONERROR);\r
+                       return ;\r
+       }\r
        __super::OnOK();\r
 }
\ No newline at end of file
        __super::OnOK();\r
 }
\ No newline at end of file