pkiutilities/CertmanUi/SRC/CertmanuiCertificateHelper.cpp
branchRCL_3
changeset 21 09b1ac925e3f
parent 9 a005fc61b02a
child 22 03674e5abf46
equal deleted inserted replaced
20:63339781d179 21:09b1ac925e3f
     1 /*
     1 /*
     2 * Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2003-2009 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()
   530 // ---------------------------------------------------------
   531 // ---------------------------------------------------------
   531 //
   532 //
   532 void CCertManUICertificateHelper::DetailsDynamicL(
   533 void CCertManUICertificateHelper::DetailsDynamicL(
   533     HBufC& aMessage, TPtrC aValue, TInt aResourceOne )
   534     HBufC& aMessage, TPtrC aValue, TInt aResourceOne )
   534     {
   535     {
   535     CERTMANUILOGGER_ENTERFN(
   536     CERTMANUILOGGER_ENTERFN(
   536         "CCertManUICertificateHelper::DetailsDynamicL" );
   537         "CCertManUICertificateHelper::DetailsDynamicL" );
   537 
   538 
   538     HBufC* buf = aValue.AllocLC();
   539     HBufC* buf = HBufC::NewLC( KMaxLengthTextCertLabel );
   539     TPtr trimmedValue( buf->Des() );
   540     buf->Des() = aValue;
   540     trimmedValue.TrimLeft();
   541     buf->Des().TrimLeft();
   541 
   542     // Cut CertLabel after fourth semi colon
   542     if( trimmedValue.Length() > KMaxLengthTextCertLabelVisible )
   543     TPtrC trimmedCertLabel = CutCertificateField( buf->Des() );
   543         {
   544     buf->Des().Copy( trimmedCertLabel );
   544         trimmedValue.SetLength( KMaxLengthTextCertLabelVisible - 1 );
   545     TInt length = buf->Des().Length();
   545         trimmedValue.Append( KTextUtilClipEndChar );
   546     if ( length == 0 )
   546         }
       
   547 
       
   548     if ( trimmedValue.Length() == 0 )
       
   549         {
   547         {
   550         DetailsResourceL( aMessage, aResourceOne );
   548         DetailsResourceL( aMessage, aResourceOne );
   551         }
   549         }
   552     else
   550     else
   553         {
   551         {
   554         //LRM (Left-to-Right mark 0x200E)
   552         //LRM (Left-to-Right mark 200E)
   555         const TInt KLRMark = 0x200E;
   553         const TInt KLRMark = 0x200E;
   556         aMessage.Des().Append( trimmedValue );
   554         aMessage.Des().Append( buf->Des() );
   557         aMessage.Des().Append( KLRMark );
   555         aMessage.Des().Append(KLRMark);
   558         aMessage.Des().Append( KCertManUIDetailsViewEnter );
   556         aMessage.Des().Append( KCertManUIDetailsViewEnter );
   559         }
   557         }
   560     CleanupStack::PopAndDestroy( buf );
   558     CleanupStack::PopAndDestroy();  // buf
   561 
   559 
   562     CERTMANUILOGGER_LEAVEFN(
   560     CERTMANUILOGGER_LEAVEFN(
   563         "CCertManUICertificateHelper::DetailsDynamicL" );
   561         "CCertManUICertificateHelper::DetailsDynamicL" );
   564     }
   562     }
   565 
   563