Пример #1
0
CDesCArray* CCommonUtils::SplitText(const TDesC& aText,const char& aSplitChar)
{
	CDesCArray* tmpArray = new(ELeave) CDesCArrayFlat(5);
	CleanupStack::PushL(tmpArray);

	TInt len = aText.Length();
	TBuf<100> tmp;
	for ( TInt i = 0; i < len ; i ++)
	{
		if(aText[i] == aSplitChar)
		{
			tmp.TrimAll();
			tmpArray->AppendL(tmp);
			tmp.Zero();
		}
		else
			tmp.Append(aText[i]);		
	}
	if (tmp.Length() > 0 )
	{
		tmp.TrimAll();
		tmpArray->AppendL(tmp);
	}	

	CleanupStack::Pop(tmpArray);
	return tmpArray;
}
void CSpreadWFDialogs::ShowSpreadWayfinderOptionsDialogL()
{
   //Dialog that lets the user chose between contact bk search
   //and entering a number manually.
   CDesCArray* optionArray = new (ELeave) CDesCArrayFlat(2);
   HBufC* option = CCoeEnv::Static()->AllocReadResourceLC(R_WF_OPTION_CONTACTS);
   optionArray->AppendL(*option);
   CleanupStack::PopAndDestroy(option);
   option = CCoeEnv::Static()->AllocReadResourceLC(R_WF_OPTION_MANUALLY);
   optionArray->AppendL(*option);
   CleanupStack::PopAndDestroy(option);
   TInt preSelIndex = iOptionsIndex;

   typedef TCallBackEvent<CSpreadWFDialogs, TSpreadWFEvent> cb_t;
   typedef CCallBackListDialog<cb_t> cbd_t;
   cbd_t::RunDlgLD(cb_t(this,
                        ESpreadWFEventOptionsOk,
                        ESpreadWFEventOptionsCancel),
                   iOptionsIndex,
                   R_WF_SHARE_WAYFINDER,
                   optionArray,
                   R_WAYFINDER_CALLBACK_SINGLE_LIST_QUERY_OK_BACK,
                   EFalse, 
                   preSelIndex);
}
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();
}
void CCalendarSettingsQuery::ConstructL()
{				
	CALLSTACKITEM_N(_CL("CCalendarSettingsQuery"), _CL("ConstructL"));
	iSelections = new (ELeave) CDesCArrayFlat(10);
	

	auto_ptr<HBufC> text1( StringLoader::LoadL( R_TEXT_WELCOME_SHOW_TITLE_OF_EVENT ) );
	auto_ptr<HBufC> text2( StringLoader::LoadL( R_TEXT_WELCOME_SHOW_BUSY_INSTEAD ) );
	auto_ptr<HBufC> text3( StringLoader::LoadL( R_TEXT_WELCOME_DONT_SHARE_EVENTS ) );

	
	iSelections->AppendL( *text1 );
	iSelections->AppendL( *text2 );
	iSelections->AppendL( *text3 );
}
CDesCArray* CPackagerCntFactory::doCreateDefaultCDesCArrayL() const
/** Implementation method for constructing a new default CDesCArray object. 

@return a Pointer to the CDesCArray object. */
	{
	CDesCArray* theTestArray = new(ELeave) CDesCArrayFlat(5);
	CleanupStack::PushL(theTestArray);
	theTestArray->AppendL(KContactItemCompanyName);
	theTestArray->AppendL(KContactItemFamilyName);
	theTestArray->AppendL(KContactItemGivenName);
	theTestArray->AppendL(KContactItemFirstPhoneNumber);
	theTestArray->AppendL(KContactItemSecondPhoneNumber);
	CleanupStack::Pop(theTestArray);
	return theTestArray;
	}					
