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