eventsui/eventsmgmtui/src/evtmgmtuilistboxmodel.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:31:27 +0100
branchRCL_3
changeset 18 870918037e16
parent 0 522cd55cc3d7
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2009 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:  List box model class for Events Management UI.
*
*/

// INCLUDES
#include <aknsfld.h> // For SearchField
#include "evtmgmtuilistboxmodel.h"
#include "evtmgmtuimodel.h"
#include "evtmgmtuifiltermodel.h"

// -----------------------------------------------------------------------------
// CEvtMgmtUiListBoxModel::~CEvtMgmtUiListBoxModel
// 
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
CEvtMgmtUiListBoxModel::~CEvtMgmtUiListBoxModel()
    {        
    delete iEvtMgmtUiFilterModel;
    }

// -----------------------------------------------------------------------------
// CEvtMgmtUiListBoxModel::NewLC
// 
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
CEvtMgmtUiListBoxModel* CEvtMgmtUiListBoxModel::NewL( )
    {
	CEvtMgmtUiListBoxModel* self = NewLC( );
	CleanupStack::Pop( self );
	return self;
    }

// -----------------------------------------------------------------------------
// CEvtMgmtUiListBoxModel::NewLC
// 
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
CEvtMgmtUiListBoxModel* CEvtMgmtUiListBoxModel::NewLC( )
    {
	CEvtMgmtUiListBoxModel* self = new ( ELeave )CEvtMgmtUiListBoxModel( );
	CleanupStack::PushL( self );
	self->ConstructL( );
	return self;
    }

// -----------------------------------------------------------------------------
// CEvtMgmtUiListBoxModel::CEvtMgmtUiListBoxModel
// 
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
CEvtMgmtUiListBoxModel::CEvtMgmtUiListBoxModel()
    {    
    }

// -----------------------------------------------------------------------------
// CEvtMgmtUiListBoxModel::ConstructL
// 
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CEvtMgmtUiListBoxModel::ConstructL()
    {    
    iEvtMgmtUiFilterModel = CEvtMgmtUiFilterModel::NewL();
    }

// -----------------------------------------------------------------------------
// CEvtMgmtUiListBoxModel::MatchableTextArray
// 
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
const MDesCArray* CEvtMgmtUiListBoxModel::MatchableTextArray() const
    {    
    return this;
    }
        
// ---------------------------------------------------------------------------
// TInt CEvtMgmtUiListBoxModel::MdcaCount() const
// ---------------------------------------------------------------------------
//
TInt CEvtMgmtUiListBoxModel::MdcaCount() const
    {
    return iEvtMgmtUiFilterModel->MdcaCount();
    }
    
// ---------------------------------------------------------------------------
// TPtrC16 CEvtMgmtUiListBoxModel::MdcaPoint() const
// ---------------------------------------------------------------------------
//
TPtrC16 CEvtMgmtUiListBoxModel::MdcaPoint( TInt  aIndex ) const
    {
    if (Filter())
        {
        return Filter()->DefaultMatchableItemFromItem(iEvtMgmtUiFilterModel->MdcaPoint(aIndex));
        }   
    else
        {
        return iEvtMgmtUiFilterModel->MdcaPoint(aIndex);
        }
    }

// -----------------------------------------------------------------------------
// CEvtMgmtUiListBoxModel::NumberOfItems
// 
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TInt CEvtMgmtUiListBoxModel::NumberOfItems() const
    {
    return Filter() ? 
           Filter()->FilteredNumberOfItems(): CTextListBoxModel::NumberOfItems();
    }

// -----------------------------------------------------------------------------
// CEvtMgmtUiListBoxModel::ItemText
// 
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TPtrC CEvtMgmtUiListBoxModel::ItemText(TInt aItemIndex) const
    {
    if(aItemIndex==0)
        {
        return iEvtMgmtUiFilterModel->GetZeroIndex();
        }
    else
        {
        return CTextListBoxModel::ItemText( Filter() ? 
                          Filter()->FilteredItemIndex(aItemIndex) : aItemIndex);
        }
    }

// -----------------------------------------------------------------------------
// CEvtMgmtUiListBoxModel::NumberOfItems
// 
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CEvtMgmtUiListBoxModel::SetItemTextArrayToFilterModel()
    {
    iEvtMgmtUiFilterModel->SetItemTextArray(ItemTextArray());
    SetItemTextArray(iEvtMgmtUiFilterModel);
    }

// -----------------------------------------------------------------------------
// CEvtMgmtUiListBoxModel::NumberOfItems
// 
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CEvtMgmtUiListBoxModel::SetFindToFilterModel(CAknSearchField* aSearchField)
    {
    iEvtMgmtUiFilterModel->SetSearchField(aSearchField);
    }

// End of File