void CSearchableListBoxContainer::AddFormattedListBoxItemL( const TDesC& aString )
{
   CTextListBoxModel* model = iListBox->Model();
   CDesCArray* itemArray = static_cast< CDesCArray* > ( model->ItemTextArray() );
   itemArray->AppendL( aString );
   iListBox->HandleItemAdditionL();
}
Пример #7
0
void CMdSFindSequence::GetFreeTextForObjectL( CDesCArray& aResultWordBuffer,
		TDefId aNamespaceDefId, TItemId aObjectId )
	{
	_LIT( KMdSFindSeqWords, "SELECT Word FROM TextSearch%u AS ts, TextSearchDictionary%u AS tsd ON tsd.WordId = ts.WordId WHERE ObjectId = ? ORDER BY Position ASC;" );

	CMdsClauseBuffer* buffer = CMdsClauseBuffer::NewLC( KMdSFindSeqWords.iTypeLength + 20 ); // two int
	buffer->BufferL().Format( KMdSFindSeqWords, aNamespaceDefId, aNamespaceDefId );
	
	CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
	
	RRowData data;
    CleanupClosePushL( data );
	data.AppendL( TColumn( aObjectId ) );
	RMdsStatement query;
    CleanupClosePushL( query );
	connection.ExecuteQueryL( buffer->ConstBufferL(), query, data );
	TPtrC16 word;
	data.Column(0).Set( word );
	while (connection.NextRowL(query, data))
		{
		data.Column(0).Get( word );
		aResultWordBuffer.AppendL( word );
		data.Free();
		}

	CleanupStack::PopAndDestroy( 3, buffer ); // query, data, buffer
	}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
TInt CSymbianUnitTestLddCtl::GetTestCaseNames(CDesCArray& aTestCaseNames)
    {
    TInt ret = iLddconn.Open(*iDriverName);
    if (ret != KErrNone)
        {
        return ret;
        }
    SUT_LOG_DEBUG("open ldd");

    TInt count;
    ret = iLddconn.GetTestCaseCount(&count);
    SUT_LOG_DEBUGF(_L("user space, test case count:%d"), count);
    if (ret != KErrNone)
        {
        return ret;
        }
    
    for (TInt i = 0; i < count; i++)
        {
        TBuf8<KTestCaseNameLength> testCaseName;
        ret = iLddconn.GetTestCaseName(&i, (TAny*) &testCaseName);
        if (ret != KErrNone)
            {
            return ret;
            }
        TBuf<KTestCaseNameLength> testCaseName16;
        testCaseName16.Copy(testCaseName);
        aTestCaseNames.AppendL(testCaseName16);
        }
    iLddconn.Close();
    SUT_LOG_DEBUG("close ldd");
    return KErrNone;
    }
Пример #9
0
// ---------------------------------------------------------------------------
// CPresenceXDM::GetAllRulesL()
// ---------------------------------------------------------------------------
//
EXPORT_C void CPresenceXDM::GetAllRulesL(CDesCArray& aRuleIds)
	{
    OPENG_DP(D_OPENG_LIT( "CPresenceXDM::GetAllRulesL" ) );
    CXdmDocumentNode* myRootNode = iPresDocument->DocumentRoot();
    if (!myRootNode)
        return;
    
    RPointerArray<CXdmDocumentNode> nodes;
    CXdmNodeAttribute* idAttribute(NULL);
    
    // Find all rules under root
    if ((myRootNode->Find(KXdmRule, nodes)) == KErrNone)
        { // go through all found rules
        TInt ruleCountInNode = nodes.Count();
        OPENG_DP(D_OPENG_LIT( "     ruleCountInNode = %d" ),ruleCountInNode );
        for (TInt i=0;i<ruleCountInNode;i++)
            { // get the id attribute
            idAttribute = (nodes[i])->Attribute(KXdmId);
            // push it to given discriptor array
            aRuleIds.AppendL(idAttribute->AttributeValue());
            }
        }
    nodes.Close();
    return;
	}
