|
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 assign from maps field. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "CPbk2ContactEditorUIAFMField.h" |
|
19 |
|
20 // Phonebook 2 |
|
21 #include <MPbk2ContactEditorUiBuilder.h> |
|
22 #include "MPbk2ContactEditorFieldVisitor.h" |
|
23 #include "MPbk2ContactEditorUiBuilderExtension.h" |
|
24 #include "CPbk2IconInfoContainer.h" |
|
25 #include <Pbk2CommonUi.rsg> |
|
26 #include "MPbk2UIField.h" |
|
27 #include "Pbk2EditorLineIds.hrh" |
|
28 #include <Pbk2UIControls.hrh> |
|
29 #include "CPbk2ContactEditorReadonlyField.h" |
|
30 #include <Pbk2MapUIRes.rsg> |
|
31 // System includes |
|
32 #include <eikcapc.h> |
|
33 #include <eikedwin.h> |
|
34 #include <AknUtils.h> |
|
35 #include <StringLoader.h> |
|
36 |
|
37 // -------------------------------------------------------------------------- |
|
38 // CPbk2ContactEditorUIAFMField::CPbk2ContactEditorUIAFMField |
|
39 // -------------------------------------------------------------------------- |
|
40 // |
|
41 CPbk2ContactEditorUIAFMField::CPbk2ContactEditorUIAFMField |
|
42 ( MPbk2UIField* aField, |
|
43 MPbk2ContactEditorUiBuilder& aUiBuilder, |
|
44 CPbk2IconInfoContainer& aIconInfoContainer, |
|
45 TInt aCustomPosition ) : |
|
46 CPbk2ContactEditorUIFieldBase( aField, aUiBuilder, |
|
47 aIconInfoContainer, aCustomPosition ) |
|
48 { |
|
49 } |
|
50 |
|
51 // -------------------------------------------------------------------------- |
|
52 // CPbk2ContactEditorUIAFMField::~CPbk2ContactEditorUIAFMField |
|
53 // -------------------------------------------------------------------------- |
|
54 // |
|
55 CPbk2ContactEditorUIAFMField::~CPbk2ContactEditorUIAFMField() |
|
56 { |
|
57 |
|
58 } |
|
59 |
|
60 // -------------------------------------------------------------------------- |
|
61 // CPbk2ContactEditorUIAFMField::NewLC |
|
62 // -------------------------------------------------------------------------- |
|
63 // |
|
64 CPbk2ContactEditorUIAFMField* CPbk2ContactEditorUIAFMField::NewL |
|
65 ( MPbk2UIField* aField, |
|
66 MPbk2ContactEditorUiBuilder& aUiBuilder, |
|
67 CPbk2IconInfoContainer& aIconInfoContainer, |
|
68 TInt aCustomPosition ) |
|
69 { |
|
70 CPbk2ContactEditorUIAFMField* self = |
|
71 new ( ELeave ) CPbk2ContactEditorUIAFMField( aField, |
|
72 aUiBuilder, aIconInfoContainer, aCustomPosition ); |
|
73 CleanupStack::PushL( self ); |
|
74 self->ConstructL(); |
|
75 CleanupStack::Pop( self ); |
|
76 return self; |
|
77 } |
|
78 |
|
79 // -------------------------------------------------------------------------- |
|
80 // CPbk2ContactEditorUIAFMField::ConstructL |
|
81 // -------------------------------------------------------------------------- |
|
82 // |
|
83 void CPbk2ContactEditorUIAFMField::ConstructL() |
|
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_ASSIGN_FROM_MAPS_LINE)); |
|
92 iControl->InitializeL(this); |
|
93 HBufC* text = StringLoader::LoadL(R_QTN_PHOB_ADDRESS_EDITOR_ASSIGN_FROM_MAP); |
|
94 CleanupStack::PushL(text); |
|
95 SetControlTextL(text->Des()); |
|
96 CleanupStack::PopAndDestroy(text); |
|
97 iControl->CreateTextViewL(); |
|
98 iCaptionedCtrl = iUiBuilder.LineControl(ControlId()); |
|
99 iUiBuilder.TryChangeFocusL(ControlId()); |
|
100 LoadBitmapToFieldL(iField->IconId()); |
|
101 } |
|
102 |
|
103 // -------------------------------------------------------------------------- |
|
104 // CPbk2ContactEditorUIAFMField::ControlId |
|
105 // -------------------------------------------------------------------------- |
|
106 // |
|
107 TInt CPbk2ContactEditorUIAFMField::ControlId() |
|
108 { |
|
109 return EPbk2EditorLineAssignFromMaps; |
|
110 } |
|
111 |
|
112 // -------------------------------------------------------------------------- |
|
113 // CPbk2ContactEditorUIAFMField::Control |
|
114 // -------------------------------------------------------------------------- |
|
115 // |
|
116 CEikEdwin* CPbk2ContactEditorUIAFMField::Control() |
|
117 { |
|
118 return iControl; |
|
119 } |
|
120 |
|
121 // -------------------------------------------------------------------------- |
|
122 // CPbk2ContactEditorUIAFMField::ActivateL |
|
123 // -------------------------------------------------------------------------- |
|
124 // |
|
125 void CPbk2ContactEditorUIAFMField::ActivateL() |
|
126 { |
|
127 iCaptionedCtrl->ActivateL(); |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CPbk2ContactEditorUIAFMField::HandleCustomFieldCommandL |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 TBool CPbk2ContactEditorUIAFMField::HandleCustomFieldCommandL(TInt aCommand ) |
|
135 { |
|
136 TBool ret(EFalse); |
|
137 MPbk2ContactEditorUiBuilderExtension* ext = |
|
138 static_cast<MPbk2ContactEditorUiBuilderExtension*>( |
|
139 iUiBuilder.ContactEditorUiBuilderExtension(KNullUid)); |
|
140 |
|
141 if(aCommand == EPbk2CmdEditorHandleCustomSelect) |
|
142 { |
|
143 ret = ext->HandleCustomFieldCommandL(EPbk2CmdEditorSelectAssignFromMaps); |
|
144 } |
|
145 return ret; |
|
146 } |
|
147 |
|
148 // -------------------------------------------------------------------------- |
|
149 // CPbk2ContactEditorUIAFMField::SetControlTextL |
|
150 // -------------------------------------------------------------------------- |
|
151 // |
|
152 void CPbk2ContactEditorUIAFMField::SetControlTextL(const TDesC& aText) |
|
153 { |
|
154 iControl->SetTextL(&aText); |
|
155 } |
|
156 |
|
157 |
|
158 // End of File |