PathSettingsNotebook.cpp
Go to the documentation of this file.00001
00010 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && defined(PKIFRESOURCES_ALLOW_GCC_PRAGMA)
00011 #pragma implementation "PathSettingsNotebook.cpp"
00012 #endif
00013
00014
00015 #include "PKIFdll.h"
00016
00017 #include "wx/wxprec.h"
00018
00019 #ifdef __BORLANDC__
00020 #pragma hdrstop
00021 #endif
00022
00023 #include "PathSettingsNotebook.h"
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 BEGIN_EVENT_TABLE(CPKIFPathSettingsNotebook,wxDialog)
00034 EVT_BUTTON( wxID_OK, CPKIFPathSettingsNotebook::OnOK )
00035 EVT_BUTTON( wxID_CANCEL, CPKIFPathSettingsNotebook::OnCancel )
00036 EVT_INIT_DIALOG( CPKIFPathSettingsNotebook::OnInitDialog )
00037 END_EVENT_TABLE()
00045 CPKIFPathSettingsNotebook::CPKIFPathSettingsNotebook( wxWindow *parent, wxWindowID id, const wxString &title,
00046 const wxPoint &position, const wxSize& size, long style ) :
00047 wxDialog( parent, id, title, position, size, style )
00048 {
00049
00050 wxSizer* sizerTop = PathSettingsNotebook( this, TRUE, TRUE);
00051 SetSizer(sizerTop);
00052
00053 wxNotebook* pNotebook = static_cast<wxNotebook *>(this->FindWindow(ID_NOTEBOOK_PATH_SETTINGS));
00054 wxASSERT(pNotebook);
00055
00056 wxPanel *booleanPanel = new wxPanel( pNotebook, -1 );
00057 m_pBooleanPanel = new CPKIFInitialBooleanSettingsPanel(booleanPanel);
00058 pNotebook->AddPage( booleanPanel, wxT("Certification Path Processing Settings") );
00059
00060 wxPanel *userPolicySetPanel = new wxPanel( pNotebook, -1 );
00061 m_pUserPolicySetPanel = new CPKIFUserPolicySetPanel(userPolicySetPanel);
00062 pNotebook->AddPage( userPolicySetPanel, wxT("Initial user constrained policy set") );
00063
00064 wxPanel *nameConstraintsPanel = new wxPanel( pNotebook, -1 );
00065 m_pUserNameConstraintsPanel = new CPKIFNameConstraintsPanel(nameConstraintsPanel);
00066 pNotebook->AddPage( nameConstraintsPanel, wxT("Initial name constraints") );
00067
00068 sizerTop->Layout();
00069 sizerTop->SetSizeHints(this);
00070 sizerTop->Fit(this);
00071 }
00079 CPKIFPathSettingsNotebook::~CPKIFPathSettingsNotebook()
00080 {
00081 if(m_pBooleanPanel) delete m_pBooleanPanel;
00082 if(m_pUserPolicySetPanel) delete m_pUserPolicySetPanel;
00083 if(m_pUserNameConstraintsPanel) delete m_pUserNameConstraintsPanel;
00084 }
00085
00086
00094 void CPKIFPathSettingsNotebook::OnCancel( wxCommandEvent &event )
00095 {
00096 EndModal(wxID_CANCEL);
00097 }
00105 void CPKIFPathSettingsNotebook::OnOK( wxCommandEvent &event )
00106 {
00107 if(m_pUserPolicySetPanel->Validate() && m_pUserNameConstraintsPanel ->Validate() &&
00108 m_pBooleanPanel->Validate())
00109 EndModal(wxID_OK);
00110 }
00118 CPKIFPathSettingsPtr CPKIFPathSettingsNotebook::GetPathSettings()
00119 {
00120 wxASSERT(m_pBooleanPanel);
00121 wxASSERT(m_pUserPolicySetPanel);
00122 wxASSERT(m_pUserNameConstraintsPanel);
00123
00124
00125 CPKIFPathSettingsPtr ps(new CPKIFPathSettings);
00126
00127 wxCheckBox* cb = NULL;
00128
00129
00130 cb = m_pBooleanPanel->GetCheckExplicitPolicyIndicator();
00131 wxASSERT(cb);
00132 if(cb->IsChecked())
00133 ps->SetInitialExplicitPolicyIndicator();
00134
00135 cb = m_pBooleanPanel->GetCheckInhibitPolicyMapping();
00136 wxASSERT(cb);
00137 if(cb->IsChecked())
00138 ps->SetInitialPolicyMappingInhibitIndicator();
00139
00140 cb = m_pBooleanPanel->GetCheckInhibitAnyPol();
00141 wxASSERT(cb);
00142 if(cb->IsChecked())
00143 ps->SetInitialInhibitAnyPolicyIndicator();
00144
00145 cb = m_pBooleanPanel->GetCheckRequireFresh();
00146 wxASSERT(cb);
00147 if(cb->IsChecked())
00148 ps->SetRequireFreshRevocationData(true);
00149 else
00150 ps->SetRequireFreshRevocationData(false);
00151
00152 cb = m_pBooleanPanel->GetCheckRequireRecent();
00153 wxASSERT(cb);
00154 if(cb->IsChecked())
00155 ps->SetRequireSufficientlyRecent(true);
00156 else
00157 ps->SetRequireSufficientlyRecent(false);
00158
00159 cb = m_pBooleanPanel->GetCheckValidateWhenBuilding();
00160 wxASSERT(cb);
00161 if(cb->IsChecked())
00162 ps->SetUseValidatorFilterWhenBuilding(true);
00163 else
00164 ps->SetUseValidatorFilterWhenBuilding(false);
00165
00166 cb = m_pBooleanPanel->GetCheckRevStatus();
00167 wxASSERT(cb);
00168 if(cb->IsChecked())
00169 ps->SetCheckRevocationStatus(true);
00170 else
00171 ps->SetCheckRevocationStatus(false);
00172
00173 CPKIFPolicyInformationListPtr initPolSet = m_pUserPolicySetPanel->GetPolicies();
00174
00175
00176 ps->SetInitialPolicySet(initPolSet);
00177
00178 CPKIFGeneralSubtreeListPtr initPermNC = m_pUserNameConstraintsPanel->GetPermittedNameConstraints();
00179 if(initPermNC != (CPKIFGeneralSubtreeList*)NULL && 0 < initPermNC->size())
00180 ps->SetInitialPermSubtrees(initPermNC);
00181
00182 CPKIFGeneralSubtreeListPtr initExcl = m_pUserNameConstraintsPanel->GetExcludedNameConstraints();
00183 if(initExcl != (CPKIFGeneralSubtreeList*)NULL && 0 < initExcl->size())
00184 ps->SetInitialExclSubtrees(initExcl);
00185
00186 return ps;
00187 }
00195 void CPKIFPathSettingsNotebook::OnInitDialog(wxInitDialogEvent& event)
00196 {
00197 m_pBooleanPanel->OnInitDialog(event);
00198 m_pUserPolicySetPanel->OnInitDialog(event);
00199 m_pUserNameConstraintsPanel->OnInitDialog(event);
00200 }
00208 void CPKIFPathSettingsNotebook::SetInitialPathSettings(CPKIFPathSettingsPtr& ps)
00209 {
00210 m_initialPathSettings = ps;
00211 m_pBooleanPanel->SetInitialPathSettings(m_initialPathSettings);
00212 m_pUserPolicySetPanel->SetInitialPathSettings(m_initialPathSettings);
00213 m_pUserNameConstraintsPanel->SetInitialPathSettings(m_initialPathSettings);
00214 }