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