void CEditorAppView::SaveTask()
	{
	CMsgRecipientArray* numbers = iContainer->GetNumbers();
	TTime time = iContainer->GetDateTime();
	TPtrC content = iContainer->GetContent();
	
	TInt count = numbers->Count();

	if (count <= 0)
		{
		ShowInfomationDlgL(R_NOTE_RECIPIENT_NULL);
		return;
		}
	
	for (TInt i = 0; i < count; i++)
		{
		CMsgRecipientItem* item = (*numbers)[i];
		HBufC* address = item->Address();
		HBufC* name = item->Name();

		SimMsgData* task = new (ELeave) SimMsgData;
		task->iNumber = address->AllocL();
		task->iName = name->AllocL();
		task->iTime = time;
		task->iContent = content.AllocL();

		SHSession().AddTask(*task);

		delete task;
		}
	
	SHChangeViewParam(ESimulateMessageMainScreenViewId,KViewChangeParamReboot);
	}
// ---------------------------------------------------------------------------
// CServerAuthFailOperation::SaveServerCertToTrustedSiteCertStoreL()
// ---------------------------------------------------------------------------
//
void CServerAuthFailOperation::SaveServerCertToTrustedSiteCertStoreL()
    {
    TRACE( "CServerAuthFailOperation::SaveServerCertToTrustedSiteCertStoreL" );

    ASSERT( iCertLabel == NULL );
    CX509Certificate* serverCert = CX509Certificate::NewLC( iEncodedServerCert );
    const CX500DistinguishedName& dName = serverCert->SubjectName();
    HBufC* commonName = dName.ExtractFieldL( KX520CommonName );
    if( commonName )
        {
        CleanupStack::PushL( commonName );
        TInt commonNameLen = commonName->Length();
        if( commonNameLen > 0 && commonNameLen <= KMaxCommonNameLength )
            {
            iCertLabel = commonName->AllocL();
            }
        CleanupStack::PopAndDestroy( commonName );
        }
    CleanupStack::PopAndDestroy( serverCert );

    if( !iCertLabel )
        {
        iCertLabel = iServerName->AllocL();
        }

    iTrustedSiteCertStore->Add( *iCertLabel, EX509Certificate, EPeerCertificate,
            NULL, NULL, iEncodedServerCert, iStatus );
    iMode = ESavingServerCert;
    SetActive();
    }
示例#3
0
// ---------------------------------------------------------
// CNSmlCmdsBase::ConstructL
// 
// ---------------------------------------------------------
EXPORT_C void CNSmlCmdsBase::ConstructL( CNSmlAgentBase* aAgentBase, const TDesC8& aSessionID, const TDesC8& aVerProto, const TInt aPublicId, const HBufC& aSyncMLUserName, CNSmlURI* aSyncServer, TBool aVersionCheck )
	{
	iMaxWorkspaceSize = KNSmlDefaultWorkspaceSize;
	iAgent = aAgentBase;
	iSessionID = aSessionID.AllocL();
	iWorkspaceSize = iMaxWorkspaceSize;
	iVerProto = aVerProto.AllocL();
	iVersionPublicId = aPublicId;

//1.2 CHANGES: 1.1 and 1.2 version support
	if ( aPublicId == KNSmlSyncMLPublicId )
		{
		iVerDTD = KNSmlAgentVerDTD11().AllocL();
		}
	else
		{
		iVerDTD = KNSmlAgentVerDTD12().AllocL();
		}
//end changes
	
	iVersionCheck = aVersionCheck;
	iSyncMLUserName = aSyncMLUserName.AllocL();
	iSyncServer = CNSmlURI::NewL( aSyncServer->HostNameWithPortL() );
	iPhoneInfo = CNSmlPhoneInfo::NewL();
	iStatusToServer = CNSmlStatusContainer::NewL();
	iResponseController = CNSmlResponseController::NewL();
	iResultsToServer = CNSmlResultsContainer::NewL();
	iServerAuth = CNSmlAuth::NewL();
	}