Пример #10
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CCrashContainer::AddToTheListL(const TDesC& aName,const TExitType&  aExitType,const TInt& aExitReason,const TDesC& aExitCategory,CDesCArray& aItemArray)
{
	TBuf<500> AddBuffer(_L("\t"));
	AddBuffer.Append(aName);
	AddBuffer.Append(_L("\t"));

	switch(aExitType)
	{
	case EExitKill:
		AddBuffer.Append(_L("Kill: "));
		break;
	case EExitTerminate:
		AddBuffer.Append(_L("Terminate: "));
		break;
	case EExitPanic:
		AddBuffer.Append(_L("Panic: "));
		break;
	case EExitPending:
		AddBuffer.Append(_L("Pend: "));
		break;
	}
	
	AddBuffer.AppendNum(aExitReason);
	AddBuffer.Append(_L(","));
	AddBuffer.Append(aExitCategory);
	
	aItemArray.AppendL(AddBuffer); 
}
Пример #11
0
TInt CFileSelectDialog::Show()
	{
	_LOG(_L("CFileSelectDialog::Show()"));
	TInt sel=0;
	CDesCArray* itemList = new (ELeave) CDesCArrayFlat(3);
	if (iCurrentPath.Compare(_L(""))!=0){if (iType==EFolder){iArray->InsertL(0,_L("Select folder"));}iArray->InsertL(0,_L("..."));}
	_LOGDATA(_L("Length of array: %d"),iArray->Count());
	
	for (TInt i=0;i<iArray->Count();i++)
		{
		TBuf<255> ItemTxt;
		ItemTxt.Copy(_L("0\t"));
		ItemTxt.Append(iArray->MdcaPoint(i));
		ItemTxt.Append(_L("\t\t"));
		itemList->AppendL(ItemTxt);
		_LOGDATA(_L("Item: %S"),&iArray->MdcaPoint(i));
		}
	_LOG(_L("Will create dialog"));
	SetItemTextArray(itemList);
    ListBox()->HandleItemAdditionL();
    Layout();
    ListBox()->SetCurrentItemIndex(0);
    ListBox()->DrawNow();
    DrawDeferred();
	}
// ---------------------------------------------------------------------------
// TPresCondIdentityMany::GetManyIdentityElementsL()
// ---------------------------------------------------------------------------
//
EXPORT_C TInt TPresCondIdentityMany::GetManyIdentityElementsL(const TDesC& aRuleID,
        CDesCArray& aDomains)
{
    OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::GetManyIdentityElementsL()" ) );
    OPENG_DP(D_OPENG_LIT( "     aRuleID = %S" ),&aRuleID);

    __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));

    CXdmDocumentNode* identityNode = iPresXDM->GetConditionChildNodeL(aRuleID,
                                     KXdmIdentity, EFalse);
    if(identityNode==NULL)
        return 0;

    RPointerArray<CXdmDocumentNode> nodes;
    CXdmNodeAttribute* domainAttr(NULL);

    // finding 'many' nodes
    TInt err = identityNode->Find(KXdmMany, nodes);

    // extracting entities from id nodes
    TInt manyCountInNode = nodes.Count();

    OPENG_DP(D_OPENG_LIT( "     manyCountInNode = %d" ),manyCountInNode);

    for (TInt i=0; i<manyCountInNode; i++)
    {   // get the domain attribute
        domainAttr = (nodes[i])->Attribute(KXdmDomain);
        if(domainAttr)
            // push it to given discriptor array
            aDomains.AppendL(domainAttr->AttributeValue());
    }

    nodes.Close();
    return manyCountInNode;
}
Пример #13
0
EXPORT_C TInt FontUtils::GetAvailableHeightsInTwipsAndPointsL(const CGraphicsDevice& aDevice,const TDesC& aTypefaceName,CArrayFix<TInt>& aTwipsList,CDesCArray& aPointsList)
/** Gets a list of all heights in twips, available for the named typeface and the 
graphics device specified.

Also gets a list of heights in points, represented as character strings.

@param aDevice The graphics device.
@param aTypefaceName The name of the typeface.
@param aTwipsList On return, contains all available heights for the typeface, 
in twips.
@param aPointsList On return, the heights in points, represented as character 
strings.
@return KErrNotSupported if the named typeface is not supported by the graphics 
device, otherwise KErrNone. */
	{ // static
	aTwipsList.Reset();
	aPointsList.Reset();
	TInt err=GetAvailableHeightsInTwipsL(aDevice,aTypefaceName,aTwipsList);
	if (err==KErrNotSupported)
		return err;
	const TInt count=aTwipsList.Count();
	for (TInt ii=0;ii<count;ii++)
		{
		const TInt points=PointsFromTwips(aTwipsList[ii]);
		if (points<EMinFontHeight)
			continue;
		TBuf<8> num;
		num.Num(points);
		aPointsList.AppendL(num);
		}
	return KErrNone;
	}
