void CBCTestPtiEngine::TestNavigationL()
    {
    iEngine->ClearCurrentWord();
    SimuInput(iEngine, _L("46873"));

    CDesCArray* cands = new (ELeave) CDesCArrayFlat(16);
    CleanupStack::PushL(cands);

    iEngine->GetCandidateListL(*cands);
    AssertIntL(0, iEngine->FirstCandidate().Compare(cands->MdcaPoint(0)),
        _L("First candidate verified"));

    for (int i = 1; i < cands->Count(); ++i)
        {
        AssertIntL(0, iEngine->NextCandidate().Compare(cands->MdcaPoint(i)),
            _L("next candidate verified"));
        }

    for (int i = cands->Count() - 2; i >= 0; --i)
        {
        AssertIntL(0, iEngine->PreviousCandidate().Compare(cands->MdcaPoint(i)),
            _L("Previous candidate verified"));
        }

    CleanupStack::PopAndDestroy(); // cands
    }
TBool CPackagerCntComparator::DoCompareCDesCArray(const CDesCArray& anArray1, const CDesCArray& anArray2) const
/** Compares two CDesCArray items. 

@param anArray1 The first CDesCArray to be compared.
@param anArray2 The second CDesCArray to be compared.
@return ETrue if the two items are equal, EFalse otherwise. */
	{// Need to check for NULL  arrays first.
	if((!&anArray1) && (!&anArray2))
		{
		return ETrue;
		}

	if((!&anArray1) || (!&anArray1))
		{
		return EFalse;
		}
	
	// Check if arrays are same length to begin with.
	TInt maxCount = anArray1.Count();
	if(!DoCompareTInt(maxCount, anArray2.Count()))
		{
		return EFalse;
		}

	for(TInt i=0; i<maxCount; ++i)
		{
		if(anArray1[i]!=anArray2[i])
			{
			return EFalse;
			}
		}

	return ETrue;	
	}	
jobjectArray CopyToNewJavaStringArrayL(JNIEnv& aJni,
                                       const CDesCArray& aNativeArray)
{
    JELOG2(EJavaLocation);
    jclass stringClass = aJni.FindClass("java/lang/String");
    User::LeaveIfNull(stringClass);
    //
    jobjectArray result = aJni.NewObjectArray(aNativeArray.Count(),
                          stringClass, NULL);
    if (result != NULL)
    {
        TPtrC item;
        for (int i = 0; i < aNativeArray.Count(); ++i)
        {
            item.Set(aNativeArray[i]);
            jstring javaString =
                java::util::S60CommonUtils::NativeToJavaString(aJni, item);
            User::LeaveIfNull(javaString);
            //
            aJni.SetObjectArrayElement(result, i, javaString);
            aJni.DeleteLocalRef(javaString);
        }
    }
    return result;
}
示例#4
0
void CMdEQuery::NotifyNewResultsL( const CDesCArray& aNewResults )
    {
	TInt firstNewItemIndex = aNewResults.Count();

	TInt oldCount = 0;
	if( iDistinctResults )
		{
		oldCount = iDistinctResults->Count();
		}
	else
		{
	    iDistinctResults = new (ELeave) CDesCArrayFlat( 8 );
		}

    TRAPD( err, AppendResultsL( aNewResults ) );
    if( err != KErrNone )
        {
        // Cleanup: remove the ones that were added.
        while( iDistinctResults->Count() > oldCount )
            {
            iDistinctResults->Delete( iDistinctResults->Count() - 1 );
            }
        // Leave with the same error.
        User::Leave(err);
        }

    for( TInt i = iObservers.Count() - 1; i >=0; i-- )
		{
		MMdEQueryObserver* observer = iObservers[i];
		observer->HandleQueryNewResults( *this, firstNewItemIndex, 
                                         aNewResults.Count() );
		}
    }
void CBCTestPtiEngine::TestPredictL()
    {
    //predictive
    iEngine->ActivateLanguageL(ELangEnglish, EPtiEnginePredictive);
    SimuInput(iEngine, _L("this"));

    TBuf<32> msg=_L("current word is: ");
    msg.Append(iEngine->CurrentWord());  //may be "this"
    msg.ZeroTerminate();
    AssertTrueL( ETrue, msg);

    // next
    msg=_L("next word is: ");
    msg.Append(iEngine->NextCandidate()); // Move on to next candidate.
    msg.ZeroTerminate();
    AssertTrueL( ETrue, msg);
    iEngine->CommitCurrentWord();

    // delete
    SimuInput(iEngine, _L("8447"));
    msg = _L("current word after del is: ");
    msg.Append(iEngine->DeleteKeyPress());
    msg.ZeroTerminate();
    AssertTrueL(ETrue, msg);

    // reject
    iEngine->ClearCurrentWord();
    AssertTrueL(ETrue, _L("reject current word"));

    // char2key
    AssertIntL(EPtiKey7, iEngine->CharacterToKey('s'), _L("char 's' map to key 7"));

    // candidate list
    iEngine->ClearCurrentWord();
    CDesCArray* cands = new (ELeave) CDesCArrayFlat(16);
    CleanupStack::PushL(cands);

    SimuInput(iEngine, _L("8447"));
    iEngine->GetCandidateListL(*cands);
    msg=_L("candidates: ");
    for (int i = 0; i < cands->Count(); ++i)
        {
        msg.Append(cands->MdcaPoint(i));
        msg.Append(_L(", "));
        }
    msg.ZeroTerminate();
    AssertIntL(cands->Count(), iEngine->NumberOfCandidates(), msg);
    CleanupStack::PopAndDestroy();  // cands

    // set current word
    iEngine->SetCurrentWord(_L("dog"));
    SimuInput(iEngine, _L("t"));
    msg=_L("dog+t change to: ");
    msg.Append(iEngine->CurrentWord());
    msg.ZeroTerminate();
    AssertTrueL(ETrue, msg);
    }
示例#6
0
void CPluginsList::Update()
	{
	CDesCArray* itemArray = static_cast< CDesCArray* > ( iListBox->Model()->ItemTextArray() );
	if (itemArray->Count()>0){itemArray->Delete(0,itemArray->Count());}
	iListBox->HandleItemAdditionL();
	TInt i=0;
	for (i=0; i<((CPluginsListView*)iCommandObserver)->iPlugins->Count(); i++)
		{
		TBuf<255> Buf;
		CreateListBoxItemL(Buf,((CPluginsListView*)iCommandObserver)->iPlugins->At(i).iName,((CPluginsListView*)iCommandObserver)->iPlugins->At(i).iDescription);
		AddListBoxItemL(iListBox,Buf);
		}
	}
