Exemplo n.º 1
0
// ---------------------------------------------------------------------------
// From MsearchInfo class.
// CSearchInfoImp::SetFieldInfoL()
// ---------------------------------------------------------------------------
//
void CSearchInfoImp::SetFieldInfoL(const TDesC16& aFieldInfo ,TInfoType aType) 
    
    {
    switch(aType)
	     {
	   	 case EFirstName:
		   	 {
		   	 HBufC16* buf = aFieldInfo.AllocL();
    		 iFirstname.Close();
    		 iFirstname.Assign( buf );
		   	 break;
		   	 }
	   	 case ELastName:
		   	 {
		   	 HBufC16* buf= aFieldInfo.AllocL();
    		 iLastname.Close();
             iLastname.Assign( buf );
		   	 break;	
		   	 }
	   	 case EEmailAddress:
		   	 {
		   	 HBufC16* buf = aFieldInfo.AllocL();
    		 iEmailId.Close();
    		 iEmailId.Assign( buf );
		   	 break;	
		   	 }
	   
	     }
   
    }
// ---------------------------------------------------------------------------
// From MPresentityGroupInfo class.
// CPresentityGroupInfoImp::SetGroupDisplayNameL()
// ---------------------------------------------------------------------------
//
void CPresentityGroupInfoImp::SetGroupDisplayNameL( 
    const TDesC16& aDisplayName )
    {
    HBufC16* displayNameBuf = aDisplayName.AllocL();
    iDisplayName.Close();
    iDisplayName.Assign( displayNameBuf );
    }
void CUpnpHttpFileAccess::ConstructL( CUpnpHttpSession* aSession,
                                      const TDesC16& aFilename )
{
    LOGS1(
        "%i, CUpnpHttpFileAccess::ConstructL(CUpnpHttpSession*, TDesC16&)",
        this );

    User::LeaveIfError(iFsSession.Connect());
    iFileToServe = aFilename.AllocL();

    TInt error =  0;
    iPosInFile = 0;
    iHeaderLength = 0;
    iSession = aSession;
    if (iSession->OverwriteExisting() && !iSession->SaveAtOffset())
    {
        error = iFile.Replace(iFsSession, *iFileToServe, EFileWrite
                              | EFileShareAny);
        User::LeaveIfError(error);
    }
    else if (iSession->OverwriteExisting() && iSession->SaveAtOffset())
    {
        error = iFile.Open(iFsSession, *iFileToServe, EFileWrite
                           | EFileShareAny);
        if (error != KErrNotFound)
        {
            TInt size = 0;
            error = iFile.Size(size);
            if (size >= (iSession->Offset()))
            {
                iPosInFile = iSession->Offset();
            }
            else
            {
                iFile.Close();
                error = iFile.Replace(iFsSession, *iFileToServe, EFileWrite
                                      | EFileShareAny);
                User::LeaveIfError(error);
            }
        }
        else
        {
            error = iFile.Create(iFsSession, *iFileToServe, EFileWrite
                                 | EFileShareAny);
            User::LeaveIfError(error);
        }
    }
    else
    {
        error = iFile.Open(iFsSession, *iFileToServe, EFileWrite
                           | EFileShareAny);
        if (error == KErrNotFound)
        {
            error = iFile.Create(iFsSession, *iFileToServe, EFileWrite
                                 | EFileShareAny);
            User::LeaveIfError(error);
        }
    }
}
Exemplo n.º 4
0
void TEnvVar::ConstructL(const TDesC16& aName, const wchar_t* aValue)
	{
	TPtrC16 valueZ = ValuePtr(aValue);
	HBufC16* valueCopy = valueZ.AllocLC();
	iName = aName.AllocL();
	iValue = valueCopy;
	CleanupStack::Pop();
	}
void CCatalogsIncompleteMessage::SetMessageL( const TDesC16& aMessage, 
                                              TInt aReturnValue )
    {
    // Only one message can be stored at any one moment
    if ( iMessageType != -1 )
        {
        User::Leave( KErrGeneral );
        }
    iMessageWide = aMessage.AllocL();
    iReturnValue = aReturnValue;
    iMessageType = 16;
    }
// -----------------------------------------------------------------------------
// CSyncMLFilterProperty::SetQueryValueText16L
// Sets query value for text16 property.
// This is useful only if data type is text16 and if query value can be used.
// This method also selects query value.
// -----------------------------------------------------------------------------
EXPORT_C void
            CSyncMLFilterProperty::SetQueryValueText16L( const TDesC16& aValue )
	{
	if ( iDataTypeForQueryValue != ESyncMLDataTypeText16 || !iCanUseQueryValue )
		{
		User::Leave( KErrNotSupported );
		}
	if ( aValue.Length() > iMaxTextLength )
		{
		User::Leave( KErrArgument );
		}

	delete iQueryValueText16;
	iQueryValueText16 = NULL;
	iQueryValueText16 = aValue.AllocL();
	iQueryValueSelected = ETrue;
	}
Exemplo n.º 7
0
void CPKCS12Handler::ExtractSecurityObjectsL(const TDesC8& aData, 
                                             const TDesC16& aPwd) 
    {
    LOG_("-> CPKCS12Handler::ExtractSecurityObjectsL()");
    if (iPassword) 
        {
        delete iPassword;
        iPassword = NULL;
        }

    // Make sure the data is in PKCS#12 format
    if (!VerifyType(aData)) 
        {
        LOG_("<- CPKCS12Handler::ExtractSecurityObjectsL() LEAVE (KErrNotSupported)");
        User::Leave(KErrArgument);
        }
        
    // If we have been provided with a valid password, then proceed
    // to decrypt / parse; otherwise, prompt for pwd.
    if (aPwd.Length() > 0)
        {
        iPassword = aPwd.AllocL();
        LOG_(" Password provided by OMADM...");
        }
    else 
        {
        LOG_(" No password provided, prompting the user for one");

        iPassword = QueryPasswordL();
        }

    // Keep asking for the password until user cancels or inputs the
    // correct password
    while (ETrue) 
        {
        if (iPassword)
            {
            LOG_1(" Non-NULL password '%S' in use, decrypting", iPassword);
            TRAPD(err, iPkcsHandler->ParseL(aData, *iPassword));
            if (err != KErrNone) 
                {
                LOG_(" Breaking news: Password proved a miserable failure! Program terminated abruptly!");
                DisplayWrongPasswordNote();
                delete iPassword;
                iPassword = NULL;
                iPassword = QueryPasswordL();
                }
            else 
                {
                // Correct password provided by the user, 
                // break free from the vicious cycle.
                delete iPassword;
                iPassword = NULL;
                break;
                }
            }
        else
            {
            // User got tired of guessing and resorted to cancel
            LOG_("<- CPKCS12Handler::ExtractSecurityObjectsL() LEAVE (KErrCancel)");
            User::Leave(KErrBadPassphrase);
            }
        }

    // Fetch references to keys and certs
    ExtractKeysAndCerts();

    LOG_("<- CPKCS12Handler::ExtractSecurityObjectsL()");
    }
Exemplo n.º 8
0
// ---------------------------------------------------------------------------
// ?description_if_needed
// ---------------------------------------------------------------------------
//
void CXIMPTestFileTool::ConstructL( const TDesC16& aInstanceId )
    {
    iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
    iInstance = aInstanceId.AllocL();
    }