ipsservices/ipssossettings/src/ipssetdata.cpp
branchRCL_3
changeset 73 c8382f7b54ef
parent 64 3533d4323edc
child 80 726fba06891a
equal deleted inserted replaced
70:968773a0b6ef 73:c8382f7b54ef
   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     
   182     CleanupStack::PopAndDestroy( manager );
   198     CleanupStack::PopAndDestroy( manager );
   183     manager = NULL;
   199     manager = NULL;
   184     }
   200     }
   185 
   201 
   186 // ---------------------------------------------------------------------------
   202 // ---------------------------------------------------------------------------
   521     TImIAPChoice ret;
   537     TImIAPChoice ret;
   522     ret.iDialogPref = ECommDbDialogPrefPrompt;
   538     ret.iDialogPref = ECommDbDialogPrefPrompt;
   523     ret.iIAP = 0;
   539     ret.iIAP = 0;
   524     if ( aIncoming )
   540     if ( aIncoming )
   525         {
   541         {
   526 		if (iIncomingIapPref->SNAPDefined())
   542         if (iIncomingIapPref->SNAPDefined())
   527 			{
   543             {
   528 			ret.iIAP = iIncomingIapPref->SNAPPreference();
   544             ret.iIAP = iIncomingIapPref->SNAPPreference();
   529 			}
   545             }
   530 			
   546             
   531         if ( iIncomingIapPref->NumberOfIAPs() > 0 )
   547         if ( iIncomingIapPref->NumberOfIAPs() > 0 )
   532             {
   548             {
   533             ret = iIncomingIapPref->IAPPreference(0);
   549             ret = iIncomingIapPref->IAPPreference(0);
   534             }
   550             }
   535         }
   551         }
   824 //
   840 //
   825 void CIpsSetData::SetSignatureL( const TDesC& aSignature )
   841 void CIpsSetData::SetSignatureL( const TDesC& aSignature )
   826     {
   842     {
   827     FUNC_LOG;
   843     FUNC_LOG;
   828     iSignature->iRichText->Reset();
   844     iSignature->iRichText->Reset();
   829     iSignature->iRichText->InsertL( 0, aSignature );
   845     
       
   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         }
   830     }
   868     }
   831 
   869 
   832 // ---------------------------------------------------------------------------
   870 // ---------------------------------------------------------------------------
   833 // CIpsSetData::SetUserNameL()
   871 // CIpsSetData::SetUserNameL()
   834 // ---------------------------------------------------------------------------
   872 // ---------------------------------------------------------------------------
   943     CleanupStack::Pop( iIncomingIapPref );
   981     CleanupStack::Pop( iIncomingIapPref );
   944     iOutgoingIapPref = CImIAPPreferences::NewLC();
   982     iOutgoingIapPref = CImIAPPreferences::NewLC();
   945     CleanupStack::Pop( iOutgoingIapPref );
   983     CleanupStack::Pop( iOutgoingIapPref );
   946         
   984         
   947     if (aIncomingIap.SNAPDefined())
   985     if (aIncomingIap.SNAPDefined())
   948     	{
   986         {
   949 		iIncomingIapPref->SetSNAPL(aIncomingIap.SNAPPreference());
   987         iIncomingIapPref->SetSNAPL(aIncomingIap.SNAPPreference());
   950     	}
   988         }
   951     else
   989     else
   952     	{
   990         {
   953     	iIncomingIapPref->AddIAPL( aIncomingIap.IAPPreference(0) );
   991         iIncomingIapPref->AddIAPL( aIncomingIap.IAPPreference(0) );
   954     	}
   992         }
   955         
   993         
   956     if (aOutgoingIap.SNAPDefined())
   994     if (aOutgoingIap.SNAPDefined())
   957       	{
   995         {
   958     	iOutgoingIapPref->SetSNAPL(aOutgoingIap.SNAPPreference());
   996         iOutgoingIapPref->SetSNAPL(aOutgoingIap.SNAPPreference());
   959        	}
   997         }
   960     else
   998     else
   961     	{
   999     	{
   962     	iOutgoingIapPref->AddIAPL( aOutgoingIap.IAPPreference(0) );
  1000     	iOutgoingIapPref->AddIAPL( aOutgoingIap.IAPPreference(0) );
   963     	}
  1001     	}
   964     
  1002     
  1108         {
  1146         {
  1109         size = KIpsSetDataFullBodyAndAttas;
  1147         size = KIpsSetDataFullBodyAndAttas;
  1110         }
  1148         }
  1111    //<cmail>
  1149    //<cmail>
  1112     else if ( iProtocol == KSenduiMtmPop3Uid && aDownloadControl == CIpsSetData::EHeadersPlus )
  1150     else if ( iProtocol == KSenduiMtmPop3Uid && aDownloadControl == CIpsSetData::EHeadersPlus )
  1113     	{
  1151         {
  1114     	// fix for POP that has only 2 radio (IMAP has 3) 
  1152         // fix for POP that has only 2 radio (IMAP has 3) 
  1115     	// and the second should have value of EWholeBody instead of EHeadersPlus 
  1153         // and the second should have value of EWholeBody instead of EHeadersPlus 
  1116     	size = KIpsSetDataFullBodyAndAttas; 
  1154         size = KIpsSetDataFullBodyAndAttas; 
  1117     	}
  1155         }
  1118     //</cmail>	
  1156     //</cmail>
  1119     else
  1157     else
  1120         {
  1158         {
  1121         size = aDownloadSize;
  1159         size = aDownloadSize;
  1122         }
  1160         }
  1123     
  1161