void DoTestV8DatabaseL()
    {
    CopyOldCdbFileToCDriveL(KDatabaseV8);
    CContactDatabase* db=CContactDatabase::OpenL(KDatabaseCDrive); 
    TDriveUnit driveUnit = _L("c:");
    TBuf<190> driveName;
    CDesCArray* dataBaseList = db->ListDatabasesL(driveUnit);
    CleanupStack::PushL(dataBaseList);
    TInt theCount = dataBaseList->Count();
    TBool oldFileFormat = EFalse;
    for(TInt i = 0; i< theCount; i++)
        {
        driveName = (*dataBaseList)[i];
        test.Printf(_L("ListDatabaseTestL, ListDatabasesL: %s \n"),driveName.PtrZ());
        TPtrC filenamePtr(driveName);
        TInt found = filenamePtr.FindF(KOldFileFormatPrefix);
        if (found != 0 && found != KErrNotFound)
            {
            oldFileFormat = ETrue;  
            }
        }
    test(oldFileFormat);

    CleanupStack::PopAndDestroy(dataBaseList);
    delete db;
    }
// ---------------------------------------------------------
// CPosLmLocalDatabaseManager::ListDatabasesL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosLmLocalDatabaseManager::ListDatabasesL(
    RPointerArray<HPosLmDatabaseInfo>& aDatabaseInfoArray)
    {
    // list URIs
    CDesCArray* dbUriArray = ListDatabasesLC();
    // list registered databases
    Session().ListDatabasesL(aDatabaseInfoArray, KFileProtocol);
    // delete from URI list those databases that are registered
    for (TInt i = aDatabaseInfoArray.Count() - 1; i >= 0; i--)
        {
        TInt index;
        if (dbUriArray->Find(aDatabaseInfoArray[i]->DatabaseUri(), index) == 0)
            {
            dbUriArray->Delete(index);
            }
        }

    // for each remaining URI in the list, fill in database info
    // and add to list
    TInt count = dbUriArray->Count();
    for (TInt i = 0; i < count; i++)
        {
        HPosLmDatabaseInfo* info = HPosLmDatabaseInfo::NewLC((*dbUriArray)[i]);
        aDatabaseInfoArray.AppendL(info);
        CleanupStack::Pop(info); // transfer of ownership to array
        }

    CleanupStack::PopAndDestroy(dbUriArray);
    // database drive, database media and default flag
    // will be filled in by database management provider.
    }
// ---------------------------------------------------------
// 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;
    }
// ---------------------------------------------------------------------------
// CLAPILandmarkStoreManager::LandmarkStoresL
// ---------------------------------------------------------------------------
//
CDesCArray* CLAPILandmarkStoreManager::LandmarkStoresL()
{
    JELOG2(EJavaLocation);
    // List landmark databases but remove the default store from the array
    CDesCArray* stores = iLmDbManager->ListDatabasesLC();
    HBufC* defaultDbName = iLmDbManager->DefaultDatabaseUriLC();

    // Remove the default database from the store names array. External stores
    // are also removed because this API does not support other than stores
    // which are located in the file system of the device
    TInt count = stores->Count();
    for (TInt i = 0; i < count; i++)
    {
        TPtrC storeUri = stores->MdcaPoint(i);
        if (defaultDbName->CompareF(storeUri) == 0 || storeUri.FindF(
                    KLAPIDefaultProtocol) == KErrNotFound)
        {
            stores->Delete(i);
            break;
        }
    }

    CleanupStack::PopAndDestroy(defaultDbName);
    CleanupStack::Pop(stores);
    return stores;
}
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();
   }
}
示例#12
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]);
        }
    }
示例#13
0
void CMdEQuery::AppendResultsL( const CDesCArray& aNewResults )
    {
    const TInt count = aNewResults.Count();
    
    for ( TInt i = 0; i < count; ++i )
    	{
    	iDistinctResults->AppendL( aNewResults[i] );
    	}
    }
示例#14
0
// ---------------------------------------------------------
// CPosTp666::SetupTestEnvironmentL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosTp666::SetupTestEnvironmentL()
    {
    iLog->Put(_L("SetupTestEnvironmentL"));
    
    // Setup start conditions for compatibility test
    _LIT(KDefaultDb, "file://c:eposlm.ldb");

    CPosLmDatabaseManager* dbManager = CPosLmDatabaseManager::NewL();
    CleanupStack::PushL(dbManager);
    
    // Remove all landmark databases
    CDesCArray* uris = dbManager->ListDatabasesL();
    CleanupStack::PushL(uris);
    for (TInt i = 0; i < uris->Count(); i++)
        {
        dbManager->DeleteDatabaseL((*uris)[i]);
        }
    CleanupStack::PopAndDestroy(uris);
        
    // Create and initialize a default database
    dbManager->CreateDatabaseL(KDefaultDb);
    dbManager->SetDefaultDatabaseL(KDefaultDb);
    CPosLandmarkDatabase* database = CPosLandmarkDatabase::OpenL();
    CleanupStack::PushL(database);
    ExecuteAndDeleteLD(database->InitializeL());
    
    // Add 5 landmarks - will generate ids 1 - 5
    const TInt KFive = 5;
    for (TInt j = 0; j < KFive; j++)
        {
        CPosLandmark* lm = CPosLandmark::NewLC();
        lm->SetLandmarkNameL(_L("Landmark"));
        database->AddLandmarkL(*lm);
        CleanupStack::PopAndDestroy(lm);
        }
        
    // Add 5 categories
    CPosLmCategoryManager* catManager = CPosLmCategoryManager::NewL(*database);
    CleanupStack::PushL(catManager);
    for (TInt k = 0; k < KFive; k++)
        {
        CPosLandmarkCategory* category = CPosLandmarkCategory::NewLC();
        TBuf<15> name;
        name = _L("Category ");
        name.AppendNum(k);
        category->SetCategoryNameL(name);
        catManager->AddCategoryL(*category);
        CleanupStack::PopAndDestroy(category);
        }
       
    CleanupStack::PopAndDestroy(3, dbManager);
    }
void CPlPerformanceAPI::ListDatabaseTestL()
	{
	TDriveUnit driveUnit = _L("c:");
	TBuf<190> driveName;
	CDesCArray* dataBaseList = iCntTestImpl.ListDatabasesL(driveUnit);
	CleanupStack::PushL(dataBaseList);
	TInt theCount = dataBaseList->Count();
	for(TInt i = 0; i< theCount; i++)
		{
		driveName = (*dataBaseList)[i];
		test.Printf(_L("ListDatabaseTestL, ListDatabasesL: %s \n"),driveName.PtrZ());
//		driveName.Delete(0,driveName.Size());
		}
//	dataBaseList->Reset();
	CleanupStack::PopAndDestroy(dataBaseList);
	}	