// ---------------------------------------------------------
// CPosLmDatabaseManagerImpl::ListDatabasesLC
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
CDesCArray* CPosLmDatabaseManagerImpl::ListDatabasesLC(
    const TDesC& aProtocol)
    {
    CDesCArray* resultList = NULL;

    if (aProtocol == KNullDesC)
        {
        TInt pluginCount = iPlugins->NumberOfInstances();
        for (TInt i = 0; i < pluginCount; i++)
            {
            if (i == 0)
                {
                resultList = iPlugins->GetInstanceAt(i)->ListDatabasesLC();
                }
            else
                {
                CDesCArray* dbList =
                    iPlugins->GetInstanceAt(i)->ListDatabasesLC();
                TInt dbCount = dbList->Count();
                for (TInt j = 0; j < dbCount; j++)
                    {
                    resultList->AppendL((*dbList)[j]);
                    }
                CleanupStack::PopAndDestroy(dbList);
                }
            }
        }
    else
        {
        CPosLmDatabaseManagerPluginBase* plugin =
            iPlugins->GetInstanceL(aProtocol);
        resultList = plugin->ListDatabasesLC();
        }
    return resultList;
    }
Пример #15
0
EXPORT_C void FontUtils::GetAvailableFontsL(const CGraphicsDevice& aDevice, CDesCArray& aFontNameList,TInt aFonts)
/** Gets the list of typeface names available for the graphics device.

@param aDevice The graphics device.
@param aFontNameList On return, contains the list of typeface names.
@param aFonts Can be used to specify which sorts of typefaces are required. 
For possible values, see the flags defined in gulftflg.hrh 
beginning with EGulAllFonts. */
	{ // static
	aFontNameList.Reset();
	const TInt numTypefaces=aDevice.NumTypefaces();
	TTypefaceSupport typefaceInfo;
	for (TInt ii=0;ii<numTypefaces;ii++)
		{
		aDevice.TypefaceSupport(typefaceInfo,ii);
		if (typefaceInfo.iTypeface.IsProportional())
			{
			if (aFonts==EGulMonospaceFontsOnly)
				continue;
			}
		else if (aFonts==EGulNoMonospaceFonts || aFonts==EGulNoMonospaceOrSymbolFonts)
			continue;
		if (typefaceInfo.iTypeface.IsSymbol())
			{
			if (aFonts==EGulNoSymbolFonts || aFonts==EGulNoMonospaceOrSymbolFonts || aFonts==EGulMonospaceFontsOnly)
				continue;
			}
		else if (aFonts==EGulSymbolFontsOnly)
			continue;
		aFontNameList.AppendL(typefaceInfo.iTypeface.iName);
		}
	}
void CMainMenuGridContainer::DeleteItemL(TInt aIndex) 
{
   CArrayPtr<CGulIcon>* icons = 
      iGrid->ItemDrawer()->FormattedCellData()->IconArray();
   if (icons && aIndex >= 0 && aIndex < icons->Count()) {
      //Delete item if index is valid.
      _LIT(KItem, "%d\t\t0");
      TBuf<8> buf;
      MDesCArray* array = iGrid->Model()->ItemTextArray();
      CDesCArray* cArray = (CDesCArray*)array;

      //Remove icon and items.
      icons->Delete(aIndex);
      cArray->Delete(aIndex, (cArray->Count() - aIndex));
      iGrid->HandleItemRemovalL();

      //Re-add the items behind, needed since we changed the indexes.
      for (TInt i = aIndex; i < icons->Count(); i++) {
         buf.Format(KItem, i);
         cArray->AppendL(buf);
      }
      //Inform list box that data was added.
      iGrid->HandleItemAdditionL();

      SetGridGraphicStyleL();
   }
}
Пример #17
0
// ---------------------------------------------------------------------------
// Search service names by given service IDs
// ---------------------------------------------------------------------------
//
void CSPSettingsEngine::FindServiceNamesL( RIdArray& aServiceIds,
    CDesCArray& aServiceNames )
    {
    XSPSLOGSTRING( "CSPSettingsEngine::FindServiceNamesL() - IN" );
    
    CCenRepDatabaseProperty* property = CCenRepDatabaseProperty::NewLC();
    TInt count = aServiceIds.Count();
    for( TInt i = 0; i < count; i++ )
        {
        TInt id = ( TInt )aServiceIds[i];
        
        TInt err = iCenRepUtils->FindPropertyL( id, EServiceName, *property );
        if( err == KErrNone )
            {
            aServiceNames.AppendL( property->GetDesValue() );
            }
        else
            {
            aServiceIds.Remove( i ); // Remove non-existent ID
            count--;
            i--; // Do not increment index
            }
        }

    CleanupStack::PopAndDestroy( property );
    
    XSPSLOGSTRING( "CSPSettingsEngine::FindServiceNamesL() - OUT" );
    }
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestPhoneCreateEditorL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestPhoneCreateEditorL( CStifItemParser& /*aItem*/ )
    {
    CAknQueryValuePhone* valuePhone = CAknQueryValuePhone::NewLC();
    STIF_ASSERT_NOT_NULL( valuePhone );
    
    CAknQueryValuePhoneArray* array = CAknQueryValuePhoneArray::NewLC();
    STIF_ASSERT_NOT_NULL( array );
    
    CDesCArray* textArray = new (ELeave) CDesCArrayFlat( 1 );
    CleanupStack::PushL( textArray );
    _LIT( KValue, "123456" );
    textArray->AppendL( KValue );
    
    array->SetArray( *textArray );
    valuePhone->SetArrayL( array );
    
    valuePhone->SetCurrentValueIndex( 0 );
    
    TBool flag = valuePhone->CreateEditorL();
    STIF_ASSERT_TRUE( flag );
    
    CleanupStack::PopAndDestroy( textArray );
    CleanupStack::PopAndDestroy( array );
    CleanupStack::PopAndDestroy( valuePhone );
    
    return KErrNone;
    }
