OSDN Git Service

Submodule Add Dialog support browse
authorFrank Li <lznuaa@gmail.com>
Fri, 20 Mar 2009 02:57:10 +0000 (10:57 +0800)
committerFrank Li <lznuaa@gmail.com>
Fri, 20 Mar 2009 02:57:10 +0000 (10:57 +0800)
src/TortoiseProc/SubmoduleAddDlg.cpp
src/TortoiseProc/SubmoduleAddDlg.h

index aae3774..0e35064 100644 (file)
@@ -4,7 +4,7 @@
 #include "stdafx.h"\r
 #include "resource.h"\r
 #include "SubmoduleAddDlg.h"\r
-\r
+#include "BrowseFolder.h"\r
 \r
 // CSubmoduleAddDlg dialog\r
 \r
@@ -63,14 +63,35 @@ BOOL CSubmoduleAddDlg::OnInitDialog()
        m_Repository.SetURLHistory(true);\r
        m_PathCtrl.SetPathHistory(true);\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_Repository.SetCurSel(0);\r
+\r
+       \r
        return TRUE;\r
 }\r
 \r
 void CSubmoduleAddDlg::OnRepBrowse()\r
 {\r
+       CBrowseFolder browseFolder;\r
+       browseFolder.m_style = BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;\r
+       CString strDirectory;\r
+       this->m_Repository.GetWindowTextW(strDirectory);\r
+       if (browseFolder.Show(GetSafeHwnd(), strDirectory) == CBrowseFolder::OK) \r
+       {\r
+               this->m_Repository.SetWindowTextW(strDirectory);\r
+       }\r
 }\r
 void CSubmoduleAddDlg::OnPathBrowse()\r
 {\r
+       CBrowseFolder browseFolder;\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
+       {\r
+               this->m_PathCtrl.SetWindowTextW(strDirectory);\r
+       }\r
 }\r
 void CSubmoduleAddDlg::OnBranchCheck()\r
 {\r
@@ -82,4 +103,11 @@ void CSubmoduleAddDlg::OnBranchCheck()
        {\r
                this->GetDlgItem(IDC_SUBMODULE_BRANCH)->ShowWindow(FALSE);              \r
        }\r
+}\r
+\r
+void CSubmoduleAddDlg::OnOK()\r
+{\r
+       m_Repository.SaveHistory();\r
+       m_PathCtrl.SaveHistory();\r
+       __super::OnOK();\r
 }
\ No newline at end of file
index 09aed47..9ee0eb1 100644 (file)
@@ -20,7 +20,7 @@ protected:
        void OnRepBrowse();\r
        void OnPathBrowse();\r
        void OnBranchCheck();\r
-       \r
+       virtual void OnOK();\r
        DECLARE_MESSAGE_MAP()\r
 public:\r
        CHistoryCombo m_Repository;\r