diff -r 5cc91383ab1e -r 7333d7932ef7 appinstaller/AppinstUi/sifuidevicedialogplugin/src/sifuidialogselectoptions_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/appinstaller/AppinstUi/sifuidevicedialogplugin/src/sifuidialogselectoptions_symbian.cpp Tue Aug 31 15:21:33 2010 +0300 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2010 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: Symbian specific functions in optional components selection dialog +* +*/ + +#include +#include +#include // RDesWriteStream + +const TInt KBufferGranularity = 4; + + +// ---------------------------------------------------------------------------- +// ConvertOptionalComponentIndexesL() +// ---------------------------------------------------------------------------- +// +QByteArray ConvertOptionalComponentIndexesL( const QList &aIndexes ) +{ + // Get aIndexes into symbianArray + RArray symbianArray; + CleanupClosePushL( symbianArray ); + QListIterator iter( aIndexes ); + while( iter.hasNext() ) { + QVariant item = iter.next(); + int i; + bool ok; + i = item.toInt( &ok ); + if( ok ) { + symbianArray.AppendL( i ); + } + } + + // Write symbianArray to a package buffer + CBufFlat* buffer = CBufFlat::NewL( KBufferGranularity ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + TPckg< const RArray > indexesPckg( symbianArray ); + writeStream.WriteL( indexesPckg ); + writeStream.CommitL(); + CleanupStack::PopAndDestroy( &writeStream ); + + // Create byte array (copies data) from the package buffer + const TInt KFromTheBeginning = 0; + TPtr8 ptr = buffer->Ptr(KFromTheBeginning); + QByteArray byteArray( reinterpret_cast( ptr.Ptr() ), ptr.Length() ); + CleanupStack::PopAndDestroy( buffer ); + + CleanupStack::PopAndDestroy( &symbianArray ); + return byteArray; +} +