Ejemplo n.º 1
0
void CYCSettingList::ResetSkinChooseItem()
{
    CAknEnumeratedTextPopupSettingItem* item = (CAknEnumeratedTextPopupSettingItem*)(this->SettingItemArray()->At(ELTSettingSkinChosse));
    CArrayPtr<CAknEnumeratedText>* texts = item->EnumeratedTextArray();
    texts->ResetAndDestroy();

    HBufC* textDef = StringLoader::LoadLC(R_TEXT_DEFAULT);
    CAknEnumeratedText* enumTextDef = new (ELeave) CAknEnumeratedText(0, textDef);
    CleanupStack::Pop(textDef);
    CleanupStack::PushL(enumTextDef);
    texts->AppendL(enumTextDef);
    CleanupStack::Pop(enumTextDef);

    RPointerArray<SkinImageStruct>& skins = iScaner->GetSkins();
    for (TInt i=0; i<skins.Count(); i++)
    {
        pSkinImageStruct sk = skins[i];
        CAknEnumeratedText* enumText;

        HBufC* text = sk->iShortName.AllocLC();
        enumText = new (ELeave) CAknEnumeratedText(sk->iIndex+1, text);
        CleanupStack::Pop(text);
        CleanupStack::PushL(enumText);
        texts->AppendL(enumText);
        CleanupStack::Pop(enumText);
    }
}
void CMessageListBox::SetIconsArray()
{
    CArrayPtr<CGulIcon>* iconArray = new (ELeave)
    CArrayPtrFlat<CGulIcon>(2);

    CleanupStack::PushL(iconArray);

    TBuf<128> path;
    path = CRippleVaultAppUi::ApplicationDriveAndPath();
    path.Append(KS80SmsMbmFileName);

    iconArray->AppendL(iEikonEnv->CreateIconL(path,
                       EMbmS80smsInbox, EMbmS80smsInboxm));

    iconArray->AppendL(iEikonEnv->CreateIconL(path,
                       EMbmS80smsSent, EMbmS80smsSentm));


    CleanupStack::Pop(); // iconArray

    // Set the listbox's first column to fill the listbox's whole width
    CColumnListBoxData* colData = iListbox->ItemDrawer()->ColumnData();
    if(colData)
    {
        colData->SetIconArray(iconArray);

        colData->SetGraphicsColumnL(0, ETrue);
        colData->SetColumnWidthPixelL(0, 30);
        colData->SetColumnAlignmentL(0, CGraphicsContext::ELeft);

        colData->SetColumnWidthPixelL(1, 100);
    }

    iListbox->SetItemHeightL(30);
}
Ejemplo n.º 3
0
/**
Add intra contact properties when called by Cntmodel/Cntvcard, clients can use aContactId to 
collect any info about that contact and create a property for export.
All property parameters should be in form of name=value pair if exported as vCard3.0	
*/
void  CCntPBAPSupport::AddIntraContactPropertiesL(const TContactItemId& /*aContactId*/, CArrayPtr<CParserProperty>* aPropertyList)
	{
	_LIT8(KVersitIntraProp,"X-IRMC-CALL-DATETIME");
	_LIT8(KParam,"TYPE");
	_LIT8(KParamVal,"MISSED");

	if(iAddIntraProperties)
		{
	    CArrayPtr<CParserParam>* arrayOfParams = new(ELeave) CArrayPtrFlat<CParserParam>(5);
		CleanupStack::PushL(TCleanupItem(CleanUpResetAndDestroy, arrayOfParams));

		CParserParam* param = CParserParam::NewL(KParam, KParamVal);
		CleanupStack::PushL(param);
		arrayOfParams->AppendL(param);
		CleanupStack::Pop(param);

		TDateTime missedTime(2006,EOctober,10,10,30,0,0);
		TVersitDateTime* dateTime = new(ELeave)TVersitDateTime(missedTime, TVersitDateTime::EIsUTC);
		CleanupStack::PushL(dateTime);
		CParserPropertyValueDateTime* dateTimeValue = new(ELeave) CParserPropertyValueDateTime(dateTime);
		CleanupStack::Pop(dateTime);

		CleanupStack::PushL(dateTimeValue);
		CParserProperty* property = CParserGroupedProperty::NewL(*dateTimeValue, KVersitIntraProp, NULL, arrayOfParams);
		CleanupStack::Pop(dateTimeValue);
		CleanupStack::PushL(property);	
		aPropertyList->AppendL(property);
		CleanupStack::Pop(property);
		CleanupStack::Pop(arrayOfParams);
		}
	}
TInt CJuikIconManagerImpl::AddIconL(TInt aProviderId, CGulIcon* aIcon)
{
	CALLSTACKITEM_N(_CL("CJuikIconManagerImpl"), _CL("AddIconL"));
	auto_ptr<CGulIcon> icon( aIcon );
	CArrayFix<TInt>& map = ProviderIconIndexL(aProviderId);
	
	TInt ix = KErrNotFound;
	if ( iEmptySlotCount > 0 )
		ix = FindEmptySlotL();
	
	if ( ix == KErrNotFound )
		{
			iIconArray->AppendL( icon.release() );					   
			map.AppendL( LastIndex( *iIconArray ) );
		}
	else
		{
			iEmptySlotCount--;
			if ( iEmptySlotCount < 0 ) Bug( _L("Empty slot count underflow") ).Raise();
			
			(*iIconArray)[ix] = icon.release();
			map.AppendL( ix );
		}
	return LastIndex( map );
}
// -----------------------------------------------------------------------------
// CCMSX509GeneralNames::DecodeL
// Decrypts raw data to this instance
// -----------------------------------------------------------------------------
void CCMSX509GeneralNames::DecodeL( const TDesC8& aRawData )
	{
    CArrayPtr< TASN1DecGeneric >* nameData =
        DecodeSequenceLC( aRawData );
    TInt nameCount = nameData->Count();
    if( nameCount == 0 )
        {
        User::Leave( KErrArgument );
        }
    CArrayPtr< CCMSX509GeneralName >* names =
        new( ELeave ) CArrayPtrFlat< CCMSX509GeneralName >( nameCount );
    CleanupStack::PushL( names );
    for( TInt i = 0; i < nameCount; i++ )
        {
        CCMSX509GeneralName* name = CCMSX509GeneralName::NewL( );
        CleanupStack::PushL( name );
        name->DecodeL( nameData->At( i )->Encoding() );
        names->AppendL( name );
        }
    CleanupStack::Pop( nameCount ); // names
    CleanupStack::Pop( names );
    CleanupStack::PopAndDestroy( nameData );
    if( iGeneralNames )
        {
        iGeneralNames->ResetAndDestroy();
        delete iGeneralNames;
        }
    iGeneralNames = names;
	}
// -----------------------------------------------------------------------------
// CCMSX509GeneralNames::SetGeneralNamesL
// GeneralNames setter
// -----------------------------------------------------------------------------
EXPORT_C void CCMSX509GeneralNames::SetGeneralNamesL(
	const CArrayPtr< CCMSX509GeneralName >& aGeneralNames )
	{
    TInt nameCount = aGeneralNames.Count();
    if( nameCount == 0 )
        {
        User::Leave ( KErrArgument );
        }
    CArrayPtr< CCMSX509GeneralName >* names =
        new( ELeave ) CArrayPtrFlat< CCMSX509GeneralName >( nameCount );
    CleanupStack::PushL( names );
    for( TInt i = 0; i < nameCount; i++ )
        {
        CCMSX509GeneralName* origName = aGeneralNames[ i ];
        CCMSX509GeneralName* name =
            CCMSX509GeneralName::NewL( origName->Tag(), origName->Data() );
        CleanupStack::PushL( name );
        names->AppendL( name );
        }
    CleanupStack::Pop( nameCount ); // names
    CleanupStack::Pop( names );
    if( iGeneralNames )
        {
        iGeneralNames->ResetAndDestroy();
        delete iGeneralNames;
        }
    iGeneralNames = names;
	}
