author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:11:15 +0300 | |
branch | RCL_3 |
changeset 80 | 726fba06891a |
parent 73 | c8382f7b54ef |
permissions | -rw-r--r-- |
64 | 1 |
/* |
2 |
* Copyright (c) 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: compose view container |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
// INCLUDE FILES |
|
21 |
#include "emailtrace.h" |
|
22 |
#include <AknIconUtils.h> |
|
23 |
#include <avkon.hrh> |
|
24 |
#include <aknlists.h> |
|
25 |
#include <aknPopup.h> |
|
26 |
#include <aknbutton.h> |
|
27 |
#include <StringLoader.h> |
|
28 |
#include <eiklabel.h> |
|
29 |
#include <eikimage.h> |
|
30 |
#include <eikenv.h> |
|
31 |
#include <AknsDrawUtils.h> |
|
32 |
#include <sysutil.h> |
|
33 |
#include <AknUtils.h> |
|
34 |
#include <FreestyleEmailUi.rsg> |
|
35 |
#include <aknphysics.h> |
|
36 |
||
37 |
#include "FreestyleEmailUiAppui.h" |
|
38 |
#include "FreestyleEmailUiLayoutData.h" |
|
39 |
#include "FreestyleEmailUiLayoutHandler.h" |
|
40 |
#include "ncsaddressinputfield.h" |
|
41 |
#include "ncsconstants.h" |
|
42 |
#include "ncsaifeditor.h" |
|
43 |
#include "ncsfieldsizeobserver.h" |
|
44 |
#include "ncsutility.h" |
|
45 |
#include "ncsheadercontainer.h" |
|
46 |
#include "txtrich.h" |
|
47 |
||
48 |
// --------------------------------------------------------------------------- |
|
49 |
// constructor |
|
50 |
// --------------------------------------------------------------------------- |
|
51 |
// |
|
52 |
CNcsAddressInputField::CNcsAddressInputField( |
|
53 |
TNcsInputFieldType aFieldType, |
|
54 |
MNcsFieldSizeObserver* aSizeObserver, |
|
55 |
MNcsAddressPopupList* aAddressPopupList, |
|
56 |
CNcsHeaderContainer* aParentControl ): |
|
57 |
MNcsControl( aSizeObserver ), |
|
58 |
iParentControl( aParentControl ), |
|
59 |
iAddressPopupList( aAddressPopupList ), |
|
60 |
iFieldType( aFieldType ) |
|
61 |
{ |
|
62 |
FUNC_LOG; |
|
63 |
} |
|
64 |
||
65 |
// ----------------------------------------------------------------------------- |
|
66 |
// CNcsAddressInputField::NewL() |
|
67 |
// Two-phased constructor. |
|
68 |
// ----------------------------------------------------------------------------- |
|
69 |
// |
|
70 |
CNcsAddressInputField* CNcsAddressInputField::NewL( |
|
71 |
TInt aLabelTextId, |
|
72 |
TNcsInputFieldType aFieldType, |
|
73 |
MNcsFieldSizeObserver* aSizeObserver, |
|
74 |
MNcsAddressPopupList* aAddressPopupList, |
|
75 |
CNcsHeaderContainer* aParentControl ) |
|
76 |
{ |
|
77 |
FUNC_LOG; |
|
78 |
CNcsAddressInputField* self = new ( ELeave ) CNcsAddressInputField( |
|
79 |
aFieldType, aSizeObserver, aAddressPopupList, aParentControl ); |
|
80 |
CleanupStack::PushL( self ); |
|
81 |
self->ConstructL( aLabelTextId ); |
|
82 |
CleanupStack::Pop( self ); |
|
83 |
return self; |
|
84 |
} |
|
85 |
||
86 |
||
87 |
// ----------------------------------------------------------------------------- |
|
88 |
// CNcsAddressInputField::ConstructL() |
|
89 |
// Symbian 2nd phase constructor can leave. |
|
90 |
// ----------------------------------------------------------------------------- |
|
91 |
// |
|
92 |
void CNcsAddressInputField::ConstructL( TInt aLabelTextId ) |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
93 |
{ |
64 | 94 |
FUNC_LOG; |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
95 |
// Create label |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
96 |
//Load the label string |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
97 |
HBufC* aTextBuf = StringLoader::LoadLC( aLabelTextId ); |
64 | 98 |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
99 |
TPtrC captionText = aTextBuf ? aTextBuf->Des() : TPtrC(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
100 |
CreateControlsL( captionText ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
101 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
102 |
iTextEditor = new ( ELeave ) CNcsAifEditor( iSizeObserver, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
103 |
captionText ); |
64 | 104 |
// iTextEditor is not completely constructed until in SetContainerWindowL() |
105 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
106 |
iTextEditor->SetPopupList(iAddressPopupList); |
64 | 107 |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
108 |
CleanupStack::PopAndDestroy( aTextBuf ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
109 |
} |
64 | 110 |
|
111 |
// --------------------------------------------------------------------------- |
|
112 |
// Destructor |
|
113 |
// --------------------------------------------------------------------------- |
|
114 |
// |
|
115 |
CNcsAddressInputField::~CNcsAddressInputField() |
|
116 |
{ |
|
117 |
FUNC_LOG; |
|
118 |
delete iTextEditor; |
|
119 |
delete iButton; |
|
120 |
delete iLabel; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
121 |
// <cmail> Platform layout change |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
122 |
/*if ( iFont ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
123 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
124 |
ControlEnv()->ScreenDevice()->ReleaseFont( iFont ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
125 |
iFont = NULL; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
126 |
}</cmail>*/ |
64 | 127 |
} |
128 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
129 |
//<cmail> |
64 | 130 |
// ----------------------------------------------------------------------------- |
131 |
// CNcsHeaderContainer::CreateControlsL() |
|
132 |
// ----------------------------------------------------------------------------- |
|
133 |
// |
|
134 |
void CNcsAddressInputField::CreateControlsL( const TDesC& aControlText ) |
|
135 |
{ |
|
136 |
FUNC_LOG; |
|
137 |
if( AknLayoutUtils::PenEnabled() ) |
|
138 |
{ |
|
139 |
//Create button |
|
140 |
TRect buttRect( 10, 10, 70, 100 ); |
|
141 |
iButton = CAknButton::NewL( NULL, NULL, NULL, NULL, aControlText, TPtrC(), KAknButtonTextLeft, 0 ); |
|
142 |
iButton->SetTextColorIds( KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG63 ); |
|
143 |
iButton->SetContainerWindowL( *iParentControl ); |
|
144 |
iButton->SetObserver( this ); |
|
145 |
iButton->SetRect( buttRect ); |
|
146 |
iButton->MakeVisible( ETrue ); |
|
147 |
iButton->ActivateL(); |
|
148 |
} |
|
149 |
else |
|
150 |
{ |
|
151 |
//Create label |
|
152 |
iLabel = new ( ELeave ) CNcsLabel( *this, NULL ); |
|
153 |
iLabel->SetTextL( aControlText ); |
|
154 |
iLabel->SetBrushStyle(CWindowGc::ENullBrush); |
|
155 |
} |
|
156 |
} |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
157 |
//</cmail> |
64 | 158 |
|
159 |
// --------------------------------------------------------------------------- |
|
160 |
// SetContainerWindow |
|
161 |
// Don't construct the window dependent elements until the window |
|
162 |
// container is set |
|
163 |
// --------------------------------------------------------------------------- |
|
164 |
// |
|
165 |
void CNcsAddressInputField::SetContainerWindowL( const CCoeControl& aContainer ) |
|
166 |
{ |
|
167 |
FUNC_LOG; |
|
168 |
CCoeControl::SetContainerWindowL(aContainer); |
|
169 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
170 |
InitComponentArrayL(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
171 |
// Check if we need to construct the components |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
172 |
if (Components().Count() == 2) return; |
64 | 173 |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
174 |
// Load the controls into the compoent array |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
175 |
CCoeControlArray& controls = Components(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
176 |
controls.SetControlsOwnedExternally(ETrue); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
177 |
//<cmail> |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
178 |
if( iButton ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
179 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
180 |
controls.AppendLC( iButton ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
181 |
CleanupStack::Pop( iButton ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
182 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
183 |
else |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
184 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
185 |
controls.AppendLC( iLabel ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
186 |
CleanupStack::Pop( iLabel ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
187 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
188 |
//</cmail> |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
189 |
controls.AppendLC(iTextEditor); |
64 | 190 |
CleanupStack::Pop(iTextEditor); |
191 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
192 |
// <cmail> |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
193 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
194 |
// Setup the text editor |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
195 |
iTextEditor->ConstructL( &aContainer, KMaxAddressFieldLines, 0 ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
196 |
// </cmail> |
64 | 197 |
|
198 |
iTextEditor->SetBorder( TGulBorder::ENone ); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
199 |
iTextEditor->SetAknEditorInputMode( EAknEditorTextInputMode ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
200 |
iTextEditor->SetAknEditorFlags( EAknEditorFlagNoT9 | EAknEditorFlagUseSCTNumericCharmap ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
201 |
iTextEditor->SetAknEditorCurrentCase( EAknEditorLowerCase ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
202 |
iTextEditor->CreateScrollBarFrameL()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
64 | 203 |
iTextEditor->SetEdwinSizeObserver( this ); |
204 |
iTextEditor->SetupEditorL(); |
|
205 |
||
206 |
// Setup the label |
|
207 |
UpdateFontSize(); |
|
208 |
||
209 |
// Setup text alignment according the mirrored/normal layout. |
|
210 |
if ( AknLayoutUtils::LayoutMirrored() ) |
|
211 |
{ |
|
212 |
if( iLabel ) |
|
213 |
iLabel->SetAlignment( EHRightVCenter ); |
|
214 |
} |
|
215 |
else |
|
216 |
{ |
|
217 |
if( iLabel ) |
|
218 |
iLabel->SetAlignment( EHLeftVCenter ); |
|
219 |
} |
|
220 |
||
221 |
// this needs to be bidi as in mirrored layout |
|
222 |
// writing language left to right can be set |
|
223 |
iTextEditor->SetAlignment( EAknEditorAlignBidi ); |
|
224 |
} |
|
225 |
||
226 |
// ----------------------------------------------------------------------------- |
|
227 |
// CNcsAddressInputField::Draw() const |
|
228 |
// Draws the display |
|
229 |
// ----------------------------------------------------------------------------- |
|
230 |
// |
|
231 |
void CNcsAddressInputField::Draw( const TRect& /*aRect*/ ) const |
|
232 |
{ |
|
233 |
FUNC_LOG; |
|
234 |
} |
|
235 |
||
236 |
// ----------------------------------------------------------------------------- |
|
237 |
// CNcsAddressInputField::GetMinLabelLength() |
|
238 |
// ----------------------------------------------------------------------------- |
|
239 |
// |
|
240 |
TInt CNcsAddressInputField::GetMinLabelLength() const |
|
241 |
{ |
|
242 |
FUNC_LOG; |
|
243 |
return iLabel ? iLabel->Font()->TextWidthInPixels( *iLabel->Text() ) : 0; |
|
244 |
} |
|
245 |
||
246 |
// ----------------------------------------------------------------------------- |
|
247 |
// CNcsAddressInputField::SizeChanged() |
|
248 |
// set size |
|
249 |
// ----------------------------------------------------------------------------- |
|
250 |
// |
|
251 |
void CNcsAddressInputField::SizeChanged() |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
252 |
{ |
64 | 253 |
FUNC_LOG; |
254 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
255 |
TRect rect = Rect(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
256 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
257 |
if( AknLayoutUtils::PenEnabled() ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
258 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
259 |
LayoutTouch(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
260 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
261 |
else |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
262 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
263 |
LayoutNonTouch(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
264 |
} |
64 | 265 |
|
266 |
// This needs to be bidi as in mirrored layout |
|
267 |
// writing language left to right can be set. |
|
268 |
// Need to set here as layout sets it also to left or right. |
|
269 |
iTextEditor->SetAlignment( EAknEditorAlignBidi ); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
270 |
|
64 | 271 |
UpdateFontSize(); |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
272 |
|
64 | 273 |
if (iTextEditor->ScrollBarFrame()) |
274 |
{ |
|
275 |
TRect rc = iTextEditor->Rect(); |
|
276 |
if (AknLayoutUtils::LayoutMirrored()) |
|
277 |
{ |
|
278 |
rc.iTl.iX += iTextEditor->ScrollBarFrame()->ScrollBarBreadth(CEikScrollBar::EVertical); |
|
279 |
} |
|
280 |
else |
|
281 |
{ |
|
282 |
rc.iBr.iX -= iTextEditor->ScrollBarFrame()->ScrollBarBreadth(CEikScrollBar::EVertical); |
|
283 |
} |
|
284 |
iTextEditor->SetRect(rc); |
|
285 |
} |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
286 |
|
64 | 287 |
PositionChanged(); |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
288 |
} |
64 | 289 |
|
290 |
// ----------------------------------------------------------------------------- |
|
291 |
// CNcsHeaderContainer::PositionChanged() |
|
292 |
// set size |
|
293 |
// ----------------------------------------------------------------------------- |
|
294 |
void CNcsAddressInputField::PositionChanged() |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
295 |
{ |
64 | 296 |
FUNC_LOG; |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
297 |
|
64 | 298 |
// keep the button in view as long as possible |
299 |
if( iButton && iParentControl->IsVisible() ) |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
300 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
301 |
const TRect rect( Rect() ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
302 |
const TRect buttonRect( iButton->Rect() ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
303 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
304 |
TInt newButtonPos( iOriginalButtonPos.iY - iOriginalFieldPos.iY ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
305 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
306 |
if( rect.iTl.iY < 0 && newButtonPos + buttonRect.Height() < rect.iBr.iY ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
307 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
308 |
iButton->SetPosition( TPoint(iOriginalButtonPos.iX, newButtonPos) ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
309 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
310 |
else |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
311 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
312 |
iButton->SetPosition( TPoint(iOriginalButtonPos.iX, newButtonPos + rect.iTl.iY) ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
313 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
314 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
315 |
} |
64 | 316 |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
317 |
//<cmail> |
64 | 318 |
// ----------------------------------------------------------------------------- |
319 |
// CNcsAddressInputField::LayoutNonTouch() |
|
320 |
// |
|
321 |
// ----------------------------------------------------------------------------- |
|
322 |
// |
|
323 |
void CNcsAddressInputField::LayoutNonTouch() |
|
324 |
{ |
|
325 |
const TRect rect( Rect() ); |
|
326 |
NcsUtility::LayoutCaptionLabel( iLabel, rect ); |
|
327 |
NcsUtility::LayoutDetailEdwin( iTextEditor, rect, iEditorLineCount, EFalse ); |
|
328 |
} |
|
329 |
||
330 |
// ----------------------------------------------------------------------------- |
|
331 |
// CNcsAddressInputField::LayoutTouch() |
|
332 |
// |
|
333 |
// ----------------------------------------------------------------------------- |
|
334 |
// |
|
335 |
void CNcsAddressInputField::LayoutTouch() |
|
336 |
{ |
|
337 |
const TRect rect( Rect() ); |
|
338 |
NcsUtility::LayoutCaptionButton( iButton, rect ); |
|
339 |
NcsUtility::LayoutDetailEdwinTouch( iTextEditor, rect, iEditorLineCount, EFalse ); |
|
340 |
||
341 |
// save the original field positions so that we can the button in view |
|
342 |
iOriginalFieldPos = rect.iTl; |
|
343 |
iOriginalButtonPos = iButton->Position(); |
|
344 |
||
345 |
iTextEditor->UpdateCustomDrawer(); |
|
346 |
} |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
347 |
|
64 | 348 |
// ----------------------------------------------------------------------------- |
349 |
// CNcsAddressInputField::HandlePointerEventL() |
|
350 |
// Handles pointer events |
|
351 |
// ----------------------------------------------------------------------------- |
|
352 |
// |
|
353 |
void CNcsAddressInputField::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
354 |
{ |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
355 |
FUNC_LOG; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
356 |
iTextEditor->HandlePointerEventL(aPointerEvent); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
357 |
if( iButton ) |
64 | 358 |
{ |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
359 |
iButton->HandlePointerEventL( aPointerEvent ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
360 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
361 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
362 |
switch( aPointerEvent.iType ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
363 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
364 |
case TPointerEvent::EButton1Down: |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
365 |
{ |
64 | 366 |
// Save start position so that it can be used in |
367 |
// drag/scrolling calculations |
|
368 |
iStartPosition = aPointerEvent.iPosition; |
|
369 |
iIsDraggingStarted = EFalse; |
|
370 |
break; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
371 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
372 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
373 |
case TPointerEvent::EDrag: |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
374 |
{ |
64 | 375 |
if ( !iIsDraggingStarted && iPhysics ) |
376 |
{ |
|
377 |
TInt drag( iStartPosition.iY - aPointerEvent.iPosition.iY ); |
|
378 |
if ( Abs( drag ) > iPhysics->DragThreshold() ) |
|
379 |
{ |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
380 |
iIsDraggingStarted = ETrue; |
64 | 381 |
} |
382 |
} |
|
383 |
break; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
384 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
385 |
} |
64 | 386 |
} |
387 |
||
388 |
// ----------------------------------------------------------------------------- |
|
389 |
// CNcsAddressInputField::HandleControlEventL() |
|
390 |
// |
|
391 |
// ----------------------------------------------------------------------------- |
|
392 |
// |
|
393 |
void CNcsAddressInputField::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ) |
|
394 |
{ |
|
395 |
if( aEventType == EEventStateChanged ) |
|
396 |
{ |
|
397 |
if( aControl == iButton && !iIsDraggingStarted ) |
|
398 |
{ |
|
399 |
iParentControl->OpenPhonebookL(); |
|
400 |
} |
|
401 |
} |
|
402 |
} |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
403 |
//</cmail> |
64 | 404 |
|
405 |
// ----------------------------------------------------------------------------- |
|
406 |
// CNcsAddressInputField::OfferKeyEventL() |
|
407 |
// Handles key events |
|
408 |
// ----------------------------------------------------------------------------- |
|
409 |
// |
|
410 |
TKeyResponse |
|
411 |
CNcsAddressInputField::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
412 |
{ |
64 | 413 |
FUNC_LOG; |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
414 |
TKeyResponse ret( EKeyWasNotConsumed ); |
64 | 415 |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
416 |
if( aKeyEvent.iCode == EKeyOK ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
417 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
418 |
iTextEditor->SetCursorPosL( iTextEditor->TextLength(), EFalse ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
419 |
iTextEditor->UpdateAddressListAllL(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
420 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
421 |
else |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
422 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
423 |
ret = iTextEditor->OfferKeyEventL( aKeyEvent, aType ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
424 |
} |
64 | 425 |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
426 |
return ret; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
427 |
} |
64 | 428 |
|
429 |
// ----------------------------------------------------------------------------- |
|
430 |
// CNcsAddressInputField::FocusChanged() |
|
431 |
// ----------------------------------------------------------------------------- |
|
432 |
// |
|
433 |
void CNcsAddressInputField::FocusChanged( TDrawNow aDrawNow ) |
|
434 |
{ |
|
435 |
FUNC_LOG; |
|
436 |
if ( IsFocused() ) |
|
437 |
{ |
|
438 |
iTextEditor->SetFocus( ETrue, aDrawNow ); |
|
439 |
//TRAP_IGNORE( iTextEditor->SetCursorPosL( iTextEditor->TextLength(), EFalse ) ); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
440 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
441 |
// make sure that control is visible on screen |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
442 |
if ( Rect().iTl.iY < 0 ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
443 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
444 |
TPoint pt = TPoint( 0, 0 ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
445 |
Reposition( pt,Rect().Width() ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
446 |
iSizeObserver->UpdateFieldPosition( this ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
447 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
448 |
else |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
449 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
450 |
TPoint pos = PositionRelativeToScreen(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
451 |
pos.iY += Size().iHeight; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
452 |
CWsScreenDevice* screenDev = ControlEnv()->ScreenDevice(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
453 |
TPixelsAndRotation pix; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
454 |
screenDev->GetDefaultScreenSizeAndRotation( pix ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
455 |
const TInt h = pix.iPixelSize.iHeight; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
456 |
if ( pos.iY >= h - h / 3 ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
457 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
458 |
TPoint pt = TPoint( 0, h / 3 ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
459 |
Reposition( pt,Rect().Width() ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
460 |
iSizeObserver->UpdateFieldPosition( this ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
461 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
462 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
463 |
|
64 | 464 |
if ( iParentControl ) |
465 |
{ |
|
466 |
TRAP_IGNORE( iParentControl->SetMskL() ); |
|
467 |
} |
|
468 |
} |
|
469 |
else |
|
470 |
{ |
|
471 |
if ( iTextEditor->SelectionLength()== 0 ) |
|
472 |
{ |
|
473 |
TRAP_IGNORE( iTextEditor->HandleTextChangedL() ); |
|
474 |
} |
|
475 |
||
476 |
iTextEditor->SetFocus( EFalse ); |
|
477 |
TRAP_IGNORE( iAddressPopupList->ClosePopupContactListL() ); |
|
478 |
} |
|
479 |
||
480 |
if ( aDrawNow ) |
|
481 |
{ |
|
482 |
DrawNow(); |
|
483 |
} |
|
484 |
} |
|
485 |
||
486 |
// ----------------------------------------------------------------------------- |
|
487 |
// CNcsAddressInputField::MinimumHeight() |
|
488 |
// ----------------------------------------------------------------------------- |
|
489 |
// |
|
490 |
TInt CNcsAddressInputField::MinimumHeight() const |
|
491 |
{ |
|
492 |
FUNC_LOG; |
|
493 |
// <cmail> Platform layout changes |
|
494 |
/*TNcsMeasures m = NcsUtility::Measures(); |
|
495 |
TInt height = m.iAifHeight - m.iAifEditorHeight + iEditorMinimumHeight; |
|
496 |
TInt height2 = m.iAifHeight; |
|
497 |
return Max( height, height2 ); |
|
498 |
*/ |
|
499 |
||
500 |
//return NcsUtility::MinimumHeaderSize( Rect(), iEditorLineCount ).iHeight; |
|
501 |
// </cmail> Platform layout changes |
|
502 |
return 0; |
|
503 |
} |
|
504 |
||
505 |
// ----------------------------------------------------------------------------- |
|
506 |
// CNcsAddressInputField::HandleEdwinSizeEventL() |
|
507 |
// ----------------------------------------------------------------------------- |
|
508 |
// |
|
509 |
TBool CNcsAddressInputField::HandleEdwinSizeEventL( |
|
510 |
CEikEdwin* /*aEdwin*/, |
|
511 |
TEdwinSizeEvent /*aEventType*/, |
|
512 |
TSize aDesirableEdwinSize ) |
|
513 |
{ |
|
514 |
FUNC_LOG; |
|
515 |
// <cmail> Platform layout change |
|
516 |
/*TInt ret( EFalse ); |
|
517 |
TInt htLine = iTextEditor->GetLineHeightL(); |
|
518 |
TInt numLinesDesired = aDesirableEdwinSize.iHeight / htLine; |
|
519 |
||
520 |
if( numLinesDesired < KMaxAddressFieldLines && |
|
521 |
iEditorMinimumHeight != aDesirableEdwinSize.iHeight ) |
|
522 |
{ |
|
523 |
iEditorMinimumHeight = aDesirableEdwinSize.iHeight; |
|
524 |
||
525 |
if( iSizeObserver ) |
|
526 |
ret = iSizeObserver->UpdateFieldSizeL(); |
|
527 |
iTextEditor->CreateScrollBarFrameL()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
|
528 |
||
529 |
} |
|
530 |
else if (iEditorMinimumHeight != htLine * KMaxAddressFieldLines) |
|
531 |
{ |
|
532 |
//We may still need to resize the controll. |
|
533 |
iEditorMinimumHeight = htLine * KMaxAddressFieldLines; |
|
534 |
iTextEditor->CreateScrollBarFrameL()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOn ); |
|
535 |
if (iSizeObserver) |
|
536 |
ret = iSizeObserver->UpdateFieldSizeL(); |
|
537 |
} |
|
538 |
return ret;*/ |
|
539 |
||
540 |
TInt ret( EFalse ); |
|
541 |
TInt htLine = iTextEditor->GetLineHeightL(); |
|
542 |
TInt numLinesDesired = aDesirableEdwinSize.iHeight / htLine; |
|
543 |
// commented because of EGWG-83ECSR, no negative feedback after removing |
|
544 |
//CEikScrollBarFrame& scrollBarFrame( *iTextEditor->CreateScrollBarFrameL() ); |
|
545 |
iEditorLineCount = numLinesDesired; |
|
546 |
//scrollBarFrame.SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
|
547 |
if ( iSizeObserver ) |
|
548 |
{ |
|
549 |
ret = iSizeObserver->UpdateFieldSizeL(); |
|
550 |
} |
|
551 |
return ret; |
|
552 |
// </cmail> |
|
553 |
} |
|
554 |
||
555 |
// ----------------------------------------------------------------------------- |
|
556 |
// CNcsAddressInputField::AddAddressL() |
|
557 |
// ----------------------------------------------------------------------------- |
|
558 |
// |
|
559 |
void CNcsAddressInputField::AddAddressL( const CNcsEmailAddressObject& aAddress ) |
|
560 |
{ |
|
561 |
FUNC_LOG; |
|
562 |
iTextEditor->AddAddressL( aAddress ); |
|
563 |
} |
|
564 |
||
565 |
// ----------------------------------------------------------------------------- |
|
566 |
// CNcsAddressInputField::AddAddressL() |
|
567 |
// ----------------------------------------------------------------------------- |
|
568 |
// |
|
569 |
void CNcsAddressInputField::AddAddressL( const TDesC& aEmail ) |
|
570 |
{ |
|
571 |
FUNC_LOG; |
|
572 |
iTextEditor->AddAddressL( KNullDesC(), aEmail ); |
|
573 |
} |
|
574 |
||
575 |
// ----------------------------------------------------------------------------- |
|
576 |
// CNcsAddressInputField::SelectAllTextL() |
|
577 |
// ----------------------------------------------------------------------------- |
|
578 |
// |
|
579 |
void CNcsAddressInputField::SelectAllTextL() |
|
580 |
{ |
|
581 |
FUNC_LOG; |
|
582 |
iTextEditor->SelectAllL(); |
|
583 |
} |
|
584 |
||
585 |
// <cmail> Platform layout changes |
|
586 |
// ----------------------------------------------------------------------------- |
|
587 |
// CNcsAddressInputField::Reposition() |
|
588 |
// ----------------------------------------------------------------------------- |
|
589 |
// |
|
590 |
void CNcsAddressInputField::Reposition( TPoint& aPt, TInt /*aWidth*/ ) |
|
591 |
{ |
|
592 |
FUNC_LOG; |
|
593 |
/* |
|
594 |
TSize sz( aWidth, MinimumHeight() ); |
|
595 |
if ( Rect() != TRect( aPt, sz ) ) |
|
596 |
{ |
|
597 |
SetExtent( aPt, sz); |
|
598 |
} |
|
599 |
aPt.iY += Size().iHeight; |
|
600 |
*/ |
|
601 |
SetPosition( aPt ); |
|
602 |
// </cmail> Platform layout changes |
|
603 |
} |
|
604 |
||
605 |
// ----------------------------------------------------------------------------- |
|
606 |
// CNcsAddressInputField::GetLabelText() |
|
607 |
// ----------------------------------------------------------------------------- |
|
608 |
// |
|
609 |
const TDesC& CNcsAddressInputField::GetLabelText() const |
|
610 |
{ |
|
611 |
FUNC_LOG; |
|
612 |
return iLabel ? *iLabel->Text() : KEmptyReturnValue(); |
|
613 |
} |
|
614 |
||
615 |
// <cmail> Platform layout change |
|
616 |
// --------------------------------------------------------------------------- |
|
617 |
// CNcsAddressInputField::LayoutLineCount |
|
618 |
// --------------------------------------------------------------------------- |
|
619 |
// |
|
620 |
TInt CNcsAddressInputField::LayoutLineCount() const |
|
621 |
{ |
|
622 |
FUNC_LOG; |
|
623 |
if( iLabel && !AknLayoutUtils::PenEnabled() ) |
|
624 |
{ |
|
625 |
return ( IsVisible() ? Max( 1, iEditorLineCount ) : 0 ) + iLabel->LayoutLineCount(); |
|
626 |
} |
|
627 |
else |
|
628 |
{ |
|
629 |
return ( IsVisible() ? Max( 1, iEditorLineCount ) : 0 ); |
|
630 |
} |
|
631 |
} |
|
632 |
// </cmail> Platform layout change |
|
633 |
||
634 |
// ----------------------------------------------------------------------------- |
|
635 |
// CNcsAddressInputField::LineCount() |
|
636 |
// ----------------------------------------------------------------------------- |
|
637 |
// |
|
638 |
TInt CNcsAddressInputField::LineCount() const |
|
639 |
{ |
|
640 |
FUNC_LOG; |
|
641 |
return iTextEditor->LineCount(); |
|
642 |
} |
|
643 |
||
644 |
// ----------------------------------------------------------------------------- |
|
645 |
// CNcsAddressInputField::ScrollableLines() |
|
646 |
// ----------------------------------------------------------------------------- |
|
647 |
// |
|
648 |
TInt CNcsAddressInputField::ScrollableLines() const |
|
649 |
{ |
|
650 |
FUNC_LOG; |
|
651 |
return iTextEditor->ScrollableLines(); |
|
652 |
} |
|
653 |
||
654 |
// ----------------------------------------------------------------------------- |
|
655 |
// CNcsAddressInputField::GetNumChars() |
|
656 |
// ----------------------------------------------------------------------------- |
|
657 |
// |
|
658 |
TInt CNcsAddressInputField::GetNumChars() const |
|
659 |
{ |
|
660 |
FUNC_LOG; |
|
661 |
return iTextEditor->GetNumChars(); |
|
662 |
} |
|
663 |
||
664 |
// ----------------------------------------------------------------------------- |
|
665 |
// CNcsAddressInputField::CursorLineNumber() |
|
666 |
// ----------------------------------------------------------------------------- |
|
667 |
// |
|
668 |
TInt CNcsAddressInputField::CursorLineNumber() const |
|
669 |
{ |
|
670 |
FUNC_LOG; |
|
671 |
return iTextEditor->CursorLineNumber(); |
|
672 |
} |
|
673 |
||
674 |
// ----------------------------------------------------------------------------- |
|
675 |
// CNcsAddressInputField::CursorPosition() |
|
676 |
// ----------------------------------------------------------------------------- |
|
677 |
// |
|
678 |
TInt CNcsAddressInputField::CursorPosition() const |
|
679 |
{ |
|
680 |
FUNC_LOG; |
|
681 |
TInt pos = iTextEditor->CursorPosition(); |
|
682 |
//Add the delta between the top of the edit control |
|
683 |
//and the top of the parent control |
|
684 |
pos += iTextEditor->Rect().iTl.iY - Rect().iTl.iY ; |
|
685 |
return pos; |
|
686 |
} |
|
687 |
||
688 |
// ----------------------------------------------------------------------------- |
|
689 |
// CNcsAddressInputField::Editor() |
|
690 |
// ----------------------------------------------------------------------------- |
|
691 |
// |
|
692 |
CNcsEditor* CNcsAddressInputField::Editor() const |
|
693 |
{ |
|
694 |
FUNC_LOG; |
|
695 |
return iTextEditor; |
|
696 |
} |
|
697 |
||
698 |
// ----------------------------------------------------------------------------- |
|
699 |
// CNcsAddressInputField::IsEmpty() |
|
700 |
// ----------------------------------------------------------------------------- |
|
701 |
// |
|
702 |
TBool CNcsAddressInputField::IsEmpty() const |
|
703 |
{ |
|
704 |
FUNC_LOG; |
|
705 |
return iTextEditor->TextLength() == 0; |
|
706 |
} |
|
707 |
||
708 |
// ----------------------------------------------------------------------------- |
|
709 |
// CNcsAddressInputField::GetLookupTextLC() |
|
710 |
// ----------------------------------------------------------------------------- |
|
711 |
// |
|
712 |
HBufC* CNcsAddressInputField::GetLookupTextLC() const |
|
713 |
{ |
|
714 |
FUNC_LOG; |
|
715 |
return iTextEditor->GetLookupTextLC(); |
|
716 |
} |
|
717 |
||
718 |
// ----------------------------------------------------------------------------- |
|
719 |
// CNcsAddressInputField::GetAddressesL() |
|
720 |
// ----------------------------------------------------------------------------- |
|
721 |
// |
|
722 |
const RPointerArray<CNcsEmailAddressObject>& |
|
723 |
CNcsAddressInputField::GetAddressesL( TBool aParseNow ) |
|
724 |
{ |
|
725 |
if ( aParseNow ) |
|
726 |
{ |
|
727 |
iTextEditor->CheckAddressWhenFocusLostL(); |
|
728 |
} |
|
729 |
return iTextEditor->GetAddressesL(); |
|
730 |
} |
|
731 |
||
732 |
// ----------------------------------------------------------------------------- |
|
733 |
// CNcsAddressInputField::EmailAddressObjectBySelection() |
|
734 |
// ----------------------------------------------------------------------------- |
|
735 |
// |
|
736 |
const CNcsEmailAddressObject* CNcsAddressInputField::EmailAddressObjectBySelection() const |
|
737 |
{ |
|
738 |
FUNC_LOG; |
|
739 |
return iTextEditor->EmailAddressObjectBySelection(); |
|
740 |
} |
|
741 |
||
742 |
// ----------------------------------------------------------------------------- |
|
743 |
// CNcsAddressInputField::TextEditor() |
|
744 |
// ----------------------------------------------------------------------------- |
|
745 |
// |
|
746 |
CEikEdwin* CNcsAddressInputField::TextEditor() const |
|
747 |
{ |
|
748 |
FUNC_LOG; |
|
749 |
return iTextEditor; |
|
750 |
} |
|
751 |
||
752 |
// ----------------------------------------------------------------------------- |
|
753 |
// CNcsAddressInputField::GetLineRectL() |
|
754 |
// ----------------------------------------------------------------------------- |
|
755 |
// |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
756 |
void CNcsAddressInputField::GetLineRectL( TRect& aLineRect ) const |
64 | 757 |
{ |
758 |
FUNC_LOG; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
759 |
return iTextEditor->GetLineRectL( aLineRect ); |
64 | 760 |
} |
761 |
||
762 |
// ----------------------------------------------------------------------------- |
|
763 |
// CNcsAddressInputField::SetMaxLabelLength() |
|
764 |
// ----------------------------------------------------------------------------- |
|
765 |
// |
|
766 |
void CNcsAddressInputField::SetMaxLabelLength( TInt aMaxLength ) |
|
767 |
{ |
|
768 |
FUNC_LOG; |
|
769 |
iMaximumLabelLength = aMaxLength; |
|
770 |
} |
|
771 |
||
772 |
// ----------------------------------------------------------------------------- |
|
773 |
// CNcsAddressInputField::SetTextColorL() |
|
774 |
// ----------------------------------------------------------------------------- |
|
775 |
// |
|
776 |
void CNcsAddressInputField::SetTextColorL( TLogicalRgb aColor ) |
|
777 |
{ |
|
778 |
FUNC_LOG; |
|
779 |
iTextEditor->SetTextColorL( aColor ); |
|
780 |
} |
|
781 |
||
782 |
// ----------------------------------------------------------------------------- |
|
783 |
// CNcsAddressInputField::SetAddressesL() |
|
784 |
// ----------------------------------------------------------------------------- |
|
785 |
// |
|
786 |
void CNcsAddressInputField::SetAddressesL( const RPointerArray<CNcsEmailAddressObject>& aAddresses ) |
|
787 |
{ |
|
788 |
FUNC_LOG; |
|
789 |
iTextEditor->SetAddressesL( aAddresses ); |
|
790 |
} |
|
791 |
||
792 |
// ----------------------------------------------------------------------------- |
|
793 |
// CNcsAddressInputField::AppendAddressesL() |
|
794 |
// ----------------------------------------------------------------------------- |
|
795 |
// |
|
796 |
void CNcsAddressInputField::AppendAddressesL( const RPointerArray<CNcsEmailAddressObject>& aAddresses ) |
|
797 |
{ |
|
798 |
FUNC_LOG; |
|
799 |
iTextEditor->AppendAddressesL( aAddresses ); |
|
800 |
} |
|
801 |
||
802 |
// ----------------------------------------------------------------------------- |
|
803 |
// CNcsAddressInputField::UpdateFontSize() |
|
804 |
// ----------------------------------------------------------------------------- |
|
805 |
// |
|
806 |
void CNcsAddressInputField::UpdateFontSize() |
|
807 |
{ |
|
808 |
FUNC_LOG; |
|
809 |
// <cmail> Platform layout change |
|
810 |
/*if ( iFont ) |
|
811 |
{ |
|
812 |
ControlEnv()->ScreenDevice()->ReleaseFont( iFont ); |
|
813 |
iFont = NULL; |
|
814 |
} |
|
815 |
||
816 |
TNcsMeasures m = NcsUtility::Measures(); |
|
817 |
if ( !iFont ) |
|
818 |
{ |
|
819 |
TRAP_IGNORE( iFont = NcsUtility::GetNearestFontL(EAknLogicalFontPrimarySmallFont, m.iLabelFontHeightPx) ); |
|
820 |
}*/ |
|
821 |
CCoeControl* control = iButton ? ( CCoeControl* )iButton : ( CCoeControl* )iLabel; |
|
822 |
iFont = NcsUtility::GetLayoutFont( control->Rect(), NcsUtility::ENcsHeaderCaptionFont ); |
|
823 |
if( control == iButton ) |
|
824 |
{ |
|
825 |
iButton->SetTextFont( iFont ); |
|
826 |
} |
|
827 |
else |
|
828 |
{ |
|
829 |
iLabel->SetFont( iFont ); |
|
830 |
} |
|
831 |
iTextEditor->UpdateFontSize(); |
|
832 |
// </cmail> Platform layout change |
|
833 |
} |
|
834 |
||
835 |
// ----------------------------------------------------------------------------- |
|
836 |
// CNcsAddressInputField::HandleResourceChange() |
|
837 |
// ----------------------------------------------------------------------------- |
|
838 |
// |
|
839 |
void CNcsAddressInputField::HandleResourceChange( TInt aType ) |
|
840 |
{ |
|
841 |
FUNC_LOG; |
|
842 |
CCoeControl::HandleResourceChange( aType ); |
|
843 |
if ( aType == KAknsMessageSkinChange || |
|
844 |
aType == KEikMessageColorSchemeChange ) |
|
845 |
{ |
|
846 |
UpdateFontSize(); |
|
847 |
// <cmail> Platform layout change |
|
848 |
iTextEditor->HandleResourceChange( aType ); // CreateScrollBarFrameL()->DrawScrollBarsNow(); |
|
849 |
// </cmail> Platform layout change |
|
850 |
} |
|
851 |
} |
|
852 |
||
853 |
void CNcsAddressInputField::FixSemicolonAtTheEndL() |
|
854 |
{ |
|
855 |
FUNC_LOG; |
|
856 |
||
857 |
if ( 0 != iTextEditor->TextLength() && |
|
858 |
!iTextEditor->HasSemicolonAtTheEndL() ) |
|
859 |
{ |
|
860 |
CRichText* rt = iTextEditor->RichText(); |
|
861 |
if ( rt ) |
|
862 |
{ |
|
863 |
rt->InsertL( rt->DocumentLength(), _L(";") ); |
|
864 |
iTextEditor->SetCursorPosL( rt->DocumentLength(), EFalse ); |
|
865 |
iTextEditor->CheckAddressWhenFocusLostL(); |
|
866 |
} |
|
867 |
} |
|
868 |
} |
|
869 |
||
870 |
void CNcsAddressInputField::EnableKineticScrollingL( CAknPhysics* aPhysics ) |
|
871 |
{ |
|
872 |
iPhysics = aPhysics; |
|
873 |
iTextEditor->EnableKineticScrollingL( aPhysics ); |
|
874 |
iTextEditor->TextLayout()->RestrictScrollToTopsOfLines( ETrue ); |
|
875 |
} |
|
876 |
||
877 |
void CNcsAddressInputField::SetPhysicsEmulationOngoing( TBool aPhysOngoing ) |
|
878 |
{ |
|
879 |
iTextEditor->SetPhysicsEmulationOngoing( aPhysOngoing ); |
|
880 |
iButton->EnableFeedback( !aPhysOngoing ); |
|
881 |
} |