void CMemSpyEngineCodeSegEntry::AddCapabilityItemsL()
    {
    _LIT(KCapFormat, "\tCapability #%3d\t\t%S");
    TBuf<128> item;
    //
    CDesCArray* capabilities = CapabilityStringsLC();
    const TInt count = capabilities->Count();
    //
    for( TInt i=0; i<count; i++ )
        {
        const TPtrC capabilityName( (*capabilities)[ i ] );
        item.Format( KCapFormat, i+1, &capabilityName );
        AppendL( item );
        }
    //
    CleanupStack::PopAndDestroy( capabilities );
    }
示例#17
0
void CStarDictAppUi::ShowDictionaryListL()
{
	TDesC *name, *path;
	TBuf<KDataBaseNameSizeMax> str;

	CDesCArray *itemTextArray = new (ELeave) CDesCArrayFlat(16);
	CleanupStack::PushL(itemTextArray);

	for(TInt i=0; i<iDictFactory->GetDataBaseCount(); i++)
	{
		name = path = NULL;
		if (iDictFactory->GetDataBaseName(i, &name, &path) && name)
		{
			str.Copy(*name);
		}
		else
		{
			TBuf<100> resourceString;
			CEikonEnv::Static()->ReadResource(resourceString,
											  R_CORRUPT_STRING);
			str.Copy(resourceString);
		}

		itemTextArray->AppendL(str);
	}

	TInt itemSelected(0), prevSelection;
	CAknListQueryDialog* listQuery = new (ELeave) CAknListQueryDialog(&itemSelected);
	listQuery->PrepareLC(R_DICTIONARY_LIST_DIALOG);
	listQuery->SetItemTextArray(itemTextArray);
	listQuery->SetOwnershipType(ELbmDoesNotOwnItemArray);

	prevSelection = iDictFactory->GetCurrentDataBase();
	if (prevSelection >= 0 && prevSelection < itemTextArray->Count())
	{
		listQuery->ListBox()->SetCurrentItemIndex(prevSelection);
	}
	if(listQuery->RunLD())
	{
		iDictFactory->SetCurrentDataBase(itemSelected);
		iStarDictContainerView->SetDictionaryName((*itemTextArray)[itemSelected]);
		iStarDictContainerView->UpdateListBox();
	}
	CleanupStack::PopAndDestroy();
}
// ------------------------------------------------
// GetFreeTextHitCountL
// ------------------------------------------------
//
TUint32 CMdSFindSequence::GetFreeTextHitCountL(
		const CDesCArray& aObjectFreeText, 
		const RPointerArray<HBufC>& aSearchFreeText)
	{
	TUint32 hitCount = 0;

	const TInt objectFreeTextCount = aObjectFreeText.Count();

	for(TInt i = 0; i < objectFreeTextCount; ++i)
		{
		TInt length = aObjectFreeText[i].Length();
		const TDesC& objectText = aObjectFreeText[i];
		const TInt32 objectTextLength = objectText.Length();
		const TInt searchFreeTextCount = aSearchFreeText.Count();

    	for( TInt j = 0; j < searchFreeTextCount; ++j )
	    	{
			const TDesC& searchText = *aSearchFreeText[j];
			const TInt32 searchTextLength = searchText.Length();

			if (searchTextLength > objectTextLength)
				{
				continue;
				}
			TInt32 searchStart = 0;
			while(objectTextLength - searchStart >= searchTextLength)
				{
				const TInt retValue = objectText.Mid(searchStart, 
						objectTextLength - searchStart).FindF(searchText);

				if(retValue != KErrNotFound)
					{
					searchStart += retValue+searchTextLength;
					hitCount++;
					}
				else
					{
					break;
					}
				}
	    	}
    	}
    return hitCount;
	}
/**
Return a list of Contacts databases found on drive aDriveUnit.

@param aListBuffer Client supplied flat buffer to be filled with a serialized
CDesCArray of Contacts databases found on drive aDriveUnit.
@param aDriveUnit Drive to list Contacts databases for.  If defaulted then a
list of Contacts databases on all drives will be returned.
*/
void CCntDbManagerController::ListDatabasesL(CBufFlat*& aListBuffer, TDriveUnit* aDriveUnit) const
	{
	const TInt KInitialBufferSize = 200;
	aListBuffer = CBufFlat::NewL(KInitialBufferSize);
	CleanupStack::PushL(aListBuffer);
	
	// Create a write stream for this buffer.
	RBufWriteStream bufStream;
	CleanupClosePushL(bufStream);
	bufStream.Open(*aListBuffer);

	// Use Persistence Layer to get list of Contacts databases.  Note that the
	// ListL() method always returns a list even if empty so no NULL check for
	// list is required.
	MLplContactsFile& pl = iPersistenceLayer->ContactsFileL();
	CDesCArray* list =NULL;
	if(aDriveUnit == NULL)
		{
		list = pl.ListL(); // Retrieve Contacts databases on all drives.
		}
	else
		{
		list = pl.ListL(aDriveUnit); // Retrieve Contacts databases on named drive.
		}

	// Externalize the CDesCArray.
	CleanupStack::PushL(list);
	TInt count = list->Count();
	bufStream.WriteUint32L(count);
	
	for (TInt i=0; i<count; i++)
		{
		TInt length=(list->MdcaPoint(i)).Length();
		bufStream.WriteUint8L(length);
		bufStream.WriteL(list->MdcaPoint(i),length);
		}
	bufStream.CommitL();
	
	CleanupStack::PopAndDestroy(2, &bufStream); // list
	CleanupStack::Pop(aListBuffer);	
	}
// -----------------------------------------------------------------------------
// CTestSDKLists::TestLBLDMdcaCountL
// -----------------------------------------------------------------------------
//
TInt CTestSDKLists::TestLBLDMdcaCountL( CStifItemParser& /*aItem*/ )
    {
    // Print to UI
    _LIT( KTestModule, "AknListBoxLayoutDecoratorTestModule" );
    _LIT( KTestLBLDMdcaCount, "In TestLBLDMdcaCount" );
    TestModuleIf().Printf( 0, KTestModule, KTestLBLDMdcaCount );
    // Print to log file
    iLog->Log( KTestLBLDMdcaCount );

    CDesCArray* textArray = CCoeEnv::Static()->ReadDesCArrayResourceL( 
            R_TESTLIST_ITEM_ARRAY );
    CleanupStack::PushL( textArray );
    iLBLDecorator->SetArray( textArray );

    TInt expected = textArray->Count();
    TInt count = iLBLDecorator->MdcaCount();
    STIF_ASSERT_EQUALS( expected, count )
    CleanupStack::PopAndDestroy( textArray );

    return KErrNone;
    }
