csxhelp/HelpEngine/src/CSXHLegacyTOC1.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 25 May 2010 12:28:46 +0300
branchRCL_3
changeset 20 326673dff2bf
parent 0 1f04cf54edd8
child 22 e3a25416bf1f
permissions -rw-r--r--
Revision: 201018 Kit: 2010121

/*
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  CCSXHLegacyTOC1 class definition
*
*/

#include "CSXHLegacyTOC1.h"
#include "CSXHViewIDs.h"
#include "CSXHLegacyContentParser.h"
#include "CSXHHelpDataBase.h"

#include <e32base.h>

CCSXHLegacyTOC1* CCSXHLegacyTOC1::NewL(const TDesC& aName)
    {
    CCSXHLegacyTOC1* self = CCSXHLegacyTOC1::NewLC(aName);
    CleanupStack::Pop(self);
    return self;
    }

CCSXHLegacyTOC1* CCSXHLegacyTOC1::NewLC(const TDesC& aName)
    {
    CCSXHLegacyTOC1* self = new(ELeave) CCSXHLegacyTOC1(aName);
    CleanupStack::PushL(self);
    return self;
    }

CCSXHLegacyTOC1::CCSXHLegacyTOC1(const TDesC& aName) :
CCSXHGenericTOC1(aName)
    {//No implementation required
    }

TUid CCSXHLegacyTOC1::GetViewID() const
    {
    return KCSXHToc2AppHelpsViewID;
    }
    
CCSXHHelpContentBase* CCSXHLegacyTOC1::GetContextTopic(const TDesC& aContextName)
    {
    TBool resetChildList = EFalse;
    if(iChildList ==NULL)
        {
        InitChildList();//Generates child list if required.     
        resetChildList = ETrue;
        }
        
    TInt count =    iChildList->Count();
    CCSXHHelpContentBase* toc2 = NULL;
    for(TInt i=0;i<count;++i )
        {
        toc2 = (*iChildList)[i];
        if(toc2->GetName().Compare(aContextName) == 0)
            return toc2;//Child list should not be reset
        }
    if(resetChildList)
        ResetChildList();
    return NULL;    
    }

void CCSXHLegacyTOC1::InitChildList()
    {
    if(iChildList != NULL)
        return;
    ConstructChildList();
    
    TRAP_IGNORE(CCSXHHelpDataBase::GetInstance()->
    GetLegacyParser()->GenerateTOC2ListL(*this,iChildList));
    }