void CFinalQuery::ConstructL()
{				
	CALLSTACKITEM_N(_CL("CFinalQuery"), _CL("ConstructL"));
	iSelections = new (ELeave) CDesCArrayFlat(10);

#ifdef ADD_SHORTCUT_QUERY
	auto_ptr<HBufC> text1( StringLoader::LoadL( R_TEXT_WELCOME_ADD_SHORTCUT_TO_IDLE) );
	auto_ptr<HBufC> text2( StringLoader::LoadL( R_TEXT_WELCOME_LAUNCH_JAIKU ) );
	
	iSelections->AppendL( *text1 );
	iSelections->AppendL( *text2 );
#else
	auto_ptr<HBufC> text1( StringLoader::LoadL( R_TEXT_WELCOME_LAUNCH_JAIKU__NOSHORTCUT ) );
	
	iSelections->AppendL( *text1 );
#endif
}
Пример #20
0
/**
Copies the specified array contents.
@param aFrom The source array.
@param aTo The target array.
@leave One of the system wide error code, if a processing failure occurs.
*/
void CMTPMetaData::CopyL(const CDesCArray& aFrom, CDesCArray& aTo)
    {
    const TUint KCount(aFrom.Count());
    for (TUint i(0); (i < KCount); i++)
        {
        aTo.AppendL(aFrom[i]);
        }
    }
Пример #21
0
// ----------------------------------------------------------------------------
// Copies elements from one array of descriptors to another
// ----------------------------------------------------------------------------
//
EXPORT_C void MPXUser::CopyArrayL(const MDesCArray& aSrc, CDesCArray& aDest)
    {
    aDest.Reset();
    for (TInt i=0; i < aSrc.MdcaCount(); ++i)
        {
        aDest.AppendL(aSrc.MdcaPoint(i));
        }
    }
void CTrialContainer::AppendItemAndUpdateBoxL(TInt aResource, 
                                              CDesCArray& aArray)
{
   HBufC* text = iCoeEnv->AllocReadResourceLC(aResource);
   aArray.AppendL( *text );
   iListBox->HandleItemAdditionL();
   CleanupStack::PopAndDestroy(text);
}
Пример #23
0
void TestFindingL(CContactDatabase& aDb)
	{
	test.Next(_L("Test FindLC"));

	syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrLocked);
	syncChecker->SetValidateResponseL(MContactSynchroniser::ESearch,KErrLocked);
	
	CContactItemFieldDef* fieldDef=new(ELeave) CContactItemFieldDef;
	CleanupStack::PushL(fieldDef);
	fieldDef->AppendL(KUidContactFieldFamilyName); 
	
	
	TRAPD(err,TestFindL(aDb, KGivenEditName, fieldDef, test) );
	test(err==KErrLocked);
	CleanupStack::PopAndDestroy(fieldDef);

	CContactItemFieldDef* fieldDef2=new(ELeave) CContactItemFieldDef;
	CleanupStack::PushL(fieldDef2);
	fieldDef2->AppendL(KUidContactFieldPhoneNumber); 
	TRAP(err, TestFindL(aDb, KTelephoneNum, fieldDef2, test) );
	test(err==KErrLocked);
	CleanupStack::PopAndDestroy(fieldDef2);

	test.Next(_L("Test FindInTextDefL"));

	TCallBack callBack(findWordSplitterL);
	CContactTextDef* textDef=CContactTextDef::NewLC();
	textDef->AppendL(TContactTextDefItem(KUidContactFieldFamilyName));
	CDesCArray* desArray = new(ELeave) CDesCArrayFlat(5);
	desArray->AppendL(_L("e"));
	
	CContactIdArray* arr = NULL;
	TRAP(err,arr = TestFindInTextDefL(aDb,*desArray,textDef, callBack, test) );
	