示例#21
0
//Test that the datatype list in the registration file is skipped
void CT_ServicesTestStep::TestCtrlPnlAppL()
	{
	INFO_PRINTF1(_L("TestCtrlPnlAppL about to start..."));
	TUid appUid={0x10207f79};
	TUid serviceUid = {0x10101010};
	CDesCArray* filesArray = new(ELeave) CDesCArraySeg(1);
	CleanupStack::PushL(filesArray);
	TInt ret = iApaLsSession.GetAppOwnedFiles(*filesArray,appUid);
	TEST(ret==KErrNone);
	TInt count(0);
	count = filesArray->Count();
	TEST(count == 1); 
	CApaAppServiceInfoArray* array = iApaLsSession.GetAppServicesLC(appUid);
	TArray<TApaAppServiceInfo> serviceArray(array->Array());
	count = serviceArray.Count();
	TEST(count == 1); 
	TEST(serviceArray[0].Uid()==serviceUid);
	CleanupStack::PopAndDestroy(2);
	filesArray = NULL;
	array = NULL;
	}
// --------------------------------------------------------------------------
// UPnPAppSettingPageHomeIAP::CreateAndExecuteSettingPageL ()
// --------------------------------------------------------------------------
//
void UPnPAppSettingItemHomeIAP::CreateAndExecuteSettingPageL()
    {
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
    // if sharing is on, only information note is displayed
    UPnPAVControllerFactory::TAVControllerServerStatus status;
    UPnPAVControllerFactory::Status( status );
    if ( iSharingState || status == UPnPAVControllerFactory::EStatusActive )
        {
        CAknInformationNote* note = new (ELeave) CAknInformationNote;
        CleanupStack::PushL(note);
        HBufC* noteText = iCoeEnv->AllocReadResourceLC(
            R_QTN_IUPNP_IAP_TURN_SHARING_OFF);
        note->ExecuteLD(*noteText);
        CleanupStack::PopAndDestroy(noteText);
        CleanupStack::Pop(note);
        return;
        }

    // Resets the member array for iap ids.
    // Creates new array for iap names.
    iIAPIdArray.Reset();
    CDesCArray* array = new (ELeave) CDesCArrayFlat(5);
    CleanupStack::PushL(array);

    // adds static setting page items from resource
    // and stores the number of static items.
    AddStaticItemsL(array);
    TInt staticItemCount = array->Count();
    
    // adds wlan access points, array GETS the ownership
    CUPnPSettingsEngine::GetWLANAccessPointsL( array, iIAPIdArray );
    
    MAknQueryValue* qValue = QueryValue();
    User::LeaveIfNull(qValue);
    LoadL();
    StoreL();

    TInt idx = GetIAPIndex( staticItemCount );
    if ( idx >= array->MdcaCount() )
        {
        idx = array->MdcaCount() - 1;
        }
    // setting page is launched
    CAknSettingPage* dlg = new (ELeave) CAknRadioButtonSettingPage(
        SettingPageResourceId(),
        idx,
        array);

    if (dlg->ExecuteLD())
        {
        switch (idx)
            {
            case EUPnPSettingsEngineIAPItemNone:
                {
                DisplayInfoL(R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT,
                             R_IBU_GALLERY_UPDATE_NOTAVAIL_NOTE_TEXT,
                             R_HOMECONNECT_INFO_QUERY);
                qValue->SetCurrentValueIndex(EUPnPSettingsEngineIAPItemNone);
                iIAPId = EUPnPSettingsEngineIAPIdNone;
                iIAPSetting = EUPnPSettingsEngineIAPItemNone;
                break;
                }
            case EUPnPSettingsEngineIAPItemAlwaysAsk:
                {
                qValue->SetCurrentValueIndex(EUPnPSettingsEngineIAPItemAlwaysAsk);
                iIAPId = EUPnPSettingsEngineIAPIdAlwaysAsk;
                iIAPSetting = EUPnPSettingsEngineIAPItemAlwaysAsk;
                DisplayInfoL(R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT,
                             R_IBU_GALLERY_UPDATE_NOTE_TEXT,
                             R_HOMECONNECT_INFO_QUERY);
                break;
                }
            case EUPnPSettingsEngineIAPItemUserDefined: // Create new
                {
                // new iap wlan iap creation is started here
                
                TInt old_iap = iIAPId;
                
                CUPnPSettingsEngine::CreateAccessPointL();
                
                //We have to re-get all the wlan iaps again since
                //user may modify the iap list   
                RArray<TInt64> newArray;
                CleanupClosePushL( newArray );
                
                //We only are interested in the iap ids
                CUPnPSettingsEngine::GetWLANAccessPointsL(
                                                    NULL, 
                                                    newArray );
                
                if( newArray.Count() <= 0 ) //if no iap exisits
                    {
                    //if previous iap is not "None" or "Always ask"
                    if( old_iap > EUPnPSettingsEngineIAPIdAlwaysAsk )
                        {
                        DisplayInfoL(
                            R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT,
                            R_IBU_GALLERY_UPDATE_NOTAVAIL_NOTE_TEXT,
                            R_HOMECONNECT_INFO_QUERY);
                        iIAPId = EUPnPSettingsEngineIAPIdNone;
                        
                        qValue->SetCurrentValueIndex(
                                            EUPnPSettingsEngineIAPItemNone );
                        iIAPSetting = EUPnPSettingsEngineIAPItemNone;
                        }
                    iIAPIdArray.Reset();
                    CleanupStack::PopAndDestroy( &newArray );
                    }
                else
                    {
                    TBool newiap = ETrue;
                    TInt lastItemIndex = newArray.Count() - 1;
                    //if the last item on the new iap list 
                    //is found in the old iap array
                    //then we think no new iap is created
                    for( TInt i = 0; i < iIAPIdArray.Count(); i++ )
                        {                        
                        if( newArray[lastItemIndex] == iIAPIdArray[i] )
                            {
                            newiap = EFalse; 
                            i = iIAPIdArray.Count();
                            }
                        }
                    
                    //get the new iap list
                    iIAPIdArray.Reset();
                    for( TInt i = 0; i < newArray.Count(); i++ )
                        {
                        iIAPIdArray.AppendL( newArray[i] );
                        }                        
                    CleanupStack::PopAndDestroy( &newArray );
                    
                    if( newiap )
                        {
                        iIAPId = iIAPIdArray[lastItemIndex];//get new iap
                        iIAPSetting = 
                                EUPnPSettingsEngineIAPItemUserDefined;
                        // show confirmation note if connection is 
                        // unsecured, the database store the value of
                        // the securitymode,such as EOpen,EWep,E802_1x,
                        // EWpa,if select other securitymode except 
                        // EOpen, the return value of the 
                        // CheckAPSecurityL fuction is not EWLanUnsecured
                        if ( CheckAPSecurityL(iIAPId) == EWLanUnsecured )
                            {
                            CAknQueryDialog* dlg = 
                                                CAknQueryDialog::NewL();
                            if (!(dlg->ExecuteLD(
                            R_UNSECURED_CONNECTIONS_CONFIRMATION_QUERY)))
                                {
                                //user cancels the dialog
                                UsePreviousIapL( old_iap ); 
                                }
                            }
                        else
                            {
                            // show 'Sharing Changed' note ( None -> sharing)
                            if(old_iap == EUPnPSettingsEngineIAPIdNone &&
                               iIAPId != old_iap )
                                {
                                DisplayInfoL(
                                     R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT,
                                     R_IBU_GALLERY_UPDATE_NOTE_TEXT,
                                     R_HOMECONNECT_INFO_QUERY);
                                }  
                            }    
                        }
                    else 
                        {
                        UsePreviousIapL(old_iap);
                        } //if( newiap )
                    } //if( newArray.Count() <= 0 )
                break;
                }
            default: // Predefined iap is selected
                {
                TInt index;
                TInt old_iap = iIAPId;
                TBool iapchange = EFalse;
                // iap id is set
                if ( idx - staticItemCount >= 0 )
                    {
                    index = idx - staticItemCount;
                    if (CheckAPSecurityL(iIAPIdArray[index]) ==
                        EWLanUnsecured)
                        {
                        // show confirmation note if connection is unsecured
                        CAknQueryDialog* dlg = CAknQueryDialog::NewL();
                        if (dlg->ExecuteLD(
                            R_UNSECURED_CONNECTIONS_CONFIRMATION_QUERY))
                            {
                            //if "Continue"
                            iapchange = ETrue;
                            }
                        }
                    else
                        {
                        iapchange = ETrue;
                        }
                   
                    if( iapchange )
                        {
                        iIAPSetting = EUPnPSettingsEngineIAPItemUserDefined;
                        iIAPId = iIAPIdArray[index];
                        qValue->SetCurrentValueIndex(
                            EUPnPSettingsEngineIAPItemUserDefined);

                        // if previous iap was 'None' and current iap
                        // is not 'None'
                        if ( old_iap == EUPnPSettingsEngineIAPIdNone &&
                             iIAPId != old_iap )
                            {
                            DisplayInfoL(
                                R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT,
                                R_IBU_GALLERY_UPDATE_NOTE_TEXT,
                                R_HOMECONNECT_INFO_QUERY);
                            }
                        }
                    }
                break;
                }
            }
        }
    LoadL();
    StoreL();

    CleanupStack::PopAndDestroy(array);
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
    }
