Пример #1
0
static void vPopulateFilterApplied(const SFILTERAPPLIED_CAN* psFilterConfigured, SFILTERAPPLIED_CAN& sFilterApplied, CMainEntryList& SrcList)
{
    SMAINENTRY& sMainEntry = SrcList.GetHead();
    int nCount  = sMainEntry.m_odSelEntryList.GetCount();
    sFilterApplied.vClear();
    sFilterApplied.m_psFilters = new SFILTERSET[nCount];
    
    POSITION pos = sMainEntry.m_odSelEntryList.GetHeadPosition();
    while (pos)
    {        		
        SSUBENTRY& sSubEntry = sMainEntry.m_odSelEntryList.GetNext(pos);
        const PSFILTERSET psTemp = SFILTERSET::psGetFilterSetPointer(psFilterConfigured->m_psFilters, 
            psFilterConfigured->m_ushTotal, sSubEntry.m_omSubEntryName.GetBuffer(MAX_PATH));
        ASSERT (psTemp != NULL);
        sFilterApplied.m_psFilters[sFilterApplied.m_ushTotal].bClone(*psTemp);
        sFilterApplied.m_ushTotal++;
    }
}
void CMsgFilterConfigPage::updateFilterConfiguration(CMainEntryList& SrcList)
{
    mUpdatedFilters.clear();

    const SMAINENTRY& sMainEntry = SrcList.GetHead();
    POSITION pos = sMainEntry.m_odSelEntryList.GetHeadPosition();
    while (pos)
    {
        SSUBENTRY sSubEntry = sMainEntry.m_odSelEntryList.GetNext(pos);
        auto filter = mFilterDetails->mFitersApplied.find(sSubEntry.m_omSubEntryName.GetBuffer(0));
        if (filter != mFilterDetails->mFitersApplied.end())
        {
            mUpdatedFilters[sSubEntry.m_omSubEntryName.GetBuffer(0)] = filter->second;
        }
        else
        {
            mUpdatedFilters[sSubEntry.m_omSubEntryName.GetBuffer(0)] = true;
        }
    }
    mFilterDetails->mFitersApplied = mUpdatedFilters;
}
static void vPopulateFilterApplied(const SFILTERAPPLIED_CAN* psFilterConfigured, SFILTERAPPLIED_CAN& sFilterApplied, CMainEntryList& SrcList)
{
    const SMAINENTRY& sMainEntry = SrcList.GetHead();
    int nCount  = sMainEntry.m_odSelEntryList.GetCount();

	SFILTERAPPLIED_CAN    sTempAppliedFilter;
	sTempAppliedFilter.bClone(sFilterApplied);
    sFilterApplied.vClear();
    sFilterApplied.m_psFilters = new SFILTERSET[nCount];

    POSITION pos = sMainEntry.m_odSelEntryList.GetHeadPosition();
    while (pos)
    {
        SSUBENTRY sSubEntry = sMainEntry.m_odSelEntryList.GetNext(pos);
        const PSFILTERSET psTemp = SFILTERSET::psGetFilterSetPointer(psFilterConfigured->m_psFilters,
                                   psFilterConfigured->m_ushTotal, sSubEntry.m_omSubEntryName.GetBuffer(MAX_PATH));
        ASSERT (psTemp != NULL);
        sFilterApplied.m_psFilters[sFilterApplied.m_ushTotal].bClone(*psTemp);
        sFilterApplied.m_ushTotal++;
    }

	//restore the enable flag for all filters
	for(int nAppFilterCnt = 0; nAppFilterCnt < sFilterApplied.m_ushTotal; nAppFilterCnt++)
	{
		for(int nTempFilCnt = 0; nTempFilCnt < sTempAppliedFilter.m_ushTotal; nTempFilCnt++ )
		{
			if((&sTempAppliedFilter.m_psFilters[nTempFilCnt]) != NULL)
			{
				if(strcmp(sFilterApplied.m_psFilters[nAppFilterCnt].m_sFilterName.m_acFilterName,sTempAppliedFilter.m_psFilters[nTempFilCnt].m_sFilterName.m_acFilterName) == 0)
				{
					((sFilterApplied.m_psFilters)+ nAppFilterCnt) ->m_bEnabled 
						=  ((sTempAppliedFilter.m_psFilters)+ nTempFilCnt) ->m_bEnabled;
				}
			}
		}
	}
}