| 97 | } |
| 98 | |
| 99 | void CServiceManage::OnOK() |
| 100 | { |
| 101 | BOOL rc; |
| 102 | |
| 103 | // TODO: Add extra validation here |
| 104 | UpdateData(TRUE); |
| 105 | |
| 106 | CComboBox *cbStartup = (CComboBox *)GetDlgItem(IDC_COMBO_STARTUP); |
| 107 | if (cbStartup) { |
| 108 | m_nStartmode = cbStartup->GetCurSel(); |
| 109 | } else { |
| 110 | m_nStartmode = CB_ERR; |
| 111 | } |
| 112 | |
| 113 | if (m_nStartmode == CB_ERR) { |
| 114 | AfxMessageBox("Invalid startup mode !", MB_OK|MB_ICONWARNING); |
| 115 | return; |
| 116 | } |
| 117 | |
| 118 | if (m_Codepage.IsEmpty()) { |
| 119 | AfxMessageBox("You must select a codepage type.", MB_OK|MB_ICONWARNING); |
| 120 | return; |
| 121 | } |
| 122 | |
| 123 | CComboBox *cbCodepage = (CComboBox *)GetDlgItem(IDC_COMBO_CODEPAGE); |
| 124 | if (cbCodepage) { |
| 125 | int rc = cbCodepage->FindStringExact(-1, m_Codepage); |
| 126 | if (rc == CB_ERR) { |
| 127 | AfxMessageBox("Invalid codepage type: "+m_Codepage, MB_OK|MB_ICONWARNING); |
| 128 | return; |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | if (AfxMessageBox("Current service settings will be overwritten,\ndo you want continue ?", |
| 133 | MB_YESNO | MB_ICONQUESTION) != IDYES) { |
| 134 | return; |
| 135 | } |
| 136 | |
| 137 | rc = Ext2SetGlobalProperty( |
| 138 | m_nStartmode, |
| 139 | (BOOLEAN)m_bReadonly, |
| 140 | (BOOLEAN)m_bExt3Writable, |
| 141 | m_Codepage.GetBuffer(CODEPAGE_MAXLEN), |
| 142 | m_sPrefix.GetBuffer(HIDINGPAT_LEN), |
| 143 | m_sSuffix.GetBuffer(HIDINGPAT_LEN), |
| 144 | (BOOLEAN)m_bAutoMount |
| 145 | ); |
| 146 | |
| 147 | if (rc) { |
| 148 | /* |
| 149 | AfxMessageBox("Ext2 service settings updated successfully !", |
| 150 | MB_OK | MB_ICONINFORMATION); |
| 151 | */ |
| 152 | CDialog::OnOK(); |
| 153 | } else { |
| 154 | AfxMessageBox("Failed to save the service settings !", |
| 155 | MB_OK | MB_ICONWARNING); |
| 156 | } |
nothing calls this directly
no test coverage detected