// ---------------------------------------------------------
// CBTUiDeviceContainer::RefreshDeviceListL
// This function will refresh only the changed parts of the
// screen, if any.
// ---------------------------------------------------------   
void CBTUiDeviceContainer::RefreshDeviceListL(const RDeviceArray* aDeviceArray,TInt selectedItem)
    {
	TRACE_FUNC_ENTRY
	
    MDesCArray* itemTextArray = iDeviceList->Model()->ItemTextArray();
    CDesCArray* itemArray = (CDesCArray*) itemTextArray;
    TBool removal=EFalse;
    TBool addition=EFalse;
	TInt previouslySelected=CurrentItemIndex();
    TBTDeviceName listItem;
    TInt deviceCount = aDeviceArray->Count();
    TInt i = 0;
    for( ; i < deviceCount; i++)
        {
        TBTDevice device = *(*aDeviceArray)[i];
        CreateListItemL(device, listItem);
        if(itemArray->Count()<=i)
        	{
        	itemArray->AppendL(listItem);
        	addition=ETrue;
        	}
        else
        	if(listItem != (*itemArray)[i] )
				{
				itemArray->Delete(i);
				itemArray->InsertL(i,listItem);
				
				removal=ETrue;
				addition=ETrue;
				}
        
        }
	if(itemArray->Count()-i>=0)
		{
		itemArray->Delete(i,itemArray->Count()-i);        
		removal=ETrue;
		}
		
        
	if(removal)        
		iDeviceList->HandleItemRemovalL();
	if(addition)
    	iDeviceList->HandleItemAdditionL();

	if(deviceCount >0 )
		iDeviceList->SetCurrentItemIndex( Max(selectedItem,0 )) ;
	else
		{
		HBufC* devEmptyText = NULL;
		if(iGroup ==EGroupPaired)
			{
			devEmptyText=iCoeEnv->AllocReadResourceLC( R_BT_NO_PAIRED_DEVICES);
			}    	
		else
			{    
			devEmptyText=iCoeEnv->AllocReadResourceLC( R_BT_NO_BLOCKED_DEVICES);
			}
		iDeviceList->View()->SetListEmptyTextL(*devEmptyText );
		CleanupStack::PopAndDestroy(devEmptyText);
		}
		
	if(addition | removal | previouslySelected!=selectedItem)
    	iDeviceList->DrawDeferred();
	TRACE_FUNC_EXIT
    } 