Ejemplo n.º 7
0
CAknSettingItem* CYCSettingList::CreateSkinChooseItem(TInt aSettingId)
{
    TBool isNumberedStyle = this->IsNumberedStyle();
    CArrayPtr<CGulIcon>* icons = this->ListBox()->ItemDrawer()->FormattedCellData()->IconArray();

    CAknEnumeratedTextPopupSettingItem* item = new (ELeave) CAknEnumeratedTextPopupSettingItem(aSettingId, iSkinChoose);
    CleanupStack::PushL(item);

    HBufC* textResource= NULL;
    textResource = StringLoader::LoadLC(R_TEXT_SETTING_SKIN_CHOOSE);
    // The same resource id can be used for multiple enumerated text setting pages.
    item->ConstructL(isNumberedStyle, aSettingId, textResource->Des(), icons,
                     R_ENUMERATEDTEXT_SETTING_PAGE, -1, 0, R_POPUP_SETTING_TEXTS);

    // Load texts dynamically.
    CArrayPtr<CAknEnumeratedText>* texts = item->EnumeratedTextArray();
    texts->ResetAndDestroy();

    HBufC* textDef = StringLoader::LoadLC(R_TEXT_DEFAULT);
    CAknEnumeratedText* enumTextDef = new (ELeave) CAknEnumeratedText(0, textDef);
    CleanupStack::Pop(textDef);
    CleanupStack::PushL(enumTextDef);
    texts->AppendL(enumTextDef);
    CleanupStack::Pop(enumTextDef);

    RPointerArray<SkinImageStruct>& skins = iScaner->GetSkins();
    for (TInt i=0; i<skins.Count(); i++)
    {
        pSkinImageStruct sk = skins[i];
        CAknEnumeratedText* enumText;

        HBufC* text = sk->iShortName.AllocLC();
        enumText = new (ELeave) CAknEnumeratedText(sk->iIndex+1, text);
        CleanupStack::Pop(text);
        CleanupStack::PushL(enumText);
        texts->AppendL(enumText);
        CleanupStack::Pop(enumText);
    }

    this->SettingItemArray()->AppendL(item);

    CleanupStack::PopAndDestroy(textResource);

    CleanupStack::Pop(item);

    return item;
}
void AddEnumeratedLanguageL(CArrayPtr<CAknEnumeratedText>& aArray,
                            TInt aEnum, HBufC* aText)
{
   CAknEnumeratedText* text = new (ELeave) CAknEnumeratedText(aEnum, aText);
   CleanupStack::PushL(text);
   aArray.AppendL(text);
   CleanupStack::Pop(text);
}
// ---------------------------------------------------------
// CSymTorrentSearchContainer::ConstructL
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CSymTorrentSearchContainer::ConstructL(const TRect& aRect, 
	CSymTorrentAppUi* aAppUi, CSTTorrentManager* aTorrentMgr)
{
	iAppUi=aAppUi;
	iTorrentMgr=aTorrentMgr;
    CreateWindowL();

    iListBox = new (ELeave) CAknDoubleGraphicStyleListBox();
    iListBox->SetMopParent(this);
	iListBox->ConstructL(this, EAknListBoxSelectionList);
	iListBox->SetContainerWindowL(*this);
	
	iListBox->View()->SetListEmptyTextL(_L("(empty)"));

	//create scrollbar
	iListBox->CreateScrollBarFrameL();
	iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
		CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
	
	CArrayPtr<CGulIcon>* icons = new (ELeave) CAknIconArray(1);  // must be initialized with the number of icons used by the list!
	CleanupStack::PushL(icons);

	#ifdef EKA2
	{
		CGulIcon* chainLinkIcon = CGulIcon::NewL();
		CleanupStack::PushL(chainLinkIcon);
		
		CFbsBitmap* chainLinkBmp = NULL;
		CFbsBitmap* chainLinkMask = NULL;
		AknIconUtils::CreateIconLC(chainLinkBmp, chainLinkMask, KBitmapFile,
			EMbmSymtorrentChainlink, EMbmSymtorrentChainlink_mask);	
		chainLinkIcon->SetBitmap(chainLinkBmp);
		chainLinkIcon->SetMask(chainLinkMask);
		CleanupStack::Pop(2);
		icons->InsertL(0, chainLinkIcon);
		CleanupStack::Pop();				
	}
	#else
	{
		CEikonEnv* eikEnv = CEikonEnv::Static();
		
		icons->AppendL(eikEnv->CreateIconL(KBitmapFile, 
			EMbmSymtorrentChainlink, EMbmSymtorrentChainlink_mask));	
	}
	#endif
			
	CleanupStack::Pop(icons); // icons
	iListBox->ItemDrawer()->ColumnData()->SetIconArray(icons);

    SetRect(aRect);
    
    CDesCArray* itemArray = static_cast<CDesCArray*>
		(iListBox->Model()->ItemTextArray());
	itemArray->InsertL(0, _L("0\tFirst line\tSecond line"));			
    
   
    ActivateL();
}
void CMainMenuGridContainer::AddItemL(TInt aBitmapId, TInt aMaskId, 
                                      TInt aIndex) 
{
   CArrayPtr<CGulIcon>* icons = 
      iGrid->ItemDrawer()->FormattedCellData()->IconArray();
   if (!icons) {
      icons = new ( ELeave ) CAknIconArray(9);
      iGrid->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
   }
   CleanupStack::PushL(icons);

   CFbsBitmap* bitmap;
   CFbsBitmap* mask;

#ifdef NAV2_CLIENT_SERIES60_V3
   AknIconUtils::CreateIconL(bitmap, mask, iView->GetMbmName(), 
                             aBitmapId, aMaskId);
   AknIconUtils::SetSize(bitmap, iIconRect.Size(),
                         EAspectRatioPreservedAndUnusedSpaceRemoved);
#else
   bitmap = iEikonEnv->CreateBitmapL(iView->GetMbmName(), aBitmapId);
   mask = iEikonEnv->CreateBitmapL(iView->GetMbmName(), aMaskId);
#endif

   CleanupStack::PushL(bitmap);
   CleanupStack::PushL(mask);

   if (aIndex >= 0 && aIndex < icons->Count()) {
      icons->InsertL(aIndex, CGulIcon::NewL(bitmap, mask));
   } else {
      icons->AppendL(CGulIcon::NewL(bitmap, mask));
   }
   CleanupStack::Pop(mask);
   CleanupStack::Pop(bitmap);
   CleanupStack::Pop(icons);

   _LIT(KItem, "%d\t\t0");
   TBuf<8> buf;
   MDesCArray* array = iGrid->Model()->ItemTextArray();
   CDesCArray* cArray = (CDesCArray*)array;
   if (aIndex >= 0 && aIndex < icons->Count()) {
      buf.Format(KItem, aIndex);
      cArray->InsertL(aIndex, buf);
      aIndex++;
      //We need to delete and re-index the array since we inserted
      //a new icon in the icon array.
      cArray->Delete(aIndex, icons->Count() - aIndex);
      for (TInt i = aIndex; i < icons->Count(); i++) {
         buf.Format(KItem, i);
         cArray->AppendL(buf);
      }
   } else {
      buf.Format(KItem, (icons->Count() - 1));
      cArray->AppendL(buf);
   }
   //Inform list box that data was added.
   iGrid->HandleItemAdditionL();
}
Ejemplo n.º 11
0
void CFileSelectDialog::PostLayoutDynInitL()
	{
	CAknListQueryDialog::PostLayoutDynInitL();
	CArrayPtr<CGulIcon>* icons;
	icons=new (ELeave) CAknIconArray(1);
    CGulIcon* icon = AknsUtils::CreateGulIconL(AknsUtils::SkinInstance(),KAknsIIDQgnPropEmpty, AknIconUtils::AvkonIconFileName(),EMbmAvkonQgn_prop_empty,EMbmAvkonQgn_prop_empty_mask);	
	icon->SetBitmapsOwnedExternally(EFalse);
	icons->AppendL(icon);
	SetIconArrayL(icons);
	Update();
	Show();
	}
