author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 11:56:55 +0300 | |
branch | RCL_3 |
changeset 74 | 6b5524b4f673 |
parent 63 | f4a778e096c2 |
child 85 | 38bb213f60ba |
permissions | -rw-r--r-- |
63 | 1 |
/* |
2 |
* Copyright (c) 2002-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 URL field. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#include "CPbk2ContactEditorUrlField.h" |
|
20 |
||
21 |
// Phonebook 2 |
|
22 |
#include <MPbk2FieldProperty.h> |
|
23 |
#include "MPbk2ContactEditorUiBuilder.h" |
|
24 |
#include <CPbk2PresentationContactField.h> |
|
25 |
||
26 |
// Virtual Phonebook |
|
27 |
#include <MVPbkContactFieldTextData.h> |
|
28 |
#include <MVPbkContactFieldUriData.h> |
|
29 |
||
30 |
// System includes |
|
31 |
#include <eikcapc.h> |
|
32 |
#include <eikedwin.h> |
|
33 |
#include <AknUtils.h> |
|
34 |
||
35 |
/// Unnamed namespace for local definitions |
|
36 |
namespace { |
|
37 |
||
38 |
// CONSTANTS |
|
39 |
_LIT(KHttp, "http://"); |
|
40 |
||
41 |
} /// namespace |
|
42 |
||
43 |
||
44 |
// -------------------------------------------------------------------------- |
|
45 |
// CPbk2ContactEditorUrlField::CPbk2ContactEditorUrlField |
|
46 |
// -------------------------------------------------------------------------- |
|
47 |
// |
|
48 |
inline CPbk2ContactEditorUrlField::CPbk2ContactEditorUrlField |
|
49 |
( CPbk2PresentationContactField& aContactField, |
|
50 |
MPbk2ContactEditorUiBuilder& aUiBuilder, |
|
51 |
CPbk2IconInfoContainer& aIconInfoContainer ) : |
|
52 |
CPbk2ContactEditorTextField( aContactField, aUiBuilder, |
|
53 |
aIconInfoContainer ) |
|
54 |
{ |
|
55 |
} |
|
56 |
||
57 |
// -------------------------------------------------------------------------- |
|
58 |
// CPbk2ContactEditorUrlField::~CPbk2ContactEditorUrlField |
|
59 |
// -------------------------------------------------------------------------- |
|
60 |
// |
|
61 |
CPbk2ContactEditorUrlField::~CPbk2ContactEditorUrlField() |
|
62 |
{ |
|
63 |
} |
|
64 |
||
65 |
// -------------------------------------------------------------------------- |
|
66 |
// CPbk2ContactEditorUrlField::NewLC |
|
67 |
// -------------------------------------------------------------------------- |
|
68 |
// |
|
69 |
CPbk2ContactEditorUrlField* CPbk2ContactEditorUrlField::NewLC |
|
70 |
( CPbk2PresentationContactField& aContactField, |
|
71 |
MPbk2ContactEditorUiBuilder& aUiBuilder, |
|
72 |
CPbk2IconInfoContainer& aIconInfoContainer ) |
|
73 |
{ |
|
74 |
CPbk2ContactEditorUrlField* self = |
|
75 |
new ( ELeave ) CPbk2ContactEditorUrlField( aContactField, aUiBuilder, |
|
76 |
aIconInfoContainer ); |
|
77 |
CleanupStack::PushL( self ); |
|
78 |
self->ConstructL(); |
|
79 |
return self; |
|
80 |
} |
|
81 |
||
82 |
// -------------------------------------------------------------------------- |
|
83 |
// CPbk2ContactEditorUrlField::ConstructL |
|
84 |
// -------------------------------------------------------------------------- |
|
85 |
// |
|
86 |
inline void CPbk2ContactEditorUrlField::ConstructL() |
|
87 |
{ |
|
88 |
// Create and insert a line in the dialog |
|
89 |
iControl = static_cast<CEikEdwin*>(iUiBuilder.CreateLineL( |
|
90 |
FieldLabel(), ControlId(), EEikCtEdwin)); |
|
91 |
||
92 |
// Control is now owned by the dialog |
|
93 |
TInt maxFieldLength = iContactField.MaxDataLength(); |
|
94 |
AknEditUtils::ConstructEditingL(iControl, maxFieldLength, |
|
95 |
maxFieldLength, EAknEditorTextCase | EAknEditorCharactersUpperCase |
|
96 |
| EAknEditorCharactersLowerCase, EAknEditorAlignLeft, |
|
97 |
ETrue, ETrue, EFalse); |
|
98 |
||
99 |
// T9 should be deactivated in all contact editors always |
|
100 |
DeactivateT9(iContactField.FieldProperty().EditMode()); |
|
101 |
||
74
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
102 |
// Enable partial screen input |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
103 |
TInt flags = iControl->AknEditorFlags(); |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
104 |
iControl->SetAknEditorFlags(flags | EAknEditorFlagEnablePartialScreen); |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
105 |
|
63 | 106 |
if (iContactField.FieldProperty().EditMode() == |
107 |
EPbk2FieldEditModeLatinOnly) |
|
108 |
{ |
|
109 |
iControl->SetAknEditorSpecialCharacterTable( |
|
110 |
R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG ); |
|
111 |
} |
|
112 |
||
113 |
switch (iContactField.FieldProperty().DefaultCase()) |
|
114 |
{ |
|
115 |
case EPbk2FieldDefaultCaseLower: |
|
116 |
{ |
|
117 |
iControl->SetAknEditorCase(EAknEditorLowerCase); |
|
118 |
break; |
|
119 |
} |
|
120 |
case EPbk2FieldDefaultCaseText: |
|
121 |
{ |
|
122 |
iControl->SetAknEditorCase(EAknEditorTextCase); |
|
123 |
break; |
|
124 |
} |
|
125 |
default: |
|
126 |
{ |
|
127 |
// Do nothing |
|
128 |
break; |
|
129 |
} |
|
130 |
} |
|
131 |
||
132 |
// Get text |
|
133 |
TPtrC text(MVPbkContactFieldTextData::Cast( |
|
134 |
iContactField.FieldData()).Text()); |
|
135 |
||
136 |
if (text.Length() == 0) |
|
137 |
{ |
|
138 |
// Insert http:// prefix to URL fields |
|
139 |
iControl->SetTextL(&KHttp()); |
|
140 |
} |
|
141 |
else |
|
142 |
{ |
|
143 |
iControl->SetTextL(&text); |
|
144 |
} |
|
145 |
||
146 |
iUiBuilder.LoadBitmapToFieldL |
|
147 |
( iContactField.FieldProperty(), iIconInfoContainer, ControlId() ); |
|
148 |
||
149 |
||
150 |
// Place cursor to the end of the line |
|
151 |
iControl->AddFlagToUserFlags(CEikEdwin::EJustAutoCurEnd); |
|
152 |
||
153 |
// CreateTextViewL() is flagged as deprecated but if it is not |
|
154 |
// called here the ActivateL() below crashes sometimes. |
|
155 |
iControl->CreateTextViewL(); |
|
156 |
iCaptionedCtrl = iUiBuilder.LineControl(ControlId()); |
|
157 |
iCaptionedCtrl->SetTakesEnterKey(EFalse); |
|
158 |
} |
|
159 |
||
160 |
// End of File |