Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
2.9 KiB

  1. // GeoInfoPage.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "CertWiz.h"
  5. #include "GeoInfoPage.h"
  6. #include "Certificat.h"
  7. #include "mru.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CGeoInfoPage property page
  15. IMPLEMENT_DYNCREATE(CGeoInfoPage, CIISWizardPage)
  16. CGeoInfoPage::CGeoInfoPage(CCertificate * pCert)
  17. : CIISWizardPage(CGeoInfoPage::IDD, IDS_CERTWIZ, TRUE),
  18. m_pCert(pCert)
  19. {
  20. //{{AFX_DATA_INIT(CGeoInfoPage)
  21. m_Locality = _T("");
  22. m_State = _T("");
  23. m_Country = _T("");
  24. //}}AFX_DATA_INIT
  25. }
  26. CGeoInfoPage::~CGeoInfoPage()
  27. {
  28. }
  29. void CGeoInfoPage::DoDataExchange(CDataExchange* pDX)
  30. {
  31. CIISWizardPage::DoDataExchange(pDX);
  32. //{{AFX_DATA_MAP(CGeoInfoPage)
  33. DDX_Text(pDX, IDC_NEWKEY_LOCALITY, m_Locality);
  34. DDV_MaxCharsCombo(pDX, IDC_NEWKEY_LOCALITY, m_Locality, 64);
  35. DDX_Text(pDX, IDC_NEWKEY_STATE, m_State);
  36. DDV_MaxCharsCombo(pDX, IDC_NEWKEY_STATE, m_State, 64);
  37. DDX_CBString(pDX, IDC_NEWKEY_COUNTRY, m_Country);
  38. //}}AFX_DATA_MAP
  39. }
  40. LRESULT
  41. CGeoInfoPage::OnWizardPrev()
  42. {
  43. return IDD_PAGE_PREV;
  44. // return m_pCert->m_CAType == CCertificate::CA_OFFLINE ?
  45. // IDD_PAGE_PREV_FILE : IDD_PAGE_PREV_ONLINE;
  46. }
  47. LRESULT
  48. CGeoInfoPage::OnWizardNext()
  49. {
  50. ASSERT(m_pCert != NULL);
  51. UpdateData(TRUE);
  52. m_pCert->m_Locality = m_Locality;
  53. m_pCert->m_State = m_State;
  54. m_countryCombo.GetSelectedCountry(m_pCert->m_Country);
  55. return m_pCert->m_CAType == CCertificate::CA_OFFLINE ?
  56. IDD_PAGE_NEXT_FILE : IDD_PAGE_NEXT_ONLINE;
  57. }
  58. BOOL CGeoInfoPage::OnSetActive()
  59. {
  60. SetButtons();
  61. return CIISWizardPage::OnSetActive();
  62. }
  63. void CGeoInfoPage::SetButtons()
  64. {
  65. UpdateData(TRUE);
  66. SetWizardButtons(m_Country.IsEmpty() || m_Locality.IsEmpty() || m_State.IsEmpty() ?
  67. PSWIZB_BACK : PSWIZB_BACK | PSWIZB_NEXT);
  68. }
  69. BEGIN_MESSAGE_MAP(CGeoInfoPage, CIISWizardPage)
  70. //{{AFX_MSG_MAP(CGeoInfoPage)
  71. ON_CBN_EDITCHANGE(IDC_NEWKEY_LOCALITY, OnChangeNewkeyLocality)
  72. ON_CBN_EDITCHANGE(IDC_NEWKEY_STATE, OnChangeNewkeyState)
  73. ON_CBN_EDITCHANGE(IDC_NEWKEY_COUNTRY, OnEditchangeNewkeyCountry)
  74. //}}AFX_MSG_MAP
  75. END_MESSAGE_MAP()
  76. /////////////////////////////////////////////////////////////////////////////
  77. // CGeoInfoPage message handlers
  78. BOOL CGeoInfoPage::OnInitDialog()
  79. {
  80. ASSERT(m_pCert != NULL);
  81. m_Locality = m_pCert->m_Locality;
  82. m_State = m_pCert->m_State;
  83. m_countryCombo.SubclassDlgItem(IDC_NEWKEY_COUNTRY, this);
  84. CIISWizardPage::OnInitDialog();
  85. m_countryCombo.Init();
  86. m_countryCombo.SetSelectedCountry(m_pCert->m_Country);
  87. // Load MRU names
  88. LoadMRUToCombo(this, IDC_NEWKEY_STATE, szStateMRU, m_State, MAX_MRU);
  89. LoadMRUToCombo(this, IDC_NEWKEY_LOCALITY, szLocalityMRU, m_Locality, MAX_MRU);
  90. SetButtons();
  91. GetDlgItem(IDC_NEWKEY_COUNTRY)->SetFocus();
  92. return FALSE;
  93. }
  94. void CGeoInfoPage::OnChangeNewkeyLocality()
  95. {
  96. SetButtons();
  97. }
  98. void CGeoInfoPage::OnChangeNewkeyState()
  99. {
  100. SetButtons();
  101. }
  102. void CGeoInfoPage::OnEditchangeNewkeyCountry()
  103. {
  104. SetButtons();
  105. }