//	test(err==KErrLocked);
	desArray->Delete(0);
	delete desArray;
//FIX
	delete arr;	
	CleanupStack::PopAndDestroy(textDef); 

	test.Next(_L("Test FindInTextDefL2"));

	TCallBack callBack2(findWordSplitterL);
	CContactTextDef* textDef2=CContactTextDef::NewLC();
	textDef2->AppendL(TContactTextDefItem(KUidContactFieldFamilyName));
	textDef2->AppendL(TContactTextDefItem(KUidContactFieldUrl));
	CDesCArray* desArray2 = new(ELeave) CDesCArrayFlat(5);
	desArray2->AppendL(_L("e"));
	
	TRAP(err,arr = TestFindInTextDefL(aDb,*desArray2,textDef2, callBack2, test) );
//	test(err==KErrLocked);
	desArray2->Delete(0);
	delete desArray2;
//FIX
	delete arr;	
	CleanupStack::PopAndDestroy(textDef2);
	}
void TestFindInTextDefLC(CContactDatabase& aDb, TContactItemId aIccId, TContactItemId aNonIccId)
	{
	test.Next(_L("Test FindInTextDefLC"));
	// Successful find of icc entry
	syncChecker->SetValidateResponseL(MContactSynchroniser::ESearch,KErrNone);
	syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrNone);

	TCallBack callBack(findWordSplitterL);
	CContactTextDef* textDef=CContactTextDef::NewLC();
	textDef->AppendL(TContactTextDefItem(KUidContactFieldFamilyName));
	CDesCArray* desArray = new(ELeave) CDesCArrayFlat(5);
	desArray->AppendL(_L("icc"));
	syncChecker->ResetMethodCallCountsL();
	CContactIdArray* array = aDb.FindInTextDefLC(*desArray,textDef,callBack);
	//test(syncChecker->ValidateMethodCallCountL() == 3);
	test(array!=NULL);
	test(array->Count() == 1);
	test((*array)[0]==aIccId);
	CleanupStack::PopAndDestroy(array);
	array=NULL;

	test.Next(_L("Test searching when ICC locked"));
	// Unsuccessful find of icc entry because icc locked
	syncChecker->SetValidateResponseL(MContactSynchroniser::ESearch,KErrLocked);
	syncChecker->ResetMethodCallCountsL();
	TRAPD(err,array = aDb.FindInTextDefLC(*desArray,textDef,callBack));
	test(syncChecker->ValidateMethodCallCountL() == 1);
	test(err==KErrLocked);
	test(array==NULL);
	desArray->Delete(0);
	delete desArray;

	// successful find of non-icc entry, even though icc locked
	CDesCArray* desArray2 = new(ELeave) CDesCArrayFlat(5);
	desArray2->AppendL(_L("non-icc"));
	syncChecker->ResetMethodCallCountsL();
	array = aDb.FindInTextDefLC(*desArray2,textDef,callBack);
	test(syncChecker->ValidateMethodCallCountL() == 0);
	test(array!=NULL);
	test(array->Count() == 1);
	test((*array)[0]==aNonIccId);

	// both the icc and non-icc entry should match the search criteria, but only the
	// non-icc entry should be returned since icc is locked
	SetNameField(aDb,aIccId,KNonIccName);
	syncChecker->ResetMethodCallCountsL();
	TRAP(err,array = aDb.FindInTextDefLC(*desArray2,textDef,callBack));
	test(syncChecker->ValidateMethodCallCountL() == 1);
	test(err==KErrLocked);
	test(array!=NULL);
	test(array->Count() == 1);
	test((*array)[0]==aNonIccId);
	desArray2->Delete(0);
	delete desArray2;
	SetNameField(aDb,aIccId,KIccName);
	CleanupStack::PopAndDestroy(2,textDef); // array, textDef
	}
