pkiutilities/CertmanUi/SRC/CertmanuiCertificateHelper.cpp
branchRCL_3
changeset 9 a005fc61b02a
parent 0 164170e6151a
child 21 09b1ac925e3f
equal deleted inserted replaced
8:ece4bbb094df 9:a005fc61b02a
     1 /*
     1 /*
     2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   525 // ---------------------------------------------------------
   525 // ---------------------------------------------------------
   526 // CCertManUICertificateHelper::DetailsDynamicL(
   526 // CCertManUICertificateHelper::DetailsDynamicL(
   527 // HBufC& aMessage, TPtrC aValue, TInt aResourceOne)
   527 // HBufC& aMessage, TPtrC aValue, TInt aResourceOne)
   528 // Reads dynamic text from CertManAPI, if the string is empty
   528 // Reads dynamic text from CertManAPI, if the string is empty
   529 // put a not defined text from the resource in its place
   529 // put a not defined text from the resource in its place
   530 // KMaxLengthTextCertLabel = 510, used by CertLabel(), Issuer(), Owner()
       
   531 // ---------------------------------------------------------
   530 // ---------------------------------------------------------
   532 //
   531 //
   533 void CCertManUICertificateHelper::DetailsDynamicL(
   532 void CCertManUICertificateHelper::DetailsDynamicL(
   534     HBufC& aMessage, TPtrC aValue, TInt aResourceOne )
   533     HBufC& aMessage, TPtrC aValue, TInt aResourceOne )
   535     {
   534     {
   536     CERTMANUILOGGER_ENTERFN(
   535     CERTMANUILOGGER_ENTERFN(
   537         "CCertManUICertificateHelper::DetailsDynamicL" );
   536         "CCertManUICertificateHelper::DetailsDynamicL" );
   538 
   537 
   539     HBufC* buf = HBufC::NewLC( KMaxLengthTextCertLabel );
   538     HBufC* buf = aValue.AllocLC();
   540     buf->Des() = aValue;
   539     TPtr trimmedValue( buf->Des() );
   541     buf->Des().TrimLeft();
   540     trimmedValue.TrimLeft();
   542     // Cut CertLabel after fourth semi colon
   541 
   543     TPtrC trimmedCertLabel = CutCertificateField( buf->Des() );
   542     if( trimmedValue.Length() > KMaxLengthTextCertLabelVisible )
   544     buf->Des().Copy( trimmedCertLabel );
   543         {
   545     TInt length = buf->Des().Length();
   544         trimmedValue.SetLength( KMaxLengthTextCertLabelVisible - 1 );
   546     if ( length == 0 )
   545         trimmedValue.Append( KTextUtilClipEndChar );
       
   546         }
       
   547 
       
   548     if ( trimmedValue.Length() == 0 )
   547         {
   549         {
   548         DetailsResourceL( aMessage, aResourceOne );
   550         DetailsResourceL( aMessage, aResourceOne );
   549         }
   551         }
   550     else
   552     else
   551         {
   553         {
   552         //LRM (Left-to-Right mark 200E)
   554         //LRM (Left-to-Right mark 0x200E)
   553         const TInt KLRMark = 0x200E;
   555         const TInt KLRMark = 0x200E;
   554         aMessage.Des().Append( buf->Des() );
   556         aMessage.Des().Append( trimmedValue );
   555         aMessage.Des().Append(KLRMark);
   557         aMessage.Des().Append( KLRMark );
   556         aMessage.Des().Append( KCertManUIDetailsViewEnter );
   558         aMessage.Des().Append( KCertManUIDetailsViewEnter );
   557         }
   559         }
   558     CleanupStack::PopAndDestroy();  // buf
   560     CleanupStack::PopAndDestroy( buf );
   559 
   561 
   560     CERTMANUILOGGER_LEAVEFN(
   562     CERTMANUILOGGER_LEAVEFN(
   561         "CCertManUICertificateHelper::DetailsDynamicL" );
   563         "CCertManUICertificateHelper::DetailsDynamicL" );
   562     }
   564     }
   563 
   565