phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorArrayItem.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 contact editor dialog array item.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "CPbk2ContactEditorArrayItem.h"
       
    19 
       
    20 // Phonebook 2
       
    21 
       
    22 // Virtual Phonebook
       
    23 
       
    24 // System includes
       
    25 
       
    26 // --------------------------------------------------------------------------
       
    27 // CPbk2ContactEditorArrayItem::CPbk2ContactEditorArrayItem
       
    28 // --------------------------------------------------------------------------
       
    29 //
       
    30 CPbk2ContactEditorArrayItem::CPbk2ContactEditorArrayItem
       
    31         ( MPbk2ContactEditorField* aContactEdytorField ) :
       
    32          iContactEdytorField(aContactEdytorField), iContactEdytorUIField(NULL)
       
    33     {
       
    34     }
       
    35         
       
    36 // --------------------------------------------------------------------------
       
    37 // CPbk2ContactEditorArrayItem::CPbk2ContactEditorArrayItem
       
    38 // --------------------------------------------------------------------------
       
    39 //
       
    40 CPbk2ContactEditorArrayItem::CPbk2ContactEditorArrayItem
       
    41         ( MPbk2ContactEditorUIField* aContactEdytorUIField ) :
       
    42          iContactEdytorField(NULL), iContactEdytorUIField(aContactEdytorUIField)
       
    43     {
       
    44     }
       
    45      
       
    46 // --------------------------------------------------------------------------
       
    47 // CPbk2ContactEditorArrayItem::~CPbk2ContactEditorArrayItem
       
    48 // --------------------------------------------------------------------------
       
    49 //
       
    50 CPbk2ContactEditorArrayItem::~CPbk2ContactEditorArrayItem()
       
    51     {
       
    52     delete iContactEdytorField;
       
    53     delete iContactEdytorUIField;
       
    54     }
       
    55         
       
    56 // --------------------------------------------------------------------------
       
    57 // CPbk2ContactEditorArrayItem::NewL
       
    58 // --------------------------------------------------------------------------
       
    59 //
       
    60 CPbk2ContactEditorArrayItem* CPbk2ContactEditorArrayItem::NewL
       
    61         ( MPbk2ContactEditorField* aContactEdytorField ) 
       
    62 	{
       
    63 	User::LeaveIfNull(aContactEdytorField);
       
    64 	CPbk2ContactEditorArrayItem* self = 
       
    65         new ( ELeave ) CPbk2ContactEditorArrayItem( aContactEdytorField );
       
    66     CleanupStack::PushL( self );
       
    67     self->ConstructL();
       
    68     CleanupStack::Pop( self );
       
    69     return self;
       
    70     }
       
    71         
       
    72 // --------------------------------------------------------------------------
       
    73 // CPbk2ContactEditorArrayItem::NewL
       
    74 // --------------------------------------------------------------------------
       
    75 //
       
    76 CPbk2ContactEditorArrayItem* CPbk2ContactEditorArrayItem::NewL
       
    77         ( MPbk2ContactEditorUIField* aContactEdytorUIField ) 
       
    78 	{
       
    79 	User::LeaveIfNull(aContactEdytorUIField);
       
    80 	CPbk2ContactEditorArrayItem* self = 
       
    81         new ( ELeave ) CPbk2ContactEditorArrayItem( aContactEdytorUIField );
       
    82     CleanupStack::PushL( self );
       
    83     self->ConstructL();
       
    84     CleanupStack::Pop( self );
       
    85     return self;
       
    86     }
       
    87 
       
    88 // --------------------------------------------------------------------------
       
    89 // CPbk2ContactEditorArrayItem::ContactEditorUIField
       
    90 // --------------------------------------------------------------------------
       
    91 //
       
    92 MPbk2ContactEditorUIField* CPbk2ContactEditorArrayItem::ContactEditorUIField() 
       
    93 	{
       
    94 	return iContactEdytorUIField;
       
    95 	}
       
    96 
       
    97 // --------------------------------------------------------------------------
       
    98 // CPbk2ContactEditorArrayItem::ContactEditorField
       
    99 // --------------------------------------------------------------------------
       
   100 //
       
   101 MPbk2ContactEditorField* CPbk2ContactEditorArrayItem::ContactEditorField() 
       
   102 	{
       
   103 	return iContactEdytorField;
       
   104 	}
       
   105 
       
   106 // --------------------------------------------------------------------------
       
   107 // CPbk2ContactEditorArrayItem::ConstructL
       
   108 // --------------------------------------------------------------------------
       
   109 //
       
   110 void CPbk2ContactEditorArrayItem::ConstructL() 
       
   111 	{
       
   112 
       
   113 	}
       
   114 
       
   115 // --------------------------------------------------------------------------
       
   116 // CPbk2ContactEditorArrayItem::ControlId
       
   117 // --------------------------------------------------------------------------
       
   118 //
       
   119 TInt CPbk2ContactEditorArrayItem::ControlId() 
       
   120 	{
       
   121 	if( iContactEdytorUIField )
       
   122 		{
       
   123 		return iContactEdytorUIField->ControlId();
       
   124 		}
       
   125 	return iContactEdytorField->ControlId();
       
   126 	}
       
   127 
       
   128 // --------------------------------------------------------------------------
       
   129 // CPbk2ContactEditorArrayItem::SetFocus
       
   130 // --------------------------------------------------------------------------
       
   131 //
       
   132 void CPbk2ContactEditorArrayItem::SetFocus() 
       
   133 	{
       
   134 	if( iContactEdytorUIField )
       
   135 		{
       
   136 		iContactEdytorUIField->SetFocus();
       
   137 		}
       
   138 	else
       
   139 		{
       
   140 		iContactEdytorField->SetFocus();
       
   141 		}
       
   142 	}
       
   143 
       
   144 // --------------------------------------------------------------------------
       
   145 // CPbk2ContactEditorArrayItem::ActivateL
       
   146 // --------------------------------------------------------------------------
       
   147 //
       
   148 void CPbk2ContactEditorArrayItem::ActivateL() 
       
   149 	{
       
   150 	if( iContactEdytorUIField )
       
   151 		{
       
   152 		iContactEdytorUIField->ActivateL();
       
   153 		}
       
   154 	else
       
   155 		{
       
   156 		iContactEdytorField->ActivateL();
       
   157 		}
       
   158 	}
       
   159 
       
   160 // --------------------------------------------------------------------------
       
   161 // CPbk2ContactEditorArrayItem::ConsumesKeyEvent
       
   162 // --------------------------------------------------------------------------
       
   163 //
       
   164 TBool CPbk2ContactEditorArrayItem::ConsumesKeyEvent(
       
   165 		const TKeyEvent& aKeyEvent, 
       
   166         TEventCode aType ) 
       
   167 	{
       
   168 	if( iContactEdytorUIField )
       
   169 		{
       
   170 		return iContactEdytorUIField->ConsumesKeyEvent( aKeyEvent, aType );
       
   171 		}
       
   172 	return iContactEdytorField->ConsumesKeyEvent( aKeyEvent, aType );
       
   173 	}
       
   174 
       
   175 // --------------------------------------------------------------------------
       
   176 // CPbk2ContactEditorArrayItem::Control
       
   177 // --------------------------------------------------------------------------
       
   178 //
       
   179 CEikEdwin* CPbk2ContactEditorArrayItem::Control() 
       
   180 	{
       
   181 	if( iContactEdytorUIField )
       
   182 		{
       
   183 		return iContactEdytorUIField->Control();
       
   184 		}
       
   185 	return iContactEdytorField->Control();
       
   186 	}