// -----------------------------------------------------------------------------
// CPosLmMultiDbSearch::SetDatabasesToSearchL
//
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
EXPORT_C void CPosLmMultiDbSearch::SetDatabasesToSearchL(
    const CDesCArray& aDatabaseList)
{
    __ASSERT_ALWAYS(!iMultiSearchOperation, User::Leave(KErrInUse));
    __ASSERT_ALWAYS(aDatabaseList.Count() != 0, User::Leave(KErrArgument));

    CloseDbsNotToSearch(aDatabaseList);

    // Create search items for new uri, re-sort for existing uri
    for (TInt j = 0; j < aDatabaseList.Count(); j++)
    {
        TPtrC dbListUri = aDatabaseList.MdcaPoint(j);

        // Does uri exist in search items?
        TBool foundUri = EFalse;
        TInt i;
        for (i = j; i < iSearchItems.Count() && !foundUri; i++)
        {
            HBufC* searchItemUri = iSearchItems[i]->iDbUriPtr;
            if (dbListUri == *searchItemUri)
            {
                foundUri = ETrue;
                break;
            }
        }

        if (foundUri)
        {
            if (i != j)
            {
                // Re-sort item
                CPosLmMultiDbSearchItem* item = iSearchItems[i];
                iSearchItems.Remove(i);
                CleanupStack::PushL(item);
                iSearchItems.InsertL(item, j);
                CleanupStack::Pop(item);
            }
        }
        else
        {
            HBufC* uriPtr = dbListUri.AllocLC();
            CPosLmMultiDbSearchItem* item =
                new (ELeave) CPosLmMultiDbSearchItem(uriPtr);
            CleanupStack::Pop(uriPtr);
            CleanupStack::PushL(item);

            iSearchItems.InsertL(item, j);
            CleanupStack::Pop(item);
        }
    }

    // Remove any remaining double uri:s
    for (TInt i = aDatabaseList.Count(); i < iSearchItems.Count(); )
    {
        CPosLmMultiDbSearchItem* item = iSearchItems[i];
        iSearchItems.Remove(i);
        delete item;
    }

    // Reset all search errors as their db indexes might be invalid now.
    iSearchErrors.Reset();
    iNoOfSearchErrors = 0;
}
EXPORT_C void CMemSpyEngineCodeSegEntry::OutputDataL( CMemSpyEngineHelperCodeSegment& aHelper ) const
    {
    _LIT(KHexFormat, "0x%08x");

    HBufC* columns = HBufC::NewLC( 4096 );
    TPtr pColumns( columns->Des() );

    // Name
    TParsePtrC parser( *iFileName );
    const TPtrC pFileNameWithoutPath( parser.NameAndExt() );
    pColumns.Append( pFileNameWithoutPath );
    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );

    // Uids
    const TUidType uids( iCreateInfo.iUids );
    for( TInt i=0; i<KMaxCheckedUid; i++ )
        {
        const TUid uidValue( uids[ i ] );
        //
        pColumns.AppendFormat( KHexFormat, uidValue.iUid );
        pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
        }

    // Module version
    if  ( iCreateInfo.iModuleVersion == KModuleVersionWild )
        {
        _LIT( KCaption, "Wild");
        pColumns.Append( KCaption );
        }
    else if ( iCreateInfo.iModuleVersion == KModuleVersionNull )
        {
        _LIT( KCaption, "Null");
        pColumns.Append( KCaption );
        }
    else
        {
        pColumns.AppendFormat( KHexFormat, iCreateInfo.iModuleVersion );
        }
    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );

    // SID
    pColumns.AppendFormat( KHexFormat, iCreateInfo.iS.iSecureId );
    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );

    // VID
    pColumns.AppendFormat( KHexFormat, iCreateInfo.iS.iVendorId );
    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );

    // Code size
    if  ( iCreateInfo.iCodeSize > 0 )
        {
        pColumns.AppendNum( iCreateInfo.iCodeSize, EDecimal );
        }
    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );

    // Text size
    if  ( iCreateInfo.iTextSize > 0 )
        {
        pColumns.AppendNum( iCreateInfo.iTextSize, EDecimal );
        }
    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );

    // Data size
    if  ( iCreateInfo.iDataSize > 0 )
        {
        pColumns.AppendNum( iCreateInfo.iDataSize, EDecimal );
        }
    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );

    // BSS
    if  ( iCreateInfo.iBssSize > 0 )
        {
        pColumns.AppendNum( iCreateInfo.iBssSize, EDecimal );
        }
    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );

    // Total data size
    if  ( iCreateInfo.iTotalDataSize > 0 )
        {
        pColumns.AppendNum( iCreateInfo.iTotalDataSize, EDecimal );
        }
    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );

    // Entrypoint veneer
    pColumns.AppendFormat( KHexFormat, iCreateInfo.iEntryPtVeneer );
    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );

    // File Entrypoint
    pColumns.AppendFormat( KHexFormat, iCreateInfo.iFileEntryPoint );
    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );

    // Dependency Count
    pColumns.AppendNum( iCreateInfo.iDepCount, EDecimal );
    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );

    // ROM Code Load Address
    if  ( iCreateInfo.iCodeLoadAddress != 0 )
        {
        pColumns.AppendFormat( KHexFormat, iCreateInfo.iCodeLoadAddress );
        }
    else
        {
        _LIT(KCaption, "N.A. - RAM Loaded");
        pColumns.Append( KCaption );
        }
    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );

    // Data Load Address
    if  ( iCreateInfo.iDataLoadAddress != 0 )
        {
        pColumns.AppendFormat( KHexFormat, iCreateInfo.iDataLoadAddress );
        }
    pColumns.Append( KMemSpyEngineCodeSegListOutputComma );

    // Capabilities
    CDesCArray* capabilities = CapabilityStringsLC();
    const TInt count = capabilities->Count();
    //
    for( TInt j=0; j<count; j++ )
        {
        const TPtrC capabilityName( (*capabilities)[ j ] );
        //
        pColumns.Append( capabilityName );
        if  ( j < count-1 )
            {
            pColumns.Append( KMemSpyEngineCodeSegListOutputComma );
            }
        }
    //
    CleanupStack::PopAndDestroy( capabilities );

    aHelper.Engine().Sink().OutputLineL( pColumns );

    CleanupStack::PopAndDestroy( columns );
    }
void CBCTestPtiEngine::TestChineseInputL()
    {
    TeardownL();

    if((iEngine = CreateEngineL(ELangPrcChinese, EPtiEngineStroke))!=NULL)
        {
        AssertNotNullL(iEngine, _L("Chinese Pinyin activated"));
        SimuInput(iEngine, _L("wei"));

        int page=0;
        iEngine->SetCandidatePageLength(20);
        AssertTrueL(ETrue, _L("page length set to 20"));
        for(TPtrC str=iEngine->CandidatePage();
                iEngine->MoreCandidatePages();
                iEngine->NextCandidatePage())
            {
            TFileName res;
            res.Format(_L("page[%d]: "), page++);
            for(int j=0; j<str.Length(); ++j)
                {
                res.Append(_L("<"));
                res.AppendNumUC(str[j], EHex);
                res.Append(_L(">"));
                }
            res.ZeroTerminate();
            AssertTrueL(ETrue, res);

            if(page>10)
                {
                break;
                }
            }//end of for

        //predict
        iEngine->PreviousCandidatePage();
        TPtrC aChar=iEngine->CandidatePage();
        iEngine->SetPredictiveChineseChar(aChar);
        AssertTrueL(ETrue, _L("next chinese char predicted"));

        //test next candidate list
        iEngine->CommitCurrentWord();
        CDesCArray* cands = new (ELeave) CDesCArrayFlat(16);
        CleanupStack::PushL(cands);

        TRAPD(err, iEngine->GetNextWordCandidateListL(*cands));
        if(err == KErrNotSupported)
            {
            AssertTrueL(ETrue, _L("predict next candidate not supported"));
            }
        else{
            TFileName msg=_L("candidates: ");
            for (int i = 0; i < cands->Count(); ++i)
            {
                msg.Append(cands->MdcaPoint(i));
                msg.Append(_L(", "));
            }
            msg.ZeroTerminate();
            AssertTrueL(ETrue, msg);
            }
        CleanupStack::PopAndDestroy();  // cands

        //test conversion
        TInt convCap=iEngine->AvailableCharConversions();
        if((convCap & EPtiSimplifiedToComplex)!=0)
            {
            AssertTrueL(ETrue, _L("can convert from simplified chinese to traditional"));
            }
        else
            {
            AssertIntL(0, convCap, _L("conv capability:"));
            }
        char inbuf[]={0x76, 0x84};
        char outbuf[]={0,0};
        iEngine->CharConversion(EPtiSimplifiedToComplex, inbuf, 2, outbuf);
        AssertTrueL(ETrue, _L("tried char conversion"));

        //Chinese Varient
        RArray<TInt> modes;
        iEngine->GetModeNameIndexL(EPtiChineseVariantPrc, modes);
        AssertTrueL(ETrue, _L("Chinese varient index table got"));
        modes.Close();

        //phrase list
        iEngine->ClearCurrentWord();
        SimuInput(iEngine, _L("wei"));
        cands = new (ELeave) CDesCArrayFlat(16);
        CleanupStack::PushL(cands);
        iEngine->GetChinesePhraseCandidatesL(*cands);
        AssertTrueL(ETrue, _L("Chinese phrase candidate list got"));
        CleanupStack::PopAndDestroy();  //cands

        TestSpellL();
        TestDictL();// test Pinyin dict.
        }
    else
        {
        AssertTrueL(ETrue, _L("unable to activate Chinese Pinyin"));
        if ( iEngine == NULL )
            {
            SetupL();
            } 
        iEngine->ActivateLanguageL(ELangEnglish, EPtiEnginePredictive);
        }
    }
