phonebookui/Phonebook2/Presentation/src/CPbk2StoreViewDefinition.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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 "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:  Phonebook 2 store view definition.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "CPbk2StoreViewDefinition.h"
       
    20 
       
    21 // Virtual Phonebook
       
    22 #include <CVPbkContactViewDefinition.h>
       
    23 
       
    24 // System includes
       
    25 #include <barsread.h>
       
    26 
       
    27 
       
    28 // --------------------------------------------------------------------------
       
    29 // CPbk2StoreViewDefinition::CPbk2StoreViewDefinition
       
    30 // --------------------------------------------------------------------------
       
    31 //
       
    32 CPbk2StoreViewDefinition::CPbk2StoreViewDefinition()
       
    33     {
       
    34     }
       
    35 
       
    36 // --------------------------------------------------------------------------
       
    37 // CPbk2StoreViewDefinition::~CPbk2StoreViewDefinition
       
    38 // --------------------------------------------------------------------------
       
    39 //
       
    40 CPbk2StoreViewDefinition::~CPbk2StoreViewDefinition()
       
    41     {
       
    42     delete iViewDefinition;
       
    43     }
       
    44 
       
    45 // --------------------------------------------------------------------------
       
    46 // CPbk2StoreViewDefinition::NewL
       
    47 // --------------------------------------------------------------------------
       
    48 //
       
    49 EXPORT_C CPbk2StoreViewDefinition* CPbk2StoreViewDefinition::NewL()
       
    50     {
       
    51     return new ( ELeave ) CPbk2StoreViewDefinition;
       
    52     }
       
    53 
       
    54 // --------------------------------------------------------------------------
       
    55 // CPbk2StoreViewDefinition::NewLC
       
    56 // --------------------------------------------------------------------------
       
    57 //
       
    58 EXPORT_C CPbk2StoreViewDefinition* CPbk2StoreViewDefinition::NewLC
       
    59         ( TResourceReader& aReader )
       
    60     {
       
    61     CPbk2StoreViewDefinition* self = new ( ELeave ) CPbk2StoreViewDefinition;
       
    62     CleanupStack::PushL( self );
       
    63     self->ConstructL( aReader );
       
    64     return self;
       
    65     }
       
    66 
       
    67 // --------------------------------------------------------------------------
       
    68 // CPbk2StoreViewDefinition::NewLC
       
    69 // --------------------------------------------------------------------------
       
    70 //
       
    71 EXPORT_C CPbk2StoreViewDefinition* CPbk2StoreViewDefinition::NewLC
       
    72         ( const CPbk2StoreViewDefinition& aViewDef )
       
    73     {
       
    74     CPbk2StoreViewDefinition* self = new ( ELeave ) CPbk2StoreViewDefinition;
       
    75     CleanupStack::PushL( self );
       
    76     self->ConstructL( aViewDef );
       
    77     return self;
       
    78     }
       
    79 
       
    80 // --------------------------------------------------------------------------
       
    81 // CPbk2StoreViewDefinition::ConstructL
       
    82 // --------------------------------------------------------------------------
       
    83 //
       
    84 void CPbk2StoreViewDefinition::ConstructL( TResourceReader& aReader )
       
    85     {
       
    86     aReader.ReadInt8(); // read version number
       
    87     iViewType = TPbk2ContactViewType( aReader.ReadInt8() );
       
    88     iViewLocation = TPbk2ContactViewLocation( aReader.ReadInt8() );
       
    89     iViewDefinition = CVPbkContactViewDefinition::NewL( aReader );
       
    90     iViewItemIconId = TPbk2IconId( aReader );
       
    91     }
       
    92 
       
    93 // --------------------------------------------------------------------------
       
    94 // CPbk2StoreViewDefinition::ConstructL
       
    95 // --------------------------------------------------------------------------
       
    96 //
       
    97 void CPbk2StoreViewDefinition::ConstructL
       
    98         ( const CPbk2StoreViewDefinition& aViewDef )
       
    99     {
       
   100     iViewType = aViewDef.ViewType();
       
   101     iViewLocation = aViewDef.ViewLocation();
       
   102     iViewDefinition =
       
   103         CVPbkContactViewDefinition::NewL( aViewDef.ViewDefinition() );
       
   104     iViewItemIconId = aViewDef.ViewItemIconId();  
       
   105     }
       
   106 
       
   107 // --------------------------------------------------------------------------
       
   108 // CPbk2StoreViewDefinition::ViewType
       
   109 // --------------------------------------------------------------------------
       
   110 //
       
   111 EXPORT_C TPbk2ContactViewType CPbk2StoreViewDefinition::ViewType() const
       
   112     {
       
   113     return iViewType;
       
   114     }
       
   115 
       
   116 // --------------------------------------------------------------------------
       
   117 // CPbk2StoreViewDefinition::ViewLocation
       
   118 // --------------------------------------------------------------------------
       
   119 //
       
   120 EXPORT_C TPbk2ContactViewLocation
       
   121         CPbk2StoreViewDefinition::ViewLocation() const
       
   122     {
       
   123     return iViewLocation;
       
   124     }
       
   125 
       
   126 // --------------------------------------------------------------------------
       
   127 // CPbk2StoreViewDefinition::ViewDefinition
       
   128 // --------------------------------------------------------------------------
       
   129 //
       
   130 EXPORT_C const CVPbkContactViewDefinition&
       
   131         CPbk2StoreViewDefinition::ViewDefinition() const
       
   132     {
       
   133     return *iViewDefinition;
       
   134     }
       
   135 
       
   136 // --------------------------------------------------------------------------
       
   137 // CPbk2StoreViewDefinition::ViewItemIconId
       
   138 // --------------------------------------------------------------------------
       
   139 //
       
   140 EXPORT_C const TPbk2IconId& CPbk2StoreViewDefinition::ViewItemIconId() const
       
   141     {
       
   142     return iViewItemIconId;
       
   143     }
       
   144 
       
   145 // --------------------------------------------------------------------------
       
   146 // CPbk2StoreViewDefinition::SetViewType
       
   147 // --------------------------------------------------------------------------
       
   148 //
       
   149 EXPORT_C void CPbk2StoreViewDefinition::SetViewType
       
   150         ( TPbk2ContactViewType aType )
       
   151     {
       
   152     iViewType = aType;
       
   153     }
       
   154 
       
   155 // --------------------------------------------------------------------------
       
   156 // CPbk2StoreViewDefinition::SetViewLocation
       
   157 // --------------------------------------------------------------------------
       
   158 //
       
   159 EXPORT_C void CPbk2StoreViewDefinition::SetViewLocation
       
   160         ( TPbk2ContactViewLocation aLocation )
       
   161     {
       
   162     iViewLocation = aLocation;
       
   163     }
       
   164 
       
   165 // --------------------------------------------------------------------------
       
   166 // CPbk2StoreViewDefinition::SetViewDefinition
       
   167 // --------------------------------------------------------------------------
       
   168 //
       
   169 EXPORT_C void CPbk2StoreViewDefinition::SetViewDefinition
       
   170         ( CVPbkContactViewDefinition* aViewDefinition )
       
   171     {
       
   172     delete iViewDefinition;
       
   173     iViewDefinition = aViewDefinition;
       
   174     }
       
   175 
       
   176 // --------------------------------------------------------------------------
       
   177 // CPbk2StoreViewDefinition::SetViewItemIcon
       
   178 // --------------------------------------------------------------------------
       
   179 //
       
   180 EXPORT_C void CPbk2StoreViewDefinition::SetViewItemIcon
       
   181         ( const TPbk2IconId& aIconId )
       
   182     {
       
   183     iViewItemIconId = aIconId;
       
   184     }
       
   185 
       
   186 // End of File