void CDefaultNumbersPopupList::Refresh()
{
	CALLSTACKITEM_N(_CL("CDefaultNumbersPopupList"), _CL("Refresh"));

	iArrayItems->Reset();
	iArrayItems->Compress();
	PopulateListbox();
	iListbox->HandleItemRemovalL();
}
// -----------------------------------------------------------------------------
void CPresenceCacheBuddyInfo::GetFieldKeysL( 
    CDesCArrayFlat& aKeys )
    {
    aKeys.Reset();
    THashMapIter<TDesC*, TInt> iter(iHashMap);    
    TDesC* const* nextKey = iter.NextKey();
    while (nextKey)
        {
        aKeys.AppendL( **nextKey );
        nextKey = iter.NextKey();
        }    
    }
// Set data to the listbox.
void CContactsSubScreenView::SetData()
{
	TBuf<50> titlename;
	TBuf<50> formatBuf;

	titlename.Copy(_L(""));
	formatBuf.Copy(_L(""));
	formatBuf.Append(*(iEikonEnv->AllocReadResourceL(R_STATUSTEXT_CONTACTS_UPLOADED)));
	titlename.Format(formatBuf, iContactsArray->MdcaCount());

    iAppTitle->SetTextL(titlename, CCknAppTitle::EMainTitle);

	iListbox->HandleItemRemovalL();

	CDesCArrayFlat* listItems = new (ELeave) CDesCArrayFlat(1);

	if(iContactsArray->MdcaCount() > 0)
	{
		listItems->Reset();
		CDesCArrayFlat* listItems = new (ELeave) CDesCArrayFlat(iContactsArray->MdcaCount());
	}
    CleanupStack::PushL(listItems);

	TBuf<500> item;
    
	for (TInt i = 0; i < iContactsArray->MdcaCount() ; i++)
	{
		item.Copy(_L(""));
		item.Append((*iContactsArray)[i]);
		item.Append(_L(","));
		item.Append((*iMobileArray)[i]);

		listItems->AppendL(item);	
	}
        
	CleanupStack::Pop(listItems);
	
    CTextListBoxModel* model = iListbox->Model();
    model->SetItemTextArray(listItems);

    // Set ListBox model responsible for deleting the listItems array
    model->SetOwnershipType(ELbmOwnsItemArray);
    
    iListbox->HandleItemAdditionL();
    DrawDeferred();
}
Exemplo n.º 4
0
// ----------------------------------------------------------------------------
// CSCPHistoryPlugin::HandleEvent
// 
// 
// Status : Approved
// ----------------------------------------------------------------------------
//    
void CSCPHistoryPlugin :: HandleEventL( TInt aID, CSCPParamObject& aParam, CSCPParamObject& aOutParam)
	{				
	Dprint ( ( _L( "CSCPHistoryPlugin::HandleEvent()" ) ) );
	
	if ( iFs == NULL )
	    {
	    return ; // Eventhandler not available
	    }	
		// check for Case
		
	switch ( aID )
        {

        case ( KSCPEventValidate ) :
            {            
           	// Obtain the paramValue
           	Dprint ( ( _L( "CSCPHistoryPlugin::KSCPEventValidate" ) ) );
			TInt passhistoryParamValue;
			passhistoryParamValue = GetHistoryCountParamValue();
			Dprint ( ( _L( "CSCPHistoryPlugin::HandleEvent passhistoryParamValue = %d" ), passhistoryParamValue ) );
			// if all required bounds are zero, there is nothing to do.
			if ( passhistoryParamValue != 0)
			    {
				// Get the configFile's path.
				// If this fails, there is something badly wrong(Private folder is not there)
				TInt errSCF = SetConfigFile ();
				if (errSCF != KErrNone)
				{
					break; // Break out from Case
				}

				// Get the historyItemCount, If the err is raised, the file is not there
				// This will lead to KSCPEventPasswordChanged event and new history file will
				// be created
				TInt historyItemCounter;
				TInt errHC = GetHistoryItemCount( historyItemCounter );
				Dprint ( ( _L( "CSCPHistoryPlugin::HandleEvent historyItemCounter = %d" ), historyItemCounter ) );
				if (errHC != KErrNone)
				{
					break; // Break out from Case
				}

				// continue with the KSCPEventValidate Check

				// Get the password from the paramObject
				TBuf<KSCPPasscodeMaxLength> seccode;
				if ( aParam.Get( KSCPParamPassword, seccode ) != KErrNone )
				{
					// Nothing to do anymore
					Dprint( (_L("CSCPHistoryPlugin::HandleEvent()\
					ERROR: KSCPEventValidate/KSCPParamPassword is != KErrNone") ));
					break; // Break out from Case
				}            
				
				// Hash  the securitycode	
				TBuf<KSCPPasscodeMaxLength> securityhash;
				iEventHandler->HashInput(seccode,securityhash);
			
				// get history
				CDesCArrayFlat* array = NULL;
				TInt errGH = KErrNone;
				
				array = new CDesCArrayFlat(1);			
				if ( array != NULL )
				    {
				    TRAPD( err2, errGH = GetHistoryArrayL( *array ) );
				    if ( err2 != KErrNone )
				        {
				        errGH = err2;
				        }
				    }
				else
				    {
				    errGH = KErrNoMemory;
				    }
			
				// If for some reason err is raised, break out
				// If the Historyonfig file get deleted on the fly ex
				if (errGH != KErrNone)
				    {
					array->Reset();
					delete array;
					break; // Break out from Case
				    }
				TInt correction;
				correction = 0;

				if ( array->Count() >=  passhistoryParamValue )
                {
                    correction =  array->Count() - passhistoryParamValue;
                }
				// check for match
				TBuf<KSCPPasscodeMaxLength> arrayItem;
				
				// Set the historyobject
				for (TInt i= 0 + correction; i < array->Count(); i++)
				    {
					arrayItem =  array->MdcaPoint(i);
					if (arrayItem.Compare(securityhash) == KErrNone)
					    {
                            aOutParam.Set( KSCPParamStatus, KErrSCPInvalidCode );
                            Dprint ( ( _L( "EDeviceLockHistoryBuffer Failed" ) ) );
                            aOutParam.AddtoFailedPolices(EDeviceLockHistoryBuffer);
                            break;
                        } // End of compare IF
                    } // End of For
					
                // kill the local
                array->Reset();
                delete array;

                } // passhistoryParamValue
            break;
            } // end of KSCPEventValidate
Exemplo n.º 5
0
/**
@SYMTestCaseID SYSLIB-FORMA-UT-1901
@SYMTestCaseDesc This function runs all the 'single edit' tests.
@SYMTestPriority High
@SYMTestActions  creates a number of documents, and then calls RunSingleEditTestsOnDocumentL to run
the actual suite of tests on that document.
@SYMTestExpectedResults The test must not fail or panic .
@SYMDEF DEF092140, DEF092139
*/
void RunSingleEditTestsL(CRichText& aRichText, CBandMaintainer& aMaintainer, CBandValidator& aValidator)
	{
	CDesCArrayFlat* doc = new(ELeave) CDesCArrayFlat(5);
	CleanupStack::PushL(doc);

//document contains one short paragraph, followed by a paragraph bigger than the band
	doc->AppendL(KEnglishMoreThanALine_1);
	doc->AppendL(KEnglishLargeParagraph);
	test.Start(_L("Document 1: no scrolling"));
	RunSingleEditTestsOnDocumentL(aRichText, aMaintainer, aValidator, *doc, 0);
	test.Next(_L("Document 1: scroll so top paragraph is removed"));
	RunSingleEditTestsOnDocumentL(aRichText, aMaintainer, aValidator, *doc, 1);
	doc->Reset();

//document contains 5 short paragraphs, long words
	doc->AppendL(KEnglishLongWords_1);
	doc->AppendL(KEnglishLongWords_2);
	doc->AppendL(KEnglishLongWords_3);
	doc->AppendL(KEnglishLongWords_4);
	doc->AppendL(KEnglishLongWords_5);
	test.Next(_L("Document 2: no scrolling"));
	RunSingleEditTestsOnDocumentL(aRichText, aMaintainer, aValidator, *doc, 0);
	test.Next(_L("Document 2: scroll so top paragraph is removed"));
	RunSingleEditTestsOnDocumentL(aRichText, aMaintainer, aValidator, *doc, 1);
	doc->Reset();

//document contains 5 short paragraphs, short words
	doc->AppendL(KEnglishShortWords_1);
	doc->AppendL(KEnglishShortWords_2);
	doc->AppendL(KEnglishShortWords_3);
	doc->AppendL(KEnglishShortWords_4);
	doc->AppendL(KEnglishShortWords_5);

	test.Next(_L("Document 3: no scrolling"));
	RunSingleEditTestsOnDocumentL(aRichText, aMaintainer, aValidator, *doc, 0);
	test.Next(_L("Document 3: scroll so top paragraph is removed"));
	RunSingleEditTestsOnDocumentL(aRichText, aMaintainer, aValidator, *doc, 1);
	doc->Reset();

//document contains 10 paragraphs, each less than a line
	doc->AppendL(KEnglishLessThanALine_1);
	doc->AppendL(KEnglishLessThanALine_5);
	doc->AppendL(KEnglishLessThanALine_2);
	doc->AppendL(KEnglishLessThanALine_4);
	doc->AppendL(KEnglishLessThanALine_3);
	doc->AppendL(KEnglishLessThanALine_3);
	doc->AppendL(KEnglishLessThanALine_4);
	doc->AppendL(KEnglishLessThanALine_2);
	doc->AppendL(KEnglishLessThanALine_5);
	doc->AppendL(KEnglishLessThanALine_1);

	test.Next(_L("Document 4: no scrolling"));
	RunSingleEditTestsOnDocumentL(aRichText, aMaintainer, aValidator, *doc, 0);
	test.Next(_L("Document 4: scroll so top paragraph is removed"));
	RunSingleEditTestsOnDocumentL(aRichText, aMaintainer, aValidator, *doc, 1);
	doc->Reset();

//document contains 1 short paragraph, normal-length words
	doc->AppendL(KEnglishMoreThanALine_1);
	test.Next(_L("Document 5: no scrolling"));
	RunSingleEditTestsOnDocumentL(aRichText, aMaintainer, aValidator, *doc, 0);
	doc->Reset();

//document contains 5 short paragraphs, normal-length words
	doc->AppendL(KEnglishMoreThanALine_1);
	doc->AppendL(KEnglishMoreThanALine_2);
	doc->AppendL(KEnglishMoreThanALine_3);
	doc->AppendL(KEnglishMoreThanALine_4);
	doc->AppendL(KEnglishMoreThanALine_5);
	test.Next(_L("Document 6: no scrolling"));
	RunSingleEditTestsOnDocumentL(aRichText, aMaintainer, aValidator, *doc, 0);
	test.Next(_L("Document 6: scroll so top paragraph is removed"));
	RunSingleEditTestsOnDocumentL(aRichText, aMaintainer, aValidator, *doc, 1);
	doc->Reset();


	CleanupStack::PopAndDestroy();

	test.End();
	}