Ejemplo n.º 12
0
void CMainMenuListContainer::AddItemL(TInt aBitmapId, TInt aMaskId,
                                      TInt aFirstLabelId, TInt aSecondLabelId)
{
    CArrayPtr<CGulIcon>* icons =
        iListBox->ItemDrawer()->FormattedCellData()->IconArray();
    if (!icons) {
        icons = new ( ELeave ) CAknIconArray(3);
        iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
    }
    CleanupStack::PushL(icons);

    CFbsBitmap* bitmap;
    CFbsBitmap* mask;

    AknIconUtils::CreateIconL(bitmap, mask, iView->GetMbmName(),
                              aBitmapId, aMaskId);

    CleanupStack::PushL(bitmap);
    CleanupStack::PushL(mask);

    icons->AppendL(CGulIcon::NewL(bitmap, mask));

    CleanupStack::Pop(mask);
    CleanupStack::Pop(bitmap);
    CleanupStack::Pop(icons);

    HBufC* firstLabel = CEikonEnv::Static()->AllocReadResourceLC(aFirstLabelId);
    HBufC* secondLabel = CEikonEnv::Static()->AllocReadResourceLC(aSecondLabelId);

    HBufC* itemText = HBufC::NewLC(firstLabel->Length() +
                                   secondLabel->Length() + 16);

    itemText->Des().Format(KItem(), (icons->Count() - 1), firstLabel, secondLabel);

    CDesCArray* itemArray =
        static_cast<CDesC16ArrayFlat*>(iListBox->Model()->ItemTextArray());

    itemArray->AppendL(*itemText);

    CleanupStack::PopAndDestroy(itemText);
    CleanupStack::PopAndDestroy(secondLabel);
    CleanupStack::PopAndDestroy(firstLabel);

    iListBox->HandleItemAdditionL();
}
void CDirectPrintPrinterSettingView::SetBearerListL(CAknEnumeratedTextPopupSettingItem* item)
	{
	TInt err = GetBearerMgr()->GetProtocolNames(iBearerList);
	if (!err)
		{
		CArrayPtr<CAknEnumeratedText>* textArray = item->EnumeratedTextArray();
		textArray->ResetAndDestroy();

		TInt count = iBearerList.Count();
		for (TInt i=0; i<count; i++)
			{
			CAknEnumeratedText* enumText = new (ELeave) CAknEnumeratedText(i, iBearerList[i].iName.AllocLC());
			CleanupStack::Pop();
			CleanupStack::PushL(enumText);
			textArray->AppendL(enumText);
			CleanupStack::Pop();
			}
		}
	}
void CJuikIconManagerImpl::ReplaceIconL(TInt aProviderId, TInt aIconId, CGulIcon* aIcon)
{
	CALLSTACKITEM_N(_CL("CJuikIconManagerImpl"), _CL("ReplaceIconL"));
	auto_ptr<CGulIcon> icon( aIcon );
	CArrayFix<TInt>& map = ProviderIconIndexL(aProviderId);
	AssertIndexL( map, aIconId );

	TInt ix = map.At( aIconId );
	if ( ix != KErrNotFound ) 
		{
			AssertIndexL( *iIconArray, ix );	
			delete (*iIconArray)[ix];
			(*iIconArray)[ix] = icon.release();
		}
	else
		{
			iIconArray->AppendL( icon.release() );					   
			map[aIconId] = LastIndex( *iIconArray );
		}
}
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestLqdlgSetIconArrayL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestLqdlgSetIconArrayL( CStifItemParser& /*aItem*/ )
    {
    TInt selectedOption( KZero );
        
    CDesCArrayFlat* mArray = new (ELeave) CDesCArrayFlat( KTen );
    CleanupStack::PushL( mArray );
     
    TBuf< KTen > palabra;
    for (TInt num = KZero; num< KTen; num++)
        {
       palabra.Format(_L("option %d"), num);
       mArray->AppendL(palabra);
        }
     
    CAknListQueryDialog* dlg = new( ELeave ) CAknListQueryDialog( &selectedOption );
    dlg->PrepareLC( R_UPDATE_QUERY_DIALOG );
    dlg->SetItemTextArray( mArray );
    dlg->SetOwnershipType( ELbmDoesNotOwnItemArray );
    
    TFileName file( KTestMbmFile );
    User::LeaveIfError( CompleteWithAppPath( file ) ); 
    
    CArrayPtr<CGulIcon>* mIcons = new(ELeave) CAknIconArray( KFive ); 
    CleanupStack::PushL(mIcons); 
    
    CFbsBitmap* bitmap = NULL;
    CFbsBitmap* mask = NULL;

    AknIconUtils::CreateIconLC( bitmap, mask, file, EMbmAvkonQgn_indi_mic, EMbmAvkonQgn_indi_mic_mask );
    CGulIcon* mIcon = CGulIcon::NewL( bitmap, mask );
    CleanupStack::PushL( mIcon );
    mIcons->AppendL( mIcon );
    
    dlg->SetIconArrayL( mIcons );
    
    CleanupStack::Pop( mIcon );
    CleanupStack::Pop( KThree );
    CleanupStack::PopAndDestroy( dlg );
    CleanupStack::Pop( KOne );
    return KErrNone;
    }
Ejemplo n.º 16
0
void CDmAdEngine::BuildTopLevelRtNodesListLC(CArrayPtr<CDmAdRtNode>*     aRtNodes,
                                             CArrayPtr<CDmAdRtNode>*&    aTopLevelRtNodes)
    {
    CArrayPtr<CDmAdRtNode>* rtNodesList;
    rtNodesList = new (ELeave) CArrayPtrFlat<CDmAdRtNode>(4);
    CleanupStack::PushL(TCleanupItem(CDmAdRtNode::CleanupOperationDeleteCArrayPtr,
                                     rtNodesList));
    
    for (TInt i=0; i < aRtNodes->Count(); i++)
        {
        CDmAdRtNode* rtNode = aRtNodes->At(i);
        if (iDdfApi->IsTopLevelRtNode(rtNode->Uri()))
            {
            rtNodesList->AppendL(rtNode);
            aRtNodes->Delete(i);
            i--;
            }
        }
    
    aTopLevelRtNodes = rtNodesList;
    }
Ejemplo n.º 17
0
void CDmAdEngine::BuildChildRtNodesListLC(CArrayPtr<CDmAdRtNode>*     aRtNodes,
                                           const TDesC8&               aSomeParentUri,
                                           CArrayPtr<CDmAdRtNode>*&    aChildRtNodes)
    {
    CArrayPtr<CDmAdRtNode>* rtNodesList;
    rtNodesList = new (ELeave) CArrayPtrFlat<CDmAdRtNode>(4);
    CleanupStack::PushL(TCleanupItem(CDmAdRtNode::CleanupOperationDeleteCArrayPtr,
                                     rtNodesList));
    
    for (TInt i=0; i < aRtNodes->Count(); i++)
        {
        CDmAdRtNode* rtNode = aRtNodes->At(i);
        if (rtNode->IsSomeChild(aSomeParentUri))
            {
            rtNodesList->AppendL(rtNode);
            aRtNodes->Delete(i);
            i--;
            }
        }
    
    aChildRtNodes = rtNodesList;
    }
TInt CJuikIconManagerImpl::GetNewProviderIdL()
{
	CALLSTACKITEM_N(_CL("CJuikIconManagerImpl"), _CL("GetNewProviderIdL"));
	TInt providerIx = KErrNotFound;
	for ( TInt i = 0; i < iProviderIconIndexes->Count(); i++)
		{
			if ( iProviderIconIndexes->At(i) == NULL )
				{
					providerIx = i;
					break;
				}
		}
	
	if ( providerIx == KErrNotFound )
		{
			iProviderIconIndexes->AppendL( new (ELeave) CArrayFixFlat<TInt>(3) );
			return LastIndex( *iProviderIconIndexes );
		}
	else
		{
			(*iProviderIconIndexes)[providerIx] =  new (ELeave) CArrayFixFlat<TInt>(3);
			return providerIx;
		}
} 
Ejemplo n.º 19
0
/**
 *  Panic is raised, if the header with other header and terminating
 *  ' ' is > 159 characters. Then 1 byte is left for payload !
 *  what will be the array element type ?
 */
