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.

194 lines
4.8 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. Servpp.h
  7. Server properties implementation file
  8. FILE HISTORY:
  9. */
  10. #include "stdafx.h"
  11. #include "qmpolpp.h"
  12. #include "spdutil.h"
  13. #ifdef _DEBUG
  14. #define new DEBUG_NEW
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18. /////////////////////////////////////////////////////////////////////////////
  19. //
  20. // CQmPolicyProperties holder
  21. //
  22. /////////////////////////////////////////////////////////////////////////////
  23. CQmPolicyProperties::CQmPolicyProperties
  24. (
  25. ITFSNode * pNode,
  26. IComponentData * pComponentData,
  27. ITFSComponentData * pTFSCompData,
  28. CQmPolicyInfo * pPolInfo,
  29. ISpdInfo * pSpdInfo,
  30. LPCTSTR pszSheetName
  31. ) : CPropertyPageHolderBase(pNode, pComponentData, pszSheetName)
  32. {
  33. //ASSERT(pFolderNode == GetContainerNode());
  34. m_bAutoDeletePages = FALSE; // we have the pages as embedded members
  35. AddPageToList((CPropertyPageBase*) &m_pageGeneral);
  36. Assert(pTFSCompData != NULL);
  37. m_spTFSCompData.Set(pTFSCompData);
  38. m_spSpdInfo.Set(pSpdInfo);
  39. m_PolInfo = *pPolInfo;
  40. }
  41. CQmPolicyProperties::~CQmPolicyProperties()
  42. {
  43. RemovePageFromList((CPropertyPageBase*) &m_pageGeneral, FALSE);
  44. }
  45. /////////////////////////////////////////////////////////////////////////////
  46. // CQmPolGenProp property page
  47. IMPLEMENT_DYNCREATE(CQmPolGenProp, CPropertyPageBase)
  48. CQmPolGenProp::CQmPolGenProp() : CPropertyPageBase(CQmPolGenProp::IDD)
  49. {
  50. //{{AFX_DATA_INIT(CQmPolGenProp)
  51. // NOTE: the ClassWizard will add member initialization here
  52. //}}AFX_DATA_INIT
  53. }
  54. CQmPolGenProp::~CQmPolGenProp()
  55. {
  56. }
  57. void CQmPolGenProp::DoDataExchange(CDataExchange* pDX)
  58. {
  59. CPropertyPageBase::DoDataExchange(pDX);
  60. //{{AFX_DATA_MAP(CQmPolGenProp)
  61. DDX_Control(pDX, IDC_QM_POL_GEN_LIST, m_listOffers);
  62. //}}AFX_DATA_MAP
  63. }
  64. BEGIN_MESSAGE_MAP(CQmPolGenProp, CPropertyPageBase)
  65. //{{AFX_MSG_MAP(CQmPolGenProp)
  66. //}}AFX_MSG_MAP
  67. END_MESSAGE_MAP()
  68. /////////////////////////////////////////////////////////////////////////////
  69. // CQmPolGenProp message handlers
  70. BOOL CQmPolGenProp::OnInitDialog()
  71. {
  72. CPropertyPageBase::OnInitDialog();
  73. PopulateOfferInfo();
  74. SetDirty(FALSE);
  75. return TRUE; // return TRUE unless you set the focus to a control
  76. // EXCEPTION: OCX Property Pages should return FALSE
  77. }
  78. void CQmPolGenProp::PopulateOfferInfo()
  79. {
  80. CString st;
  81. int nRows;
  82. int nWidth;
  83. CQmPolicyProperties * pPolProp;
  84. CQmPolicyInfo * pPolInfo;
  85. pPolProp = (CQmPolicyProperties *) GetHolder();
  86. Assert(pPolProp);
  87. pPolProp->GetPolicyInfo(&pPolInfo);
  88. st.LoadString(IDS_QM_POL_GEN_AUTH);
  89. nWidth = m_listOffers.GetStringWidth(st) + 20;
  90. m_listOffers.InsertColumn(0, st, LVCFMT_LEFT, nWidth);
  91. st.LoadString(IDS_QM_POL_GEN_ESP_CONF);
  92. nWidth = m_listOffers.GetStringWidth(st) + 20;
  93. m_listOffers.InsertColumn(1, st, LVCFMT_LEFT, nWidth);
  94. st.LoadString(IDS_QM_POL_GEN_ESP_INTEG);
  95. nWidth = m_listOffers.GetStringWidth(st) + 20;
  96. m_listOffers.InsertColumn(2, st, LVCFMT_LEFT, nWidth);
  97. st.LoadString(IDS_QM_POL_GEN_KEY_LIFE);
  98. nWidth = m_listOffers.GetStringWidth(st) + 20;
  99. m_listOffers.InsertColumn(3, st, LVCFMT_LEFT, nWidth);
  100. st.LoadString(IDS_QM_POL_GEN_PFS);
  101. nWidth = m_listOffers.GetStringWidth(st) + 20;
  102. m_listOffers.InsertColumn(4, st, LVCFMT_LEFT, nWidth);
  103. st.LoadString(IDS_QM_POL_GEN_PFS_GP);
  104. nWidth = m_listOffers.GetStringWidth(st) + 20;
  105. m_listOffers.InsertColumn(5, st, LVCFMT_LEFT, nWidth);
  106. nRows = 0;
  107. for (int i = 0; i < (int)pPolInfo->m_arrOffers.GetSize(); i++)
  108. {
  109. nRows = m_listOffers.InsertItem(nRows, _T(""));
  110. if (-1 != nRows)
  111. {
  112. QmAlgorithmToString(QM_ALGO_AUTH, pPolInfo->m_arrOffers[i], &st);
  113. m_listOffers.SetItemText(nRows, 0, st);
  114. QmAlgorithmToString(QM_ALGO_ESP_CONF, pPolInfo->m_arrOffers[i], &st);
  115. m_listOffers.SetItemText(nRows, 1, st);
  116. QmAlgorithmToString(QM_ALGO_ESP_INTEG, pPolInfo->m_arrOffers[i], &st);
  117. m_listOffers.SetItemText(nRows, 2, st);
  118. KeyLifetimeToString(pPolInfo->m_arrOffers[i]->m_Lifetime, &st);
  119. m_listOffers.SetItemText(nRows, 3, st);
  120. BoolToString(pPolInfo->m_arrOffers[i]->m_fPFSRequired, &st);
  121. m_listOffers.SetItemText(nRows, 4, st);
  122. st.Format(_T("%d"), pPolInfo->m_arrOffers[i]->m_dwPFSGroup);
  123. m_listOffers.SetItemText(nRows, 5, st);
  124. }
  125. nRows++;
  126. }
  127. }
  128. BOOL CQmPolGenProp::OnApply()
  129. {
  130. if (!IsDirty())
  131. return TRUE;
  132. UpdateData();
  133. //TODO
  134. //Do nothing at this time
  135. //CPropertyPageBase::OnApply();
  136. return TRUE;
  137. }
  138. BOOL CQmPolGenProp::OnPropertyChange(BOOL bScope, LONG_PTR *ChangeMask)
  139. {
  140. return FALSE;
  141. }