Пример #1
0
void CuDlgReplicationServerPageStartupSetting::OnButtonRestore()
{
	UINT nState = 0;
	CString strMessage;
	int answ, nCount = m_cListCtrl.GetItemCount(),iIndex = -1;

	m_cListCtrl.HideProperty(TRUE);
	iIndex = m_cListCtrl.GetNextItem (-1, LVNI_SELECTED);

	if (iIndex == -1)
		return;
	CaReplicationItem* pItem = (CaReplicationItem*)m_cListCtrl.GetItemData(iIndex);
	if (!pItem)
		return;
	//"Do you want to restore '%s' "
	//"to its default setting ?"
	strMessage.Format(IDS_F_RESTORE_DEFAULT,(LPCTSTR)pItem->GetDescription());
	answ = AfxMessageBox(strMessage , MB_ICONEXCLAMATION | MB_YESNO);
	if ( answ == IDYES ){
		BOOL bNotUsed;
		pItem->SetToDefault();
		pItem->SetValueModifyByUser(TRUE);
		if (pItem->GetType() == CaReplicationItem::REP_BOOLEAN)
		{
			CString strValue = pItem->GetFlagContent(bNotUsed);
			if (strValue.CompareNoCase (_T("TRUE")) == 0)
				m_cListCtrl.SetCheck (iIndex, 1, TRUE);
			else
				m_cListCtrl.SetCheck (iIndex, 1, FALSE);
		}
		else
			m_cListCtrl.SetItemText (iIndex, 1, pItem->GetFlagContent(bNotUsed));
	}
	EnableButtons();
}
Пример #2
0
void CuDlgReplicationServerPageStartupSetting::OnButtonRestoreAll()
{
	CString strMessage;
	int i,answ, nCount = m_cListCtrl.GetItemCount();
	if (nCount == 0)
		return;
	m_cListCtrl.HideProperty(TRUE);
	answ = AfxMessageBox(IDS_A_RESTORE_ALL , MB_ICONEXCLAMATION | MB_YESNO );
	if ( answ == IDYES ) {
		for (i=0; i<nCount; i++)
		{
			CaReplicationItem* pItem = (CaReplicationItem*)m_cListCtrl.GetItemData(i);
			if ( pItem != NULL)
			{
				BOOL bNotUsed;
				pItem->SetToDefault();
				pItem->SetValueModifyByUser(TRUE);
				if (pItem->GetType() == CaReplicationItem::REP_BOOLEAN)
				{
					CString strValue = pItem->GetFlagContent(bNotUsed);
					if (strValue.CompareNoCase (_T("TRUE")) == 0)
						m_cListCtrl.SetCheck (i, 1, TRUE);
					else
						m_cListCtrl.SetCheck (i, 1, FALSE);
				}
				else
					m_cListCtrl.SetItemText (i, 1, pItem->GetFlagContent(bNotUsed));
			}
		}
	}
	EnableButtons();
}
Пример #3
0
BOOL CaReplicationItemList::SetAllFlagsToDefault()
{
	POSITION pos = GetHeadPosition();

	while (pos != NULL) {
		CaReplicationItem* obj = GetNext(pos);
		obj->SetToDefault();
		obj->SetValueModifyByUser(TRUE);
	}
	return TRUE;
}