void TWapTextMessage::EncodeSegmentsL(CArrayPtr<HBufC8>& aSegmentArray)
    {
    TBuf8<KMaxSmsChars>  header;        // buffer for a modifiable header
    TInt        headerLength = 0;
    TInt        segmentNumberIndex = 0; // index of segment number field in the header
    TBuf8<2>    hexSegmentNumber;
    TInt        dataSegmented = 0;

    OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, TWAPTEXTMESSAGE_ENCODESEGMENTSL_1, "TWapTextMessage::EncodeSegmentsL()");

    iSegmentNumber = 0;
    do
        {
        //
        // Create the segment and add it to the array...
        //
        HBufC8*  segment = HBufC8::NewL(KMaxSmsChars); // 160 characters
        CleanupStack::PushL(segment);
        TPtr8  ptr(segment->Des());
        aSegmentArray.AppendL(segment);
        CleanupStack::Pop(); // segment

        //
        // Calculate length of header and copy it...
        //
        if (iSegmentNumber==0)
            {
            headerLength = CreateHeader(header, segmentNumberIndex);
            }

        ptr.Copy(header);
        if (iTotalSegments>255)
            {
            User::Leave(KErrOverflow);
            }

        //
        // Set segment number...
        //
        if (segmentNumberIndex != 0)
            {
            hexSegmentNumber.NumFixedWidthUC(iSegmentNumber+1, EHex, 2); // two bytes wide
            ptr.Insert(segmentNumberIndex, hexSegmentNumber);
            }

        //
        // Count any escaped characters we can be sure that the converted data
        // size fits inside the remaining length (e.g. so that non-7bit characters
        // when converted by the SMS Stack will still fit).
        //
        TInt  segmentSize = iRefData.Length() - dataSegmented;

        if (segmentSize > KMaxSmsChars - headerLength)
            {
            segmentSize = KMaxSmsChars - headerLength;
            }

        while (segmentSize > 1)
            {
            TPtrC8  segmentData(iRefData.Mid(dataSegmented, segmentSize));
            TInt  non7bitCharEscapes = 0;
            
            //
            // Count all non-7bit characters that will be escaped (many non-7bit
            // characters are not escaped, but converted to "?"). The ones
            // that are known to be escaped are list below:
            //
            //    12  [Form Feed].
            //    91  "["
            //    92  "\"
            //    93  "]"
            //    94  "^"
            //   123  "{"
            //   124  "|"
            //   125  "}"
            //   126  "~"
            //
            for (TInt  ch = 0;  ch < segmentSize;  ch++)
                {
                if (segmentData[ch] == 12  ||
                    (segmentData[ch] >= 91  &&  segmentData[ch] <= 94)  ||
                    (segmentData[ch] >= 123  &&  segmentData[ch] <= 126))
                    {
                    non7bitCharEscapes++;
                    }
                }
            
            //
            // Can it fit? If so store it, otherwise reduce the size...
            //
            if (segmentData.Length() + non7bitCharEscapes <= KMaxSmsChars - headerLength)
                {
                ptr.Append(segmentData);
                break;
                }
            
            segmentSize--;
            }
        
            dataSegmented += segmentSize;
            iSegmentNumber++;
        }
    while (dataSegmented < iRefData.Length());

    __ASSERT_DEBUG(iTotalSegments == aSegmentArray.Count(), Panic(KPanicEncodingError));
    } // TWapTextMessage::EncodeSegmentsL
// ------------------------------------------------------------------------------------------------
// CArrayPtr<CNpdItem>* CNSmlNotepadDatabase::FetchItemsLC(TBool aIncludeText,
// ------------------------------------------------------------------------------------------------
CArrayPtr<CNpdItem>* CNSmlNotepadDatabase::FetchItemsLC(TBool aIncludeText,
                                                    TInt* aKey)
    {
    _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): begin") ;

    CArrayPtr<CNpdItem>* res = new (ELeave) CArrayPtrFlat<CNpdItem> (8);
    CleanupPtrArrayPushL(res);
        
    if(!aKey)
        {
        _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): In aKey case");
        RPointerArray<CCalInstance> array;
        CleanupRPtrArrayPushL(array);
        _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): After cleaupstack");
        
        TCalTime startDate;
        startDate.SetTimeLocalL(TDateTime(1900, EJanuary, 1, 0, 0, 0, 0));
        TCalTime endDate;
        endDate.SetTimeLocalL(TDateTime(2100, EJanuary, 30, 0, 0, 0, 0));
        CalCommon::TCalTimeRange timeRange(startDate, endDate);
    
        iInstanceView->FindInstanceL(array,CalCommon::EIncludeNotes, timeRange);
        CNpdItem* entry = NULL;
        TInt i = 0;

        while (i < array.Count())
            {
            entry = CNpdItem::NewLC();
            entry->SetKey( array[i]->Entry().LocalUidL() );
            entry->SetModified( array[i]->Entry().LastModifiedDateL().TimeUtcL());
            if(aIncludeText)
                {
                _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): aIncludeText true");
                HBufC* content = HBufC::NewL( array[i]->Entry().DescriptionL().Length() );
                content->Des().Copy( array[i]->Entry().DescriptionL() );                
                entry->SetContent( content );
                }
            res->AppendL(entry);
            _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): After res->AppendL(entry)");
            CleanupStack::Pop(entry);
            _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): After popping (entry)");
            i++;
            }
        _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): before pop and destroy");
        CleanupStack::PopAndDestroy(&array);
        _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): After While Loop");
        }
    else
        {
        _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): In else case");
        CCalEntry* entryTobeFetched(NULL);
        entryTobeFetched = iEntryView->FetchL(*aKey);
        _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): After Fetching entry");
        if(entryTobeFetched)
            {
            CleanupStack::PushL(entryTobeFetched); 
            CNpdItem* entry = CNpdItem::NewLC();
            entry->SetKey( entryTobeFetched->LocalUidL() );
            entry->SetModified( entryTobeFetched->LastModifiedDateL().TimeUtcL() );
            if(aIncludeText)
                {
                HBufC* content = HBufC::NewL( entryTobeFetched->DescriptionL().Length() );
                content->Des().Copy( entryTobeFetched->DescriptionL() );                
                entry->SetContent( content );
                }
            res->AppendL(entry);
            CleanupStack::Pop(entry);
            CleanupStack::PopAndDestroy(entryTobeFetched);
            }
        }
    _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemLC(): end");
    return res;
    }
