phonebookui/Phonebook2/remotecontactlookup/contactactionservice/src/CFscFieldPropertyArray.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 14 Sep 2010 20:54:53 +0300
branchRCL_3
changeset 21 9da50d567e3c
parent 20 f4a778e096c2
permissions -rw-r--r--
Revision: 201033 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     1
/*
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     8
*
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    11
*
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    12
* Contributors:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    13
*
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    14
* Description:  Field property array for field types.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    15
 *
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    16
*/
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    17
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    18
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    19
#include "emailtrace.h"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
#include "CFscFieldPropertyArray.h"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
// Phonebook 2
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
#include "FscPresentationUtils.h"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
#include "CFscFieldProperty.h"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
#include "CFscFieldOrderingManager.h"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
#include <pbk2rclactionutils.rsg>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    27
#include "CFscFieldPropertyGroup.h"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    28
#include <Pbk2ContentIdentifiers.hrh>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
// Virtual Phonebook
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    31
#include <MVPbkFieldType.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    32
#include <TVPbkFieldVersitProperty.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    33
#include <CVPbkFieldTypeSelector.h>
21
9da50d567e3c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    34
#include <vpbkeng.rsg>
20
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    35
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
// System includes
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
#include <barsc.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
#include <barsread.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
#include <featmgr.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
#include <eikenv.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
#include <apgcli.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
#include <eikappui.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    43
#include <eikapp.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
#include <data_caging_path_literals.hrh>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
#include <bautils.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
#include <coemain.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
// CONSTANTS DECLARATIONS
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
_LIT( KFscRscFileName, "pbk2rclactionutils.rsc" );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
// CFscFieldPropertyArray::CFscFieldPropertyArray
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
inline CFscFieldPropertyArray::CFscFieldPropertyArray()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
    FUNC_LOG;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    62
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
// CFscFieldPropertyArray::ConstructL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    64
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    66
inline void CFscFieldPropertyArray::ConstructL(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    67
        const MVPbkFieldTypeList& aSupportedFieldTypeList)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    68
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    69
    FUNC_LOG;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    70
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    71
    TFileName resourceFileName( KDC_APP_RESOURCE_DIR );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    72
    resourceFileName.Append(KFscRscFileName);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    73
    BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), resourceFileName );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    74
    TInt offset = CCoeEnv::Static()->AddResourceFileL( resourceFileName );    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    75
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    76
    // Read field type presentation order information
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    77
    TResourceReader reader;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    78
    CCoeEnv::Static()->CreateResourceReaderLC(reader, 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    79
    R_FSC_FIELDTYPE_PRESENTATION_ORDERS);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    81
    CFscFieldOrderingManager* orderings =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    82
            CFscFieldOrderingManager::NewL(reader);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    83
    CleanupStack::PopAndDestroy(); // R_FSC_FIELDTYPE_PRESENTATION_ORDERS
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    84
    CleanupStack::PushL(orderings);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
    // Read field property resource strucutre array
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    87
    CCoeEnv::Static()->CreateResourceReaderLC(reader, R_FSC_FIELD_PROPERTIES);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    88
    ReadFieldPropertiesL(reader, aSupportedFieldTypeList, *orderings);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    90
    CCoeEnv::Static()->DeleteResourceFile(offset);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    91
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    92
    CleanupStack::PopAndDestroy(2);// orderings, r_fsc_field_properties
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    93
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    94
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
// CFscFieldPropertyArray::NewL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    97
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    99
 CFscFieldPropertyArray* CFscFieldPropertyArray::NewL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   100