示例#27
0
void CImSmtpSession::SendFileL()
	{
	// Start the 'file mailer' object
	__ASSERT_DEBUG(!iSmtpFile,gPanic(EImsmSmtpFileObjectAlreadyExists));
	// log the info of the message to be sent
	if (iLogMessage)
		iLogMessage->Reset();
	//  Update the header info for this message..
	CImHeader* header = CImHeader::NewLC();
	CMsvStore* store = iServerEntry.EditStoreL();
	CleanupStack::PushL(store);
	header->RestoreL(*store);

	TBool isBccRcpt = EFalse;
	CDesCArray* rcptArray = NULL;
	TBool sendBccNow = iToRcptHeaderUpdated;

	if(!iToRcptHeaderUpdated)
		{
		//  Set the new info...
		//set from address
		HBufC* formatedAddress = CreateFormattedAddressLC(iSettings.EmailAddress(), iSettings.EmailAlias());//Format the address fields
		header->SetFromL(*formatedAddress);
		CleanupStack::PopAndDestroy(formatedAddress);
		formatedAddress = NULL;

		// set ReceiptAddress if one exists in the settings
		if( header->ReceiptAddress().Length() == 0 && iSettings.ReceiptAddress().Length() > 0 )
			{
			formatedAddress=CreateFormattedAddressLC(iSettings.ReceiptAddress(),iSettings.EmailAlias());//Format the address fields
			header->SetReceiptAddressL(*formatedAddress);
			CleanupStack::PopAndDestroy(formatedAddress);
			formatedAddress = NULL;
			}

		if(header->ToRecipients().Count()==0 && header->CcRecipients().Count()==0)
			{
			sendBccNow=ETrue;
			}

		// ReplyToAddress
		if ((header->ReplyTo().Length() == 0 || header->ReplyTo() == iSettings.ReplyToAddress()) &&
		    (iSettings.ReplyToAddress().Length() > 0))
			{
			formatedAddress= CreateFormattedAddressLC(iSettings.ReplyToAddress(),iSettings.EmailAlias());//Format the address fields
			header->SetReplyToL(*formatedAddress);
			CleanupStack::PopAndDestroy(formatedAddress);
			formatedAddress = NULL;
			}
		
		//make a copy of 'Bcc' recipients then remove from Msg header
		rcptArray= &(header->BccRecipients());
		if (iSettings.SendCopyToSelf()==ESendCopyAsBccRecipient)
			{
			if ( header->ReceiptAddress().Length() )
				rcptArray->AppendL(header->ReceiptAddress());
			else if ( header->ReplyTo().Length() )
				rcptArray->AppendL(header->ReplyTo());
			}

		if(rcptArray->Count() > 0)
			{
			iBccRcptFound=ETrue; // 'Bcc' recipients exists
			iBccRcptIndex=0;	  //reset the counter
			iFinishedWithBccRcpts=EFalse;

			iSendFiles->ResetBccRcptArrayL();

			TInt numberRcpts = rcptArray->Count();
			if(numberRcpts)
			{
			iSendFiles->BccRcptArray().AppendL((*rcptArray)[0]);
			CDesCArray& tempArr = iSendFiles->BccRcptArray();
			for(TInt counter=1; counter<numberRcpts; counter++)
				{
				TInt aPos = 0;
				tempArr.Find((*rcptArray)[counter],aPos,ECmpFolded16);			
				if(aPos > 0)	
				iSendFiles->BccRcptArray().AppendL((*rcptArray)[counter]);
				}
				}
			rcptArray->Reset();
			}

		iToRcptHeaderUpdated=ETrue;
		isBccRcpt=EFalse;
		}

	// Reset the number of Sent Messages, if all previous messages have been sent
	if (iNumMsgsSent >= iNumMsgsToSend)
		{
		iNumMsgsSent = 0;
		}

	// Calc the num of messages we're sending. If there is a To or CC,
	// recipient then there will be a message sent
	if(header->ToRecipients().Count()>0 || header->CcRecipients().Count()>0)
		iNumMsgsToSend = 1;
	else
		iNumMsgsToSend = 0;

	// If there are BCC recipients, then we will be sending a message to each
	if (iBccRcptFound)
		iNumMsgsToSend += iSendFiles->BccRcptArray().Count();

	// Make sure there are recipients to send to.
	__ASSERT_ALWAYS(iNumMsgsToSend,gPanic(EImsmZeroRecipientsInMessage));

	// sending Msg to 'Bcc' recipients so update header
	if (sendBccNow && iBccRcptFound)
		{
		rcptArray= &(header->BccRecipients());
		rcptArray->Reset();
		header->BccRecipients().AppendL(iSendFiles->BccRcptArray()[iBccRcptIndex]);

		++iBccRcptIndex;//for the next recipient
		if(iBccRcptIndex < iSendFiles->BccRcptArray().Count())
			iFinishedWithBccRcpts=EFalse;
		else
			iFinishedWithBccRcpts=ETrue;

		isBccRcpt=ETrue;
		}

	header->StoreL(*store);
	store->CommitL();
	if (iLogMessage)
		{
		iLogMessage->LogEvent().SetEventType(KLogMailEventTypeUid);
		if ((header->ToRecipients().Count()
 			+ header->CcRecipients().Count()
 			+ header->BccRecipients().Count()) > 1)
 		// If there are multiple recipients then set the recipient to 'multiple'
 			{
 			TBuf<KLogMaxSharedStringLength> multipleRecipientsString;
 			iLogMessage->GetString(multipleRecipientsString, R_LOG_REMOTE_MULTIPLE);
 			iLogMessage->LogEvent().SetRemoteParty(multipleRecipientsString);
 			}
 		else
 		// If there is only one recipient then set the recipient name
 			{
			if (header->ToRecipients().Count())
				iLogMessage->LogEvent().SetRemoteParty(header->ToRecipients()[0]);

			else if (header->CcRecipients().Count())
				iLogMessage->LogEvent().SetRemoteParty(header->CcRecipients()[0]);

			else if (header->BccRecipients().Count())
				iLogMessage->LogEvent().SetRemoteParty(header->BccRecipients()[0]);
			}

		iLogMessage->LogEvent().SetSubject(header->Subject());

		TBuf<KLogMaxSharedStringLength> outString;
		iLogMessage->GetString(outString, R_LOG_DIR_OUT);
		iLogMessage->LogEvent().SetDirection(outString);

		iLogMessage->LogEvent().SetLink(iServerEntry.Entry().Id());
		}

	CleanupStack::PopAndDestroy(2, header);

	iTimeNow.UniversalTime();	// Set time/date of sending this message file
	if (iLogMessage)
		iLogMessage->LogEvent().SetTime(iTimeNow);
	TRAPD(error,iSmtpFile = CImSmtpFile::NewL(	*iSocket,
                                                iServerEntry,
												iTimeNow,
												iSmtpBuffer,
												iSettings,
												isBccRcpt)); // Create the file mailing object

	if(error == KErrNone)
		{
		// If this is the first message to send, then calc the total bytes to send
		if (iNumMsgsSent == 0)
			{
			iTotalBytesToSend =  iSmtpFile->TotalMsgSizeL() * iNumMsgsToSend;
			}

		// Tell the file how many bytes it will be sending.  This is just a
		// rough estimate for progress
		iSmtpFile->SetBytesToSend(iTotalBytesToSend/iNumMsgsToSend);

		// Increment the number of messages sent
		++iNumMsgsSent;

		iSmtpFile->StartL(iStatus);		// start sending the message
		MOBILITY_TEST_MTM_STATE(iServiceId, KMobilityTestMtmStateSmtpSendFile);
		}
	else
		{
		iCompleted=error;
		RequestComplete(iStatus,0-error);	// Failed to create File object, but don't want to stop session prematurely, so negate error code
		}
	}