Ejemplo n.º 21
0
void CAppDemoAppView::CreateListBox()
	{
		iListBox = new (ELeave) CAknDoubleLargeStyleListBox();//CAknDoubleStyleListBox;
		iListBox->SetContainerWindowL(*this);
		
		// Second Phase Construction
		TResourceReader reader;
		CEikonEnv::Static()->CreateResourceReaderLC(reader, R_LISTBOX_DOUBLE);
		iListBox->ConstructFromResourceL(reader);
		CleanupStack::PopAndDestroy(); // reader
			
		CArrayPtr<CGulIcon>* icons = new (ELeave) CArrayPtrFlat<CGulIcon>(1);
		CleanupStack::PushL(icons);
		MAknsSkinInstance* skin = AknsUtils::SkinInstance();
		///Add icon
		
		CFbsBitmap* AppIcon(NULL);
		CFbsBitmap* AppIconMsk(NULL);
		CGulIcon* appIcon = NULL;
		appIcon = AknsUtils::CreateGulIconL(skin, KAknsIIDQgnMenuUnknownLst, ETrue);
		icons->AppendL(appIcon);

		CleanupStack::Pop();
		iListBox->ItemDrawer()->ColumnData()->SetIconArray(icons);
		
		CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(3);
		CleanupStack::PushL(array);
		
		_LIT(KFormat,"\t%S");
		_LIT(KFormatPrice,"\t\x5355\x4ef7\xff1a %S\x5143"); //价格   元
		_LIT(KFormatInt,"%d");
		
		TBuf<256> buf;
		TInt index = 0;
		
		//
		buf.Zero();
		buf.AppendFormat(KFormatInt,index);
		buf.AppendFormat(KFormat,&_L("\x82f9\x679c"));//苹果
		buf.AppendFormat(KFormatPrice,&_L("0.01"));
		array->AppendL(buf);
		//
		buf.Zero();
		buf.AppendFormat(KFormatInt,index);
		buf.AppendFormat(KFormat,&_L("\x8461\x8404"));//葡萄
		buf.AppendFormat(KFormatPrice,&_L("50"));
		array->AppendL(buf);
		//
		buf.Zero();
		buf.AppendFormat(KFormatInt,index);
		buf.AppendFormat(KFormat,&_L("\x9999\x8549"));//香蕉
		buf.AppendFormat(KFormatPrice,&_L("51"));
		array->AppendL(buf);
		//
		buf.Zero();
		buf.AppendFormat(KFormatInt,index);
		buf.AppendFormat(KFormat,&_L("\x6a31\x6843"));//樱桃
		buf.AppendFormat(KFormatPrice,&_L("100"));
		array->AppendL(buf);
		//
		buf.Zero();
		buf.AppendFormat(KFormatInt,index);
		buf.AppendFormat(KFormat,&_L("\x8292\x679c"));//芒果
		buf.AppendFormat(KFormatPrice,&_L("101"));
		array->AppendL(buf);
		//
		buf.Zero();
		buf.AppendFormat(KFormatInt,index);
		buf.AppendFormat(KFormat,&_L("\x897f\x74dc"));//西瓜
		buf.AppendFormat(KFormatPrice,&_L("200"));
		array->AppendL(buf);
		//
		buf.Zero();
		buf.AppendFormat(KFormatInt,index);
		buf.AppendFormat(KFormat,&_L("\x83e0\x841d"));//菠萝
		buf.AppendFormat(KFormatPrice,&_L("201"));
		array->AppendL(buf);
		//
		buf.Zero();
		buf.AppendFormat(KFormatInt,index);
		buf.AppendFormat(KFormat,&_L("\x756a\x8304"));//番茄
		buf.AppendFormat(KFormatPrice,&_L("500"));
		array->AppendL(buf);
		//
		buf.Zero();
		buf.AppendFormat(KFormatInt,index);
		buf.AppendFormat(KFormat,&_L("\x9ec4\x6843"));//黄桃
		buf.AppendFormat(KFormatPrice,&_L("501"));
		array->AppendL(buf);
		//
		buf.Zero();
		buf.AppendFormat(KFormatInt,index);
		buf.AppendFormat(KFormat,&_L("\x8354\x679d"));//荔枝
		buf.AppendFormat(KFormatPrice,&_L("2000"));
		array->AppendL(buf);
		//
				
		CleanupStack::Pop();
		iListBox->Model()->SetItemTextArray(array);	
		
		iListBox->SetListBoxObserver(this);
		iListBox->CreateScrollBarFrameL(ETrue);
		iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
			CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
		
		iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue);
	}
// ---------------------------------------------------------------------------
// ?description
// ---------------------------------------------------------------------------
//
void CreateAndAppendNotifierLC( CArrayPtr<MEikSrvNotifierBase2>& aArray,
    const TUid& aUid, const TUid& aChannel )
    {
    CBTNotifWrapper* notifier = CBTNotifWrapper::NewLC( aUid, aChannel );
    aArray.AppendL( notifier );
    }
void CDirectPrintPrinterSettingView::LoadListL()
	{
	LOG("CDirectPrintPrinterSettingView::LoadListL BEGIN");

	TBuf<25> itemTitle;

	// Common setting item
	CAknTextSettingItem* item1 = new (ELeave) CAknTextSettingItem(ESettingViewItemPrinterName, iPrinterName);
	CleanupStack::PushL(item1);
	item1->SetEmptyItemTextL( _L("None") );
	CEikonEnv::Static()->ReadResource(itemTitle, R_DIRECTPRINT_PRINTERSETTING_ITEM_PRINTERNAME);
	item1->ConstructL(EFalse, ESettingViewItemPrinterName, itemTitle, NULL, R_DIRECTPRINT_PRINTERSETTING_TEXT_SETTING_PAGE, -1);
	iListBox->SettingItemArray()->AppendL(item1);
	CleanupStack::Pop(item1);

	LOG("CDirectPrintPrinterSettingView::LoadListL 1");

	iDriver = 0;
	CAknEnumeratedTextPopupSettingItem* item2 = new (ELeave) CAknEnumeratedTextPopupSettingItem(ESettingViewItemDriver, iDriver);
	CleanupStack::PushL(item2);
	CEikonEnv::Static()->ReadResource(itemTitle, R_DIRECTPRINT_PRINTERSETTING_ITEM_DRIVER);
	item2->ConstructL(EFalse, ESettingViewItemDriver, itemTitle, NULL, R_DIRECTPRINT_PRINTERSETTING_POPUP_SETTING_PAGE, -1, 0, R_DIRECTPRINT_PRINTERSETTING_POPUP_SETTING_TEXTS);

	LOG("CDirectPrintPrinterSettingView::LoadListL 2");
	// set printer driver
		{
		const TInt KSettingItemArrayGranularity = 5;
		// Construct the array
		CArrayPtr<CAknEnumeratedText>* enumeratedTextArray; 
		enumeratedTextArray = new( ELeave ) CArrayPtrFlat<CAknEnumeratedText>( KSettingItemArrayGranularity );
		CleanupStack::PushL( enumeratedTextArray );

		// Construct a dummy array for popup text, needed to avoid a panic
		CArrayPtr<HBufC>* popupTextArray; 
		popupTextArray = new( ELeave ) CArrayPtrFlat<HBufC>( KSettingItemArrayGranularity );
		CleanupStack::PushL( popupTextArray );

		CDirectPrintAppAppUi* appui = static_cast<CDirectPrintAppAppUi*>( AppUi() );
		CDirectPrintEngine* engine = appui->Engine();

		// Read in the texts to be used in the setting item list
		TInt index;
		// Loop through all the texts 

		LOG1("ModelCount=[%d]", engine->ModelCount());

		for (index=0; index < engine->ModelCount(); index++)
			{
			HBufC* thisText = HBufC::NewLC(KMaxPrinterModelNameLength); 
			TPtr thisTextDes = thisText->Des();
			engine->ModelName(index, thisTextDes);
			CAknEnumeratedText* enumeratedText = new( ELeave ) CAknEnumeratedText( index, thisText );
			CleanupStack::Pop( thisText ); 
			CleanupStack::PushL( enumeratedText );
			enumeratedTextArray->AppendL( enumeratedText );
			CleanupStack::Pop( enumeratedText ); 
			}
		if (engine->ModelCount() > 0)
			{
			item2->SetEnumeratedTextArrays( enumeratedTextArray, popupTextArray );
			}
		CleanupStack::Pop( popupTextArray );
		CleanupStack::Pop( enumeratedTextArray );
		}
	LOG("CDirectPrintPrinterSettingView::LoadListL 2-2");

	iListBox->SettingItemArray()->AppendL(item2);
	CleanupStack::Pop(item2);

	LOG("CDirectPrintPrinterSettingView::LoadListL 3");
	iType = 0;
	CAknEnumeratedTextPopupSettingItem* item3 = new (ELeave) CAknEnumeratedTextPopupSettingItem(ESettingViewItemType, iType);
	CleanupStack::PushL(item3);
	CEikonEnv::Static()->ReadResource(itemTitle, R_DIRECTPRINT_PRINTERSETTING_ITEM_TYPE);
	item3->ConstructL(EFalse, ESettingViewItemType, itemTitle, NULL, R_DIRECTPRINT_PRINTERSETTING_POPUP_SETTING_PAGE, -1, 0, R_DIRECTPRINT_PRINTERSETTING_TYPE_POPUP_SETTING_TEXTS);
	iListBox->SettingItemArray()->AppendL(item3);
	CleanupStack::Pop(item3);

	iBearer = 0;
	LOG("CDirectPrintPrinterSettingView::LoadListL 4");
	CAknEnumeratedTextPopupSettingItem* item4 = new (ELeave) CAknEnumeratedTextPopupSettingItem(ESettingViewItemBearer, iBearer);
	CleanupStack::PushL(item4);
	CEikonEnv::Static()->ReadResource(itemTitle, R_DIRECTPRINT_PRINTERSETTING_ITEM_BEARER);
	item4->ConstructL(EFalse, ESettingViewItemBearer, itemTitle, NULL, R_DIRECTPRINT_PRINTERSETTING_POPUP_SETTING_PAGE, -1, 0, R_DIRECTPRINT_PRINTERSETTING_BEARER_POPUP_SETTING_TEXTS);

	SetBearerListL(item4);

	iListBox->SettingItemArray()->AppendL(item4);
	CleanupStack::Pop(item4);

	LOG("CDirectPrintPrinterSettingView::LoadListL xxx");

	iListBox->ListBox()->SetCurrentItemIndex(0);
	LOG("CDirectPrintPrinterSettingView::LoadListL xx");
	iListBox->HandleChangeInItemArrayOrVisibilityL(); 
	LOG("CDirectPrintPrinterSettingView::LoadListL END");
	}