(const MVPbkFieldTypeList& aSupportedFieldTypeList)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   101
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   102
    FUNC_LOG;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   103
    CFscFieldPropertyArray* self = new(ELeave) CFscFieldPropertyArray;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
    CleanupStack::PushL(self);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   105
    self->ConstructL( aSupportedFieldTypeList);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   106
    CleanupStack::Pop(self);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   107
    return self;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   108
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   109
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   110
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
// CFscFieldPropertyArray::NewL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   114
 CFscFieldPropertyArray* CFscFieldPropertyArray::NewL(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   115
        const MVPbkFieldTypeList& aSupportedFieldTypeList,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   116
        TResourceReader& aReader)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   117
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   118
    FUNC_LOG;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   119
    CFscFieldPropertyArray* self = new(ELeave) CFscFieldPropertyArray;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
    CleanupStack::PushL(self);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
    CFscFieldOrderingManager* orderings =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
    self->CreateFieldOrderingsLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
    self->ReadFieldPropertiesL( aReader, aSupportedFieldTypeList, *orderings );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
    CleanupStack::PopAndDestroy( orderings );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
    CleanupStack::Pop(self);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
    return self;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   127
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   128
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   129
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   130
// CFscFieldPropertyArray::~CFscFieldPropertyArray
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   131
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   132
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   133
CFscFieldPropertyArray::~CFscFieldPropertyArray()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   134
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   135
    FUNC_LOG;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   136
    iFieldProperties.ResetAndDestroy();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   137
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   138
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   139
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   140
// CFscFieldPropertyArray::FindProperty
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   141
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   142
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   143
const MPbk2FieldProperty* CFscFieldPropertyArray::FindProperty(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   144
        const MVPbkFieldType& aFieldType) const
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   145
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   146
    FUNC_LOG;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   147
    const CFscFieldProperty* result= NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   148
    const TInt count = iFieldProperties.Count();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   149
    for (TInt i = 0; i < count; ++i)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   150
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   151
        const CFscFieldProperty* property = iFieldProperties[i];
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   152
        if (property->FieldType().IsSame(aFieldType))
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   153
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   154
            result = property;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   155
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   156
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   157
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   158
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   159
    return result;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   160
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   161
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   162
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   163
// CFscFieldPropertyArray::Count
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   164
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   165
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   166
TInt CFscFieldPropertyArray::Count() const
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   167
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   168
    FUNC_LOG;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   169
    return iFieldProperties.Count();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   170
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   171
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   172
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   173
// CFscFieldPropertyArray::At
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   174
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   175
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   176
const MPbk2FieldProperty& CFscFieldPropertyArray::At(TInt aIndex) const
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   177
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   178
    FUNC_LOG;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   179
    return *iFieldProperties[aIndex];
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   180
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   181
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   182
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   183
// CFscFieldPropertyArray::ReadFieldPropertiesL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   184
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   185
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   186
void CFscFieldPropertyArray::ReadFieldPropertiesL(TResourceReader& aReader,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   187
        const MVPbkFieldTypeList& aSupportedFieldTypeList,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   188
        CFscFieldOrderingManager& aOrderingManager)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   189
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   190
    FUNC_LOG;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   191
    // aSupportedFieldTypeList is a list of the supported field type of the used store
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   192
    const TInt count = aReader.ReadInt16();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   193
    for (TInt i = 0; i < count; ++i)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   194
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   195
        CFscFieldProperty* property = CFscFieldProperty::NewLC(aReader,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   196
                aSupportedFieldTypeList, aOrderingManager);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   197
        TBool doNotAdd = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   198
        if (property->IsSupported())
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   199
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   200
            if (!FeatureManager::FeatureSupported(KFeatureIdJapanese))
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   201
                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   202
                // Non-Japanese variants use all the other properties but
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   203
                // Japanese reading fields
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   204
                const MVPbkFieldType* lastNameReading =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   205
                        aSupportedFieldTypeList.Find(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   206
                        R_VPBK_FIELD_TYPE_LASTNAMEREADING);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   207
                const MVPbkFieldType* firstNameReading =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   208
                        aSupportedFieldTypeList.Find(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   209
                        R_VPBK_FIELD_TYPE_FIRSTNAMEREADING);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   210
                const MVPbkFieldType& type = property->FieldType();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   211
                if ( (lastNameReading && lastNameReading->IsSame(type) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   212
                        || firstNameReading && firstNameReading->IsSame(type) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   213
                    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   214
                    doNotAdd = ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   215
                    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   216
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   217
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   218
        else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   219
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   220
            doNotAdd = ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   221
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   222
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   223
        if (doNotAdd)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   224
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   225
            CleanupStack::PopAndDestroy(property);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   226
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   227
        else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   228
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   229
            iFieldProperties.AppendL(property);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   230
            CleanupStack::Pop(property);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   231
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   232
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   233
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   234
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   235
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   236
// CFscFieldPropertyArray::CreateFieldOrderingsLC
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   237
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   238
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   239
CFscFieldOrderingManager* CFscFieldPropertyArray::CreateFieldOrderingsLC(void)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   240
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   241
    FUNC_LOG;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   242
    TFileName resourceFileName( KDC_APP_RESOURCE_DIR );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   243
    resourceFileName.Append(KFscRscFileName);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   244
    BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), resourceFileName );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   245
    TInt offset = CCoeEnv::Static()->AddResourceFileL( resourceFileName );    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   246
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   247
    // Read field type presentation order information
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   248
    TResourceReader reader;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   249
    CCoeEnv::Static()->CreateResourceReaderLC(reader,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   250
            R_FSC_FIELDTYPE_PRESENTATION_ORDERS);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   251
    CFscFieldOrderingManager* orderings =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   252
            CFscFieldOrderingManager::NewL(reader);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   253
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   254
    CCoeEnv::Static()->DeleteResourceFile(offset);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   255
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   256
    CleanupStack::PopAndDestroy(2);// R_FSC_FIELDTYPE_PRESENTATION_ORDERS, resFile
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   257
    CleanupStack::PushL(orderings);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   258
    return orderings;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   259
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   260
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   261
// End of File
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   262