author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 20:54:53 +0300 | |
branch | RCL_3 |
changeset 21 | 9da50d567e3c |
parent 20 | f4a778e096c2 |
permissions | -rw-r--r-- |
20 | 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 UI address field. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include "CPbk2ContactEditorUIAddressField.h" |
|
19 |
||
20 |
// Phonebook 2 |
|
21 |
#include <MPbk2ContactEditorUiBuilder.h> |
|
22 |
#include "MPbk2ContactEditorFieldVisitor.h" |
|
23 |
#include "MPbk2ContactEditorUiBuilderExtension.h" |
|
24 |
#include "CPbk2IconInfoContainer.h" |
|
21
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
20
diff
changeset
|
25 |
#include <pbk2commonui.rsg> |
20 | 26 |
#include "MPbk2UIField.h" |
27 |
#include "Pbk2EditorLineIds.hrh" |
|
28 |
#include <Pbk2UIControls.hrh> |
|
29 |
#include "CPbk2ContactEditorReadonlyField.h" |
|
21
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
20
diff
changeset
|
30 |
#include <pbk2uicontrols.rsg> |
20 | 31 |
// System includes |
32 |
#include <eikcapc.h> |
|
33 |
#include <eikedwin.h> |
|
34 |
#include <AknUtils.h> |
|
35 |
||
36 |
// -------------------------------------------------------------------------- |
|
37 |
// CPbk2ContactEditorUIAddressField::CPbk2ContactEditorUIAddressField |
|
38 |
// -------------------------------------------------------------------------- |
|
39 |
// |
|
40 |
CPbk2ContactEditorUIAddressField::CPbk2ContactEditorUIAddressField |
|
41 |
( MPbk2UIField* aField, |
|
42 |
MPbk2ContactEditorUiBuilder& aUiBuilder, |
|
43 |
CPbk2IconInfoContainer& aIconInfoContainer, |
|
44 |
TInt aCustomPosition ) : |
|
45 |
CPbk2ContactEditorUIFieldBase( aField, aUiBuilder, |
|
46 |
aIconInfoContainer, aCustomPosition ) |
|
47 |
{ |
|
48 |
} |
|
49 |
||
50 |
// -------------------------------------------------------------------------- |
|
51 |
// CPbk2ContactEditorUIAddressField::~CPbk2ContactEditorUIAddressField |
|
52 |
// -------------------------------------------------------------------------- |
|
53 |
// |
|
54 |
CPbk2ContactEditorUIAddressField::~CPbk2ContactEditorUIAddressField() |
|
55 |
{ |
|
56 |
||
57 |
} |
|
58 |
||
59 |
// -------------------------------------------------------------------------- |
|
60 |
// CPbk2ContactEditorUIAddressField::NewLC |
|
61 |
// -------------------------------------------------------------------------- |
|
62 |
// |
|
63 |
CPbk2ContactEditorUIAddressField* CPbk2ContactEditorUIAddressField::NewL |
|
64 |
( MPbk2UIField* aField, |
|
65 |
MPbk2ContactEditorUiBuilder& aUiBuilder, |
|
66 |
CPbk2IconInfoContainer& aIconInfoContainer, |
|
67 |
TInt aCustomPosition, |
|
68 |
const TDesC& aCustomText ) |
|
69 |
{ |
|
70 |
CPbk2ContactEditorUIAddressField* self = |
|
71 |
new ( ELeave ) CPbk2ContactEditorUIAddressField( aField, |
|
72 |
aUiBuilder, aIconInfoContainer, aCustomPosition ); |
|
73 |
CleanupStack::PushL( self ); |
|
74 |
self->ConstructL(aCustomText); |
|
75 |
CleanupStack::Pop( self ); |
|
76 |
return self; |
|
77 |
} |
|
78 |
||
79 |
// -------------------------------------------------------------------------- |
|
80 |
// CPbk2ContactEditorUIAddressField::ConstructL |
|
81 |
// -------------------------------------------------------------------------- |
|
82 |
// |
|
83 |
void CPbk2ContactEditorUIAddressField::ConstructL(const TDesC& aCustomText) |
|
84 |
{ |
|
85 |
User::LeaveIfNull(iField); |
|
86 |
MPbk2ContactEditorUiBuilderExtension* ext = |
|
87 |
static_cast<MPbk2ContactEditorUiBuilderExtension*>( |
|
88 |
iUiBuilder.ContactEditorUiBuilderExtension(KNullUid)); |
|
89 |
||
90 |
iControl = static_cast<CPbk2ContactEditorReadonlyField*>( |
|
91 |
ext->AddCustomFieldToFormL(iCustomPosition, R_PBK2_ADDRESS_LINE)); |
|
92 |
iControl->InitializeL(this); |
|
93 |
SetControlTextL(aCustomText); |
|
94 |
iControl->CreateTextViewL(); |
|
95 |
iCaptionedCtrl = iUiBuilder.LineControl(ControlId()); |
|
96 |
iUiBuilder.TryChangeFocusL(ControlId()); |
|
97 |
LoadBitmapToFieldL(iField->IconId()); |
|
98 |
SetFieldLabelL(iField->DefaultLabel()); |
|
99 |
} |
|
100 |
||
101 |
// -------------------------------------------------------------------------- |
|
102 |
// CPbk2ContactEditorUIAddressField::ControlId |
|
103 |
// -------------------------------------------------------------------------- |
|
104 |
// |
|
105 |
TInt CPbk2ContactEditorUIAddressField::ControlId() |
|
106 |
{ |
|
107 |
return EPbk2EditorLineAddress; |
|
108 |
} |
|
109 |
||
110 |
// -------------------------------------------------------------------------- |
|
111 |
// CPbk2ContactEditorUIAddressField::Control |
|
112 |
// -------------------------------------------------------------------------- |
|
113 |
// |
|
114 |
CEikEdwin* CPbk2ContactEditorUIAddressField::Control() |
|
115 |
{ |
|
116 |
return iControl; |
|
117 |
} |
|
118 |
||
119 |
// -------------------------------------------------------------------------- |
|
120 |
// CPbk2ContactEditorUIAddressField::ActivateL |
|
121 |
// -------------------------------------------------------------------------- |
|
122 |
// |
|
123 |
void CPbk2ContactEditorUIAddressField::ActivateL() |
|
124 |
{ |
|
125 |
iCaptionedCtrl->ActivateL(); |
|
126 |
} |
|
127 |
||
128 |
// ----------------------------------------------------------------------------- |
|
129 |
// CPbk2ContactEditorUIAddressField::HandleCustomFieldCommandL |
|
130 |
// ----------------------------------------------------------------------------- |
|
131 |
// |
|
132 |
TBool CPbk2ContactEditorUIAddressField::HandleCustomFieldCommandL(TInt aCommand ) |
|
133 |
{ |
|
134 |
TBool ret(EFalse); |
|
135 |
MPbk2ContactEditorUiBuilderExtension* ext = |
|
136 |
static_cast<MPbk2ContactEditorUiBuilderExtension*>( |
|
137 |
iUiBuilder.ContactEditorUiBuilderExtension(KNullUid)); |
|
138 |
||
139 |
if(aCommand == EPbk2CmdEditorHandleCustomSelect) |
|
140 |
{ |
|
141 |
ret = ext->HandleCustomFieldCommandL(EPbk2CmdEditorSelectAddress); |
|
142 |
} |
|
143 |
return ret; |
|
144 |
} |
|
145 |
||
146 |
// -------------------------------------------------------------------------- |
|
147 |
// CPbk2ContactEditorUIAddressField::SetControlTextL |
|
148 |
// -------------------------------------------------------------------------- |
|
149 |
// |
|
150 |
void CPbk2ContactEditorUIAddressField::SetControlTextL(const TDesC& aText) |
|
151 |
{ |
|
152 |
iControl->SetTextL(&aText); |
|
153 |
} |
|
154 |
||
155 |
// ----------------------------------------------------------------------------- |
|
156 |
// CPbk2ContactEditorUIAddressField::ConsumesKeyEvent |
|
157 |
// ----------------------------------------------------------------------------- |
|
158 |
// |
|
159 |
TBool CPbk2ContactEditorUIAddressField::ConsumesKeyEvent |
|
160 |
( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
161 |
{ |
|
162 |
TKeyResponse keyResponse = iControl->OfferKeyEventL( aKeyEvent, aType ); |
|
163 |
||
164 |
if ( EKeyWasConsumed == keyResponse ) |
|
165 |
{ |
|
166 |
return ETrue; |
|
167 |
} |
|
168 |
||
169 |
return EFalse; |
|
170 |
} |
|
171 |
||
172 |
||
173 |
// End of File |