void CMyListBoxAppView::SetIconsArray()
{
	// Creates a new icon array.
	CArrayPtr<CGulIcon>* iconArray = new (ELeave)
		CArrayPtrFlat<CGulIcon>(6);
	CleanupStack::PushL(iconArray);

	if( iIsDoubleLine == 0)//Main Screen
	{
		TBuf<128> path;
		path = CRippleVaultAppUi::ApplicationDriveAndPath();
		path.Append(KIconsMbmFileName);

		iconArray->AppendL(iEikonEnv->CreateIconL(path,
			EMbmIconsSecure, EMbmIconsSecurem));
		iconArray->AppendL(iEikonEnv->CreateIconL(path,
			EMbmIconsContacts, EMbmIconsContactsm));
		iconArray->AppendL(iEikonEnv->CreateIconL(path, 
			EMbmIconsPhotos, EMbmIconsPhotosm));
		iconArray->AppendL(iEikonEnv->CreateIconL(path, 
			EMbmIconsVideos, EMbmIconsVideosm));
		iconArray->AppendL(iEikonEnv->CreateIconL(path, 
			EMbmIconsSms, EMbmIconsSmsm));
		//iconArray->AppendL(iEikonEnv->CreateIconL(path, 
		//	EMbmIconsCsp, EMbmIconsCspm));
		iconArray->AppendL(iEikonEnv->CreateIconL(path, 
			EMbmIconsStatus, EMbmIconsStatusm));
	}
	else if( iIsDoubleLine == 1)//Contacts Screen
	{
		TBuf<128> path;
		path = CRippleVaultAppUi::ApplicationDriveAndPath();
		path.Append(KSubIconsMbmFileName);

		iconArray->AppendL(iEikonEnv->CreateIconL(path,
			EMbmSubiconsContactsview, EMbmSubiconsContactsviewm));
		iconArray->AppendL(iEikonEnv->CreateIconL(path, 
			EMbmSubiconsPhotossendtovault, EMbmSubiconsPhotossendtovaultm));
		iconArray->AppendL(iEikonEnv->CreateIconL(path, 
			EMbmSubiconsListsettings, EMbmSubiconsListsettingsm));		
	}
	else if( iIsDoubleLine == 2)//Photos Screen
	{
		TBuf<128> path;
		path = CRippleVaultAppUi::ApplicationDriveAndPath();
		path.Append(KSubIconsMbmFileName);

		iconArray->AppendL(iEikonEnv->CreateIconL( path,EMbmSubiconsPhotosviewgallery,EMbmSubiconsPhotosviewgallerym));                
		// Appends icon.
		iconArray->AppendL(iEikonEnv->CreateIconL( path,EMbmSubiconsPhotossendtovault,EMbmSubiconsPhotossendtovaultm));
		// Appends icon.
		//iconArray->AppendL(iEikonEnv->CreateIconL( path,EMbmSubiconsPhotosgetfromvault,EMbmSubiconsPhotosgetfromvaultm));
		// Appends icon.
		iconArray->AppendL(iEikonEnv->CreateIconL( path,EMbmSubiconsPhotossharealbum,EMbmSubiconsPhotossharealbumm));                
		// Appends icon.
		//iconArray->AppendL(iEikonEnv->CreateIconL( path,EMbmSubiconsPhotosunsharealbums,EMbmSubiconsPhotosunsharealbumsm));
		// Appends icon.
		iconArray->AppendL(iEikonEnv->CreateIconL( path,EMbmSubiconsListsettings,EMbmSubiconsListsettingsm));
	}
	else if( iIsDoubleLine == 3)//Videos Screen
	{
		TBuf<128> path;
		path = CRippleVaultAppUi::ApplicationDriveAndPath();
		path.Append(KSubIconsMbmFileName);

		// Appends icon.
		iconArray->AppendL(iEikonEnv->CreateIconL( path,EMbmSubiconsVideosviewgallery,EMbmSubiconsVideosviewgallerym));                
		// Appends icon.
		iconArray->AppendL(iEikonEnv->CreateIconL( path,EMbmSubiconsVideossendtovault,EMbmSubiconsVideossendtovaultm));
		// Appends icon.
		//iconArray->AppendL(iEikonEnv->CreateIconL( path,EMbmSubiconsVideosgetfromvault,EMbmSubiconsVideosgetfromvaultm));
		// Appends icon.
		iconArray->AppendL(iEikonEnv->CreateIconL( path,EMbmSubiconsVideossharealbum,EMbmSubiconsVideossharealbumm));                
		// Appends icon.
		//iconArray->AppendL(iEikonEnv->CreateIconL( path,EMbmSubiconsVideosunsharealbum,EMbmSubiconsVideosunsharealbumm));
		// Appends icon.
		iconArray->AppendL(iEikonEnv->CreateIconL( path,EMbmSubiconsListsettings,EMbmSubiconsListsettingsm));
	}
	else if( iIsDoubleLine == 4)//Sms Screen
	{
		TBuf<128> path;
		path = CRippleVaultAppUi::ApplicationDriveAndPath();
		path.Append(KSubIconsMbmFileName);

		// Appends icon.
		iconArray->AppendL(iEikonEnv->CreateIconL( path,EMbmSubiconsSmsview,EMbmSubiconsSmsviewm));                
		// Appends icon.
		iconArray->AppendL(iEikonEnv->CreateIconL( path,EMbmSubiconsSmssendtovault,EMbmSubiconsSmssendtovaultm));
		// Appends icon.
		//iconArray->AppendL(iEikonEnv->CreateIconL( path,EMbmSubiconsSmsgetfromvault,EMbmSubiconsSmsgetfromvaultm));
		// Appends icon.
		iconArray->AppendL(iEikonEnv->CreateIconL( path,EMbmSubiconsListsettings,EMbmSubiconsListsettingsm)); 
	}

	CleanupStack::Pop(); // iconArray

	// Sets the icon array.
	CCustomListItemDrawer* itemDrawer = static_cast<CCustomListItemDrawer*>
		(iListBox->View()->ItemDrawer());
	itemDrawer->SetIconArray(iconArray); // transfer ownership

	// Sets the height of the list box item
	// (= 2 * maximum height of the icon).
	TSize size = itemDrawer->MaxIconSize();
	iListBox->SetItemHeightL(1.5 * size.iHeight);
}
// ---------------------------------------------------------
// CDisconnectDlgDialog::PreLayoutDynInitL
// ---------------------------------------------------------
//
void CDisconnectDlgDialog::PreLayoutDynInitL()
    {
    CLOG_ENTERFN("CDisconnectDlgDialog::PreLayoutDynInitL");    
    
    CAknListQueryDialog::PreLayoutDynInitL();
    
    STATIC_CAST( CEikServAppUi*, 
                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
    
    CConnectionCArray* connArray = iConnModel->GetConnArray();

    // items: application and IAP names
    CDesCArrayFlat* items = new( ELeave )CDesCArrayFlat( connArray->Count() );
    CleanupStack::PushL( items );
    // icons: application icons
    CArrayPtr< CGulIcon >* icons = new( ELeave )CAknIconArray( 
                                                        connArray->Count() );
    CleanupStack::PushL( icons );

    CGulIcon* iconTemp = NULL;
    CGulIcon* icon = NULL;

    TInt count = connArray->Count();
    CLOG_WRITEF(_L( "count: %d" ), count );     

    // Get the info of every connection and initialize the list of dialog
    for( TInt i = 0; i < count; i++ )
        {
        CConnectionInfo* info = connArray->At( i );

        TBool useSharedIcon = EFalse;
        // Application and IAP name
        HBufC* listItem = HBufC::NewLC( KListItemTextBuf );
        TPtrC iap = info->GetIapNameL();
        
        TPtrC app = info->GetAppNameL( useSharedIcon ); 

        // Application icon
        iconTemp = info->GetAppIconL( useSharedIcon );
        icon = CGulIcon::NewL();
        icon->SetBitmapsOwnedExternally( ETrue );
        icon->SetBitmap( iconTemp->Bitmap() );
        icon->SetMask( iconTemp->Mask() );

        icons->AppendL( icon );

        listItem->Des().Format( KFormat, i, &iap, &app );
        items->AppendL( listItem->Des() );

        CleanupStack::PopAndDestroy( listItem ); // listItem
        }

    // set new item list
    SetItemTextArray( items );
    // set icon list
    SetIconArrayL( icons );
    // we don't have to take care of delete items
    SetOwnershipType( ELbmOwnsItemArray );

    CleanupStack::Pop( icons );
    CleanupStack::Pop( items );
    
    iExpiryTimer = CExpiryTimer::NewL( *this );
    iExpiryTimer->Start();

    CLOG_LEAVEFN("CDisconnectDlgDialog::PreLayoutDynInitL");
    }
// ---------------------------------------------------------------------------
// CAppMngr2ListContainer::PopulateItemArrayL()
// ---------------------------------------------------------------------------
//
void CAppMngr2ListContainer::PopulateItemArrayL()
    {
    FLOG( "CAppMngr2ListContainer::PopulateItemArrayL()" );
    
    CArrayPtr<CGulIcon>* iconArray = iListBox->ItemDrawer()->ColumnData()->IconArray();
    DeleteItemSpecificIcons( *iconArray );
    
    TInt count = ItemCount();
    for( TInt index = 0; index < count; index++ )
        {
        const CAppMngr2InfoBase& appInfo = ItemInfo( index );

        // Get name and details
        TPtrC name = appInfo.Name();
        TPtrC size = appInfo.Details();

        // Get icon indexes that plugin loaded in LoadIconsL()
        TInt iconIndexBase;
        TInt iconIndexMax;
        Model().GetIconIndexesL( appInfo.Runtime().RuntimeUid(),
                iconIndexBase, iconIndexMax );
        
        // Get list icon index from plugin
        TInt iconIndex = appInfo.IconIndex();
        
        // Convert index into the range of 0 .. (icons - 1)
        if( iconIndex == EAppMngr2UseSpecificIcon )
            {
            CGulIcon* icon = NULL;
            TRAP_IGNORE( icon = appInfo.SpecificIconL() );
            if( icon )
                {
                CleanupStack::PushL( icon );
                iconIndex = iconArray->Count();
                iconArray->AppendL( icon );
                CleanupStack::Pop( icon );
                iItemSpecificIcons++;
                }
            else
                {
                iconIndex = EAppMngr2IconIndex_QgnPropUnknown;
                }
            }
        else
            {
            // There are no default list icons that plugins could use, so
            // this must be list icon that plugin has loaded in LoadIconsL().
            // Icons (of this plugin) are indexed from iconIndexBase.
            iconIndex += iconIndexBase;

            // Plugin should use only those icons it has provided. Use
            // default unknown icon if plugin tries to use icons that
            // another plugin has loaded.
            if( iconIndex < iconIndexBase || iconIndex >= iconIndexMax )
                {
                iconIndex = EAppMngr2IconIndex_QgnPropUnknown;
                }
            }
        // Sanity check - index must be in range, otherwise list panics 
        if( iconIndex < 0 || iconIndex >= iconArray->Count() )
            {
            iconIndex = EAppMngr2IconIndex_QgnPropUnknown;
            }

        // Get indicator icon index from plugin
        TInt indIconIndex = appInfo.IndicatorIconIndex();
        
        // Convert indicator icon index into the range of 0 .. (icons-1) or
        // leave special value EAppMngr2NoIndicatorIcon in it
        if( indIconIndex == EAppMngr2UseSpecificIcon )
            {
            CGulIcon* icon = NULL;
            TRAP_IGNORE( icon = appInfo.SpecificIndicatorIconL() );
            if( icon )
                {
                CleanupStack::PushL( icon );
                indIconIndex = iconArray->Count();
                iconArray->AppendL( icon );
                CleanupStack::Pop( icon );
                iItemSpecificIcons++;
                }
            else
                {
                indIconIndex = EAppMngr2NoIndicatorIcon;
                }
            }
        else
            {
            // EAppMngr2NoIndicatorIcon is special value that is handled later
            if( indIconIndex != EAppMngr2NoIndicatorIcon )
                {
                // Default icon indexes (starting from EAppMngr2NoIndicatorIcon) are
                // all above the icon index range reserved for plugins
                if( indIconIndex > EAppMngr2NoIndicatorIcon )
                    {
                    // Use default icons, indexes start from zero
                    indIconIndex -= ( EAppMngr2NoIndicatorIcon + 1 );
                    }
                else
                    {
                    // Use item specific icons, indexes start from iconIndexBase
                    indIconIndex += iconIndexBase;
                    }
                }
            }
        // Sanity check - icon index must be in range, otherwise list panics
        if( ( indIconIndex != EAppMngr2NoIndicatorIcon ) &&
                ( indIconIndex < 0 || indIconIndex >= iconArray->Count() ) )
            {
            indIconIndex = EAppMngr2NoIndicatorIcon;
            }

        // Construct line to be displayed
        HBufC* temp = HBufC::NewLC( name.Length() + size.Length() + KSpaceForTabsAndIconIndexes );
        TPtr line = temp->Des();
        if( indIconIndex == EAppMngr2NoIndicatorIcon )
            {
            line.AppendFormat( KItemFormatNoInd, iconIndex, &name, &size );
            }
        else
            {
            line.AppendFormat( KItemFormatFull, iconIndex, &name, &size, indIconIndex );
            }
        iItemArray->AppendL( line );
        FLOG( "CAppMngr2ListContainer::PopulateItemArrayL(): %S", temp );
        CleanupStack::PopAndDestroy( temp );
        }
    }
// ----------------------------------------------------
// CNormalSettingContainer::LoadListL()
// Loads the setting item list dynamically.
// ----------------------------------------------------
//
void CNormalSettingContainer::LoadListL()
    {
    TBool isNumberedStyle = iItemList->IsNumberedStyle();
    CArrayPtr<CGulIcon>* icons = iItemList->ListBox()->ItemDrawer()->FormattedCellData()->IconArray();
    CArrayPtr<CAknEnumeratedText>* texts;
    CAknEnumeratedText* enumText;
    HBufC* text;

    /* Text setting item */
//    CAknTextSettingItem* item = new (ELeave) CAknTextSettingItem(1, iText);
//    CleanupStack::PushL(item);
//    item->SetEmptyItemTextL( KEmptyText );
//    // The same resource id can be used for multiple text setting pages.
//    item->ConstructL(isNumberedStyle, 1, KName, icons, R_TEXT_SETTING_PAGE, -1);
//    iItemList->SettingItemArray()->AppendL(item);
//    CleanupStack::Pop(item);
//
//
//    /* Integer setting item */
//    CAknIntegerEdwinSettingItem* item2 = new (ELeave) CAknIntegerEdwinSettingItem(2, iNumber);
//    CleanupStack::PushL(item2);
//    // The same resource id can be used for multiple integer setting pages.
//    item2->ConstructL(isNumberedStyle, 2, KName2, icons, R_INTEGER_SETTING_PAGE, -1);
//    iItemList->SettingItemArray()->AppendL(item2);
//    CleanupStack::Pop(item2);
//
//
//    /* Password setting item */
//    CAknPasswordSettingItem* item3 = new (ELeave) CAknPasswordSettingItem(  3,
//                                                                            CAknPasswordSettingItem::EAlpha,
//                                                                            iPassword);
//    CleanupStack::PushL(item3);
//    item3->SetEmptyItemTextL( KEmptyText );
//    // The same resource id can be used for multiple password setting pages.
//    item3->ConstructL(isNumberedStyle, 3, KName3, icons, R_PASSWORD_SETTING_PAGE, -1);
//    iItemList->SettingItemArray()->AppendL(item3);
//    CleanupStack::Pop(item3);
//
//
//    /* Volume setting item */
//    CAknVolumeSettingItem* item4 = new (ELeave) CAknVolumeSettingItem(4, iVolume);
//    CleanupStack::PushL(item4);
//    // The same resource id can be used for multiple volume setting pages.
//    item4->ConstructL(isNumberedStyle, 4, KName4, icons, R_VOLUME_SETTING_PAGE, -1);
//    iItemList->SettingItemArray()->AppendL(item4);
//    CleanupStack::Pop(item4);
//
//
//   /* Slider setting item. Read comments in CDynamicSettingListSlider, why
//    * a derived class is used instead of CAknSliderSettingItem
//    */
//    CDynamicSettingListSlider* item5 = new (ELeave) CDynamicSettingListSlider(5, iSlider);
//    CleanupStack::PushL(item5);
//    // The same resource id can be used for multiple slider setting pages.
//    item5->ConstructL(isNumberedStyle, 5, KName5, icons, R_SLIDER_SETTING_PAGE, -1);
//    iItemList->SettingItemArray()->AppendL(item5);
//    CleanupStack::Pop(item5);
//
//
//    /* Date setting item */
//    CAknTimeOrDateSettingItem* item6 = new (ELeave) CAknTimeOrDateSettingItem(  6,
//                                                                                CAknTimeOrDateSettingItem::EDate,
//                                                                                iDate);
//    CleanupStack::PushL(item6);
//    // The same resource id can be used for multiple date setting pages.
//    item6->ConstructL(isNumberedStyle, 6, KName6, icons, R_DATE_SETTING_PAGE, -1);
//    iItemList->SettingItemArray()->AppendL(item6);
//    CleanupStack::Pop(item6);
//
//
//    /* Time offset setting item */
//    CAknTimeOffsetSettingItem* item7 = new (ELeave) CAknTimeOffsetSettingItem(7, iTime);
//    CleanupStack::PushL(item7);
//    // The same resource id can be used for multiple time offset setting pages.
//    item7->ConstructL(isNumberedStyle, 7, KName7, icons, R_TIMEOFFSET_SETTING_PAGE, -1);
//    iItemList->SettingItemArray()->AppendL(item7);
//    CleanupStack::Pop(item7);
//
//
//    /* Ip field setting item */
//    CAknIpFieldSettingItem* item8 = new (ELeave) CAknIpFieldSettingItem(8, iIp);
//    CleanupStack::PushL(item8);
//    // The same resource id can be used for multiple ip field setting pages.
//    item8->ConstructL(isNumberedStyle, 8, KName8, icons, R_IPFIELD_SETTING_PAGE, -1);
//    iItemList->SettingItemArray()->AppendL(item8);
//    CleanupStack::Pop(item8);
//
//
//    /* Enumerated text setting item */  更换频率
    CAknEnumeratedTextPopupSettingItem* item9 = new (ELeave) CAknEnumeratedTextPopupSettingItem(EItemFreqency, iEnumText);
    CleanupStack::PushL(item9);
    // The same resource id can be used for multiple enumerated text setting pages.
    text = StringLoader::LoadLC(R_SETTING_FREQUENCY_TITLE);
    item9->ConstructL(isNumberedStyle, EItemFreqency, text->Des(), icons, R_ENUMERATEDTEXT_SETTING_PAGE, -1, 0, R_POPUP_SETTING_TEXTS);
    CleanupStack::PopAndDestroy();
    
    // Load texts dynamically.
    texts = item9->EnumeratedTextArray();
    texts->ResetAndDestroy();    
    // 1 hour
    text = StringLoader::LoadLC(R_TEXT_FREQUENCY_ONE_HOUR);
    enumText = new (ELeave) CAknEnumeratedText(EFrequencyOneHour, text);
    CleanupStack::Pop(text);
    CleanupStack::PushL(enumText);
    texts->AppendL(enumText);
    CleanupStack::Pop(enumText);
    // 8 hours
    text = StringLoader::LoadLC(R_TEXT_FREQUENCY_EIGHT_HOURS);
    enumText = new (ELeave) CAknEnumeratedText(EFrequencyEightHours, text);
    CleanupStack::Pop(text);
    CleanupStack::PushL(enumText);
    texts->AppendL(enumText);
    CleanupStack::Pop(enumText);
    // 1 day
    text = StringLoader::LoadLC(R_TEXT_FREQUENCY_ONE_DAY);
    enumText = new (ELeave) CAknEnumeratedText(EFrequencyOneDay, text);
    CleanupStack::Pop(text);
    CleanupStack::PushL(enumText);
    texts->AppendL(enumText);
    CleanupStack::Pop(enumText);
    // 3 days
    text = StringLoader::LoadLC(R_TEXT_FREQUENCY_THREE_DAYS);
    enumText = new (ELeave) CAknEnumeratedText(EFrequencyThreeDays, text);
    CleanupStack::Pop(text);
    CleanupStack::PushL(enumText);
    texts->AppendL(enumText);
    CleanupStack::Pop(enumText);
    // 1 week
    text = StringLoader::LoadLC(R_TEXT_FREQUENCY_ONE_WEEK);
    enumText = new (ELeave) CAknEnumeratedText(EFrequencyOneWeek, text);
    CleanupStack::Pop(text);
    CleanupStack::PushL(enumText);
    texts->AppendL(enumText);
    CleanupStack::Pop(enumText);

    iItemList->SettingItemArray()->AppendL(item9);
    CleanupStack::Pop(item9);


//  /* Binary popup setting item */	开机启动
//    CAknBinaryPopupSettingItem* item10 = new (ELeave) CAknBinaryPopupSettingItem(EItemAutoStart, iBinary);
//    CleanupStack::PushL(item10);
//    // The same resource id can be used for multiple binary setting pages.
//    text = StringLoader::LoadLC(R_SETTING_AUTOSTART_TITLE);
//    item10->ConstructL(isNumberedStyle, EItemAutoStart, text->Des(), icons, R_BINARY_SETTING_PAGE, -1, 0, R_BINARY_TEXTS);
//    CleanupStack::PopAndDestroy();
//    
//    // Load texts dynamically.
//    texts = item10->EnumeratedTextArray();
//    texts->ResetAndDestroy();
//    // Text 1
//    text = StringLoader::LoadLC(R_TEXT_NO);
//    enumText = new (ELeave) CAknEnumeratedText(0, text);
//    CleanupStack::Pop(text);
//    CleanupStack::PushL(enumText);
//    texts->AppendL(enumText);
//    CleanupStack::Pop(enumText);
//    // Text 2
//    text = StringLoader::LoadLC(R_TEXT_YES);
//    enumText = new (ELeave) CAknEnumeratedText(1, text);
//    CleanupStack::Pop(text);
//    CleanupStack::PushL(enumText);
//    texts->AppendL(enumText);
//    CleanupStack::Pop(enumText);
//
//    // Sets the correct text visible
//    item10->LoadL();
//
//    iItemList->SettingItemArray()->AppendL(item10);
//    CleanupStack::Pop(item10);

    // Required when there is only one setting item.
    iItemList->SettingItemArray()->RecalculateVisibleIndicesL();

    iItemList->HandleChangeInItemArrayOrVisibilityL();
    }