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 70 | 968773a0b6ef |
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 <s32mem.h> |
|
23 |
#include <txtrich.h> |
|
24 |
#include <AknIconUtils.h> |
|
25 |
#include <StringLoader.h> |
|
26 |
#include <avkon.hrh> |
|
27 |
#include <AknsDrawUtils.h> |
|
28 |
#include <aknview.h> |
|
29 |
#include <AknUtils.h> |
|
30 |
#include <FreestyleEmailUi.rsg> |
|
31 |
#include <eikclbd.h> |
|
32 |
#include <aknViewAppUi.h> |
|
33 |
#include <aknnotewrappers.h> //CAknInformationNote |
|
34 |
#include <txtetext.h> |
|
35 |
#include <aknphysics.h> |
|
36 |
||
37 |
#include "ncscomposeviewcontainer.h" |
|
38 |
#include "ncsheadercontainer.h" |
|
39 |
#include "ncsaddressinputfield.h" |
|
40 |
#include "ncssubjectfield.h" |
|
41 |
#include "ncsconstants.h" |
|
42 |
#include "ncseditor.h" |
|
43 |
#include "ncspopuplistbox.h" |
|
44 |
#include "ncscomposeview.h" |
|
45 |
#include "ncsutility.h" |
|
46 |
#include "ncsemailaddressobject.h" |
|
47 |
#include "FreestyleEmailUiUtilities.h" |
|
48 |
#include "FreestyleEmailUiConstants.h" |
|
49 |
#include "FreestyleEmailUiSendAttachmentsListControl.h" |
|
50 |
#include "FreestyleEmailUiSendAttachmentsListVisualiser.h" |
|
51 |
#include "FreestyleEmailUiSendAttachmentsListModel.h" |
|
52 |
#include "FreestyleEmailUi.hrh" |
|
53 |
#include "FSAutoSaver.h" |
|
54 |
#include "FreestyleEmailUiCLSItem.h" |
|
55 |
#include "FSAsyncTextFormatter.h" |
|
56 |
||
57 |
const TInt KHeaderVisibilityThreshold = -100; |
|
58 |
||
59 |
// ========================= MEMBER FUNCTIONS ================================== |
|
60 |
||
61 |
// --------------------------------------------------------------------------- |
|
62 |
// constructor |
|
63 |
// --------------------------------------------------------------------------- |
|
64 |
// |
|
65 |
CNcsComposeViewContainer::CNcsComposeViewContainer( |
|
66 |
CNcsComposeView& aView, |
|
67 |
CFsAutoSaver& aAutoSaver, |
|
68 |
CFSMailBox& aMailBox ): |
|
69 |
iView( aView ), iAmountMesFieldMovedUp( 0 ), |
|
70 |
iAutoSaver( aAutoSaver ), iMailBox( aMailBox ) |
|
71 |
{ |
|
72 |
FUNC_LOG; |
|
73 |
} |
|
74 |
||
75 |
// ----------------------------------------------------------------------------- |
|
76 |
// CNcsComposeViewContainer::NewL() |
|
77 |
// Two-phased constructor. |
|
78 |
// ----------------------------------------------------------------------------- |
|
79 |
// |
|
80 |
CNcsComposeViewContainer* CNcsComposeViewContainer::NewL( |
|
81 |
CNcsComposeView& aView, const TRect& aRect, CFSMailBox& aMailBox, |
|
82 |
CFsAutoSaver& aAutoSaver, TInt aFlags ) |
|
83 |
{ |
|
84 |
FUNC_LOG; |
|
85 |
||
86 |
CNcsComposeViewContainer* self = new ( ELeave ) CNcsComposeViewContainer( |
|
87 |
aView, aAutoSaver, aMailBox ); |
|
88 |
CleanupStack::PushL( self ); |
|
89 |
self->ConstructL( aRect, aFlags ); |
|
90 |
CleanupStack::Pop( self ); |
|
91 |
||
92 |
return self; |
|
93 |
} |
|
94 |
||
95 |
// ----------------------------------------------------------------------------- |
|
96 |
// CNcsComposeViewContainer::ConstructL() |
|
97 |
// Symbian 2nd phase constructor can leave. |
|
98 |
// ----------------------------------------------------------------------------- |
|
99 |
// |
|
100 |
void CNcsComposeViewContainer::ConstructL( const TRect& aRect, TInt aFlags ) |
|
101 |
{ |
|
102 |
FUNC_LOG; |
|
103 |
||
104 |
SetMopParent( &iView ); |
|
105 |
CreateWindowL(); |
|
106 |
||
107 |
if ( CAknPhysics::FeatureEnabled() ) |
|
108 |
{ |
|
109 |
iPhysics = CAknPhysics::NewL( *this, this ); |
|
110 |
} |
|
111 |
||
112 |
// Setup the control array |
|
113 |
InitComponentArrayL(); |
|
114 |
CCoeControlArray& controls = Components(); |
|
115 |
controls.SetControlsOwnedExternally( ETrue ); |
|
116 |
||
117 |
// Create the header field |
|
118 |
iHeader = CNcsHeaderContainer::NewL( *this, iMailBox, aFlags, iPhysics ); |
|
119 |
controls.AppendLC( iHeader ); |
|
120 |
CleanupStack::Pop( iHeader ); |
|
121 |
||
122 |
// Create 'message body' field, default text is empty for that field |
|
123 |
iMessageField = new ( ELeave ) CNcsEditor( this, EFalse, ENcsEditorBody ); |
|
124 |
iMessageField->SetContainerWindowL( *this ); |
|
125 |
iMessageField->ConstructL( this, 0, 0 ); |
|
126 |
iMessageField->SetAlignment( EAknEditorAlignBidi ); |
|
127 |
iMessageField->SetAknEditorInputMode( EAknEditorTextInputMode ); |
|
128 |
iMessageField->EnableKineticScrollingL( iPhysics ); |
|
129 |
controls.AppendLC( iMessageField ); |
|
130 |
CleanupStack::Pop( iMessageField ); |
|
131 |
||
132 |
iMessageField->SetNcsFontType( NcsUtility::ENcsBodytextFont ); |
|
133 |
||
134 |
// Listen edwin events and size events from message body field |
|
135 |
iMessageField->AddEdwinObserverL( this ); |
|
136 |
iMessageField->SetEdwinSizeObserver( this ); |
|
137 |
||
138 |
// Create read-only field to be used for original message quote when |
|
139 |
// protocol doesn't allow editing the original message |
|
140 |
iReadOnlyQuoteField = new( ELeave ) CNcsEditor( this, EFalse ); |
|
141 |
iReadOnlyQuoteField->SetContainerWindowL( *this ); |
|
142 |
iReadOnlyQuoteField->ConstructL( this, 0, 0 ); |
|
143 |
iReadOnlyQuoteField->SetAlignment( EAknEditorAlignBidi ); |
|
144 |
iReadOnlyQuoteField->SetReadOnly( ETrue ); |
|
145 |
controls.AppendLC( iReadOnlyQuoteField ); |
|
146 |
CleanupStack::Pop( iReadOnlyQuoteField ); |
|
147 |
||
148 |
// Listen edwin events and size events from smart quote field |
|
149 |
iReadOnlyQuoteField->AddEdwinObserverL( this ); |
|
150 |
iReadOnlyQuoteField->SetEdwinSizeObserver( this ); |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
151 |
iReadOnlyQuoteField->EnableKineticScrollingL( iPhysics ); |
64 | 152 |
|
153 |
// Create the scroll bar |
|
154 |
iScrollBar = new( ELeave ) CAknDoubleSpanScrollBar( this ); |
|
155 |
iScrollBar->ConstructL( ETrue, this, this, CEikScrollBar::EVertical, |
|
156 |
aRect.Height() ); |
|
157 |
iScrollBar->MakeVisible( EFalse ); |
|
158 |
iScrollBar->SetModelL( &iScrollBarModel ); |
|
159 |
controls.AppendLC( iScrollBar ); |
|
160 |
CleanupStack::Pop( iScrollBar ); |
|
161 |
||
162 |
iMessageField->SetupEditorL(); |
|
163 |
iReadOnlyQuoteField->SetupEditorL(); |
|
164 |
||
165 |
iBgContext = CAknsBasicBackgroundControlContext::NewL( |
|
166 |
KAknsIIDQsnBgAreaMain, Rect(), EFalse ); |
|
167 |
||
168 |
SetRect( aRect ); |
|
169 |
||
170 |
iLongTapDetector = CAknLongTapDetector::NewL( this ); |
|
171 |
||
172 |
// activate auto save functionality |
|
173 |
iAutoSaver.Enable( ETrue ); |
|
174 |
} |
|
175 |
||
176 |
// --------------------------------------------------------------------------- |
|
177 |
// CNcsComposeViewContainer::StopAsyncTextFormatter |
|
178 |
// --------------------------------------------------------------------------- |
|
179 |
// |
|
180 |
void CNcsComposeViewContainer::StopAsyncTextFormatter() |
|
181 |
{ |
|
182 |
if ( iAsyncTextFormatter ) |
|
183 |
{ |
|
184 |
iAsyncTextFormatter->Cancel(); |
|
185 |
} |
|
186 |
} |
|
187 |
||
188 |
// --------------------------------------------------------------------------- |
|
189 |
// CNcsComposeViewContainer::~CNcsComposeViewContainer |
|
190 |
// Destructor |
|
191 |
// --------------------------------------------------------------------------- |
|
192 |
// |
|
193 |
CNcsComposeViewContainer::~CNcsComposeViewContainer() |
|
194 |
{ |
|
195 |
FUNC_LOG; |
|
196 |
||
197 |
if ( iAsyncTextFormatter ) |
|
198 |
{ |
|
199 |
iAsyncTextFormatter->Cancel(); |
|
200 |
delete iAsyncTextFormatter; |
|
201 |
} |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
202 |
|
64 | 203 |
if ( iContactHandler ) |
204 |
{ |
|
205 |
iContactHandler->ClearObservers(); |
|
206 |
} |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
207 |
delete iHeader; |
64 | 208 |
delete iScrollBar; |
209 |
delete iMessageField; |
|
210 |
delete iBgContext; |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
211 |
delete iLongTapDetector; |
64 | 212 |
delete iReadOnlyQuoteField; |
213 |
delete iReadOnlyQuote; |
|
214 |
||
215 |
delete iPhysics; |
|
216 |
iPhysics = NULL; |
|
217 |
} |
|
218 |
||
219 |
||
220 |
// ----------------------------------------------------------------------------- |
|
221 |
// CNcsComposeViewContainer::FocusChanged |
|
222 |
// |
|
223 |
// ----------------------------------------------------------------------------- |
|
224 |
// |
|
225 |
void CNcsComposeViewContainer::FocusChanged( TDrawNow aDrawNow ) |
|
226 |
{ |
|
227 |
FUNC_LOG; |
|
228 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
229 |
if ( iFocused != iHeader && |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
230 |
iFocused != iMessageField && |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
231 |
iFocused != iReadOnlyQuoteField ) |
64 | 232 |
{ |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
233 |
iFocused = iHeader; |
64 | 234 |
} |
235 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
236 |
iFocused->SetFocus( IsFocused(), aDrawNow ); |
64 | 237 |
iView.HandleContainerChangeRequiringToolbarRefresh(); |
238 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
239 |
if ( aDrawNow ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
240 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
241 |
DrawNow(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
242 |
} |
64 | 243 |
} |
244 |
// ----------------------------------------------------------------------------- |
|
245 |
// CNcsComposeViewContainer::SetMskL() |
|
246 |
// |
|
247 |
// ----------------------------------------------------------------------------- |
|
248 |
// |
|
249 |
void CNcsComposeViewContainer::SetMskL() |
|
250 |
{ |
|
251 |
FUNC_LOG; |
|
252 |
iHeader->SetMskL(); |
|
253 |
} |
|
254 |
||
255 |
// ----------------------------------------------------------------------------- |
|
256 |
// CNcsComposeViewContainer::HandlePointerEventL() |
|
257 |
// |
|
258 |
// ----------------------------------------------------------------------------- |
|
259 |
// |
|
260 |
void CNcsComposeViewContainer::HandlePointerEventL( |
|
261 |
const TPointerEvent& aPointerEvent ) |
|
262 |
{ |
|
263 |
FUNC_LOG; |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
264 |
TBool clearSelection(EFalse); |
64 | 265 |
if ( aPointerEvent.iType != TPointerEvent::EButton1Down && |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
266 |
iHeader->NeedsLongTapL( aPointerEvent.iPosition ) ) |
64 | 267 |
{ |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
268 |
iLongTapDetector->PointerEventL( aPointerEvent ); |
64 | 269 |
} |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
270 |
|
64 | 271 |
switch( aPointerEvent.iType ) |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
272 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
273 |
case TPointerEvent::EButton1Down: |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
274 |
{ |
64 | 275 |
// Save current and original position so that those can be used in |
276 |
// drag/scrolling calculations |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
277 |
iPreviousPosition = iOriginalPosition = aPointerEvent.iPosition; |
64 | 278 |
iIsDragging = EFalse; |
279 |
iIsFlicking = EFalse; |
|
280 |
||
281 |
if( iPhysics ) |
|
282 |
{ |
|
283 |
iPhysics->StopPhysics(); |
|
284 |
iPhysics->ResetFriction(); |
|
285 |
iStartTime.HomeTime(); |
|
286 |
UpdatePhysicsL(); |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
287 |
} |
64 | 288 |
|
289 |
if ( iHeader->Rect().Contains( aPointerEvent.iPosition ) ) |
|
290 |
{ |
|
291 |
if ( iFocused == iMessageField ) |
|
292 |
{ |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
293 |
if( iMessageField->SelectionLength() ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
294 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
295 |
iMessageField->ClearSelectionL(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
296 |
} |
64 | 297 |
iMessageField->SetFocus( EFalse, ENoDrawNow ); |
298 |
iFocused = iHeader; |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
299 |
iHeader->SetFocus( ETrue, ENoDrawNow ); |
64 | 300 |
} |
301 |
else if ( iFocused == iReadOnlyQuoteField ) |
|
302 |
{ |
|
303 |
iReadOnlyQuoteField->SetFocus( EFalse, ENoDrawNow ); |
|
304 |
iFocused = iHeader; |
|
305 |
iHeader->SetFocus( ETrue, ENoDrawNow ); |
|
306 |
} |
|
307 |
} |
|
308 |
else if ( iReadOnlyQuoteField->Rect().Contains( |
|
309 |
aPointerEvent.iPosition ) ) |
|
310 |
{ |
|
311 |
if ( iFocused == iMessageField ) |
|
312 |
{ |
|
313 |
iMessageField->SetFocus( EFalse, ENoDrawNow ); |
|
314 |
iFocused = iReadOnlyQuoteField; |
|
315 |
iReadOnlyQuoteField->SetFocus( ETrue, ENoDrawNow ); |
|
316 |
iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
|
317 |
} |
|
318 |
else if ( iFocused == iHeader ) |
|
319 |
{ |
|
320 |
iHeader->SetFocus( EFalse, ENoDrawNow ); |
|
321 |
iFocused = iReadOnlyQuoteField; |
|
322 |
iReadOnlyQuoteField->SetFocus( ETrue, ENoDrawNow ); |
|
323 |
iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
|
324 |
} |
|
325 |
} |
|
326 |
else |
|
327 |
{ |
|
328 |
if ( iFocused == iHeader ) |
|
329 |
{ |
|
330 |
iHeader->SetFocus( EFalse, ENoDrawNow ); |
|
331 |
iFocused = iMessageField; |
|
332 |
iMessageField->SetFocus( ETrue, ENoDrawNow ); |
|
333 |
} |
|
334 |
else if ( iFocused == iReadOnlyQuoteField ) |
|
335 |
{ |
|
336 |
iReadOnlyQuoteField->SetFocus( EFalse, ENoDrawNow ); |
|
337 |
iFocused = iMessageField; |
|
338 |
iMessageField->SetFocus( ETrue, ENoDrawNow ); |
|
339 |
} |
|
340 |
else |
|
341 |
{ |
|
342 |
// Changes made in predictive input mode can be approved |
|
343 |
// only if ClearSelection is called AFTER |
|
344 |
// CCoeControl::HandlePointerEventL, |
|
345 |
// so iMessageField->ClearSelection() has been moved |
|
346 |
clearSelection = ETrue; |
|
347 |
} |
|
348 |
} |
|
349 |
||
350 |
break; |
|
351 |
} |
|
352 |
||
353 |
case TPointerEvent::EButton1Up: |
|
354 |
{ |
|
355 |
if( iIsDragging && iPhysics ) |
|
356 |
{ |
|
357 |
TPoint drag( iOriginalPosition - aPointerEvent.iPosition ); |
|
358 |
iPhysics->StartPhysics( drag, iStartTime ); |
|
359 |
iIsFlicking = ETrue; |
|
360 |
iIsDragging = EFalse; |
|
361 |
} |
|
362 |
break; |
|
363 |
} |
|
364 |
||
365 |
case TPointerEvent::EDrag: |
|
366 |
{ |
|
367 |
if ( !iIsDragging ) |
|
368 |
{ |
|
369 |
TInt drag( iOriginalPosition.iY - aPointerEvent.iPosition.iY ); |
|
370 |
if ( Abs( drag ) > iPhysics->DragThreshold() ) |
|
371 |
{ |
|
372 |
// If user started dragging, cancel hotspot actions |
|
373 |
iIsDragging = ETrue; |
|
374 |
iMessageField->SetPhysicsEmulationOngoing( ETrue ); |
|
375 |
iReadOnlyQuoteField->SetPhysicsEmulationOngoing( ETrue ); |
|
376 |
iHeader->SetPhysicsEmulationOngoing( ETrue ); |
|
377 |
} |
|
378 |
} |
|
379 |
||
380 |
// Get current pointer position |
|
381 |
TPoint position = aPointerEvent.iPosition; |
|
382 |
||
383 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
384 |
if ( iPhysics ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
385 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
386 |
if ( iIsDragging ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
387 |
{ |
64 | 388 |
TPoint delta( 0, iPreviousPosition.iY - position.iY ); |
70
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
389 |
if ( !( iMessageField->SelectionLength() || iReadOnlyQuoteField->SelectionLength() ) ) |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
390 |
iPhysics->RegisterPanningPosition( delta ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
391 |
} |
64 | 392 |
} |
393 |
else |
|
394 |
{ |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
395 |
TInt topPosition( iHeaderPos.iY - iHeader->Position().iY ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
396 |
TInt totalHeight( ContentTotalHeight() ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
397 |
TInt areaHeight( VisibleAreaHeight() ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
398 |
TInt scrollOffset( 0 ); |
64 | 399 |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
400 |
if ( totalHeight > areaHeight ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
401 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
402 |
// Calculate new scroll offset based on current and |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
403 |
// previous Y-positions |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
404 |
scrollOffset = topPosition + |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
405 |
( iPreviousPosition.iY - position.iY ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
406 |
// Ensure that thumb position is in correct range |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
407 |
scrollOffset = Max( scrollOffset, 0 ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
408 |
scrollOffset = Min( scrollOffset, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
409 |
totalHeight - areaHeight ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
410 |
} |
64 | 411 |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
412 |
Scroll( scrollOffset ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
413 |
} |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
414 |
|
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
415 |
// Save current position as previous pos for future calculations |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
416 |
iPreviousPosition = position; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
417 |
|
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
418 |
break; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
419 |
} |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
420 |
|
64 | 421 |
default: |
422 |
{ |
|
423 |
// unknown event, ignored |
|
424 |
break; |
|
425 |
} |
|
426 |
} |
|
427 |
||
428 |
if ( aPointerEvent.iType == TPointerEvent::EButton1Down && |
|
429 |
iHeader->NeedsLongTapL( aPointerEvent.iPosition ) ) |
|
430 |
{ |
|
431 |
iLongTapDetector->PointerEventL( aPointerEvent ); |
|
432 |
} |
|
433 |
||
434 |
CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
435 |
if (clearSelection) |
|
436 |
{ |
|
437 |
iMessageField->ClearSelectionL(); |
|
438 |
} |
|
439 |
} |
|
440 |
||
441 |
// ----------------------------------------------------------------------------- |
|
442 |
// CNcsComposeViewContainer::OfferKeyEventL() |
|
443 |
// Handles key events |
|
444 |
// ----------------------------------------------------------------------------- |
|
445 |
// |
|
446 |
TKeyResponse CNcsComposeViewContainer::OfferKeyEventL( |
|
447 |
const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
448 |
{ |
|
449 |
FUNC_LOG; |
|
450 |
||
451 |
if( iPhysics ) |
|
452 |
{ |
|
453 |
iPhysics->StopPhysics(); |
|
454 |
iPhysics->ResetFriction(); |
|
455 |
} |
|
456 |
||
457 |
TKeyResponse ret( EKeyWasNotConsumed ); |
|
458 |
||
459 |
//we are allowing to change MSK label |
|
460 |
SwitchChangeMskOff( EFalse ); |
|
461 |
||
462 |
if ( aKeyEvent.iCode == EKeyYes ) |
|
463 |
{ |
|
464 |
// check that at least one of the address fields has an address |
|
465 |
if ( !iHeader->AreAddressFieldsEmpty() ) |
|
466 |
{ |
|
467 |
iView.HandleCommandL( ENcsCmdSend ); |
|
468 |
} |
|
469 |
else |
|
470 |
{ |
|
471 |
AppendAddressesL(); |
|
472 |
} |
|
473 |
ret = EKeyWasConsumed; |
|
474 |
} |
|
475 |
else if ( aKeyEvent.iCode == EKeyOK ) |
|
476 |
{ |
|
477 |
if ( iHeader->IsPopupActive() ) |
|
478 |
{ |
|
479 |
DoPopupSelectL(); |
|
480 |
ret = EKeyWasConsumed; |
|
481 |
} |
|
482 |
else if ( AppendAddressesL() ) |
|
483 |
{ |
|
484 |
ret = EKeyWasConsumed; |
|
485 |
} |
|
486 |
} |
|
487 |
else if ( aKeyEvent.iScanCode == 'S' && |
|
488 |
aKeyEvent.iModifiers & EModifierCtrl && |
|
489 |
aType == EEventKey ) |
|
490 |
{ |
|
491 |
iView.HandleCommandL( ENcsCmdSaveDraft ); |
|
492 |
ret = EKeyWasConsumed; |
|
493 |
} |
|
494 |
else if ( aKeyEvent.iCode == EKeyUpArrow || |
|
495 |
aKeyEvent.iCode == EKeyDownArrow ) |
|
496 |
{ |
|
497 |
ret = iFocused->OfferKeyEventL( aKeyEvent, aType ); |
|
498 |
||
499 |
if ( ret == EKeyWasNotConsumed ) |
|
500 |
{ |
|
501 |
ret = ChangeFocusL( aKeyEvent ); |
|
502 |
} |
|
503 |
||
504 |
if ( ret != EKeyWasConsumed ) |
|
505 |
{ |
|
506 |
DrawDeferred(); |
|
507 |
} |
|
508 |
} |
|
509 |
||
510 |
if ( ret == EKeyWasNotConsumed ) |
|
511 |
{ |
|
512 |
if ( iFocused ) |
|
513 |
ret = iFocused->OfferKeyEventL( aKeyEvent, aType ); |
|
514 |
||
515 |
iView.HandleContainerChangeRequiringToolbarRefresh(); |
|
516 |
||
517 |
// Report user activity to auto saver if editor field handled the |
|
518 |
// event. In case of message field (body text), EKeyWasConsumed |
|
519 |
// condition does not come true because AknFep consumes EKeyEvent |
|
520 |
// and calls HandleEdwinEventL. This OfferKeyEventL gets only |
|
521 |
// EEventKeyUp and EEventKeyDown events. Thus, when typing body text, |
|
522 |
// autosaver is notified in HandleEdwinEventL() |
|
523 |
if ( ( ret == EKeyWasConsumed ) && ( iFocused != iMessageField ) ) |
|
524 |
{ |
|
525 |
iAutoSaver.ReportActivity(); |
|
526 |
} |
|
527 |
} |
|
528 |
||
529 |
return ret; |
|
530 |
} |
|
531 |
||
532 |
// ----------------------------------------------------------------------------- |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
533 |
// CNcsComposeViewContainer::UpdateScreenPosition() |
64 | 534 |
// If the user scrolled down in the message field |
535 |
// we want to scroll up the header and grow the message field. |
|
536 |
// ----------------------------------------------------------------------------- |
|
537 |
// |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
538 |
void CNcsComposeViewContainer::UpdateScreenPosition( |
64 | 539 |
const TUint& /*aKeyCode*/ ) |
540 |
{ |
|
541 |
FUNC_LOG; |
|
542 |
||
543 |
// get screen rectangle |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
544 |
const TRect screenRect = iCmailPaneRect; |
64 | 545 |
|
546 |
TPoint msgPos( iMessageField->Position() ); |
|
547 |
TPoint quotePos( iReadOnlyQuoteField->Position() ); |
|
548 |
||
549 |
// find out cursor position in absolute coordinates |
|
550 |
TRect lineRect; |
|
551 |
if ( iFocused == iMessageField ) |
|
552 |
{ |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
553 |
iMessageField->GetLineRect( lineRect ); |
64 | 554 |
lineRect.Move( msgPos ); |
555 |
} |
|
556 |
else if ( iFocused == iReadOnlyQuoteField ) |
|
557 |
{ |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
558 |
iReadOnlyQuoteField->GetLineRect( lineRect ); |
64 | 559 |
lineRect.Move( quotePos ); |
560 |
} |
|
561 |
else |
|
562 |
{ |
|
563 |
// This function should be used only when focus is in body or |
|
564 |
// read-only quote |
|
565 |
return; |
|
566 |
} |
|
567 |
TPoint linePos = lineRect.iTl; |
|
568 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
569 |
TInt minTargetY = screenRect.iTl.iY + lineRect.Height(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
570 |
TInt maxTargetY = screenRect.iBr.iY - lineRect.Height() * 2; |
64 | 571 |
|
572 |
TInt moveY = 0; |
|
573 |
// if cursor goes out of screen then move the controls |
|
574 |
if ( linePos.iY > maxTargetY ) |
|
575 |
{ |
|
576 |
moveY = maxTargetY - linePos.iY; |
|
577 |
} |
|
578 |
else if ( linePos.iY < minTargetY ) |
|
579 |
{ |
|
580 |
moveY = minTargetY - linePos.iY; |
|
581 |
} |
|
582 |
||
583 |
// Check we don't scroll too low |
|
584 |
if ( quotePos.iY + moveY + iReadOnlyQuoteField->Size().iHeight < |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
585 |
screenRect.iBr.iY ) |
64 | 586 |
{ |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
587 |
moveY = screenRect.iBr.iY - quotePos.iY - |
64 | 588 |
iReadOnlyQuoteField->Size().iHeight; |
589 |
} |
|
590 |
||
591 |
// Check we don't scroll too high |
|
592 |
TPoint headerPos = iHeader->Position(); |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
593 |
if ( headerPos.iY + moveY > iHeaderPos.iY ) |
64 | 594 |
{ |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
595 |
moveY = iHeaderPos.iY - headerPos.iY; |
64 | 596 |
} |
597 |
||
598 |
if ( moveY ) |
|
599 |
{ |
|
600 |
headerPos.iY += moveY; |
|
601 |
iHeader->SetPosition( headerPos ); |
|
602 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
603 |
iSeparatorLineYPos += moveY; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
604 |
|
64 | 605 |
msgPos.iY += moveY; |
606 |
iMessageField->SetPosition( msgPos ); |
|
607 |
||
608 |
quotePos.iY += moveY; |
|
609 |
iReadOnlyQuoteField->SetPosition( quotePos ); |
|
610 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
611 |
const TInt bottom = Rect().iBr.iY; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
612 |
if ( iMessageField->IsFocused() ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
613 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
614 |
iMessageField->SetCursorVisible( msgPos.iY <= bottom ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
615 |
} |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
616 |
else if ( iReadOnlyQuoteField->IsFocused() ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
617 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
618 |
iReadOnlyQuoteField->SetCursorVisible( quotePos.iY <= bottom ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
619 |
} |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
620 |
|
64 | 621 |
UpdateScrollBar(); |
622 |
} |
|
623 |
} |
|
624 |
||
625 |
// ----------------------------------------------------------------------------- |
|
626 |
// CNcsComposeViewContainer::UpdateFieldPosition |
|
627 |
// |
|
628 |
// ----------------------------------------------------------------------------- |
|
629 |
// |
|
630 |
void CNcsComposeViewContainer::UpdateFieldPosition( CCoeControl* aAnchor ) |
|
631 |
{ |
|
632 |
FUNC_LOG; |
|
633 |
||
634 |
// We may not be completely constructed |
|
635 |
if ( iHeader && iMessageField && iReadOnlyQuoteField ) |
|
636 |
{ |
|
637 |
// First, move all the controls in the header |
|
638 |
iHeader->UpdateFieldPosition( aAnchor ); |
|
639 |
||
640 |
// Then, move the body field below the header |
|
641 |
TRect headerRect = iHeader->Rect(); |
|
642 |
||
643 |
const TSize separatorSize( |
|
644 |
NcsUtility::SeparatorSizeInThisResolution() ); |
|
645 |
iSeparatorLineYPos = headerRect.iBr.iY; |
|
646 |
||
647 |
TPoint bodyPos( iMessageField->Position() ); |
|
648 |
bodyPos.iY = iSeparatorLineYPos + separatorSize.iHeight; |
|
649 |
iMessageField->SetPosition( bodyPos ); |
|
650 |
||
651 |
TPoint quotePos( iReadOnlyQuoteField->Position() ); |
|
652 |
quotePos.iY = iMessageField->Rect().iBr.iY; |
|
653 |
iReadOnlyQuoteField->SetPosition( quotePos ); |
|
654 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
655 |
const TInt bottom = Rect().iBr.iY; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
656 |
if ( iMessageField->IsFocused() ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
657 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
658 |
iMessageField->SetCursorVisible( bodyPos.iY <= bottom ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
659 |
} |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
660 |
else if ( iReadOnlyQuoteField->IsFocused() ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
661 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
662 |
iReadOnlyQuoteField->SetCursorVisible( quotePos.iY <= bottom ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
663 |
} |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
664 |
|
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
665 |
TInt scrollSpan = Max( ContentTotalHeight(), VisibleAreaHeight() + 1 ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
666 |
iScrollBarModel.SetScrollSpan( scrollSpan ); |
64 | 667 |
UpdateScrollBar(); |
668 |
DrawDeferred(); |
|
669 |
} |
|
670 |
||
671 |
} |
|
672 |
||
673 |
// ----------------------------------------------------------------------------- |
|
674 |
// CNcsComposeViewContainer::ChangeFocusL() |
|
675 |
// Handles key events |
|
676 |
// ----------------------------------------------------------------------------- |
|
677 |
// |
|
678 |
TKeyResponse CNcsComposeViewContainer::ChangeFocusL( |
|
679 |
const TKeyEvent& aKeyEvent ) |
|
680 |
{ |
|
681 |
FUNC_LOG; |
|
682 |
||
683 |
TKeyResponse ret( EKeyWasNotConsumed ); |
|
684 |
||
685 |
if ( iFocused == iReadOnlyQuoteField && aKeyEvent.iCode == EKeyUpArrow ) |
|
686 |
{ |
|
687 |
iFocused = iMessageField; |
|
688 |
iReadOnlyQuoteField->SetFocus( EFalse, ENoDrawNow ); |
|
689 |
iMessageField->SetFocus( ETrue, ENoDrawNow ); |
|
690 |
ret = EKeyWasConsumed; |
|
691 |
} |
|
692 |
else if ( iFocused == iMessageField ) |
|
693 |
{ |
|
694 |
if ( aKeyEvent.iCode == EKeyUpArrow ) |
|
695 |
{ |
|
696 |
iFocused = iHeader; |
|
697 |
iHeader->SetFocus( ETrue, ENoDrawNow ); |
|
698 |
iMessageField->SetFocus( EFalse, ENoDrawNow ); |
|
699 |
iHeader->MakeVisible( ETrue ); |
|
700 |
CommitL( EBodyField ); |
|
701 |
ret = EKeyWasConsumed; |
|
702 |
} |
|
703 |
else if ( aKeyEvent.iCode == EKeyDownArrow && |
|
704 |
iReadOnlyQuoteField->TextLength() ) |
|
705 |
{ |
|
706 |
// Focus move to read-only quote only if there is some text in it. |
|
707 |
iFocused = iReadOnlyQuoteField; |
|
708 |
iReadOnlyQuoteField->SetFocus( ETrue, ENoDrawNow ); |
|
709 |
iMessageField->SetFocus( EFalse, ENoDrawNow ); |
|
710 |
iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
|
711 |
ret = EKeyWasConsumed; |
|
712 |
} |
|
713 |
} |
|
714 |
else if ( iFocused == iHeader && aKeyEvent.iCode == EKeyDownArrow ) |
|
715 |
{ |
|
716 |
iFocused = iMessageField; |
|
717 |
iHeader->SetFocus( EFalse, ENoDrawNow ); |
|
718 |
iMessageField->SetFocus( ETrue, ENoDrawNow ); |
|
719 |
iMessageField->SetCursorPosL( 0, EFalse ); |
|
720 |
ret = EKeyWasConsumed; |
|
721 |
} |
|
722 |
||
723 |
if ( ret == EKeyWasConsumed ) |
|
724 |
{ |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
725 |
UpdateScreenPosition( aKeyEvent.iCode ); |
64 | 726 |
} |
727 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
728 |
DrawDeferred(); |
64 | 729 |
return ret; |
730 |
} |
|
731 |
||
732 |
// ----------------------------------------------------------------------------- |
|
733 |
// CNcsComposeViewContainer::UpdateFieldSizeL() |
|
734 |
// This is called through MNcsFieldSizeObserver when the rects have changed |
|
735 |
// ----------------------------------------------------------------------------- |
|
736 |
// |
|
737 |
TBool CNcsComposeViewContainer::UpdateFieldSizeL( TBool aDoScroll ) |
|
738 |
{ |
|
739 |
FUNC_LOG; |
|
740 |
||
741 |
// We may not have finished construction |
|
742 |
if ( iHeader && iMessageField && iReadOnlyQuoteField && !aDoScroll ) |
|
743 |
{ |
|
744 |
SizeChanged(); |
|
745 |
} |
|
746 |
if ( iHeader && aDoScroll ) |
|
747 |
{ |
|
748 |
iHeader->DoScroll(); |
|
749 |
} |
|
750 |
||
751 |
return EFalse; |
|
752 |
} |
|
753 |
||
754 |
// ----------------------------------------------------------------------------- |
|
755 |
// CNcsComposeViewContainer::SizeChanged() |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
756 |
// Handles container size change. |
64 | 757 |
// ----------------------------------------------------------------------------- |
758 |
// |
|
759 |
void CNcsComposeViewContainer::SizeChanged() |
|
760 |
{ |
|
761 |
FUNC_LOG; |
|
762 |
||
763 |
const TRect rect( Rect() ); |
|
764 |
iScrollBar->SetRect( NcsUtility::ListCmailScrollbarRect( rect ) ); |
|
765 |
TRect cmailPaneRect( NcsUtility::ListCmailPaneRect( rect ) ); |
|
766 |
||
767 |
const TInt headerLineCount( iHeader->LayoutLineCount() ); |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
768 |
iHeaderPos = NcsUtility::HeaderControlPosition( cmailPaneRect, 0 ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
769 |
iHeader->SetOrigin( iHeaderPos ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
770 |
const TPoint currentHeaderPos = iHeader->Position(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
771 |
if ( currentHeaderPos.iY > iHeaderPos.iY ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
772 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
773 |
cmailPaneRect.Move( 0, currentHeaderPos.iY - iHeaderPos.iY ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
774 |
} |
64 | 775 |
iCmailPaneRect = cmailPaneRect; |
776 |
||
777 |
NcsUtility::LayoutHeaderControl( |
|
778 |
iHeader, cmailPaneRect, 0, headerLineCount ); |
|
779 |
||
780 |
// do not used stored headerLineCount, because relayout above may grow or |
|
781 |
// shrink edit fields |
|
782 |
NcsUtility::LayoutBodyEdwin( |
|
783 |
iMessageField, cmailPaneRect, iHeader->LayoutLineCount(), |
|
784 |
iMessageField->LineCount(), iSeparatorLineYPos ); |
|
785 |
iMessageField->SetAlignment( EAknEditorAlignBidi ); |
|
786 |
||
787 |
// we don't need format again when format was already done |
|
788 |
// during creation of forward/reply message |
|
789 |
if ( !iSwitchOffFormattingText ) |
|
790 |
{ |
|
791 |
TRAP_IGNORE( iMessageField->FormatAllTextNowL() ); |
|
792 |
} |
|
793 |
||
794 |
iMessageField->UpdateFontSize(); |
|
795 |
||
796 |
TInt readOnlyQuoteFieldHeight( 0 ); |
|
797 |
if ( iReadOnlyQuoteField->TextLength() ) |
|
798 |
{ |
|
799 |
TInt dummySeparatorPos; |
|
800 |
NcsUtility::LayoutBodyEdwin( |
|
801 |
iReadOnlyQuoteField, cmailPaneRect, |
|
802 |
iHeader->LayoutLineCount() + iMessageField->LineCount(), |
|
803 |
iReadOnlyQuoteField->LineCount(), dummySeparatorPos ); |
|
804 |
iReadOnlyQuoteField->SetAlignment( EAknEditorAlignBidi ); |
|
805 |
// we don't need format again when format was already done |
|
806 |
// during creation of forward/reply message |
|
807 |
if ( !iSwitchOffFormattingText ) |
|
808 |
{ |
|
809 |
TRAP_IGNORE( iReadOnlyQuoteField->FormatAllTextNowL() ); |
|
810 |
} |
|
811 |
iReadOnlyQuoteField->UpdateFontSize(); |
|
812 |
readOnlyQuoteFieldHeight = iReadOnlyQuoteField->Rect().Height(); |
|
813 |
} |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
814 |
else |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
815 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
816 |
// Set quote field immediatelly bellow message field with zero height. |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
817 |
TRect quoteRect = iMessageField->Rect(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
818 |
quoteRect.iTl = quoteRect.iBr; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
819 |
iReadOnlyQuoteField->SetRect( quoteRect ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
820 |
} |
64 | 821 |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
822 |
iBgContext->SetRect( rect ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
823 |
iMessageField->SetRealRect( rect ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
824 |
iReadOnlyQuoteField->SetRealRect( rect ); |
64 | 825 |
|
826 |
TInt messageLineHeigth = |
|
827 |
NcsUtility::HeaderCaptionPaneRect( cmailPaneRect ).Height(); |
|
828 |
iSeparatorHeight = NcsUtility::SeparatorSizeInThisResolution().iHeight; |
|
829 |
iMessageEditorMinHeigth = |
|
830 |
cmailPaneRect.Height() - iHeader->Size().iHeight - |
|
831 |
iSeparatorHeight - |
|
832 |
readOnlyQuoteFieldHeight; |
|
833 |
||
834 |
iMessageEditorMinHeigth -= iMessageEditorMinHeigth % messageLineHeigth; |
|
835 |
if ( iMessageEditorMinHeigth > messageLineHeigth ) |
|
836 |
{ |
|
837 |
TSize newSize( iMessageField->Size().iWidth, |
|
838 |
Max( iMessageField->Size().iHeight, |
|
839 |
iMessageEditorMinHeigth ) ); |
|
840 |
||
841 |
if ( !iSwitchOffFormattingText ) |
|
842 |
{ |
|
843 |
iMessageField->SetSize( newSize ); |
|
844 |
} |
|
845 |
} |
|
846 |
else |
|
847 |
{ |
|
848 |
iMessageEditorMinHeigth = messageLineHeigth; |
|
849 |
} |
|
850 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
851 |
// update some layout variables |
64 | 852 |
iHeaderHeight = iHeader->Rect().Height(); |
853 |
TRect bodyRect = iMessageField->Rect(); |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
854 |
iReadOnlyQuoteField->SetPosition( |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
855 |
TPoint( bodyRect.iTl.iX, bodyRect.iBr.iY ) ); |
64 | 856 |
TRect quoteRect = iReadOnlyQuoteField->Rect(); |
857 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
858 |
iTotalComposerHeight = iHeaderHeight + iSeparatorHeight + |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
859 |
bodyRect.Height() + quoteRect.Height(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
860 |
|
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
861 |
iVisibleAreaHeight = iCmailPaneRect.Height(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
862 |
|
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
863 |
// Scroll span is set always to be larger than the window size to |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
864 |
// keep the scroll bar visible. |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
865 |
TInt scrollSpan = Max( iTotalComposerHeight, iVisibleAreaHeight + 1 ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
866 |
iScrollBarModel.SetScrollSpan( scrollSpan ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
867 |
iScrollBarModel.SetWindowSize( iVisibleAreaHeight ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
868 |
if ( iHeader->IsFocused() ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
869 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
870 |
iHeader->DoScroll(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
871 |
} |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
872 |
else |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
873 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
874 |
UpdateScreenPosition(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
875 |
} |
64 | 876 |
UpdateScrollBar(); |
877 |
DrawDeferred(); |
|
878 |
} |
|
879 |
||
880 |
// ----------------------------------------------------------------------------- |
|
881 |
// CNcsComposeViewContainer::Draw() const |
|
882 |
// Draws the display |
|
883 |
// ----------------------------------------------------------------------------- |
|
884 |
// |
|
885 |
void CNcsComposeViewContainer::Draw( const TRect& aRect ) const |
|
886 |
{ |
|
887 |
FUNC_LOG; |
|
888 |
||
889 |
CWindowGc& gc = SystemGc(); |
|
890 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
891 |
if ( skin ) |
|
892 |
{ |
|
893 |
AknsDrawUtils::Background( skin, iBgContext, this, gc, aRect ); |
|
894 |
} |
|
895 |
} |
|
896 |
||
897 |
// ----------------------------------------------------------------------------- |
|
898 |
// CNcsComposeViewContainer::SetBodyContentL() |
|
899 |
// ----------------------------------------------------------------------------- |
|
900 |
// |
|
901 |
void CNcsComposeViewContainer::SetBodyContentL( const TDesC& aMessage, |
|
902 |
const TDesC& aReadOnlyQuote ) |
|
903 |
{ |
|
904 |
FUNC_LOG; |
|
905 |
delete iReadOnlyQuote; |
|
906 |
iReadOnlyQuote = NULL; |
|
907 |
if ( aReadOnlyQuote.Length() ) |
|
908 |
{ |
|
909 |
iReadOnlyQuote = aReadOnlyQuote.AllocL(); |
|
910 |
} |
|
911 |
||
912 |
RMemReadStream inputStream( aMessage.Ptr(), aMessage.Size() ); |
|
913 |
CleanupClosePushL( inputStream ); |
|
914 |
iMessageField->RichText()->ImportTextL( 0, inputStream, |
|
915 |
CPlainText::EOrganiseByParagraph ); |
|
916 |
CleanupStack::PopAndDestroy( &inputStream ); |
|
917 |
||
918 |
// Activating the field will set the control to the end of the text |
|
919 |
iMessageField->ActivateL(); |
|
920 |
iMessageField->SetCursorPosL( 0, EFalse ); |
|
921 |
iMessageField->FormatAllTextNowL(); |
|
922 |
||
923 |
inputStream.Open( aReadOnlyQuote.Ptr(), aReadOnlyQuote.Size() ); |
|
924 |
CleanupClosePushL( inputStream ); |
|
925 |
iReadOnlyQuoteField->RichText()->ImportTextL( 0, inputStream, |
|
926 |
CPlainText::EOrganiseByParagraph ); |
|
927 |
CleanupStack::PopAndDestroy( &inputStream ); |
|
928 |
||
929 |
// Activating the field will set the control to the end of the text |
|
930 |
iReadOnlyQuoteField->ActivateL(); |
|
931 |
iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ); |
|
932 |
||
933 |
// Recalculate the size of the body field |
|
934 |
SizeChanged(); |
|
935 |
} |
|
936 |
||
937 |
// ----------------------------------------------------------------------------- |
|
938 |
// CNcsComposeViewContainer::SetBodyContentAsyncL() |
|
939 |
// ----------------------------------------------------------------------------- |
|
940 |
// |
|
941 |
void CNcsComposeViewContainer::SetBodyContentAsyncL( const TDesC& aMessage, |
|
942 |
const TDesC& aReadOnlyQuote ) |
|
943 |
{ |
|
944 |
FUNC_LOG; |
|
945 |
delete iReadOnlyQuote; |
|
946 |
iReadOnlyQuote = NULL; |
|
947 |
if ( aReadOnlyQuote.Length() ) |
|
948 |
{ |
|
949 |
iReadOnlyQuote = aReadOnlyQuote.AllocL(); |
|
950 |
} |
|
951 |
||
952 |
RMemReadStream inputStream( aMessage.Ptr(), aMessage.Size() ); |
|
953 |
CleanupClosePushL( inputStream ); |
|
954 |
iMessageField->RichText()->ImportTextL( 0, inputStream, |
|
955 |
CPlainText::EOrganiseByParagraph ); |
|
956 |
CleanupStack::PopAndDestroy( &inputStream ); |
|
957 |
||
958 |
||
959 |
// Activating the field will set the control to the end of the text |
|
960 |
iMessageField->ActivateL(); |
|
961 |
iMessageField->SetCursorPosL( 0, EFalse ); |
|
962 |
||
963 |
iProcessedField = iMessageField; |
|
964 |
||
965 |
iAsyncTextFormatter = CFSAsyncTextFormatter::NewL(); |
|
966 |
iAsyncTextFormatter->StartFormatting( iMessageField->TextLayout(), this ); |
|
967 |
||
968 |
// callback from AO: FormatAllTextCompleteL |
|
969 |
} |
|
970 |
||
971 |
// ----------------------------------------------------------------------------- |
|
972 |
// CNcsComposeViewContainer::FormatAllTextCancelled() |
|
973 |
// ----------------------------------------------------------------------------- |
|
974 |
// |
|
975 |
void CNcsComposeViewContainer::FormatAllTextCancelled() |
|
976 |
{ |
|
977 |
iView.SetBodyContentComplete(); |
|
978 |
} |
|
979 |
||
980 |
// ----------------------------------------------------------------------------- |
|
981 |
// CNcsComposeViewContainer::FormatAllTextComplete() |
|
982 |
// ----------------------------------------------------------------------------- |
|
983 |
// |
|
984 |
void CNcsComposeViewContainer::FormatAllTextComplete() |
|
985 |
{ |
|
986 |
if ( iReadOnlyQuote && iProcessedField == iMessageField ) |
|
987 |
{ |
|
988 |
iProcessedField = iReadOnlyQuoteField; |
|
989 |
if ( iReadOnlyQuote ) |
|
990 |
{ |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
991 |
TInt dummySeparatorPos; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
992 |
NcsUtility::LayoutBodyEdwin( iReadOnlyQuoteField, iCmailPaneRect, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
993 |
iHeader->LayoutLineCount() + iMessageField->LineCount(), |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
994 |
iReadOnlyQuoteField->LineCount(), dummySeparatorPos ); |
64 | 995 |
iReadOnlyQuoteField->SetAlignment( EAknEditorAlignBidi ); |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
996 |
|
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
997 |
RMemReadStream inputStream; |
64 | 998 |
inputStream.Open( iReadOnlyQuote->Ptr(), iReadOnlyQuote->Size() ); |
999 |
TRAP_IGNORE( iReadOnlyQuoteField->RichText()->ImportTextL( 0, inputStream, |
|
1000 |
CPlainText::EOrganiseByParagraph ) ); |
|
1001 |
inputStream.Close(); |
|
1002 |
||
1003 |
// Activating the field will set the control to the end of the text |
|
1004 |
TRAP_IGNORE( iReadOnlyQuoteField->ActivateL() ); |
|
1005 |
TRAP_IGNORE( iReadOnlyQuoteField->SetCursorPosL( 0, EFalse ) ); |
|
1006 |
||
1007 |
if ( !iAsyncTextFormatter ) |
|
1008 |
{ |
|
1009 |
TRAP_IGNORE( iAsyncTextFormatter = CFSAsyncTextFormatter::NewL() ); |
|
1010 |
} |
|
1011 |
iAsyncTextFormatter->StartFormatting( |
|
1012 |
iReadOnlyQuoteField->TextLayout(), this ); |
|
1013 |
} |
|
1014 |
} |
|
1015 |
else |
|
1016 |
{ |
|
1017 |
// Recalculate the size of the body field |
|
1018 |
iSwitchOffFormattingText = ETrue; |
|
1019 |
SizeChanged(); |
|
1020 |
iSwitchOffFormattingText = EFalse; |
|
1021 |
||
1022 |
iView.SetBodyContentComplete(); |
|
1023 |
} |
|
1024 |
} |
|
1025 |
||
1026 |
// ----------------------------------------------------------------------------- |
|
1027 |
// CNcsComposeViewContainer::GetBodyContentLC() |
|
1028 |
// ----------------------------------------------------------------------------- |
|
1029 |
// |
|
1030 |
HBufC* CNcsComposeViewContainer::GetBodyContentLC() |
|
1031 |
{ |
|
1032 |
FUNC_LOG; |
|
1033 |
HBufC* body = NULL; |
|
1034 |
||
1035 |
TInt messageLength = iMessageField->TextLength(); |
|
1036 |
HBufC* message = HBufC::NewLC( messageLength ); |
|
1037 |
TPtr messagePtr = message->Des(); |
|
1038 |
iMessageField->GetText( messagePtr ); |
|
1039 |
||
1040 |
CleanupStack::Pop(); |
|
1041 |
CleanupStack::PushL( message ); |
|
1042 |
messageLength = message->Length(); |
|
1043 |
||
1044 |
// Append read-only quote if present |
|
1045 |
if ( iReadOnlyQuote ) |
|
1046 |
{ |
|
1047 |
TInt quoteLength = iReadOnlyQuote->Length(); |
|
1048 |
TInt length = messageLength + KIMSLineFeed().Length() + quoteLength; |
|
1049 |
body = message->ReAllocL( length ); |
|
1050 |
CleanupStack::Pop( message ); |
|
1051 |
CleanupStack::PushL( body ); |
|
1052 |
||
1053 |
TPtr bodyPtr = body->Des(); |
|
1054 |
bodyPtr.Append( KIMSLineFeed() ); |
|
1055 |
bodyPtr.Append( *iReadOnlyQuote ); |
|
1056 |
} |
|
1057 |
else |
|
1058 |
{ |
|
1059 |
body = message; |
|
1060 |
} |
|
1061 |
||
1062 |
return body; |
|
1063 |
} |
|
1064 |
||
1065 |
// ----------------------------------------------------------------------------- |
|
1066 |
// CNcsComposeViewContainer::BodyText() |
|
1067 |
// ----------------------------------------------------------------------------- |
|
1068 |
// |
|
1069 |
CRichText& CNcsComposeViewContainer::BodyText() |
|
1070 |
{ |
|
1071 |
FUNC_LOG; |
|
1072 |
return *iMessageField->RichText(); |
|
1073 |
} |
|
1074 |
||
1075 |
// ----------------------------------------------------------------------------- |
|
1076 |
// CNcsComposeViewContainer::HandleScrollEventL() |
|
1077 |
// ----------------------------------------------------------------------------- |
|
1078 |
// |
|
1079 |
void CNcsComposeViewContainer::HandleScrollEventL( |
|
1080 |
CEikScrollBar* aScrollBar, TEikScrollEvent /*aEventType*/ ) |
|
1081 |
{ |
|
1082 |
FUNC_LOG; |
|
1083 |
||
1084 |
if( iPhysics ) |
|
1085 |
{ |
|
1086 |
iPhysics->StopPhysics(); |
|
1087 |
iPhysics->ResetFriction(); |
|
1088 |
} |
|
1089 |
||
1090 |
ClosePopupContactListL(); |
|
1091 |
||
1092 |
Scroll( aScrollBar->ThumbPosition() ); |
|
1093 |
} |
|
1094 |
||
1095 |
// ----------------------------------------------------------------------------- |
|
1096 |
// CNcsComposeViewContainer::OperationCompleteL |
|
1097 |
// ----------------------------------------------------------------------------- |
|
1098 |
// |
|
1099 |
void CNcsComposeViewContainer::OperationCompleteL( TContactHandlerCmd /*aCmd*/, |
|
1100 |
const RPointerArray<CFSEmailUiClsItem>& aContacts ) |
|
1101 |
{ |
|
1102 |
FUNC_LOG; |
|
1103 |
if ( aContacts.Count() ) |
|
1104 |
{ |
|
1105 |
RPointerArray<CNcsEmailAddressObject> ncsObjects; |
|
1106 |
CleanupResetAndDestroyClosePushL( ncsObjects ); |
|
1107 |
||
1108 |
for ( TInt i = 0 ; i < aContacts.Count() ; i++ ) |
|
1109 |
{ |
|
1110 |
CNcsEmailAddressObject* object = |
|
1111 |
CNcsEmailAddressObject::NewL( aContacts[i]->DisplayName(), |
|
1112 |
aContacts[i]->EmailAddress() ); |
|
1113 |
if ( aContacts[i]->MultipleEmails() ) |
|
1114 |
{ |
|
1115 |
||
1116 |
object->SetDisplayFull( ETrue ); |
|
1117 |
} |
|
1118 |
CleanupStack::PushL( object ); |
|
1119 |
ncsObjects.AppendL( object ); |
|
1120 |
CleanupStack::Pop( object ); |
|
1121 |
} |
|
1122 |
||
1123 |
if ( iAppendAddresses == EAppendTo ) |
|
1124 |
{ |
|
1125 |
AppendToFieldAddressesL( ncsObjects ); |
|
1126 |
} |
|
1127 |
// if Cc field is focused insert addresses in there |
|
1128 |
else if ( iAppendAddresses == EAppendCc ) |
|
1129 |
{ |
|
1130 |
AppendCcFieldAddressesL( ncsObjects ); |
|
1131 |
} |
|
1132 |
// if Bcc field is focused insert addresses in there |
|
1133 |
else if ( iAppendAddresses == EAppendBcc ) |
|
1134 |
{ |
|
1135 |
AppendBccFieldAddressesL( ncsObjects ); |
|
1136 |
} |
|
1137 |
||
1138 |
CleanupStack::PopAndDestroy( &ncsObjects ); |
|
1139 |
} |
|
1140 |
iView.HandleContainerChangeRequiringToolbarRefresh(); |
|
1141 |
} |
|
1142 |
||
1143 |
// ----------------------------------------------------------------------------- |
|
1144 |
// CNcsComposeViewContainer::OperationErrorL |
|
1145 |
// ----------------------------------------------------------------------------- |
|
1146 |
// |
|
1147 |
void CNcsComposeViewContainer::OperationErrorL( |
|
1148 |
TContactHandlerCmd, TInt /*aError*/ ) |
|
1149 |
{ |
|
1150 |
FUNC_LOG; |
|
1151 |
//Nothing to do |
|
1152 |
} |
|
1153 |
||
1154 |
// ----------------------------------------------------------------------------- |
|
1155 |
// CNcsComposeViewContainer::HandleEdwinEventL |
|
1156 |
// ----------------------------------------------------------------------------- |
|
1157 |
// |
|
1158 |
void CNcsComposeViewContainer::HandleEdwinEventL( CEikEdwin* aEdwin, |
|
1159 |
TEdwinEvent aEventType ) |
|
1160 |
{ |
|
1161 |
FUNC_LOG; |
|
1162 |
if (( aEdwin == iMessageField || aEdwin == iReadOnlyQuoteField ) && |
|
1163 |
( !iPhysics || iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionNone )) |
|
1164 |
{ |
|
1165 |
if ( aEventType == MEikEdwinObserver::EEventTextUpdate || |
|
1166 |
aEventType == MEikEdwinObserver::EEventNavigation ) |
|
1167 |
{ |
|
1168 |
iAutoSaver.ReportActivity(); |
|
1169 |
||
1170 |
// Update screen position and scroll bar when text changed |
|
1171 |
// or cursor moved |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1172 |
UpdateScreenPosition(); |
64 | 1173 |
UpdateScrollBar(); |
1174 |
DrawDeferred(); |
|
1175 |
} |
|
1176 |
} |
|
1177 |
} |
|
1178 |
||
1179 |
// ----------------------------------------------------------------------------- |
|
1180 |
// CNcsComposeViewContainer::HandleEdwinSizeEventL |
|
1181 |
// ----------------------------------------------------------------------------- |
|
1182 |
// |
|
1183 |
TBool CNcsComposeViewContainer::HandleEdwinSizeEventL( CEikEdwin* aEdwin, |
|
1184 |
TEdwinSizeEvent /*aEventType*/, TSize aDesirableEdwinSize ) |
|
1185 |
{ |
|
1186 |
FUNC_LOG; |
|
1187 |
TBool ret = ETrue; |
|
1188 |
||
1189 |
if ( aDesirableEdwinSize.iHeight < iPrevDesiredHeigth ) |
|
1190 |
{ |
|
1191 |
if ( aDesirableEdwinSize.iHeight < iMessageEditorMinHeigth ) |
|
1192 |
{ |
|
1193 |
Scroll( 0 ); |
|
1194 |
} |
|
1195 |
} |
|
1196 |
||
1197 |
if ( aEdwin == iMessageField ) |
|
1198 |
{ |
|
1199 |
if ( aDesirableEdwinSize.iHeight >= iMessageEditorMinHeigth ) |
|
1200 |
{ |
|
1201 |
if ( !iSwitchOffFormattingText ) |
|
1202 |
{ |
|
1203 |
aEdwin->SetSize( aDesirableEdwinSize ); |
|
1204 |
} |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1205 |
} |
64 | 1206 |
} |
1207 |
else |
|
1208 |
{ |
|
1209 |
if ( !iSwitchOffFormattingText ) |
|
1210 |
{ |
|
1211 |
aEdwin->SetSize( aDesirableEdwinSize ); |
|
1212 |
} |
|
1213 |
} |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1214 |
|
64 | 1215 |
if ( aEdwin == iMessageField ) |
1216 |
{ |
|
1217 |
// move the quote field below the body field |
|
1218 |
TPoint quotePos = iMessageField->Position(); |
|
1219 |
quotePos.iY += iMessageField->Size().iHeight; |
|
1220 |
iReadOnlyQuoteField->SetPosition( quotePos ); |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1221 |
UpdateScreenPosition(); |
64 | 1222 |
} |
1223 |
||
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1224 |
// Update scroll span and position. |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1225 |
TInt scrollSpan = Max( ContentTotalHeight(), VisibleAreaHeight() + 1 ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1226 |
iScrollBarModel.SetScrollSpan( scrollSpan ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1227 |
UpdateScrollBar(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1228 |
|
64 | 1229 |
iPrevDesiredHeigth = aDesirableEdwinSize.iHeight; |
1230 |
||
1231 |
return ret; |
|
1232 |
} |
|
1233 |
||
1234 |
// ----------------------------------------------------------------------------- |
|
1235 |
// CNcsComposeViewContainer::MopSupplyObject |
|
1236 |
// From CCoeControl. |
|
1237 |
// ----------------------------------------------------------------------------- |
|
1238 |
// |
|
1239 |
TTypeUid::Ptr CNcsComposeViewContainer::MopSupplyObject( TTypeUid aId ) |
|
1240 |
{ |
|
1241 |
FUNC_LOG; |
|
1242 |
if ( aId.iUid == MAknsControlContext::ETypeId ) |
|
1243 |
{ |
|
1244 |
return MAknsControlContext::SupplyMopObject( aId, iBgContext ); |
|
1245 |
} |
|
1246 |
return CCoeControl::MopSupplyObject( aId ); |
|
1247 |
} |
|
1248 |
||
1249 |
// ----------------------------------------------------------------------------- |
|
1250 |
// CNcsComposeViewContainer::UpdateScrollBar() |
|
1251 |
// ----------------------------------------------------------------------------- |
|
1252 |
// |
|
1253 |
void CNcsComposeViewContainer::UpdateScrollBar() |
|
1254 |
{ |
|
1255 |
FUNC_LOG; |
|
1256 |
||
1257 |
TRect headerRect = iHeader->Rect(); |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1258 |
TInt visiblePosition = iHeaderPos.iY - headerRect.iTl.iY; |
64 | 1259 |
|
1260 |
iScrollBarModel.SetFocusPosition( visiblePosition ); |
|
1261 |
||
1262 |
iScrollBar->SetModel( &iScrollBarModel ); |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1263 |
iScrollBar->MakeVisible( !iHeader->IsPopupActive() ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1264 |
} |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1265 |
|
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1266 |
// ----------------------------------------------------------------------------- |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1267 |
// CNcsComposeViewContainer::UpdateScrollBarVisibility() |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1268 |
// ----------------------------------------------------------------------------- |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1269 |
// |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1270 |
void CNcsComposeViewContainer::UpdateScrollBarVisibility( TBool aVisible ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1271 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1272 |
FUNC_LOG; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1273 |
iScrollBar->MakeVisible( aVisible ); |
64 | 1274 |
} |
1275 |
||
1276 |
// ----------------------------------------------------------------------------- |
|
1277 |
// CNcsComposeViewContainer::SetFocusToMessageFieldL() |
|
1278 |
// ----------------------------------------------------------------------------- |
|
1279 |
// |
|
1280 |
void CNcsComposeViewContainer::SetFocusToMessageFieldL() |
|
1281 |
{ |
|
1282 |
FUNC_LOG; |
|
1283 |
||
1284 |
if( iFocused != iMessageField ) |
|
1285 |
{ |
|
1286 |
iHeader->SetFocus( EFalse, ENoDrawNow ); |
|
1287 |
iMessageField->SetCursorPosL( 0, EFalse ); |
|
1288 |
iMessageField->SetFocus( ETrue, ENoDrawNow ); |
|
1289 |
iFocused = iMessageField; |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1290 |
UpdateScreenPosition(); |
64 | 1291 |
DrawDeferred(); |
1292 |
} |
|
1293 |
} |
|
1294 |
||
1295 |
// ----------------------------------------------------------------------------- |
|
1296 |
// CNcsComposeViewContainer::AddQuickTextL() |
|
1297 |
// ----------------------------------------------------------------------------- |
|
1298 |
// |
|
1299 |
void CNcsComposeViewContainer::AddQuickTextL( const TDesC& aText ) |
|
1300 |
{ |
|
1301 |
FUNC_LOG; |
|
1302 |
||
1303 |
// If in 'To' field, go to msg. field |
|
1304 |
if( !iMessageField->IsFocused() ) |
|
1305 |
{ |
|
1306 |
SetFocusToMessageFieldL(); |
|
1307 |
} |
|
1308 |
TInt pos = iMessageField->CursorPos(); |
|
1309 |
TCursorSelection selIns( pos, pos ); |
|
1310 |
iMessageField->InsertDeleteCharsL( pos, aText, selIns ); |
|
1311 |
// Fix for error EFTG-7Y63XG, moving cursor to the end of inserted text |
|
1312 |
pos += aText.Length(); |
|
1313 |
iMessageField->SetCursorPosL( pos, EFalse ); |
|
1314 |
DrawDeferred(); |
|
1315 |
||
1316 |
} |
|
1317 |
||
1318 |
// ----------------------------------------------------------------------------- |
|
1319 |
// CNcsComposeViewContainer::SelectAllToFieldTextL |
|
1320 |
// |
|
1321 |
// ----------------------------------------------------------------------------- |
|
1322 |
// |
|
1323 |
void CNcsComposeViewContainer::SelectAllToFieldTextL() |
|
1324 |
{ |
|
1325 |
FUNC_LOG; |
|
1326 |
||
1327 |
iHeader->SelectAllToFieldTextL(); |
|
1328 |
||
1329 |
} |
|
1330 |
||
1331 |
// ----------------------------------------------------------------------------- |
|
1332 |
// CNcsComposeViewContainer::SelectAllCcFieldTextL |
|
1333 |
// |
|
1334 |
// ----------------------------------------------------------------------------- |
|
1335 |
// |
|
1336 |
void CNcsComposeViewContainer::SelectAllCcFieldTextL() |
|
1337 |
{ |
|
1338 |
FUNC_LOG; |
|
1339 |
||
1340 |
iHeader->SelectAllCcFieldTextL(); |
|
1341 |
||
1342 |
} |
|
1343 |
||
1344 |
// ----------------------------------------------------------------------------- |
|
1345 |
// CNcsComposeViewContainer::SelectAllBccFieldTextL |
|
1346 |
// |
|
1347 |
// ----------------------------------------------------------------------------- |
|
1348 |
// |
|
1349 |
void CNcsComposeViewContainer::SelectAllBccFieldTextL() |
|
1350 |
{ |
|
1351 |
FUNC_LOG; |
|
1352 |
||
1353 |
iHeader->SelectAllBccFieldTextL(); |
|
1354 |
||
1355 |
} |
|
1356 |
||
1357 |
// ----------------------------------------------------------------------------- |
|
1358 |
// CNcsComposeViewContainer::SelectAllSubjectFieldTextL |
|
1359 |
// |
|
1360 |
// ----------------------------------------------------------------------------- |
|
1361 |
// |
|
1362 |
void CNcsComposeViewContainer::SelectAllSubjectFieldTextL() |
|
1363 |
{ |
|
1364 |
FUNC_LOG; |
|
1365 |
||
1366 |
iHeader->SelectAllSubjectFieldTextL(); |
|
1367 |
||
1368 |
} |
|
1369 |
||
1370 |
// ----------------------------------------------------------------------------- |
|
1371 |
// CNcsComposeViewContainer::IsSubjectFieldEmpty |
|
1372 |
// |
|
1373 |
// ----------------------------------------------------------------------------- |
|
1374 |
// |
|
1375 |
TBool CNcsComposeViewContainer::IsSubjectFieldEmpty() |
|
1376 |
{ |
|
1377 |
FUNC_LOG; |
|
1378 |
return iHeader->IsSubjectFieldEmpty(); |
|
1379 |
} |
|
1380 |
||
1381 |
// ----------------------------------------------------------------------------- |
|
1382 |
// CNcsComposeViewContainer::AppendAddressesL |
|
1383 |
// |
|
1384 |
// ----------------------------------------------------------------------------- |
|
1385 |
// |
|
1386 |
TBool CNcsComposeViewContainer::AppendAddressesL() |
|
1387 |
{ |
|
1388 |
FUNC_LOG; |
|
1389 |
||
1390 |
iContactHandler = CFsDelayedLoader::InstanceL()->GetContactHandlerL(); |
|
1391 |
if ( iContactHandler ) |
|
1392 |
{ |
|
1393 |
iContactHandler->GetAddressesFromPhonebookL( this ); |
|
1394 |
} |
|
1395 |
||
1396 |
if ( IsFocusCc() ) |
|
1397 |
{ |
|
1398 |
iAppendAddresses = EAppendCc; |
|
1399 |
} |
|
1400 |
else if ( IsFocusBcc() ) |
|
1401 |
{ |
|
1402 |
iAppendAddresses = EAppendBcc; |
|
1403 |
} |
|
1404 |
else |
|
1405 |
{ |
|
1406 |
iAppendAddresses = EAppendTo; |
|
1407 |
} |
|
1408 |
||
1409 |
return ETrue; |
|
1410 |
} |
|
1411 |
||
1412 |
// ----------------------------------------------------------------------------- |
|
1413 |
// CNcsComposeViewContainer::HandleAttachmentsOpenCommand |
|
1414 |
// If attachment header field is focused and open key is pressed |
|
1415 |
// ----------------------------------------------------------------------------- |
|
1416 |
// |
|
1417 |
void CNcsComposeViewContainer::HandleAttachmentsOpenCommandL() |
|
1418 |
{ |
|
1419 |
FUNC_LOG; |
|
1420 |
||
1421 |
iView.HandleCommandL( EFsEmailUiCmdOpenAttachment ); |
|
1422 |
||
1423 |
} |
|
1424 |
||
1425 |
// ----------------------------------------------------------------------------- |
|
1426 |
// CNcsComposeViewContainer::LaunchStylusPopupMenu |
|
1427 |
// Called when long tap happens in the attachments field |
|
1428 |
// ----------------------------------------------------------------------------- |
|
1429 |
// |
|
1430 |
void CNcsComposeViewContainer::LaunchStylusPopupMenu( const TPoint& aPenEventScreenLocation ) |
|
1431 |
{ |
|
1432 |
FUNC_LOG; |
|
1433 |
iView.LaunchStylusPopupMenu( aPenEventScreenLocation ); |
|
1434 |
} |
|
1435 |
||
1436 |
// ----------------------------------------------------------------------------- |
|
1437 |
// CNcsComposeViewContainer::GetToFieldAddressesL |
|
1438 |
// |
|
1439 |
// ----------------------------------------------------------------------------- |
|
1440 |
// |
|
1441 |
const RPointerArray<CNcsEmailAddressObject>& |
|
1442 |
CNcsComposeViewContainer::GetToFieldAddressesL( TBool aParseNow ) |
|
1443 |
{ |
|
1444 |
return iHeader->GetToFieldAddressesL( aParseNow ); |
|
1445 |
} |
|
1446 |
||
1447 |
// ----------------------------------------------------------------------------- |
|
1448 |
// CNcsComposeViewContainer::GetCcFieldAddressesL |
|
1449 |
// |
|
1450 |
// ----------------------------------------------------------------------------- |
|
1451 |
// |
|
1452 |
const RPointerArray<CNcsEmailAddressObject>& |
|
1453 |
CNcsComposeViewContainer::GetCcFieldAddressesL( TBool aParseNow ) |
|
1454 |
{ |
|
1455 |
return iHeader->GetCcFieldAddressesL( aParseNow ); |
|
1456 |
} |
|
1457 |
||
1458 |
// ----------------------------------------------------------------------------- |
|
1459 |
// CNcsComposeViewContainer::GetBccFieldAddressesL |
|
1460 |
// |
|
1461 |
// ----------------------------------------------------------------------------- |
|
1462 |
// |
|
1463 |
const RPointerArray<CNcsEmailAddressObject>& |
|
1464 |
CNcsComposeViewContainer::GetBccFieldAddressesL( TBool aParseNow ) |
|
1465 |
{ |
|
1466 |
return iHeader->GetBccFieldAddressesL( aParseNow ); |
|
1467 |
} |
|
1468 |
||
1469 |
// ----------------------------------------------------------------------------- |
|
1470 |
// CNcsComposeViewContainer::GetSubjectLC |
|
1471 |
// |
|
1472 |
// ----------------------------------------------------------------------------- |
|
1473 |
// |
|
1474 |
HBufC* CNcsComposeViewContainer::GetSubjectLC() const |
|
1475 |
{ |
|
1476 |
FUNC_LOG; |
|
1477 |
return iHeader->GetSubjectLC(); |
|
1478 |
} |
|
1479 |
||
1480 |
// ----------------------------------------------------------------------------- |
|
1481 |
// CNcsComposeViewContainer::IsBccFieldVisible |
|
1482 |
// |
|
1483 |
// ----------------------------------------------------------------------------- |
|
1484 |
// |
|
1485 |
TBool CNcsComposeViewContainer::IsBccFieldVisible() const |
|
1486 |
{ |
|
1487 |
FUNC_LOG; |
|
1488 |
return iHeader->IsBccFieldVisible(); |
|
1489 |
} |
|
1490 |
||
1491 |
// ----------------------------------------------------------------------------- |
|
1492 |
// CNcsComposeViewContainer::IsCcFieldVisible |
|
1493 |
// |
|
1494 |
// ----------------------------------------------------------------------------- |
|
1495 |
// |
|
1496 |
TBool CNcsComposeViewContainer::IsCcFieldVisible() const |
|
1497 |
{ |
|
1498 |
FUNC_LOG; |
|
1499 |
return iHeader->IsCcFieldVisible(); |
|
1500 |
} |
|
1501 |
||
1502 |
||
1503 |
// ----------------------------------------------------------------------------- |
|
1504 |
// CNcsComposeViewContainer::IsFocusAttachments |
|
1505 |
// |
|
1506 |
// ----------------------------------------------------------------------------- |
|
1507 |
// |
|
1508 |
TBool CNcsComposeViewContainer::IsFocusAttachments() const |
|
1509 |
{ |
|
1510 |
FUNC_LOG; |
|
1511 |
return iHeader->IsFocusAttachments(); |
|
1512 |
} |
|
1513 |
||
1514 |
// ----------------------------------------------------------------------------- |
|
1515 |
// CNcsComposeViewContainer::IsFocusTo |
|
1516 |
// |
|
1517 |
// ----------------------------------------------------------------------------- |
|
1518 |
// |
|
1519 |
TBool CNcsComposeViewContainer::IsFocusTo() const |
|
1520 |
{ |
|
1521 |
FUNC_LOG; |
|
1522 |
return iHeader->IsFocusTo(); |
|
1523 |
} |
|
1524 |
||
1525 |
// ----------------------------------------------------------------------------- |
|
1526 |
// CNcsComposeViewContainer::IsFocusCc |
|
1527 |
// |
|
1528 |
// ----------------------------------------------------------------------------- |
|
1529 |
// |
|
1530 |
TBool CNcsComposeViewContainer::IsFocusCc() const |
|
1531 |
{ |
|
1532 |
FUNC_LOG; |
|
1533 |
return iHeader->IsFocusCc(); |
|
1534 |
} |
|
1535 |
||
1536 |
// ----------------------------------------------------------------------------- |
|
1537 |
// CNcsComposeViewContainer::IsFocusBcc |
|
1538 |
// |
|
1539 |
// ----------------------------------------------------------------------------- |
|
1540 |
// |
|
1541 |
TBool CNcsComposeViewContainer::IsFocusBcc() const |
|
1542 |
{ |
|
1543 |
FUNC_LOG; |
|
1544 |
return iHeader->IsFocusBcc(); |
|
1545 |
} |
|
1546 |
||
1547 |
// ----------------------------------------------------------------------------- |
|
1548 |
// CNcsComposeViewContainer::GetCcFieldLength |
|
1549 |
// |
|
1550 |
// ----------------------------------------------------------------------------- |
|
1551 |
// |
|
1552 |
TInt CNcsComposeViewContainer::GetCcFieldLength() const |
|
1553 |
{ |
|
1554 |
FUNC_LOG; |
|
1555 |
return iHeader->GetCcFieldLength(); |
|
1556 |
} |
|
1557 |
||
1558 |
// ----------------------------------------------------------------------------- |
|
1559 |
// CNcsComposeViewContainer::GetBccFieldLength |
|
1560 |
// |
|
1561 |
// ----------------------------------------------------------------------------- |
|
1562 |
// |
|
1563 |
TInt CNcsComposeViewContainer::GetBccFieldLength() const |
|
1564 |
{ |
|
1565 |
FUNC_LOG; |
|
1566 |
return iHeader->GetBccFieldLength(); |
|
1567 |
} |
|
1568 |
||
1569 |
// ----------------------------------------------------------------------------- |
|
1570 |
// CNcsComposeViewContainer::GetToFieldLength |
|
1571 |
// |
|
1572 |
// ----------------------------------------------------------------------------- |
|
1573 |
// |
|
1574 |
TInt CNcsComposeViewContainer::GetToFieldLength() const |
|
1575 |
{ |
|
1576 |
FUNC_LOG; |
|
1577 |
return iHeader->GetToFieldLength(); |
|
1578 |
} |
|
1579 |
||
1580 |
// ----------------------------------------------------------------------------- |
|
1581 |
// CNcsComposeViewContainer::GetSubjectFieldLength |
|
1582 |
// |
|
1583 |
// ----------------------------------------------------------------------------- |
|
1584 |
// |
|
1585 |
TInt CNcsComposeViewContainer::GetSubjectFieldLength() const |
|
1586 |
{ |
|
1587 |
FUNC_LOG; |
|
1588 |
return iHeader->GetSubjectFieldLength(); |
|
1589 |
} |
|
1590 |
||
1591 |
// ----------------------------------------------------------------------------- |
|
1592 |
// CNcsComposeViewContainer::GetMessageFieldLength |
|
1593 |
// |
|
1594 |
// ----------------------------------------------------------------------------- |
|
1595 |
// |
|
1596 |
TInt CNcsComposeViewContainer::GetMessageFieldLength() const |
|
1597 |
{ |
|
1598 |
FUNC_LOG; |
|
1599 |
return iMessageField->TextLength(); |
|
1600 |
} |
|
1601 |
||
1602 |
// ----------------------------------------------------------------------------- |
|
1603 |
// CNcsComposeViewContainer::GetAttachmentCount |
|
1604 |
// |
|
1605 |
// ----------------------------------------------------------------------------- |
|
1606 |
// |
|
1607 |
TInt CNcsComposeViewContainer::GetAttachmentCount() const |
|
1608 |
{ |
|
1609 |
FUNC_LOG; |
|
1610 |
TInt count = iView.AttachmentsListControl()->Model()->Count(); |
|
1611 |
return count; |
|
1612 |
} |
|
1613 |
||
1614 |
// ----------------------------------------------------------------------------- |
|
1615 |
// CNcsComposeViewContainer::HasRemoteAttachments |
|
1616 |
// |
|
1617 |
// ----------------------------------------------------------------------------- |
|
1618 |
// |
|
1619 |
TBool CNcsComposeViewContainer::HasRemoteAttachments() const |
|
1620 |
{ |
|
1621 |
FUNC_LOG; |
|
1622 |
TBool ret = iView.AttachmentsListControl()->Model()->HasRemoteAttachments(); |
|
1623 |
return ret; |
|
1624 |
} |
|
1625 |
||
1626 |
// ----------------------------------------------------------------------------- |
|
1627 |
// CNcsComposeViewContainer::GetLookupTextLC |
|
1628 |
// |
|
1629 |
// ----------------------------------------------------------------------------- |
|
1630 |
// |
|
1631 |
HBufC* CNcsComposeViewContainer::GetLookupTextLC() const |
|
1632 |
{ |
|
1633 |
FUNC_LOG; |
|
1634 |
return iHeader->GetLookupTextLC(); |
|
1635 |
} |
|
1636 |
||
1637 |
// ----------------------------------------------------------------------------- |
|
1638 |
// CNcsComposeViewContainer::GetToFieldSelectionLength |
|
1639 |
// |
|
1640 |
// ----------------------------------------------------------------------------- |
|
1641 |
// |
|
1642 |
TInt CNcsComposeViewContainer::GetToFieldSelectionLength() const |
|
1643 |
{ |
|
1644 |
FUNC_LOG; |
|
1645 |
return iHeader->GetToFieldSelectionLength(); |
|
1646 |
} |
|
1647 |
||
1648 |
// ----------------------------------------------------------------------------- |
|
1649 |
// CNcsComposeViewContainer::GetCcFieldSelectionLength |
|
1650 |
// |
|
1651 |
// ----------------------------------------------------------------------------- |
|
1652 |
// |
|
1653 |
TInt CNcsComposeViewContainer::GetCcFieldSelectionLength() const |
|
1654 |
{ |
|
1655 |
FUNC_LOG; |
|
1656 |
return iHeader->GetCcFieldSelectionLength(); |
|
1657 |
} |
|
1658 |
||
1659 |
// ----------------------------------------------------------------------------- |
|
1660 |
// CNcsComposeViewContainer::GetBccFieldSelectionLength |
|
1661 |
// |
|
1662 |
// ----------------------------------------------------------------------------- |
|
1663 |
// |
|
1664 |
TInt CNcsComposeViewContainer::GetBccFieldSelectionLength() const |
|
1665 |
{ |
|
1666 |
FUNC_LOG; |
|
1667 |
return iHeader->GetBccFieldSelectionLength(); |
|
1668 |
} |
|
1669 |
||
1670 |
// ----------------------------------------------------------------------------- |
|
1671 |
// CNcsComposeViewContainer::SetMenuBar |
|
1672 |
// |
|
1673 |
// ----------------------------------------------------------------------------- |
|
1674 |
// |
|
1675 |
void CNcsComposeViewContainer::SetMenuBar( CEikButtonGroupContainer* aMenuBar ) |
|
1676 |
{ |
|
1677 |
FUNC_LOG; |
|
1678 |
||
1679 |
iHeader->SetMenuBar(aMenuBar); |
|
1680 |
} |
|
1681 |
||
1682 |
// ----------------------------------------------------------------------------- |
|
1683 |
// CNcsComposeViewContainer::SetToFieldAddressesL |
|
1684 |
// |
|
1685 |
// ----------------------------------------------------------------------------- |
|
1686 |
// |
|
1687 |
void CNcsComposeViewContainer::SetToFieldAddressesL( |
|
1688 |
RPointerArray<CNcsEmailAddressObject>& aAddress ) |
|
1689 |
{ |
|
1690 |
FUNC_LOG; |
|
1691 |
||
1692 |
iHeader->SetToFieldAddressesL(aAddress); |
|
1693 |
} |
|
1694 |
||
1695 |
// ----------------------------------------------------------------------------- |
|
1696 |
// CNcsComposeViewContainer::SetCcFieldAddressesL |
|
1697 |
// |
|
1698 |
// ----------------------------------------------------------------------------- |
|
1699 |
// |
|
1700 |
void CNcsComposeViewContainer::SetCcFieldAddressesL( |
|
1701 |
RPointerArray<CNcsEmailAddressObject>& aAddress ) |
|
1702 |
{ |
|
1703 |
FUNC_LOG; |
|
1704 |
||
1705 |
iHeader->SetCcFieldAddressesL( aAddress ); |
|
1706 |
} |
|
1707 |
||
1708 |
// ----------------------------------------------------------------------------- |
|
1709 |
// CNcsComposeViewContainer::SetBccFieldAddressesL |
|
1710 |
// |
|
1711 |
// ----------------------------------------------------------------------------- |
|
1712 |
// |
|
1713 |
void CNcsComposeViewContainer::SetBccFieldAddressesL( |
|
1714 |
RPointerArray<CNcsEmailAddressObject>& aAddress ) |
|
1715 |
{ |
|
1716 |
FUNC_LOG; |
|
1717 |
||
1718 |
iHeader->SetBccFieldAddressesL( aAddress ); |
|
1719 |
||
1720 |
} |
|
1721 |
||
1722 |
// ----------------------------------------------------------------------------- |
|
1723 |
// CNcsComposeViewContainer::AppendToFieldAddressesL |
|
1724 |
// |
|
1725 |
// ----------------------------------------------------------------------------- |
|
1726 |
// |
|
1727 |
void CNcsComposeViewContainer::AppendToFieldAddressesL( RPointerArray<CNcsEmailAddressObject>& aAddresses ) |
|
1728 |
{ |
|
1729 |
FUNC_LOG; |
|
1730 |
FixSemicolonL(); |
|
1731 |
iHeader->AppendToFieldAddressesL(aAddresses); |
|
1732 |
||
1733 |
} |
|
1734 |
||
1735 |
// ----------------------------------------------------------------------------- |
|
1736 |
// CNcsComposeViewContainer::AppendCcFieldAddressesL |
|
1737 |
// |
|
1738 |
// ----------------------------------------------------------------------------- |
|
1739 |
// |
|
1740 |
void CNcsComposeViewContainer::AppendCcFieldAddressesL( RPointerArray<CNcsEmailAddressObject>& aAddress ) |
|
1741 |
{ |
|
1742 |
FUNC_LOG; |
|
1743 |
FixSemicolonL(); |
|
1744 |
iHeader->AppendCcFieldAddressesL( aAddress ); |
|
1745 |
||
1746 |
} |
|
1747 |
||
1748 |
// ----------------------------------------------------------------------------- |
|
1749 |
// CNcsComposeViewContainer::AppendBccFieldAddressesL |
|
1750 |
// |
|
1751 |
// ----------------------------------------------------------------------------- |
|
1752 |
// |
|
1753 |
void CNcsComposeViewContainer::AppendBccFieldAddressesL( RPointerArray<CNcsEmailAddressObject>& aAddress ) |
|
1754 |
{ |
|
1755 |
FUNC_LOG; |
|
1756 |
FixSemicolonL(); |
|
1757 |
iHeader->AppendBccFieldAddressesL( aAddress ); |
|
1758 |
||
1759 |
} |
|
1760 |
||
1761 |
// ----------------------------------------------------------------------------- |
|
1762 |
// CNcsComposeViewContainer::SetSubjectL |
|
1763 |
// |
|
1764 |
// ----------------------------------------------------------------------------- |
|
1765 |
// |
|
1766 |
void CNcsComposeViewContainer::SetSubjectL( const TDesC& aSubject ) |
|
1767 |
{ |
|
1768 |
FUNC_LOG; |
|
1769 |
||
1770 |
iHeader->SetSubjectL( aSubject ); |
|
1771 |
||
1772 |
} |
|
1773 |
||
1774 |
// ----------------------------------------------------------------------------- |
|
1775 |
// CNcsComposeViewContainer::SetAttachmentLabelTextsLD |
|
1776 |
// |
|
1777 |
// ----------------------------------------------------------------------------- |
|
1778 |
// |
|
1779 |
void CNcsComposeViewContainer::SetAttachmentLabelTextsLD( |
|
1780 |
CDesCArray* aAttachmentNames, CDesCArray* aAttachmentSizes ) |
|
1781 |
{ |
|
1782 |
FUNC_LOG; |
|
1783 |
iHeader->SetAttachmentLabelTextsLD( aAttachmentNames, aAttachmentSizes ); |
|
1784 |
} |
|
1785 |
||
1786 |
// ----------------------------------------------------------------------------- |
|
1787 |
// CNcsComposeViewContainer::FocusedAttachmentLabelIndex |
|
1788 |
// |
|
1789 |
// ----------------------------------------------------------------------------- |
|
1790 |
// |
|
1791 |
TInt CNcsComposeViewContainer::FocusedAttachmentLabelIndex() |
|
1792 |
{ |
|
1793 |
FUNC_LOG; |
|
1794 |
return iHeader->FocusedAttachmentLabelIndex(); |
|
1795 |
} |
|
1796 |
||
1797 |
// ----------------------------------------------------------------------------- |
|
1798 |
// CNcsComposeViewContainer::HideAttachmentLabel |
|
1799 |
// |
|
1800 |
// ----------------------------------------------------------------------------- |
|
1801 |
// |
|
1802 |
void CNcsComposeViewContainer::HideAttachmentLabel() |
|
1803 |
{ |
|
1804 |
FUNC_LOG; |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
1805 |
iHeader->HideAttachmentLabel(); |
64 | 1806 |
} |
1807 |
||
1808 |
// ----------------------------------------------------------------------------- |
|
1809 |
// CNcsComposeViewContainer::SetCcFieldVisibleL |
|
1810 |
// |
|
1811 |
// ----------------------------------------------------------------------------- |
|
1812 |
// |
|
1813 |
void CNcsComposeViewContainer::SetCcFieldVisibleL( TBool aVisible, TBool aFocus ) |
|
1814 |
{ |
|
1815 |
FUNC_LOG; |
|
1816 |
||
1817 |
if ( aFocus ) |
|
1818 |
{ |
|
1819 |
iMessageField->SetCursorPosL( 0,EFalse ); |
|
1820 |
iMessageField->SetFocus( EFalse ); |
|
1821 |
iHeader->MakeVisible( ETrue ); |
|
1822 |
iHeader->SetFocus( ETrue ); |
|
1823 |
iFocused = iHeader; |
|
1824 |
} |
|
1825 |
iHeader->SetCcFieldVisibleL( aVisible, EDrawNow, aFocus ); |
|
1826 |
||
1827 |
} |
|
1828 |
||
1829 |
// ----------------------------------------------------------------------------- |
|
1830 |
// CNcsComposeViewContainer::SetBccFieldVisibleL |
|
1831 |
// |
|
1832 |
// ----------------------------------------------------------------------------- |
|
1833 |
// |
|
1834 |
void CNcsComposeViewContainer::SetBccFieldVisibleL( TBool aVisible, TBool aFocus ) |
|
1835 |
{ |
|
1836 |
FUNC_LOG; |
|
1837 |
||
1838 |
if ( aFocus ) |
|
1839 |
{ |
|
1840 |
iMessageField->SetCursorPosL( 0, EFalse ); |
|
1841 |
iMessageField->SetFocus( EFalse ); |
|
1842 |
iHeader->MakeVisible( ETrue ); |
|
1843 |
iHeader->SetFocus( ETrue ); |
|
1844 |
iFocused = iHeader; |
|
1845 |
} |
|
1846 |
iHeader->SetBccFieldVisibleL( aVisible, EDrawNow, aFocus ); |
|
1847 |
||
1848 |
} |
|
1849 |
||
1850 |
// ----------------------------------------------------------------------------- |
|
1851 |
// CNcsComposeViewContainer::IncludeAddressL |
|
1852 |
// |
|
1853 |
// ----------------------------------------------------------------------------- |
|
1854 |
// |
|
1855 |
void CNcsComposeViewContainer::IncludeAddressL(const CNcsEmailAddressObject& eml) |
|
1856 |
{ |
|
1857 |
FUNC_LOG; |
|
1858 |
||
1859 |
iHeader->IncludeAddressL(eml); |
|
1860 |
||
1861 |
} |
|
1862 |
||
1863 |
// ----------------------------------------------------------------------------- |
|
1864 |
// CNcsComposeViewContainer::IncludeAddressL |
|
1865 |
// |
|
1866 |
// ----------------------------------------------------------------------------- |
|
1867 |
// |
|
1868 |
void CNcsComposeViewContainer::IncludeAddressL() |
|
1869 |
{ |
|
1870 |
FUNC_LOG; |
|
1871 |
||
1872 |
iHeader->IncludeAddressL(); |
|
1873 |
||
1874 |
} |
|
1875 |
||
1876 |
// ----------------------------------------------------------------------------- |
|
1877 |
// CNcsComposeViewContainer::ClosePopupContactListL |
|
1878 |
// |
|
1879 |
// ----------------------------------------------------------------------------- |
|
1880 |
// |
|
1881 |
void CNcsComposeViewContainer::ClosePopupContactListL() |
|
1882 |
{ |
|
1883 |
FUNC_LOG; |
|
1884 |
||
1885 |
iHeader->ClosePopupContactListL(); |
|
1886 |
||
1887 |
} |
|
1888 |
||
1889 |
// ----------------------------------------------------------------------------- |
|
1890 |
// CNcsComposeViewContainer::DeleteSelectionL |
|
1891 |
// |
|
1892 |
// ----------------------------------------------------------------------------- |
|
1893 |
// |
|
1894 |
void CNcsComposeViewContainer::DeleteSelectionL() |
|
1895 |
{ |
|
1896 |
FUNC_LOG; |
|
1897 |
||
1898 |
iHeader->DeleteSelectionL(); |
|
1899 |
||
1900 |
} |
|
1901 |
||
1902 |
// ----------------------------------------------------------------------------- |
|
1903 |
// CNcsComposeViewContainer::SetFocusToToField |
|
1904 |
// |
|
1905 |
// ----------------------------------------------------------------------------- |
|
1906 |
// |
|
1907 |
void CNcsComposeViewContainer::SetFocusToToField() |
|
1908 |
{ |
|
1909 |
FUNC_LOG; |
|
1910 |
||
1911 |
iHeader->FocusToField(); |
|
1912 |
||
1913 |
} |
|
1914 |
||
1915 |
// ----------------------------------------------------------------------------- |
|
1916 |
// CNcsComposeViewContainer::SetFocusToAttachmentField |
|
1917 |
// |
|
1918 |
// ----------------------------------------------------------------------------- |
|
1919 |
// |
|
1920 |
void CNcsComposeViewContainer::SetFocusToAttachmentField() |
|
1921 |
{ |
|
1922 |
FUNC_LOG; |
|
1923 |
||
1924 |
if ( iFocused == iMessageField ) |
|
1925 |
{ |
|
1926 |
iFocused = iHeader; |
|
1927 |
iHeader->SetFocus( ETrue, EDrawNow ); |
|
1928 |
iMessageField->SetFocus( EFalse, EDrawNow ); |
|
1929 |
iHeader->MakeVisible( ETrue ); |
|
1930 |
} |
|
1931 |
iHeader->FocusAttachmentField(); |
|
1932 |
} |
|
1933 |
||
1934 |
// ----------------------------------------------------------------------------- |
|
1935 |
// CNcsComposeViewContainer::AreAddressFieldsEmpty |
|
1936 |
// |
|
1937 |
// ----------------------------------------------------------------------------- |
|
1938 |
// |
|
1939 |
TBool CNcsComposeViewContainer::AreAddressFieldsEmpty() |
|
1940 |
{ |
|
1941 |
FUNC_LOG; |
|
1942 |
return iHeader->AreAddressFieldsEmpty(); |
|
1943 |
} |
|
1944 |
||
1945 |
// ----------------------------------------------------------------------------- |
|
1946 |
// CNcsComposeViewContainer::DoPopupSelectL |
|
1947 |
// |
|
1948 |
// ----------------------------------------------------------------------------- |
|
1949 |
// |
|
1950 |
void CNcsComposeViewContainer::DoPopupSelectL() |
|
1951 |
{ |
|
1952 |
FUNC_LOG; |
|
1953 |
||
1954 |
iHeader->DoPopupSelectL(); |
|
1955 |
||
1956 |
} |
|
1957 |
||
1958 |
// ----------------------------------------------------------------------------- |
|
1959 |
// CNcsComposeViewContainer::HandleLayoutChangeL |
|
1960 |
// |
|
1961 |
// ----------------------------------------------------------------------------- |
|
1962 |
// |
|
1963 |
void CNcsComposeViewContainer::HandleLayoutChangeL() |
|
1964 |
{ |
|
1965 |
FUNC_LOG; |
|
1966 |
SetRect( iView.ClientRect() ); |
|
1967 |
if ( iHeader ) |
|
1968 |
{ |
|
1969 |
iHeader->HandleDynamicVariantSwitchL(); |
|
1970 |
} |
|
1971 |
// force recalculation of the position of every component |
|
1972 |
UpdateFieldPosition( NULL ); |
|
1973 |
UpdateScrollBar(); |
|
1974 |
} |
|
1975 |
||
1976 |
// ----------------------------------------------------------------------------- |
|
1977 |
// CNcsComposeViewContainer::HandleSkinChangeL |
|
1978 |
// |
|
1979 |
// ----------------------------------------------------------------------------- |
|
1980 |
// |
|
1981 |
void CNcsComposeViewContainer::HandleSkinChangeL() |
|
1982 |
{ |
|
1983 |
FUNC_LOG; |
|
1984 |
if ( iHeader ) |
|
1985 |
{ |
|
1986 |
iHeader->HandleSkinChangeL(); |
|
1987 |
} |
|
1988 |
||
1989 |
if ( iMessageField ) |
|
1990 |
{ |
|
1991 |
iMessageField->UpdateFontSize(); |
|
1992 |
} |
|
1993 |
||
1994 |
if ( iScrollBar ) |
|
1995 |
{ |
|
1996 |
iScrollBar->HandleResourceChange( KAknsMessageSkinChange ); |
|
1997 |
iScrollBar->DrawNow(); |
|
1998 |
} |
|
1999 |
} |
|
2000 |
||
2001 |
// ----------------------------------------------------------------------------- |
|
2002 |
// CNcsComposeViewContainer::ContentTotalHeight |
|
2003 |
// Return the total height of the components shown in the view |
|
2004 |
// ----------------------------------------------------------------------------- |
|
2005 |
// |
|
2006 |
TInt CNcsComposeViewContainer::ContentTotalHeight() |
|
2007 |
{ |
|
2008 |
FUNC_LOG; |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2009 |
TInt totalHeight( iHeader->Size().iHeight + |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2010 |
iSeparatorHeight + iMessageField->Size().iHeight ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2011 |
|
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2012 |
if ( iReadOnlyQuoteField->IsVisible() ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2013 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2014 |
totalHeight += iReadOnlyQuoteField->Size().iHeight; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2015 |
} |
64 | 2016 |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2017 |
return totalHeight; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2018 |
} |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2019 |
|
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2020 |
// ----------------------------------------------------------------------------- |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2021 |
// Returns the height of visible composer area. |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2022 |
// ----------------------------------------------------------------------------- |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2023 |
// |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2024 |
TInt CNcsComposeViewContainer::VisibleAreaHeight() |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2025 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2026 |
return iVisibleAreaHeight; |
64 | 2027 |
} |
2028 |
||
2029 |
// ----------------------------------------------------------------------------- |
|
2030 |
// CNcsComposeViewContainer::CommitL() |
|
2031 |
// ----------------------------------------------------------------------------- |
|
2032 |
// |
|
2033 |
void CNcsComposeViewContainer::CommitL( TFieldToCommit aFieldToCommit ) |
|
2034 |
{ |
|
2035 |
FUNC_LOG; |
|
2036 |
iView.CommitL( ETrue, aFieldToCommit ); |
|
2037 |
iView.HandleContainerChangeRequiringToolbarRefresh(); |
|
2038 |
} |
|
2039 |
||
2040 |
// ----------------------------------------------------------------------------- |
|
2041 |
// CNcsComposeViewContainer::SwitchChangeMskOff |
|
2042 |
// sets up iSwitchChangeMskOff falg, which disables changes of MSK label if |
|
2043 |
// any popup dialog is open |
|
2044 |
// ----------------------------------------------------------------------------- |
|
2045 |
void CNcsComposeViewContainer::SwitchChangeMskOff(TBool aTag) |
|
2046 |
{ |
|
2047 |
FUNC_LOG; |
|
2048 |
iHeader->SwitchChangeMskOff( aTag ); |
|
2049 |
} |
|
2050 |
||
2051 |
// ----------------------------------------------------------------------------- |
|
2052 |
// CNcsHeaderContainer::HandleLongTapEventL() |
|
2053 |
// Handles key events |
|
2054 |
// ----------------------------------------------------------------------------- |
|
2055 |
void CNcsComposeViewContainer::HandleLongTapEventL( |
|
2056 |
const TPoint& aPenEventLocation, |
|
2057 |
const TPoint& aPenEventScreenLocation ) |
|
2058 |
{ |
|
2059 |
FUNC_LOG; |
|
2060 |
iHeader->HandleLongTap( aPenEventLocation, aPenEventScreenLocation ); |
|
2061 |
} |
|
2062 |
||
2063 |
||
2064 |
void CNcsComposeViewContainer::FixSemicolonL() |
|
2065 |
{ |
|
2066 |
FUNC_LOG; |
|
2067 |
iHeader->FixSemicolonInAddressFieldsL(); |
|
2068 |
} |
|
2069 |
||
2070 |
// --------------------------------------------------------------------------- |
|
2071 |
// CNcsComposeViewContainer::UpdatePhysicsL() |
|
2072 |
// --------------------------------------------------------------------------- |
|
2073 |
// |
|
2074 |
void CNcsComposeViewContainer::UpdatePhysicsL() |
|
2075 |
{ |
|
2076 |
FUNC_LOG; |
|
2077 |
if ( iPhysics ) |
|
2078 |
{ |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2079 |
const TSize viewSize( iCmailPaneRect.Size() ); |
64 | 2080 |
// We must ensure that world size is at least the size of the view |
2081 |
const TSize worldSize( viewSize.iWidth, |
|
2082 |
Max( ContentTotalHeight(), viewSize.iHeight ) ); |
|
2083 |
iPhysics->InitPhysicsL( worldSize, viewSize, EFalse ); |
|
2084 |
} |
|
2085 |
} |
|
2086 |
||
2087 |
// ----------------------------------------------------------------------------- |
|
2088 |
// CNcsComposeViewContainer::Scroll() |
|
2089 |
// ----------------------------------------------------------------------------- |
|
2090 |
// |
|
2091 |
void CNcsComposeViewContainer::Scroll( TInt aTargetPos, TBool aDrawNow ) |
|
2092 |
{ |
|
2093 |
FUNC_LOG; |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2094 |
TPoint headerPos = iHeader->Position(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2095 |
const TInt currentPos = iHeaderPos.iY - headerPos.iY; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2096 |
TInt moveY = currentPos - aTargetPos; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2097 |
|
64 | 2098 |
if ( aDrawNow ) |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2099 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2100 |
moveY = iTotalMoveY + moveY; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2101 |
iTotalMoveY = 0; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2102 |
if ( moveY ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2103 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2104 |
headerPos.iY += moveY; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2105 |
iHeader->SetPosition( headerPos ); |
64 | 2106 |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2107 |
// set header invisible if it is not in visible area |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2108 |
// this is done to prevent drawing of header when it is not necessary |
64 | 2109 |
if ( headerPos.iY + iHeaderHeight <= KHeaderVisibilityThreshold && iHeader->IsVisible() ) |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2110 |
{ |
64 | 2111 |
iHeader->MakeVisible( EFalse ); |
2112 |
} |
|
2113 |
// set header visible if it is in visible area |
|
2114 |
else if ( headerPos.iY + iHeaderHeight > KHeaderVisibilityThreshold && !iHeader->IsVisible() ) |
|
2115 |
{ |
|
2116 |
iHeader->MakeVisible( ETrue ); |
|
2117 |
} |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2118 |
|
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2119 |
TPoint msgPos( iMessageField->Position() ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2120 |
msgPos.iY += moveY; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2121 |
iMessageField->SetPosition( msgPos ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2122 |
|
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2123 |
TPoint quotePos( iReadOnlyQuoteField->Position() ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2124 |
quotePos.iY += moveY; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2125 |
iReadOnlyQuoteField->SetPosition( quotePos ); |
64 | 2126 |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2127 |
const TInt bottom = Rect().iBr.iY; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2128 |
if ( iMessageField->IsFocused() ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2129 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2130 |
iMessageField->SetCursorVisible( msgPos.iY <= bottom ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2131 |
} |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2132 |
else if ( iReadOnlyQuoteField->IsFocused() ) |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2133 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2134 |
iReadOnlyQuoteField->SetCursorVisible( quotePos.iY <= bottom ); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2135 |
} |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2136 |
|
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2137 |
iSeparatorLineYPos += moveY; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2138 |
|
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2139 |
UpdateScrollBar(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2140 |
DrawDeferred(); |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2141 |
} |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2142 |
} |
64 | 2143 |
else |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2144 |
{ |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2145 |
iTotalMoveY += moveY; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2146 |
} |
64 | 2147 |
} |
2148 |
||
2149 |
// ----------------------------------------------------------------------------- |
|
2150 |
// CNcsComposeViewContainer::ViewPositionChanged |
|
2151 |
// From MAknPhysicsObserver |
|
2152 |
// ----------------------------------------------------------------------------- |
|
2153 |
// |
|
2154 |
void CNcsComposeViewContainer::ViewPositionChanged( |
|
2155 |
const TPoint& aNewPosition, TBool aDrawNow, TUint /*aFlags*/ ) |
|
2156 |
{ |
|
2157 |
FUNC_LOG; |
|
2158 |
TInt scrollOffset = aNewPosition.iY - iVisibleAreaHeight / 2; |
|
2159 |
||
2160 |
// when the composer view is overlapped by other view for instance task switcher or screensaver |
|
2161 |
// physics sends a faulty event to move the composer view down. |
|
2162 |
// This action is ignored here. |
|
2163 |
if (aNewPosition.iY != 0) |
|
2164 |
{ |
|
2165 |
Scroll( scrollOffset, aDrawNow ); |
|
2166 |
} |
|
2167 |
} |
|
2168 |
||
2169 |
// ----------------------------------------------------------------------------- |
|
2170 |
// CNcsComposeViewContainer::PhysicEmulationEnded |
|
2171 |
// From MAknPhysicsObserver |
|
2172 |
// ----------------------------------------------------------------------------- |
|
2173 |
// |
|
2174 |
void CNcsComposeViewContainer::PhysicEmulationEnded() |
|
2175 |
{ |
|
2176 |
FUNC_LOG; |
|
2177 |
iIsFlicking = EFalse; |
|
2178 |
iMessageField->SetPhysicsEmulationOngoing( EFalse ); |
|
2179 |
iReadOnlyQuoteField->SetPhysicsEmulationOngoing( EFalse ); |
|
2180 |
iHeader->SetPhysicsEmulationOngoing( EFalse ); |
|
2181 |
} |
|
2182 |
||
2183 |
// ----------------------------------------------------------------------------- |
|
2184 |
// CNcsComposeViewContainer::ViewPosition |
|
2185 |
// From MAknPhysicsObserver |
|
2186 |
// ----------------------------------------------------------------------------- |
|
2187 |
// |
|
2188 |
TPoint CNcsComposeViewContainer::ViewPosition() const |
|
2189 |
{ |
|
2190 |
FUNC_LOG; |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2191 |
TInt y = iHeaderPos.iY - iHeader->Position().iY + iVisibleAreaHeight / 2; |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
2192 |
return TPoint( 0, y ); |
64 | 2193 |
} |
2194 |
||
2195 |
// ----------------------------------------------------------------------------- |
|
2196 |
// CNcsComposeViewContainer::IsRemoteSearchInprogress |
|
2197 |
// ----------------------------------------------------------------------------- |
|
2198 |
// |
|
2199 |
TBool CNcsComposeViewContainer::IsRemoteSearchInprogress() const |
|
2200 |
{ |
|
2201 |
FUNC_LOG; |
|
2202 |
return iHeader->IsRemoteSearchInprogress(); |
|
2203 |
} |