コード例 #1
0
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
void CMailBoxContainer::GetFoldersL(void)
{
	iFolderArray.ResetAndDestroy();
	
	if(iSession)
	{	
		
		CMsvEntry *localServiceEntry = iSession->GetEntryL(KMsvLocalServiceIndexEntryId);
		CleanupStack::PushL(localServiceEntry);
		CMsvEntrySelection *folders = localServiceEntry->ChildrenWithTypeL(KUidMsvFolderEntry);
		CleanupStack::PushL(folders);

		for (TInt i = 0;i <  folders->Count();i++)
		{
			TMsvEntry ExtraFolder = localServiceEntry->ChildDataL((*folders)[i]);
			
			CMailFldItem* NewIttem = new(ELeave)CMailFldItem();
			CleanupStack::PushL(NewIttem);
			
			NewIttem->iTitle = ExtraFolder.iDetails.AllocL();
			NewIttem->iMscId = 	ExtraFolder.Id();

			CleanupStack::Pop();//NewIttem
			iFolderArray.Append(NewIttem);
		}
		
		CleanupStack::PopAndDestroy(2); // localServiceEntry, folders
	
	
		AddEmailFoldersL(iSession);
	}
}
コード例 #2
0
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
void CIpsPlgImap4ConnectOp::CreateInboxMessagesSelectionL()
    {
    FUNC_LOG;
    // get children of service entry 
    CMsvEntry* cEntry = iMsvSession.GetEntryL( iService );
    CleanupStack::PushL( cEntry );
    CMsvEntrySelection* childrenSelection = cEntry->ChildrenL();
    CleanupStack::PopAndDestroy( cEntry );
    cEntry = NULL;
    CleanupStack::PushL( childrenSelection );

    if ( childrenSelection->Count() )
        {
        TMsvId id = (*childrenSelection)[0]; // index 0 == inbox
        cEntry = iMsvSession.GetEntryL( id ); // reusing cEntry pointer for Inbox entry
        CleanupStack::PushL( cEntry );
        delete iSelection;
        iSelection = NULL;
        // get message-type children of inbox
        iSelection = cEntry->ChildrenWithTypeL( KUidMsvMessageEntry );
        CleanupStack::PopAndDestroy( cEntry );
        }
    CleanupStack::PopAndDestroy( childrenSelection );
    }
コード例 #3
0
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
void CIpsSosAOImapAgent::PopulateAllL()
    {
    FUNC_LOG;
    TImImap4GetPartialMailInfo info;
    //<QMail>
    CIpsSosAOSettingsHandler* settings = 
             CIpsSosAOSettingsHandler::NewL(iSession, iServiceId);
     CleanupStack::PushL(settings);
     settings->ConstructImapPartialFetchInfo( info, *iImapSettings );
     CleanupStack::PopAndDestroy(settings);	
	//</QMail>
    
    if ( !IsConnected() )
        {
        SignalSyncCompleted( iServiceId, iError );
        CancelAllAndDisconnectL();
        }
	//<QMail>
    else if ( iFoldersArray.Count() > 0 && info.iTotalSizeLimit 
            != KIpsSetDataHeadersOnly )
	//</QMail>
         {

         // only inbox is set, do we have to populate other folders also
         TMsvId id = iFoldersArray[0];
         CMsvEntry* cEntry = iSession.GetEntryL( id );
         CleanupStack::PushL( cEntry );
         CMsvEntrySelection* sel = cEntry->ChildrenWithTypeL( 
                 KUidMsvMessageEntry ); 
         CleanupStack::PushL( sel );
         
         info.iDestinationFolder = iFoldersArray[0];
         
         CIpsPlgTimerOperation* dummy = NULL;
         iImapClientMtm->SwitchCurrentEntryL( iServiceId );
         TFSMailMsgId mbox( KIpsPlgImap4PluginUidValue, iServiceId );
         iStatus = KRequestPending;
		 //<Qmail>
         iOngoingOp = CIpsPlgImap4PopulateOp::NewL(
                 iSession,
                 this->iStatus,
                 iServiceId,
                 *dummy,
                 info,
                 *sel,
                 mbox,
                 this,
                 0,
                 NULL );
         //</Qmail>
         iFoldersArray.Remove( 0 );
         SetActive();
         iState = EStatePopulateAll;
         CleanupStack::PopAndDestroy( 2, cEntry );
         
         }
     else
         {
         iState = EStateDisconnect;
         SignalSyncStarted( iServiceId );
         SetActiveAndCompleteThis();
         }
    }
