author | Simon Howkins <simonh@symbian.org> |
Thu, 25 Nov 2010 12:13:04 +0000 | |
branch | RCL_3 |
changeset 83 | 31a5fbf5db1d |
parent 80 | 726fba06891a |
permissions | -rw-r--r-- |
64 | 1 |
/* |
2 |
* Copyright (c) 2009 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: ESMR subject field implementation |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include "cesmrsubjectfield.h" |
|
19 |
#include "cmrimage.h" |
|
20 |
#include "nmrlayoutmanager.h" |
|
21 |
#include "cesmreditor.h" |
|
22 |
#include "mesmrtitlepaneobserver.h" |
|
23 |
#include "cesmrglobalnote.h" |
|
24 |
#include "esmrfieldbuilderdef.h" |
|
25 |
#include "nmrcolormanager.h" |
|
26 |
#include "nmrbitmapmanager.h" |
|
27 |
#include "mesmrlistobserver.h" |
|
28 |
||
29 |
#include <calentry.h> |
|
30 |
#include <StringLoader.h> |
|
31 |
#include <AknsConstants.h> |
|
32 |
#include <esmrgui.rsg> |
|
33 |
#include <AknsBasicBackgroundControlContext.h> |
|
34 |
#include <eikmfne.h> |
|
35 |
||
36 |
#include "emailtrace.h" |
|
37 |
||
38 |
// ======== MEMBER FUNCTIONS ======== |
|
39 |
||
40 |
// --------------------------------------------------------------------------- |
|
41 |
// CESMRSubjectField::CESMRSubjectField |
|
42 |
// --------------------------------------------------------------------------- |
|
43 |
// |
|
44 |
CESMRSubjectField::CESMRSubjectField() |
|
45 |
{ |
|
46 |
FUNC_LOG; |
|
47 |
SetFocusType( EESMRHighlightFocus ); |
|
48 |
} |
|
49 |
||
50 |
// --------------------------------------------------------------------------- |
|
51 |
// CESMRSubjectField::~CESMRSubjectField |
|
52 |
// --------------------------------------------------------------------------- |
|
53 |
// |
|
54 |
CESMRSubjectField::~CESMRSubjectField( ) |
|
55 |
{ |
|
56 |
FUNC_LOG; |
|
57 |
delete iFieldIcon; |
|
58 |
delete iBgControlContext; |
|
59 |
delete iPriorityIcon; |
|
60 |
} |
|
61 |
||
62 |
// --------------------------------------------------------------------------- |
|
63 |
// CESMRSubjectField::ConstructL |
|
64 |
// --------------------------------------------------------------------------- |
|
65 |
// |
|
66 |
void CESMRSubjectField::ConstructL( TESMREntryFieldId aId, TInt aTextId, |
|
67 |
NMRBitmapManager::TMRBitmapId aIconID ) |
|
68 |
{ |
|
69 |
FUNC_LOG; |
|
70 |
SetFieldId( aId ); |
|
71 |
||
72 |
iFieldIcon = CMRImage::NewL( aIconID ); |
|
73 |
iFieldIcon->SetParent( this ); |
|
74 |
||
75 |
iSubject = CESMREditor::NewL ( this, 1, KMaxTextLength, |
|
76 |
CEikEdwin::EResizable | CEikEdwin::EAvkonEditor | EAknEditorFlagNoLRNavigation); |
|
77 |
iSubject->SetEdwinSizeObserver ( this ); |
|
78 |
iSubject->SetEdwinObserver( this ); |
|
79 |
iSubject->SetParent( this ); |
|
80 |
||
81 |
CESMRField::ConstructL( iSubject ); // iSubject ownership transfered |
|
82 |
||
83 |
HBufC* buf = StringLoader::LoadLC ( aTextId ); |
|
84 |
iSubject->SetDefaultTextL( buf ); // ownership transferred |
|
85 |
CleanupStack::Pop( buf ); |
|
86 |
||
87 |
// Setting background instead of theme skin |
|
88 |
NMRBitmapManager::TMRBitmapStruct bitmapStruct; |
|
89 |
bitmapStruct = NMRBitmapManager::GetBitmapStruct( |
|
90 |
NMRBitmapManager::EMRBitmapInputCenter ); |
|
91 |
||
92 |
TRect initialisationRect( 0, 0, 0, 0 ); |
|
93 |
iBgControlContext = |
|
94 |
CAknsBasicBackgroundControlContext::NewL( |
|
95 |
bitmapStruct.iItemId, |
|
96 |
initialisationRect, |
|
97 |
EFalse ); |
|
98 |
||
99 |
iSubject->SetSkinBackgroundControlContextL( iBgControlContext ); |
|
100 |
||
101 |
iCurrentPriority = EFSCalenMRPriorityNormal; |
|
102 |
} |
|
103 |
||
104 |
// --------------------------------------------------------------------------- |
|
105 |
// CESMRSubjectField::NewL |
|
106 |
// --------------------------------------------------------------------------- |
|
107 |
// |
|
108 |
CESMRSubjectField* CESMRSubjectField::NewL( TFieldType aType ) |
|
109 |
{ |
|
110 |
FUNC_LOG; |
|
111 |
CESMRSubjectField* self = new( ELeave )CESMRSubjectField; |
|
112 |
CleanupStack::PushL ( self ); |
|
113 |
if ( aType == ETypeSubject ) |
|
114 |
{ |
|
115 |
self->ConstructL( EESMRFieldSubject, |
|
116 |
R_QTN_MEET_REQ_SUBJECT_FIELD, |
|
117 |
NMRBitmapManager::EMRBitmapSubject ); |
|
118 |
} |
|
119 |
else |
|
120 |
{ |
|
121 |
self->ConstructL( EESMRFieldOccasion, |
|
122 |
R_QTN_CALENDAR_ANNIVERSARY_TYPE_OCCASION, |
|
123 |
NMRBitmapManager::EMRBitmapOccasion ); |
|
124 |
} |
|
125 |
CleanupStack::Pop( self ); |
|
126 |
return self; |
|
127 |
} |
|
128 |
||
129 |
// --------------------------------------------------------------------------- |
|
130 |
// CESMRSubjectField::MinimumSize |
|
131 |
// --------------------------------------------------------------------------- |
|
132 |
// |
|
133 |
TSize CESMRSubjectField::MinimumSize() |
|
134 |
{ |
|
135 |
TRect parentRect( Parent()->Rect() ); |
|
136 |
||
137 |
TRect fieldRect = |
|
138 |
NMRLayoutManager::GetFieldLayoutRect( parentRect, 1 ).Rect(); |
|
139 |
||
140 |
TRect editorRect( NMRLayoutManager::GetLayoutText( |
|
141 |
fieldRect, |
|
142 |
NMRLayoutManager::EMRTextLayoutTextEditor ).TextRect() ); |
|
143 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
144 |
if( iPriorityIcon && ( iCurrentPriority != EFSCalenMRPriorityNormal ) ) |
64 | 145 |
{ |
146 |
editorRect = NMRLayoutManager::GetLayoutText( |
|
147 |
fieldRect, |
|
148 |
NMRLayoutManager::EMRTextLayoutSingleRowEditorText ).TextRect(); |
|
149 |
} |
|
150 |
||
151 |
// Adjust field size so that there's room for expandable editor. |
|
152 |
fieldRect.Resize( 0, iSize.iHeight - editorRect.Height() ); |
|
153 |
||
154 |
return fieldRect.Size(); |
|
155 |
} |
|
156 |
||
157 |
// --------------------------------------------------------------------------- |
|
158 |
// CESMRSubjectField::InitializeL |
|
159 |
// --------------------------------------------------------------------------- |
|
160 |
// |
|
161 |
void CESMRSubjectField::InitializeL() |
|
162 |
{ |
|
163 |
FUNC_LOG; |
|
164 |
// Do nothing |
|
165 |
} |
|
166 |
||
167 |
// --------------------------------------------------------------------------- |
|
168 |
// CESMRSubjectField::InternalizeL |
|
169 |
// --------------------------------------------------------------------------- |
|
170 |
// |
|
171 |
void CESMRSubjectField::InternalizeL( MESMRCalEntry& aEntry ) |
|
172 |
{ |
|
173 |
FUNC_LOG; |
|
174 |
CCalEntry& entry = aEntry.Entry ( ); |
|
175 |
HBufC* subject = entry.SummaryL().AllocLC ( ); |
|
176 |
||
177 |
// if there is no text available, don't overwrite the default text |
|
178 |
// with empty descriptor. |
|
179 |
if ( subject->Length ( )> 0 ) |
|
180 |
{ |
|
181 |
iSubject->ClearSelectionAndSetTextL ( *subject ); |
|
182 |
if ( iTitlePaneObserver ) |
|
183 |
{ |
|
184 |
iTitlePaneObserver->UpdateTitlePaneTextL( *subject ); |
|
185 |
} |
|
186 |
} |
|
187 |
||
188 |
if( entry.PriorityL() != EFSCalenMRPriorityNormal && |
|
189 |
entry.EntryTypeL() == CCalEntry::EAppt ) |
|
190 |
{ |
|
191 |
SetPriorityIconL( entry.PriorityL() ); |
|
192 |
} |
|
193 |
||
194 |
// this is needed to be re-called here, otherwise the CEikEdwin |
|
195 |
// does not get correctly instantiated with default text |
|
196 |
iSubject->FocusChanged( EDrawNow ); |
|
197 |
||
198 |
CleanupStack::PopAndDestroy ( subject ); |
|
199 |
} |
|
200 |
||
201 |
// --------------------------------------------------------------------------- |
|
202 |
// CESMRSubjectField::ExternalizeL |
|
203 |
// --------------------------------------------------------------------------- |
|
204 |
// |
|
205 |
void CESMRSubjectField::ExternalizeL( MESMRCalEntry& aEntry ) |
|
206 |
{ |
|
207 |
FUNC_LOG; |
|
208 |
HBufC* subject = iSubject->GetTextInHBufL ( ); |
|
209 |
||
210 |
CCalEntry& entry = aEntry.Entry(); |
|
211 |
||
212 |
if ( subject ) |
|
213 |
{ |
|
214 |
CleanupStack::PushL ( subject ); |
|
215 |
||
216 |
// externalize the text only if it differs from the |
|
217 |
// default text. In other words, default text is not |
|
218 |
// externalized. |
|
219 |
if ( iSubject->DefaultText().Compare (*subject )!= 0 ) |
|
220 |
{ |
|
221 |
entry.SetSummaryL( *subject ); |
|
222 |
} |
|
223 |
||
224 |
CleanupStack::PopAndDestroy( subject ); |
|
225 |
} |
|
226 |
else |
|
227 |
{ |
|
228 |
entry.SetSummaryL( KNullDesC ); |
|
229 |
} |
|
230 |
||
231 |
entry.SetPriorityL( iCurrentPriority ); |
|
232 |
} |
|
233 |
||
234 |
// --------------------------------------------------------------------------- |
|
235 |
// CESMRSubjectField::SetOutlineFocusL |
|
236 |
// --------------------------------------------------------------------------- |
|
237 |
// |
|
238 |
void CESMRSubjectField::SetOutlineFocusL( TBool aFocus ) |
|
239 |
{ |
|
240 |
FUNC_LOG; |
|
241 |
CESMRField::SetOutlineFocusL ( aFocus ); |
|
242 |
||
243 |
if ( aFocus ) //Focus is gained on the field |
|
244 |
{ |
|
245 |
ChangeMiddleSoftKeyL( EESMRCmdSaveMR,R_QTN_MSK_SAVE ); |
|
246 |
} |
|
247 |
} |
|
248 |
||
249 |
// --------------------------------------------------------------------------- |
|
250 |
// CESMRSubjectField::HandleEdwinSizeEventL |
|
251 |
// --------------------------------------------------------------------------- |
|
252 |
// |
|
253 |
TBool CESMRSubjectField::HandleEdwinSizeEventL( CEikEdwin* aEdwin, |
|
254 |
TEdwinSizeEvent /*aType*/, TSize aSize ) |
|
255 |
{ |
|
256 |
FUNC_LOG; |
|
257 |
TBool reDraw( EFalse ); |
|
258 |
||
259 |
if( iSize != aSize ) |
|
260 |
{ |
|
261 |
// Let's save the required size for the iSubject |
|
262 |
iSize = aSize; |
|
263 |
||
264 |
if ( iObserver && aEdwin == iSubject ) |
|
265 |
{ |
|
266 |
iObserver->ControlSizeChanged( this ); |
|
267 |
reDraw = ETrue; |
|
268 |
} |
|
269 |
||
270 |
if( iSubject->LineCount() != iLineCount ) |
|
271 |
{ |
|
272 |
// Line count has changed, the whole component needs |
|
273 |
// to be redrawn |
|
274 |
DrawDeferred(); |
|
275 |
iLineCount = iSubject->LineCount(); |
|
276 |
} |
|
277 |
} |
|
278 |
return reDraw; |
|
279 |
} |
|
280 |
||
281 |
// --------------------------------------------------------------------------- |
|
282 |
// CESMRSubjectField::HandleEdwinEventL |
|
283 |
// --------------------------------------------------------------------------- |
|
284 |
// |
|
285 |
void CESMRSubjectField::HandleEdwinEventL( CEikEdwin *aEdwin, TEdwinEvent aEventType ) |
|
286 |
{ |
|
287 |
FUNC_LOG; |
|
288 |
if ( iTitlePaneObserver && |
|
289 |
aEdwin == iSubject && |
|
290 |
aEventType == EEventTextUpdate ) |
|
291 |
{ |
|
292 |
HBufC* text = iSubject->GetTextInHBufL(); |
|
293 |
if ( text ) |
|
294 |
{ |
|
295 |
CleanupStack::PushL( text ); |
|
296 |
||
297 |
iTitlePaneObserver->UpdateTitlePaneTextL( *text ); |
|
298 |
||
299 |
TInt textLength( text->Length() ); |
|
300 |
if ( iSubject->GetLimitLength() <= textLength ) |
|
301 |
{ |
|
302 |
NotifyEventAsyncL( EESMRCmdSizeExceeded ); |
|
303 |
} |
|
304 |
||
305 |
CleanupStack::PopAndDestroy( text ); |
|
306 |
} |
|
307 |
else |
|
308 |
{ |
|
309 |
iTitlePaneObserver->UpdateTitlePaneTextL( KNullDesC ); |
|
310 |
} |
|
311 |
} |
|
312 |
} |
|
313 |
||
314 |
// --------------------------------------------------------------------------- |
|
315 |
// CESMRSubjectField::SetTitlePaneObserver |
|
316 |
// --------------------------------------------------------------------------- |
|
317 |
// |
|
318 |
void CESMRSubjectField::SetTitlePaneObserver( MESMRTitlePaneObserver* aObserver ) |
|
319 |
{ |
|
320 |
FUNC_LOG; |
|
321 |
iTitlePaneObserver = aObserver; |
|
322 |
} |
|
323 |
||
324 |
// --------------------------------------------------------------------------- |
|
325 |
// CESMRSubjectField::GetCursorLineVerticalPos |
|
326 |
// --------------------------------------------------------------------------- |
|
327 |
// |
|
328 |
void CESMRSubjectField::GetCursorLineVerticalPos(TInt& aUpper, TInt& aLower) |
|
329 |
{ |
|
330 |
aLower = iSubject->CurrentLineNumber() * iSubject->RowHeight(); |
|
331 |
aUpper = aLower - iSubject->RowHeight(); |
|
332 |
} |
|
333 |
||
334 |
// --------------------------------------------------------------------------- |
|
335 |
// CESMRSubjectField::ListObserverSet |
|
336 |
// --------------------------------------------------------------------------- |
|
337 |
// |
|
338 |
void CESMRSubjectField::ListObserverSet() |
|
339 |
{ |
|
340 |
FUNC_LOG; |
|
341 |
iSubject->SetListObserver( iObserver ); |
|
342 |
} |
|
343 |
||
344 |
// --------------------------------------------------------------------------- |
|
345 |
// CESMRSubjectField::ExecuteGenericCommandL |
|
346 |
// --------------------------------------------------------------------------- |
|
347 |
// |
|
348 |
TBool CESMRSubjectField::ExecuteGenericCommandL( |
|
349 |
TInt aCommand ) |
|
350 |
{ |
|
351 |
FUNC_LOG; |
|
352 |
TBool isUsed( EFalse ); |
|
353 |
switch ( aCommand ) |
|
354 |
{ |
|
355 |
case EESMRCmdPriorityHigh: |
|
356 |
{ |
|
357 |
SetPriorityIconL( EFSCalenMRPriorityHigh ); |
|
358 |
isUsed = ETrue; |
|
359 |
break; |
|
360 |
} |
|
361 |
case EESMRCmdPriorityNormal: |
|
362 |
{ |
|
363 |
SetPriorityIconL( EFSCalenMRPriorityNormal ); |
|
364 |
isUsed = ETrue; |
|
365 |
break; |
|
366 |
} |
|
367 |
case EESMRCmdPriorityLow: |
|
368 |
{ |
|
369 |
SetPriorityIconL( EFSCalenMRPriorityLow ); |
|
370 |
isUsed = ETrue; |
|
371 |
break; |
|
372 |
} |
|
373 |
||
374 |
case EESMRCmdSizeExceeded: |
|
375 |
{ |
|
376 |
CESMRGlobalNote::ExecuteL ( |
|
377 |
CESMRGlobalNote::EESMRCannotDisplayMuchMore ); |
|
378 |
||
379 |
HBufC* text = iSubject->GetTextInHBufL(); |
|
380 |
CleanupDeletePushL( text ); |
|
381 |
if ( text ) |
|
382 |
{ |
|
383 |
TInt curPos = iSubject->CursorPos(); |
|
384 |
if( curPos > iSubject->GetLimitLength() - 1 ) |
|
385 |
curPos = iSubject->GetLimitLength() - 1; |
|
386 |
HBufC* newText = |
|
387 |
text->Des().Mid( 0, iSubject->GetLimitLength() - 1 ).AllocLC(); |
|
388 |
||
389 |
iSubject->SetTextL ( newText ); |
|
390 |
CleanupStack::PopAndDestroy( newText ); |
|
391 |
newText = NULL; |
|
392 |
||
393 |
iSubject->SetCursorPosL (curPos, EFalse ); |
|
394 |
iSubject->HandleTextChangedL(); |
|
395 |
iSubject->UpdateScrollBarsL(); |
|
396 |
SetFocus(ETrue); |
|
397 |
} |
|
398 |
CleanupStack::PopAndDestroy( text ); |
|
399 |
isUsed = ETrue; |
|
400 |
break; |
|
401 |
} |
|
402 |
default: |
|
403 |
{ |
|
404 |
break; |
|
405 |
} |
|
406 |
} |
|
407 |
return isUsed; |
|
408 |
} |
|
409 |
||
410 |
// --------------------------------------------------------------------------- |
|
411 |
// CESMRSubjectField::CountComponentControls |
|
412 |
// --------------------------------------------------------------------------- |
|
413 |
// |
|
414 |
TInt CESMRSubjectField::CountComponentControls() const |
|
415 |
{ |
|
416 |
TInt count( 0 ); |
|
417 |
if ( iFieldIcon ) |
|
418 |
{ |
|
419 |
++count; |
|
420 |
} |
|
421 |
||
422 |
if ( iSubject ) |
|
423 |
{ |
|
424 |
++count; |
|
425 |
} |
|
426 |
||
427 |
if ( iPriorityIcon ) |
|
428 |
{ |
|
429 |
++count; |
|
430 |
} |
|
431 |
return count; |
|
432 |
} |
|
433 |
||
434 |
// --------------------------------------------------------------------------- |
|
435 |
// CESMRSubjectField::ComponentControl |
|
436 |
// --------------------------------------------------------------------------- |
|
437 |
// |
|
438 |
CCoeControl* CESMRSubjectField::ComponentControl( |
|
439 |
TInt aIndex ) const |
|
440 |
{ |
|
441 |
switch ( aIndex ) |
|
442 |
{ |
|
443 |
case 0: |
|
444 |
return iFieldIcon; |
|
445 |
case 1: |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
446 |
if( iPriorityIcon ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
447 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
448 |
return iPriorityIcon; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
449 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
450 |
else |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
451 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
452 |
return iSubject; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
453 |
} |
64 | 454 |
case 2: |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
455 |
if( iPriorityIcon ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
456 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
457 |
return iSubject; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
458 |
} |
64 | 459 |
default: |
460 |
return NULL; |
|
461 |
} |
|
462 |
} |
|
463 |
||
464 |
// --------------------------------------------------------------------------- |
|
465 |
// CESMRSubjectField::SizeChanged |
|
466 |
// --------------------------------------------------------------------------- |
|
467 |
// |
|
468 |
void CESMRSubjectField::SizeChanged( ) |
|
469 |
{ |
|
470 |
TRect rect( Rect() ); |
|
471 |
||
472 |
TAknLayoutRect rowLayoutRect( |
|
473 |
NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 ) ); |
|
474 |
TRect rowRect( rowLayoutRect.Rect() ); |
|
475 |
||
476 |
// Layouting field icon |
|
477 |
if( iFieldIcon ) |
|
478 |
{ |
|
479 |
TAknWindowComponentLayout iconLayout( |
|
480 |
NMRLayoutManager::GetWindowComponentLayout( |
|
481 |
NMRLayoutManager::EMRLayoutSingleRowAColumnGraphic ) ); |
|
482 |
AknLayoutUtils::LayoutControl( iFieldIcon, rowRect, iconLayout ); |
|
483 |
} |
|
484 |
||
485 |
// Layouting priority icon |
|
486 |
if( iPriorityIcon ) |
|
487 |
{ |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
488 |
if( iCurrentPriority != EFSCalenMRPriorityNormal ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
489 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
490 |
TAknWindowComponentLayout iconLayout( |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
491 |
NMRLayoutManager::GetWindowComponentLayout( |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
492 |
NMRLayoutManager::EMRLayoutSingleRowDColumnGraphic ) ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
493 |
AknLayoutUtils::LayoutImage( iPriorityIcon, rowRect, iconLayout ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
494 |
} |
64 | 495 |
} |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
496 |
else |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
497 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
498 |
delete iPriorityIcon; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
499 |
iPriorityIcon = NULL; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
500 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
501 |
|
64 | 502 |
TAknLayoutText editorLayoutText; |
503 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
504 |
if( iPriorityIcon && ( iCurrentPriority != EFSCalenMRPriorityNormal ) ) |
64 | 505 |
{ |
506 |
editorLayoutText = NMRLayoutManager::GetLayoutText( rowRect, |
|
507 |
NMRLayoutManager::EMRTextLayoutSingleRowEditorText ); |
|
508 |
} |
|
509 |
else |
|
510 |
{ |
|
511 |
editorLayoutText = NMRLayoutManager::GetLayoutText( rowRect, |
|
512 |
NMRLayoutManager::EMRTextLayoutTextEditor ); |
|
513 |
} |
|
514 |
||
515 |
// Layouting editor field |
|
516 |
TRect editorRect( editorLayoutText.TextRect() ); |
|
517 |
||
518 |
// Resize height according to actual height required by edwin. |
|
519 |
editorRect.Resize( 0, iSize.iHeight - editorRect.Height() ); |
|
520 |
iSubject->SetRect( editorRect ); |
|
521 |
||
522 |
// Try setting font. Failures are ignored. |
|
523 |
TRAP_IGNORE( iSubject->SetFontL( editorLayoutText.Font() ) ); |
|
524 |
||
525 |
// Layouting focus |
|
526 |
TRect bgRect( TPoint( editorRect.iTl.iX, editorRect.iTl.iY ), |
|
527 |
editorRect.Size() ); |
|
528 |
||
529 |
// Move focus rect so that it's relative to field's position. |
|
530 |
bgRect.Move( -Position() ); |
|
531 |
SetFocusRect( bgRect ); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
532 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
533 |
if ( !iOutlineFocus ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
534 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
535 |
RecordField(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
536 |
iObserver->RedrawField( *this ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
537 |
} |
64 | 538 |
} |
539 |
||
540 |
// --------------------------------------------------------------------------- |
|
541 |
// CESMRSubjectField::SetContainerWindowL |
|
542 |
// --------------------------------------------------------------------------- |
|
543 |
// |
|
544 |
void CESMRSubjectField::SetContainerWindowL( |
|
545 |
const CCoeControl& aContainer ) |
|
546 |
{ |
|
547 |
CCoeControl::SetContainerWindowL( aContainer ); |
|
548 |
iSubject->SetContainerWindowL( aContainer ); |
|
549 |
||
550 |
iSubject->SetParent( this ); |
|
551 |
} |
|
552 |
||
553 |
// --------------------------------------------------------------------------- |
|
554 |
// CESMRSubjectField::OfferKeyEventL() |
|
555 |
// --------------------------------------------------------------------------- |
|
556 |
// |
|
557 |
TKeyResponse CESMRSubjectField::OfferKeyEventL( |
|
558 |
const TKeyEvent& aEvent, |
|
559 |
TEventCode aType ) |
|
560 |
{ |
|
561 |
FUNC_LOG; |
|
562 |
TKeyResponse response( EKeyWasNotConsumed); |
|
563 |
response = iSubject->OfferKeyEventL ( aEvent, aType ); |
|
564 |
||
565 |
if ( aType == EEventKey && |
|
566 |
( aEvent.iScanCode != EStdKeyUpArrow && |
|
567 |
aEvent.iScanCode != EStdKeyDownArrow )) |
|
568 |
{ |
|
569 |
iSubject->DrawDeferred(); |
|
570 |
} |
|
571 |
return response; |
|
572 |
} |
|
573 |
||
574 |
// --------------------------------------------------------------------------- |
|
575 |
// CESMRSubjectField::SetPriorityIconL |
|
576 |
// --------------------------------------------------------------------------- |
|
577 |
// |
|
578 |
void CESMRSubjectField::SetPriorityIconL( TUint aPriority ) |
|
579 |
{ |
|
580 |
switch ( aPriority ) |
|
581 |
{ |
|
582 |
case EFSCalenMRPriorityHigh: |
|
583 |
{ |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
584 |
if( iPriorityIcon ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
585 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
586 |
delete iPriorityIcon; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
587 |
iPriorityIcon = NULL; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
588 |
} |
64 | 589 |
|
590 |
iPriorityIcon = CMRImage::NewL( |
|
591 |
NMRBitmapManager::EMRBitmapPriorityHigh, |
|
592 |
this, |
|
593 |
ETrue ); |
|
594 |
iPriorityIcon->SetParent( this ); |
|
595 |
if( iCurrentPriority == EFSCalenMRPriorityNormal ) |
|
596 |
{ |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
597 |
iCurrentPriority = EFSCalenMRPriorityHigh; |
64 | 598 |
SizeChanged(); |
599 |
} |
|
600 |
iCurrentPriority = EFSCalenMRPriorityHigh; |
|
601 |
break; |
|
602 |
} |
|
603 |
||
604 |
case EFSCalenMRPriorityNormal: |
|
605 |
{ |
|
606 |
delete iPriorityIcon; |
|
607 |
iPriorityIcon = NULL; |
|
608 |
if( iCurrentPriority != EFSCalenMRPriorityNormal ) |
|
609 |
{ |
|
610 |
SizeChanged(); |
|
611 |
} |
|
612 |
iCurrentPriority = EFSCalenMRPriorityNormal; |
|
613 |
break; |
|
614 |
} |
|
615 |
||
616 |
case EFSCalenMRPriorityLow: |
|
617 |
{ |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
618 |
if( iPriorityIcon ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
619 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
620 |
delete iPriorityIcon; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
621 |
iPriorityIcon = NULL; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
622 |
} |
64 | 623 |
|
624 |
iPriorityIcon = CMRImage::NewL( |
|
625 |
NMRBitmapManager::EMRBitmapPriorityLow ); |
|
626 |
iPriorityIcon->SetParent( this ); |
|
627 |
if( iCurrentPriority == EFSCalenMRPriorityNormal ) |
|
628 |
{ |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
629 |
iCurrentPriority = EFSCalenMRPriorityLow; |
64 | 630 |
SizeChanged(); |
631 |
} |
|
632 |
iCurrentPriority = EFSCalenMRPriorityLow; |
|
633 |
break; |
|
634 |
} |
|
635 |
default: |
|
636 |
{ |
|
637 |
break; |
|
638 |
} |
|
639 |
} |
|
640 |
} |
|
641 |
||
642 |
// EOF |