cpsecplugins/cpadvancedsecplugin/src/advsecsettingslabeledcertinfo_symbian.cpp
changeset 63 989397f9511c
equal deleted inserted replaced
62:3255e7d5bd67 63:989397f9511c
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Helper class to contain a labeled CCTCertInfo object
       
    15 *
       
    16 */
       
    17 
       
    18 #include "advsecsettingslabeledcertinfo_symbian.h"
       
    19 
       
    20 
       
    21 // ======== MEMBER FUNCTIONS ========
       
    22 
       
    23 // ---------------------------------------------------------------------------
       
    24 // CAdvSecSettingsLabeledCertInfo::CAdvSecSettingsLabeledCertInfo()
       
    25 // ---------------------------------------------------------------------------
       
    26 //
       
    27 CAdvSecSettingsLabeledCertInfo::CAdvSecSettingsLabeledCertInfo(
       
    28     const CCTCertInfo &aCertInfo) : iCertInfo(aCertInfo)
       
    29 {
       
    30 }
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // CAdvSecSettingsLabeledCertInfo::~CAdvSecSettingsLabeledCertInfo()
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 CAdvSecSettingsLabeledCertInfo::~CAdvSecSettingsLabeledCertInfo()
       
    37 {
       
    38     delete iLabel;
       
    39 }
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // CAdvSecSettingsLabeledCertInfo::CertInfo()
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 const CCTCertInfo &CAdvSecSettingsLabeledCertInfo::CertInfo() const
       
    46 {
       
    47     return iCertInfo;
       
    48 }
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // CAdvSecSettingsLabeledCertInfo::Label()
       
    52 // ---------------------------------------------------------------------------
       
    53 //
       
    54 const TDesC &CAdvSecSettingsLabeledCertInfo::Label() const
       
    55 {
       
    56     if (iLabel) {
       
    57         return *iLabel;
       
    58     }
       
    59     return KNullDesC;
       
    60 }
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 // CAdvSecSettingsLabeledCertInfo::SetLabelL()
       
    64 // ---------------------------------------------------------------------------
       
    65 //
       
    66 void CAdvSecSettingsLabeledCertInfo::SetLabelL(const TDesC &aLabel)
       
    67 {
       
    68     if (iLabel) {
       
    69         delete iLabel;
       
    70         iLabel = NULL;
       
    71     }
       
    72     iLabel = aLabel.AllocL();
       
    73 }
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // CAdvSecSettingsLabeledCertInfo::AppendLabelL()
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 void CAdvSecSettingsLabeledCertInfo::AppendLabelL(const TDesC &aSeparator,
       
    80     const TDesC &aAdditionalText)
       
    81 {
       
    82     if (iLabel && iLabel->Length()) {
       
    83         TInt length = iLabel->Length() + aSeparator.Length() + aAdditionalText.Length();
       
    84         iLabel = iLabel->ReAllocL(length);
       
    85         TPtr labelPtr = iLabel->Des();
       
    86         labelPtr.Append(aSeparator);
       
    87         labelPtr.Append(aAdditionalText);
       
    88     } else {
       
    89         SetLabelL(aAdditionalText);
       
    90     }
       
    91 }
       
    92 
       
    93 // ---------------------------------------------------------------------------
       
    94 // CAdvSecSettingsLabeledCertInfo::Compare()
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 TInt CAdvSecSettingsLabeledCertInfo::Compare(const CAdvSecSettingsLabeledCertInfo& aLeft,
       
    98     const CAdvSecSettingsLabeledCertInfo& aRight)
       
    99 {
       
   100     return (aLeft.Label().CompareF(aRight.Label()));
       
   101 }
       
   102