コード例 #4
0
ファイル: saex.cpp プロジェクト: Bathla/SMS_Encryptor
void CSAEXAppUi::CreateNewSMSMessageL()
    {
    
   	TMsvSelectionOrdering order( KMsvNoGrouping, EMsvSortByDate, ETrue );
    CMsvEntry* folderEntry = CMsvEntry::NewL( *iSession,KMsvDraftEntryId, order );
    CleanupStack::PushL( folderEntry );    
    CMsvEntrySelection* folderSelection = folderEntry->ChildrenWithTypeL(
        KUidMsvMessageEntry );
    CleanupStack::PushL( folderSelection );

	const TInt count( folderSelection->Count() );
	 for ( TInt i( 0 ); i < count; i++ )
	 {
		CMsvEntry *msgEntry; 		
       TMsvId msgEntryId = ( *folderSelection )[ i ];	  
		msgEntry=iSession->GetEntryL( msgEntryId);
		CleanupStack::PushL(msgEntry);

		if( msgEntry!= KErrNone )
		{

				if(true)//msgEntry->Entry().iType)//KUidMsvMessageEntry)
				{				
					CParaFormatLayer* paraLayer = CParaFormatLayer::NewL();
					CleanupStack::PushL(paraLayer); 
					CCharFormatLayer* charLayer = CCharFormatLayer::NewL(); 
					CleanupStack::PushL(charLayer); 
					CRichText* cipherBody = CRichText::NewL(paraLayer, charLayer); 
					CRichText * plainBody=CRichText::NewL(paraLayer, charLayer); 

					CleanupStack::PushL(cipherBody); 
					CleanupStack::PushL(plainBody); 

					CMsvStore* store= msgEntry->ReadStoreL();
					CleanupStack::PushL(store);

					store->RestoreBodyTextL(*cipherBody);

					CSendAs* iSendAs=NULL;   
					iSendAs = CSendAs::NewL(*this);				

					if(iSendAs)
						{
								CleanupStack::PushL(iSendAs);        
								iSendAs->SetMtmL(KUidMsgTypeSMS);        

								if(iSendAs->AvailableServices().Count()<1)
									{
										CEikonEnv::Static()->InfoMsg(_L("No SMS services available."));
										User::Leave(KErrNotFound);
									}
        
								iSendAs->SetService(0); 
        
								User::LeaveIfError(iSendAs->QueryMessageCapability(KUidMtmQueryCanSendMsg, EFalse));
								User::LeaveIfError(iSendAs->QueryMessageCapability(KUidMtmQueryMaxBodySize, ETrue));

        
								iSendAs->CreateMessageL();

								iSendAs->AddRecipientL( iRecipient->Des() );
								//iSendAs->SetSubjectL( KIGainTag ); 
								
								decryptBody(cipherBody,plainBody);								
								iSendAs->SetBodyL(*plainBody);									
								

								User::LeaveIfError(iSendAs->ValidateMessage());
								iSendAs->SaveMessageL(ETrue); // message is saved into Outbox(drafts)

								CleanupStack::PopAndDestroy(1,iSendAs);//plainBody and iSendAs

								
						}		

							CleanupStack::PopAndDestroy(5, paraLayer);	

					}
					else
					{
								CEikonEnv::Static()->AlertWin(_L("No SMS found."));
								User::Leave(KErrNotFound);
					
					}
						CleanupStack::PopAndDestroy(1, msgEntry);	
		}


	 }	 
	 	CleanupStack::PopAndDestroy( 2 ); 	

    }