ipsservices/ipssossettings/src/ipssetdata.cpp
branchRCL_3
changeset 80 726fba06891a
parent 73 c8382f7b54ef
equal deleted inserted replaced
73:c8382f7b54ef 80:726fba06891a
   177     CIpsSetDataManager* manager = CIpsSetDataManager::NewLC( aSession );
   177     CIpsSetDataManager* manager = CIpsSetDataManager::NewLC( aSession );
   178 
   178 
   179     TMsvEntry mbox = IpsSetUtils::GetMailboxEntryL( aSession, aMailboxId );
   179     TMsvEntry mbox = IpsSetUtils::GetMailboxEntryL( aSession, aMailboxId );
   180     manager->LoadEmailSettingsL( mbox, *this );
   180     manager->LoadEmailSettingsL( mbox, *this );
   181     
   181     
   182     // Update signature if needed
       
   183     HBufC* body = NULL;
       
   184     body = HBufC::NewL( iSignature->iRichText->DocumentLength() );
       
   185     CleanupStack::PushL( body );
       
   186     TPtr ptr = body->Des();
       
   187     iSignature->iRichText->Extract( ptr );
       
   188     TInt len = ptr.Length();
       
   189     ptr.TrimLeft();
       
   190     len-= ptr.Length();
       
   191     if( len )
       
   192         {
       
   193         // Remove leading empty line from signature
       
   194         iSignature->iRichText->DeleteL( 0, len );
       
   195         }
       
   196     CleanupStack::PopAndDestroy( body );
       
   197     
       
   198     CleanupStack::PopAndDestroy( manager );
   182     CleanupStack::PopAndDestroy( manager );
   199     manager = NULL;
   183     manager = NULL;
   200     }
   184     }
   201 
   185 
   202 // ---------------------------------------------------------------------------
   186 // ---------------------------------------------------------------------------
   537     TImIAPChoice ret;
   521     TImIAPChoice ret;
   538     ret.iDialogPref = ECommDbDialogPrefPrompt;
   522     ret.iDialogPref = ECommDbDialogPrefPrompt;
   539     ret.iIAP = 0;
   523     ret.iIAP = 0;
   540     if ( aIncoming )
   524     if ( aIncoming )
   541         {
   525         {
   542         if (iIncomingIapPref->SNAPDefined())
   526 		if (iIncomingIapPref->SNAPDefined())
   543             {
   527 			{
   544             ret.iIAP = iIncomingIapPref->SNAPPreference();
   528 			ret.iIAP = iIncomingIapPref->SNAPPreference();
   545             }
   529 			}
   546             
   530 			
   547         if ( iIncomingIapPref->NumberOfIAPs() > 0 )
   531         if ( iIncomingIapPref->NumberOfIAPs() > 0 )
   548             {
   532             {
   549             ret = iIncomingIapPref->IAPPreference(0);
   533             ret = iIncomingIapPref->IAPPreference(0);
   550             }
   534             }
   551         }
   535         }
   840 //
   824 //
   841 void CIpsSetData::SetSignatureL( const TDesC& aSignature )
   825 void CIpsSetData::SetSignatureL( const TDesC& aSignature )
   842     {
   826     {
   843     FUNC_LOG;
   827     FUNC_LOG;
   844     iSignature->iRichText->Reset();
   828     iSignature->iRichText->Reset();
   845     
   829     iSignature->iRichText->InsertL( 0, aSignature );
   846     if ( aSignature.Length() )
       
   847         {
       
   848         TChar firstChar = aSignature[0];
       
   849         _LIT( KNewLines, "\r\n\x2028\x2029" );
       
   850         _LIT( KIMSLineFeed, "\r\n");
       
   851         if ( KNewLines().Locate( firstChar ) == KErrNotFound )
       
   852             {
       
   853             // First character is not a new line character. Insert one.
       
   854             HBufC* body = NULL;
       
   855             body = HBufC::NewL( aSignature.Length() + KIMSLineFeed().Length() );
       
   856             CleanupStack::PushL( body );
       
   857             TPtr ptr = body->Des();
       
   858             ptr.Append( KIMSLineFeed );
       
   859             ptr.Append( aSignature );
       
   860             iSignature->iRichText->InsertL( 0, ptr );
       
   861             CleanupStack::PopAndDestroy( body );
       
   862             }
       
   863         else
       
   864             {
       
   865             iSignature->iRichText->InsertL( 0, aSignature );
       
   866             }
       
   867         }
       
   868     }
   830     }
   869 
   831 
   870 // ---------------------------------------------------------------------------
   832 // ---------------------------------------------------------------------------
   871 // CIpsSetData::SetUserNameL()
   833 // CIpsSetData::SetUserNameL()
   872 // ---------------------------------------------------------------------------
   834 // ---------------------------------------------------------------------------
   981     CleanupStack::Pop( iIncomingIapPref );
   943     CleanupStack::Pop( iIncomingIapPref );
   982     iOutgoingIapPref = CImIAPPreferences::NewLC();
   944     iOutgoingIapPref = CImIAPPreferences::NewLC();
   983     CleanupStack::Pop( iOutgoingIapPref );
   945     CleanupStack::Pop( iOutgoingIapPref );
   984         
   946         
   985     if (aIncomingIap.SNAPDefined())
   947     if (aIncomingIap.SNAPDefined())
   986         {
   948     	{
   987         iIncomingIapPref->SetSNAPL(aIncomingIap.SNAPPreference());
   949 		iIncomingIapPref->SetSNAPL(aIncomingIap.SNAPPreference());
   988         }
   950     	}
   989     else
   951     else
   990         {
   952     	{
   991         iIncomingIapPref->AddIAPL( aIncomingIap.IAPPreference(0) );
   953     	iIncomingIapPref->AddIAPL( aIncomingIap.IAPPreference(0) );
   992         }
   954     	}
   993         
   955         
   994     if (aOutgoingIap.SNAPDefined())
   956     if (aOutgoingIap.SNAPDefined())
   995         {
   957       	{
   996         iOutgoingIapPref->SetSNAPL(aOutgoingIap.SNAPPreference());
   958     	iOutgoingIapPref->SetSNAPL(aOutgoingIap.SNAPPreference());
   997         }
   959        	}
   998     else
   960     else
   999     	{
   961     	{
  1000     	iOutgoingIapPref->AddIAPL( aOutgoingIap.IAPPreference(0) );
   962     	iOutgoingIapPref->AddIAPL( aOutgoingIap.IAPPreference(0) );
  1001     	}
   963     	}
  1002     
   964     
  1146         {
  1108         {
  1147         size = KIpsSetDataFullBodyAndAttas;
  1109         size = KIpsSetDataFullBodyAndAttas;
  1148         }
  1110         }
  1149    //<cmail>
  1111    //<cmail>
  1150     else if ( iProtocol == KSenduiMtmPop3Uid && aDownloadControl == CIpsSetData::EHeadersPlus )
  1112     else if ( iProtocol == KSenduiMtmPop3Uid && aDownloadControl == CIpsSetData::EHeadersPlus )
  1151         {
  1113     	{
  1152         // fix for POP that has only 2 radio (IMAP has 3) 
  1114     	// fix for POP that has only 2 radio (IMAP has 3) 
  1153         // and the second should have value of EWholeBody instead of EHeadersPlus 
  1115     	// and the second should have value of EWholeBody instead of EHeadersPlus 
  1154         size = KIpsSetDataFullBodyAndAttas; 
  1116     	size = KIpsSetDataFullBodyAndAttas; 
  1155         }
  1117     	}
  1156     //</cmail>
  1118     //</cmail>	
  1157     else
  1119     else
  1158         {
  1120         {
  1159         size = aDownloadSize;
  1121         size = aDownloadSize;
  1160         }
  1122         }
  1161     
  1123