diff -r 000000000000 -r 5a93021fdf25 connectionutilities/ConnectionDialogs/src/ConnectionInfoKey.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectionutilities/ConnectionDialogs/src/ConnectionInfoKey.cpp Thu Dec 17 08:55:21 2009 +0200 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2005 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: Implementation of class CConnectionInfoKey. +* +*/ + + +// INCLUDE FILES +#include "ConnectionInfoKey.h" +#include "ConnectionInfo.h" + + +// ================= MEMBER FUNCTIONS ======================= +// +// --------------------------------------------------------- +// CConnectionInfoKey::CConnectionInfoKey() +// --------------------------------------------------------- +// +CConnectionInfoKey::CConnectionInfoKey( TBool aIsWLANFeatureSupported ) +: TKeyArrayFix( 0, ECmpCollated ), + iIsWLANFeatureSupported( aIsWLANFeatureSupported ) + { + } + + +// --------------------------------------------------------- +// CConnectionInfoKey::~CConnectionInfoKey() +// --------------------------------------------------------- +// +CConnectionInfoKey::~CConnectionInfoKey() + { + if ( iIsWLANFeatureSupported ) + { + delete iNameEasyWLAN; + } + } + + +// --------------------------------------------------------- +// CConnectionInfoKey::NewL() +// --------------------------------------------------------- +// +CConnectionInfoKey* CConnectionInfoKey::NewL( TDesC &aNameEasyWLAN ) + { + CConnectionInfoKey* self = new (ELeave) CConnectionInfoKey( ETrue ); + CleanupStack::PushL( self ); + self->ConstructL( aNameEasyWLAN ); + CleanupStack::Pop( self ); + + return self; + } + + +// --------------------------------------------------------- +// CConnectionInfoKey::ConstructL() +// --------------------------------------------------------- +// +void CConnectionInfoKey::ConstructL( TDesC &aNameEasyWLAN ) + { + iNameEasyWLAN = aNameEasyWLAN.AllocL(); + } + + +// --------------------------------------------------------- +// CConnectionInfoKey::NewL() +// --------------------------------------------------------- +// +CConnectionInfoKey* CConnectionInfoKey::NewL() + { + CConnectionInfoKey* self = new (ELeave) CConnectionInfoKey( EFalse ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +// --------------------------------------------------------- +// CConnectionInfoKey::ConstructL() +// --------------------------------------------------------- +// +void CConnectionInfoKey::ConstructL() + { + } + + + +// --------------------------------------------------------- +// CConnectionInfoKey::SetPtr( CArrayPtrFlat* aPtr ) +// --------------------------------------------------------- +// +void CConnectionInfoKey::SetPtr( CArrayPtrFlat* aPtr ) + { + iPtr = aPtr; + } + + +// --------------------------------------------------------- +// CConnectionInfoKey::Compare( TInt aLeft, TInt aRight ) const +// --------------------------------------------------------- +// +TInt CConnectionInfoKey::Compare( TInt aLeft, TInt aRight ) const + { + TInt retval; + + if ( iIsWLANFeatureSupported && + ! iPtr->At( aLeft )->Name().CompareC( *iNameEasyWLAN ) ) + { + retval = -1; + } + else if ( iIsWLANFeatureSupported && + ! iPtr->At( aRight )->Name().CompareC( *iNameEasyWLAN ) ) + { + retval = 1; + } + else + { + retval = iPtr->At( aLeft )->Name().CompareC( + iPtr->At( aRight )->Name() ); + } + + return retval; + } + + +// --------------------------------------------------------- +// CConnectionInfoKey::At( TInt anIndex ) const +// --------------------------------------------------------- +// +TAny* CConnectionInfoKey::At( TInt anIndex ) const + { + TDesC16 tem( iPtr->At( anIndex )->Name() ); + TAny* ptr = ( TAny* )&tem; + + return ptr; + } + + +// End of File