示例#28
0
void CFriendLink::ReadXML()
{
	TiXmlDocument doc("c:\\insearch.xml");
	if(!doc.LoadFile())
	{
		TInt t = 0;
		return;
	}
	TiXmlElement *RootElement=doc.FirstChildElement();//根
	if (!RootElement)
	{
		return;
	}
	TiXmlElement* cpnext = RootElement->FirstChildElement("cp");//值.
	if (!cpnext)
	{
		return;
	}
	
//	const char *elementtxt = next->Value();
	TInt Currentcp = atoi( cpnext->FirstChild()->Value() );
	
	TiXmlElement* apnext = RootElement->FirstChildElement("ap");
	if(!apnext)
	{
		return;
	}
	TInt allap = atoi(apnext->FirstChild()->Value());
	
	TiXmlElement* Lnext = RootElement->FirstChildElement("l");

	CDesCArray* iDesArray = NULL;//用于存放所有的值.
	
	iDesArray = new (ELeave) CDesCArrayFlat(10);
	
	while (Lnext)
	{
		//循环读L里的数据。
		
		iDesArray->AppendL(* CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((const TUint8*)Lnext->FirstChild()->Value())));
		Lnext=Lnext->NextSiblingElement();
	//	ilistbox->AppendL(* CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((const TUint8*)Lnext->FirstChild()->Value())));
		
	}

	//把底下的代码放到一个函数里,就可以了。下面是用来读取到列表的,上面是用来存放数据的。

	TInt allcount = iDesArray->Count();
	if (this->ilistbox)
	{
		this->ilistbox->Reset();
		for(int i=0;i<allcount;i++)
		{
			HBufC* iBuf = NULL;
			
			const TPtrC& ptr = (*iDesArray)[i];//原来他是返回一个TPtrC的值。

			iBuf=HBufC::NewL(ptr.Length());
		
			iBuf->Des().Append(ptr);
			this->ilistbox->AppendL(CNormalListBoxItem::NewL(*iBuf));
			delete iBuf;
			iBuf = NULL;
		}
	}
	TInt itemp = 0;
	delete iDesArray;
	iDesArray = NULL;

}
void CContactsSubScreenView::ConstructL(CCoeControl* aWindowOwningContainer)
{
    // Application title
    iAppTitle = CCknAppTitle::NewL(CCknAppTitle::EWindow);
    iAppTitle->SetContainerWindowL(*this);

	TBuf<50> titlename;
	TBuf<50> formatBuf;

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

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

    // Search results listbox
    iListbox = new(ELeave)CEikColumnListBox; // Column listbox with one column
    iListbox->ConstructL(aWindowOwningContainer,
        CEikListBox::ENoExtendedSelection);
    iListbox->CreateScrollBarFrameL(ETrue);
    iListbox->ScrollBarFrame()->SetScrollBarVisibilityL(
        CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
    iListbox->SetObserver(this); // See HandleControlEventL
    iListbox->SetContainerWindowL(*aWindowOwningContainer);

    SetContainerWindowL(*aWindowOwningContainer);

	// Set the listbox's first column to fill the listbox's whole width
    CColumnListBoxData* colData = iListbox->ItemDrawer()->ColumnData();
    if(colData)
    {
		colData->SetColumnWidthPixelL(0, 200);       
    }

	iListbox->SetItemHeightL(30);

	if(iAppUi.iStoragePath == 1)
	{
	  CDesCArray* smsnames = iAppUi.GetSmsNameList();	

	  CDesCArray* smsmobiles = iAppUi.GetSmsMobileList();

	  if(smsnames->Count() == 0)
	  {
		iContactsArray = new (ELeave) CDesCArrayFlat(1);
		iMobileArray   = new (ELeave) CDesCArrayFlat(1);
	  }
	  else
	  {
		iContactsArray = new (ELeave) CDesCArrayFlat(smsnames->Count());
		iMobileArray   = new (ELeave) CDesCArrayFlat(smsnames->Count());
	  }

	  for(int i = 0 ; i < smsnames->Count() ; i++)
	  {
		 iContactsArray->AppendL(smsnames->MdcaPoint(i)); 
		 iMobileArray->AppendL(smsmobiles->MdcaPoint(i)); 
	  }	

	  SetData();
	}
	else
	{
		iContactsArray = new (ELeave) CDesCArrayFlat(12);
		iMobileArray   = new (ELeave) CDesCArrayFlat(12);
	}
}