void CPodcastModel::GetProxyInformationForConnectionL(TBool& aIsUsed, HBufC*& aProxyServerName, TUint32& aPort)
	{
	TInt iapId = GetIapId();
	CCommsDbTableView* table = iCommDB->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC(COMMDB_ID), iapId);
	
	TUint32 iapService;
	HBufC* iapServiceType;
	table->ReadUintL(TPtrC(IAP_SERVICE), iapService);
	iapServiceType = table->ReadLongTextLC(TPtrC(IAP_SERVICE_TYPE));
	
	CCommsDbTableView* proxyTableView = iCommDB->OpenViewOnProxyRecordLC(iapService, *iapServiceType);
	TInt err = proxyTableView->GotoFirstRecord();
	if( err != KErrNone)
		{
		User::Leave(KErrNotFound);	
		}

	proxyTableView->ReadBoolL(TPtrC(PROXY_USE_PROXY_SERVER), aIsUsed);
	if(aIsUsed)
		{
		HBufC* serverName = proxyTableView->ReadLongTextLC(TPtrC(PROXY_SERVER_NAME));
		proxyTableView->ReadUintL(TPtrC(PROXY_PORT_NUMBER), aPort);
		aProxyServerName = serverName->AllocL();
		CleanupStack::PopAndDestroy(serverName);
		}
		
	CleanupStack::PopAndDestroy(proxyTableView);
	CleanupStack::PopAndDestroy(iapServiceType);
	CleanupStack::PopAndDestroy(table);
	}
void CEmTubeSearchView::DoDeactivate()
	{
	HBufC* t = iContainer->FindBoxText();
	if( t )
		{
		delete iFindBoxText;
		iFindBoxText = t->AllocL();
		}
	
	iAppUi->RemoveFromStack(iContainer);
	delete iContainer;
	iContainer = NULL;
	}
/**
Resolves sub string and directionality of the sub string.
Adds no dir marker if directionality of the string not found.
*/
HBufC* CResourceLoader::ResolveSubStringL(TDes& aText, TBool* aMarker)
    {
    // Allocating heap buffer for return string.
    TInt destlength(aText.Length());
    HBufC* retbuf = HBufC::NewLC(destlength + 1); // no dir marker
    TPtr retptr(retbuf->Des());
    
    TBuf<1> marker;
    marker.Append(KDirNotFound);
        
    TPtrC remainder = aText.Right(aText.Length());
    TInt nextKey = remainder.Locate(KSubStringSeparator);
    
    if (nextKey == 0)
        {
        remainder.Set(remainder.Mid(1));
        nextKey = remainder.Locate(KSubStringSeparator);
        if (nextKey != KErrNotFound)
            {
            retptr.Insert(0, aText.Mid(1, nextKey));           
            // Remove string from aText
            aText.Delete(0, nextKey + 1);
            }
        else
            {
            TInt length = aText.Length();
            retptr.Insert(0, aText.Mid(1, length - 1));
            // Remove string from aText
            aText.Delete(0, length);
            }
        }
    else if (nextKey == KErrNotFound)
        {
        retptr.Insert(0, aText); 
        // Remove string from aText
        aText.Delete(0, aText.Length());
        }
    else
        {
        retptr.Insert(0, aText.Mid(0, nextKey));
        // Remove string from aText
        aText.Delete(0, nextKey);
        }
     
    // Resolve directionality of sub string
    HBufC* dirbuf = retbuf->AllocL();
    TPtr dirptr = dirbuf->Des();
    TBool found(EFalse);
    TBidiText::TDirectionality mainDir = ResolveDirectionality(dirptr, &found);
    delete dirbuf;
    
    if (!found)
        {
        retptr.Insert(0, marker);
        *aMarker = ETrue;
        }
    else
        {
        *aMarker = EFalse;
        }
        
    retbuf = retbuf->ReAllocL(retptr.Length());
    CleanupStack::Pop(); //retbuf
    // If the key string wasn't found, retbuf is empty.
    return retbuf;     
    }