void CFilterStringDlg::OnCbnSelchangeStringRule() { int isel = m_cbxRule.GetCurSel(); m_rule = (PWSMatch::MatchRule)m_cbxRule.GetItemData(isel); EnableDialogItems(); }
void CFilterPasswordDlg::OnCbnSelchangePasswordRule() { int isel = m_cbxRule.GetCurSel(); m_rule = (PWSMatch::MatchRule)m_cbxRule.GetItemData(isel); if (m_rule == PWSMatch::MR_WILLEXPIRE) { if (m_num1 < 1) m_num1 = 1; } else m_num1 = 0; EnableDialogItems(); }
BOOL CFilterStringDlg::OnInitDialog() { CFilterBaseDlg::OnInitDialog(); CString cs_text; int iItem(-1); // NOTE: This ComboBox is NOT sorted by design ! if (m_cbxRule.GetCount() == 0) { if (m_add_present) { const PWSMatch::MatchRule mrx[] = {PWSMatch::MR_PRESENT, PWSMatch::MR_NOTPRESENT}; for (size_t i = 0; i < _countof(mrx); i++) { UINT iumsg = PWSMatch::GetRule(mrx[i]); cs_text.LoadString(iumsg); iItem = m_cbxRule.AddString(cs_text); m_cbxRule.SetItemData(iItem, mrx[i]); m_rule2selection[mrx[i]] = iItem; } } const PWSMatch::MatchRule mrx[] = {PWSMatch::MR_EQUALS, PWSMatch::MR_NOTEQUAL, PWSMatch::MR_BEGINS, PWSMatch::MR_NOTBEGIN, PWSMatch::MR_ENDS, PWSMatch::MR_NOTEND, PWSMatch::MR_CONTAINS, PWSMatch::MR_NOTCONTAIN, PWSMatch::MR_CNTNANY, PWSMatch::MR_NOTCNTNANY, PWSMatch::MR_CNTNALL, PWSMatch::MR_NOTCNTNALL}; for (size_t i = 0; i < _countof(mrx); i++) { UINT iumsg = PWSMatch::GetRule(mrx[i]); cs_text.LoadString(iumsg); iItem = m_cbxRule.AddString(cs_text); m_cbxRule.SetItemData(iItem, mrx[i]); m_rule2selection[mrx[i]] = iItem; } } int isel = m_rule2selection[(int)m_rule]; if (isel == -1) m_rule = PWSMatch::MR_INVALID; if (m_rule != PWSMatch::MR_INVALID) { m_cbxRule.SetCurSel(isel); EnableDialogItems(); } else { m_cbxRule.SetCurSel(-1); m_case = BST_UNCHECKED; m_string = L""; } UpdateData(FALSE); return TRUE; }
BOOL CFilterPasswordDlg::OnInitDialog() { CFilterBaseDlg::OnInitDialog(); CString cs_text; // NOTE: This ComboBox is NOT sorted by design ! if (m_cbxRule.GetCount() == 0) { const PWSMatch::MatchRule mrx[] = {PWSMatch::MR_EQUALS, PWSMatch::MR_NOTEQUAL, PWSMatch::MR_BEGINS, PWSMatch::MR_NOTBEGIN, PWSMatch::MR_ENDS, PWSMatch::MR_NOTEND, PWSMatch::MR_CONTAINS, PWSMatch::MR_NOTCONTAIN, PWSMatch::MR_CNTNANY, PWSMatch::MR_NOTCNTNANY, PWSMatch::MR_CNTNALL, PWSMatch::MR_NOTCNTNALL, PWSMatch::MR_EXPIRED, PWSMatch::MR_WILLEXPIRE}; for (size_t i = 0; i < _countof(mrx); i++) { UINT iumsg = PWSMatch::GetRule(mrx[i]); cs_text.LoadString(iumsg); int iItem = m_cbxRule.AddString(cs_text); m_cbxRule.SetItemData(iItem, mrx[i]); m_rule2selection[mrx[i]] = iItem; } } int isel = m_rule2selection[(int)m_rule]; if (isel == -1) m_rule = PWSMatch::MR_INVALID; if (m_rule != PWSMatch::MR_INVALID) { m_cbxRule.SetCurSel(isel); EnableDialogItems(); } else m_cbxRule.SetCurSel(-1); // Last 32-bit date is 03:14:07 UTC on Tuesday, January 19, 2038 // Find number of days from now to 2038/01/18 = max value here const CTime ct_Latest(2038, 1, 18, 0, 0, 0); const CTime ct_Now(CTime::GetCurrentTime()); CTimeSpan elapsedTime = ct_Latest - ct_Now; m_maxDays = (int)elapsedTime.GetDays(); UpdateData(FALSE); return TRUE; }
BOOL CFilterMediaTypeDlg::OnInitDialog() { CFilterBaseDlg::OnInitDialog(); CString cs_text; // NOTE: This ComboBox is NOT sorted by design ! if (m_cbxRule.GetCount() == 0) { if (m_add_present) { const PWSMatch::MatchRule mrx[] = {PWSMatch::MR_PRESENT, PWSMatch::MR_NOTPRESENT}; for (size_t i = 0; i < _countof(mrx); i++) { UINT iumsg = PWSMatch::GetRule(mrx[i]); cs_text.LoadString(iumsg); int iItem = m_cbxRule.AddString(cs_text); m_cbxRule.SetItemData(iItem, mrx[i]); m_rule2selection[mrx[i]] = iItem; } } const PWSMatch::MatchRule mrx[] = {PWSMatch::MR_EQUALS, PWSMatch::MR_NOTEQUAL, PWSMatch::MR_BEGINS, PWSMatch::MR_NOTBEGIN, PWSMatch::MR_ENDS, PWSMatch::MR_NOTEND, PWSMatch::MR_CONTAINS, PWSMatch::MR_NOTCONTAIN, PWSMatch::MR_CNTNANY, PWSMatch::MR_NOTCNTNANY, PWSMatch::MR_CNTNALL, PWSMatch::MR_NOTCNTNALL}; for (size_t i = 0; i < _countof(mrx); i++) { UINT iumsg = PWSMatch::GetRule(mrx[i]); cs_text.LoadString(iumsg); int iItem = m_cbxRule.AddString(cs_text); m_cbxRule.SetItemData(iItem, mrx[i]); m_rule2selection[mrx[i]] = iItem; } } int isel = m_rule2selection[(int)m_rule]; if (isel == -1) m_rule = PWSMatch::MR_INVALID; if (m_rule != PWSMatch::MR_INVALID) { m_cbxRule.SetCurSel(isel); EnableDialogItems(); } else { m_cbxRule.SetCurSel(-1); m_case = BST_UNCHECKED; m_string = L""; } if (m_cbxAvailableMTs.GetCount() == 0 && m_psMediaTypes != NULL) { size_t i = 0; for (auto iter = m_psMediaTypes->begin(); iter != m_psMediaTypes->end(); i++, iter++) { int iItem = m_cbxAvailableMTs.AddString(iter->c_str()); m_cbxAvailableMTs.SetItemData(iItem, i); } } UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control }