Пример #25
0
/**
 *	Add a list box item to a list.
 */
void CSettingList::AddListBoxItemL( 
		CEikTextListBox* aListBox,
		const TDesC& aString )
	{
	CTextListBoxModel* model = aListBox->Model();
	CDesCArray* itemArray = static_cast< CDesCArray* > ( model->ItemTextArray() );
	itemArray->AppendL( aString );
	aListBox->HandleItemAdditionL();
	}
Пример #26
0
CDesCArray* CLanguageList::GenerateLanguageNameArrayLC()
{
   CDesCArray* langArray = new (ELeave) CDesCArraySeg(8);
   CleanupStack::PushL(langArray);
   
   for(CLanguageList::iterator q = begin(); q != end(); ++q){
      langArray->AppendL(q->fullname);
   }
   return langArray;
}
void X509CertNameParser::CompareAndAddNameL( const TDesC& aProposal, 
                                             CDesCArray& aNameArray )
    {
    TInt pos = 0; // This is needed only for calling Find().
    // Append to array, if aProposal don't already exist in the array.
    if ( aNameArray.Find( aProposal, pos, ECmpNormal ) )
        {
        aNameArray.AppendL( aProposal );
        }
    }
Пример #28
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperViewContainer::ShowL( const TDesC& aString, TBool& aLast, const TBool& aFileOutput )
    {
    MDesCArray* itemList = iListbox->Model()->ItemTextArray();
    CDesCArray* itemArray = ( CDesCArray* ) itemList;

    itemArray->AppendL( aString );

    iListbox->HandleItemAdditionL();
    iListbox->SetCurrentItemIndex( iCount );
    iCount++;
    if ( aLast )
        {
        if (aFileOutput)
            {
            RFile file;
            RFs& fs = CEikonEnv::Static()->FsSession();
            TFileName fileName =_L("Layout_");

            TRect screenRect;
            AknLayoutUtils::LayoutMetricsRect(
                AknLayoutUtils::EApplicationWindow,
                screenRect );

            // Add screen dimensions
            TInt height = screenRect.Height();
            TInt width = screenRect.Width();
            fileName.AppendNum(height);
            fileName.Append('_');
            fileName.AppendNum(width);

            fileName.Append(_L(".txt"));

            TInt err=file.Open(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny);
            if (err==KErrNotFound) // file does not exist - create it
                err=file.Create(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny);
            else
                file.SetSize(0); //sweep the file
            TFileText textFile;
            textFile.Set(file);
            err = textFile.Seek(ESeekStart);
            if (err) User::InfoPrint(_L("File corrupted"));

            // Finally loop through all the entries:
            TInt idx = 0;
            for(;idx!=itemList->MdcaCount();idx++)
                {
                err = textFile.Write(itemList->MdcaPoint(idx));
                if (err) User::InfoPrint(_L("File corrupted"));
                }
            file.Close();
            }
        DrawNow();
        }
    }
// -----------------------------------------------------------------------------
// CAMMSEMCReverbEnvironmentalPresetUtility::GetPresetNamesL
// Gets list of preset names available.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
void CAMMSEMCReverbEnvironmentalPresetUtility::GetPresetNamesL(
    CDesCArray& aPresetNames)
{
    LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::GetPresetNamesL +");
    TArray< TEfEnvironmentalReverbUtilityPreset > presetNames =
        iEmptyEnvironmentalReverbUtility->Presets();
    TInt presetCount = presetNames.Count();
    for (TInt i = 0; i < presetCount; i++)
    {
        aPresetNames.AppendL(presetNames[ i ].iPresetName);
    }
    LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::GetPresetNamesL -");
}
// -----------------------------------------------------------------------------
// CPosLmMultiDbSearch::DatabasesToSearchL
//
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
EXPORT_C CDesCArray* CPosLmMultiDbSearch::DatabasesToSearchL()
{
    CDesCArray* databaseList = new (ELeave) CDesCArrayFlat(KPosGranularity);
    CleanupStack::PushL(databaseList);

    for (TInt i = 0; i < iSearchItems.Count(); i++)
    {
        databaseList->AppendL(*(iSearchItems[i]->iDbUriPtr));
    }

    CleanupStack::Pop(databaseList);
    return databaseList;
}