|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "FBFileListContainer.h" |
|
21 #include "FB.hrh" |
|
22 #include "FBDocument.h" |
|
23 #include "FBAppUi.h" |
|
24 #include "FBModel.h" |
|
25 #include "FBFileUtils.h" |
|
26 #include "FBStd.h" |
|
27 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) |
|
28 #include "FBToolbar.h" |
|
29 #endif |
|
30 |
|
31 #include <w32std.h> |
|
32 #include <AknDef.h> |
|
33 #include <AknUtils.h> |
|
34 #include <eikspane.h> |
|
35 #include <akntitle.h> |
|
36 #include <aknnavilabel.h> |
|
37 #include <aknlists.h> |
|
38 #include <aknsfld.h> |
|
39 #include <eikclbd.h> |
|
40 #include <eiktxlbm.h> |
|
41 #include <AknsListBoxBackgroundControlContext.h> |
|
42 #include <AknInfoPopupNoteController.h> |
|
43 #include <AknIconArray.h> |
|
44 #include <layoutmetadata.cdl.h> |
|
45 |
|
46 _LIT(KEmptyDirectory, "No entries"); |
|
47 _LIT(KNoMatches, "No matches"); |
|
48 |
|
49 const TInt KSimpleViewFontHeight = 127; |
|
50 const TInt KExtendedViewFontHeight1 = 127; |
|
51 const TInt KExtendedViewFontHeight2 = 105; |
|
52 |
|
53 const TInt KSimpleViewFontHeightQHD = 120; |
|
54 const TInt KExtendedViewFontHeight1QHD = 115; |
|
55 const TInt KExtendedViewFontHeight2QHD = 90; |
|
56 |
|
57 // ===================================== MEMBER FUNCTIONS ===================================== |
|
58 |
|
59 void CFileBrowserFileListContainer::ConstructL(const TRect& /*aRect*/) |
|
60 { |
|
61 iModel = static_cast<CFileBrowserDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model(); |
|
62 iModel->SetFileListContainer(this); |
|
63 |
|
64 iFileViewMode = -1; |
|
65 iIsDragging = EFalse; |
|
66 |
|
67 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __SERIES60_32__) |
|
68 iToolbar = CFileBrowserToolbar::NewL(); |
|
69 if ( iModel->Settings().iEnableToolbar && |
|
70 AknLayoutUtils::PenEnabled() ) |
|
71 { |
|
72 iToolbar->ShowToolbarL(); |
|
73 } |
|
74 else |
|
75 { |
|
76 iToolbar->HideToolbarL(); |
|
77 } |
|
78 #endif |
|
79 |
|
80 CreateWindowL(); |
|
81 Window().SetShadowDisabled(EFalse); |
|
82 SetBlank(); |
|
83 |
|
84 SetScreenLayoutL(iModel->Settings().iDisplayMode); |
|
85 |
|
86 CreateEmptyNaviPaneLabelL(); |
|
87 |
|
88 iModel->FileUtils()->RefreshViewL(); |
|
89 |
|
90 EnableDragEvents(); |
|
91 |
|
92 ActivateL(); |
|
93 |
|
94 iInfoPopup = CAknInfoPopupNoteController::NewL(); |
|
95 iInfoPopup->SetTimePopupInView(5000); |
|
96 iInfoPopup->SetTimeDelayBeforeShow(500); |
|
97 iInfoPopup->SetTextL(_L("TIP: Use left arrow key or touch drag to left to move up in the directory structure.")); |
|
98 iInfoPopup->ShowInfoPopupNote(); |
|
99 } |
|
100 |
|
101 // -------------------------------------------------------------------------------------------- |
|
102 |
|
103 CFileBrowserFileListContainer::~CFileBrowserFileListContainer() |
|
104 { |
|
105 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) |
|
106 delete iToolbar; |
|
107 #endif |
|
108 delete iInfoPopup; |
|
109 |
|
110 DeleteNaviPane(); |
|
111 |
|
112 if (iSearchField) |
|
113 delete iSearchField; |
|
114 |
|
115 if (iListBox) |
|
116 delete iListBox; |
|
117 } |
|
118 |
|
119 // -------------------------------------------------------------------------------------------- |
|
120 |
|
121 void CFileBrowserFileListContainer::CreateEmptyNaviPaneLabelL() |
|
122 { |
|
123 CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); |
|
124 |
|
125 iNaviContainer = static_cast<CAknNavigationControlContainer*>(sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi))); |
|
126 iNaviDecorator = iNaviContainer->CreateNavigationLabelL(); |
|
127 iNaviContainer->PushL(*iNaviDecorator); |
|
128 } |
|
129 |
|
130 // -------------------------------------------------------------------------------------------- |
|
131 |
|
132 void CFileBrowserFileListContainer::DeleteNaviPane() |
|
133 { |
|
134 if (iNaviContainer) |
|
135 { |
|
136 iNaviContainer->Pop(iNaviDecorator); |
|
137 } |
|
138 |
|
139 if (iNaviDecorator) |
|
140 { |
|
141 delete iNaviDecorator; |
|
142 iNaviDecorator = NULL; |
|
143 } |
|
144 } |
|
145 |
|
146 // -------------------------------------------------------------------------------------------- |
|
147 |
|
148 void CFileBrowserFileListContainer::Draw(const TRect& aRect) const |
|
149 { |
|
150 CWindowGc& gc = SystemGc(); |
|
151 gc.Clear(aRect); |
|
152 } |
|
153 |
|
154 // -------------------------------------------------------------------------------------------- |
|
155 |
|
156 void CFileBrowserFileListContainer::HandleControlEventL( |
|
157 CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/) |
|
158 { |
|
159 } |
|
160 |
|
161 // -------------------------------------------------------------------------------------------- |
|
162 |
|
163 TKeyResponse CFileBrowserFileListContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) |
|
164 { |
|
165 // open search field with alpha digit numbers |
|
166 if (aType == EEventKeyDown && !iSearchField && aKeyEvent.iScanCode < EStdKeyF1 && TChar(aKeyEvent.iScanCode).IsAlphaDigit()) |
|
167 { |
|
168 EnableSearchFieldL(); |
|
169 |
|
170 if (iSearchField) |
|
171 { |
|
172 //static_cast<CAknFilteredTextListBoxModel*>(iListBox->Model())->Filter()->DeferredSendKeyEventToFepL(aKeyEvent.iCode); |
|
173 return EKeyWasConsumed; |
|
174 } |
|
175 } |
|
176 |
|
177 // close search field with clear-button if it's empty |
|
178 if (iSearchField && aKeyEvent.iCode == EKeyBackspace) |
|
179 { |
|
180 TFileName searchText; |
|
181 iSearchField->GetSearchText(searchText); |
|
182 |
|
183 if (searchText == KNullDesC) |
|
184 { |
|
185 DisableSearchFieldL(); |
|
186 return EKeyWasConsumed; |
|
187 } |
|
188 } |
|
189 |
|
190 // check file/directory handling related cases |
|
191 if (iModel->FileUtils()->HandleOfferKeyEventL(aKeyEvent, aType) == EKeyWasConsumed) |
|
192 return EKeyWasConsumed; |
|
193 |
|
194 TKeyResponse result = EKeyWasNotConsumed; |
|
195 |
|
196 if (iSearchField && iListBox) |
|
197 { |
|
198 // find items with all event codes (that's the reason why there is EEventKey instead of aType) |
|
199 TBool needsRefresh(EFalse); |
|
200 result = AknFind::HandleFindOfferKeyEventL(aKeyEvent, EEventKey, this, iListBox, iSearchField, EFalse, needsRefresh); |
|
201 |
|
202 if (needsRefresh) |
|
203 DrawNow(); |
|
204 } |
|
205 |
|
206 // scroll one page up/down with volume keys |
|
207 if (result == EKeyWasNotConsumed && iListBox && iListBox->Model()->NumberOfItems() > 0 && (aKeyEvent.iCode == EKeyIncVolume || (aKeyEvent.iCode=='#' && !iModel->IsHashKeySelectionInUse()))) |
|
208 { |
|
209 CListBoxView::TSelectionMode selectionMode = CListBoxView::ENoSelection; |
|
210 CListBoxView::TCursorMovement moveto = CListBoxView::ECursorPrevScreen; |
|
211 |
|
212 iListBox->View()->MoveCursorL(moveto, selectionMode); |
|
213 |
|
214 iListBox->SetCurrentItemIndex(iListBox->CurrentItemIndex()); |
|
215 iListBox->DrawDeferred(); |
|
216 |
|
217 return EKeyWasConsumed; |
|
218 |
|
219 } |
|
220 else if (result == EKeyWasNotConsumed && iListBox && iListBox->Model()->NumberOfItems() > 0 && (aKeyEvent.iCode == EKeyDecVolume || aKeyEvent.iCode=='*')) |
|
221 { |
|
222 CListBoxView::TSelectionMode selectionMode = CListBoxView::ENoSelection; |
|
223 CListBoxView::TCursorMovement moveto = CListBoxView::ECursorNextScreen; |
|
224 |
|
225 if (iListBox->CurrentItemIndex() >= iListBox->Model()->NumberOfItems() - iListBox->View()->NumberOfItemsThatFitInRect(iListBox->View()->ViewRect())) |
|
226 moveto = CListBoxView::ECursorLastItem; |
|
227 |
|
228 iListBox->View()->MoveCursorL(moveto, selectionMode); |
|
229 |
|
230 iListBox->SetCurrentItemIndex(iListBox->CurrentItemIndex()); |
|
231 iListBox->DrawDeferred(); |
|
232 |
|
233 return EKeyWasConsumed; |
|
234 } |
|
235 |
|
236 // offer key event to the listbox if not already consumed |
|
237 else if (result == EKeyWasNotConsumed && iListBox) |
|
238 return iListBox->OfferKeyEventL(aKeyEvent, aType); |
|
239 else |
|
240 return result; |
|
241 } |
|
242 |
|
243 // -------------------------------------------------------------------------------------------- |
|
244 |
|
245 void CFileBrowserFileListContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) |
|
246 { |
|
247 switch (aEventType) |
|
248 { |
|
249 case EEventEnterKeyPressed: |
|
250 case EEventItemDoubleClicked: |
|
251 { |
|
252 // "emulate" enter key press and send it to file utils for prosessing |
|
253 |
|
254 TKeyEvent keyEvent; |
|
255 keyEvent.iCode = EKeyEnter; |
|
256 keyEvent.iModifiers = 0; |
|
257 |
|
258 TEventCode type = EEventKey; |
|
259 |
|
260 iModel->FileUtils()->HandleOfferKeyEventL(keyEvent, type); |
|
261 } |
|
262 break; |
|
263 default: |
|
264 break; |
|
265 } |
|
266 } |
|
267 |
|
268 // -------------------------------------------------------------------------------------------- |
|
269 |
|
270 void CFileBrowserFileListContainer::HandlePointerEventL(const TPointerEvent &aPointerEvent) |
|
271 { |
|
272 // detect direction of dragging by comparing the start and finish points |
|
273 |
|
274 if (aPointerEvent.iType == TPointerEvent::EButton1Down) |
|
275 { |
|
276 iDragStartPoint = aPointerEvent.iPosition; |
|
277 iIsDragging = EFalse; |
|
278 } |
|
279 else if (aPointerEvent.iType == TPointerEvent::EDrag) |
|
280 { |
|
281 iIsDragging = ETrue; |
|
282 |
|
283 return; |
|
284 } |
|
285 else if (aPointerEvent.iType == TPointerEvent::EButton1Up) |
|
286 { |
|
287 if (iIsDragging) |
|
288 { |
|
289 const TInt KDelta = iDragStartPoint.iX - aPointerEvent.iPosition.iX; |
|
290 const TInt KThreshold = 30; |
|
291 |
|
292 if (KDelta < -KThreshold) // dragging to right |
|
293 { |
|
294 // "emulate" right key press and send it to file utils for prosessing |
|
295 |
|
296 TKeyEvent keyEvent; |
|
297 keyEvent.iCode = EKeyRightArrow; |
|
298 keyEvent.iModifiers = 0; |
|
299 |
|
300 TEventCode type = EEventKey; |
|
301 |
|
302 iModel->FileUtils()->HandleOfferKeyEventL(keyEvent, type); |
|
303 |
|
304 return; |
|
305 } |
|
306 else if (KDelta > KThreshold) // dragging to left |
|
307 { |
|
308 // "emulate" left key press and send it to file utils for prosessing |
|
309 |
|
310 TKeyEvent keyEvent; |
|
311 keyEvent.iCode = EKeyLeftArrow; |
|
312 keyEvent.iModifiers = 0; |
|
313 |
|
314 TEventCode type = EEventKey; |
|
315 |
|
316 iModel->FileUtils()->HandleOfferKeyEventL(keyEvent, type); |
|
317 |
|
318 return; |
|
319 } |
|
320 } |
|
321 iIsDragging = EFalse; |
|
322 } |
|
323 else |
|
324 { |
|
325 iIsDragging = EFalse; |
|
326 } |
|
327 |
|
328 CCoeControl::HandlePointerEventL(aPointerEvent); |
|
329 } |
|
330 |
|
331 // -------------------------------------------------------------------------------------------- |
|
332 |
|
333 void CFileBrowserFileListContainer::CreateListBoxL(TInt aFileViewMode) |
|
334 { |
|
335 iFileViewMode = aFileViewMode; |
|
336 |
|
337 if (iSearchField) |
|
338 DisableSearchFieldL(); |
|
339 |
|
340 if (iListBox) |
|
341 { |
|
342 delete iListBox; |
|
343 iListBox = NULL; |
|
344 } |
|
345 |
|
346 if (iFileViewMode == EFileViewModeSimple) |
|
347 { |
|
348 iListBox = new(ELeave) CSimpleFileViewListBox; |
|
349 } |
|
350 else |
|
351 { |
|
352 iListBox = new(ELeave) CExtendedFileViewListBox; |
|
353 } |
|
354 |
|
355 |
|
356 iListBox->SetContainerWindowL(*this); |
|
357 iListBox->ConstructL(this, EAknListBoxMarkableList); |
|
358 |
|
359 iListBox->View()->SetListEmptyTextL(KEmptyDirectory); |
|
360 |
|
361 iListBox->CreateScrollBarFrameL(ETrue); |
|
362 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); |
|
363 iListBox->SetListBoxObserver(this); |
|
364 |
|
365 // make sure listbox has correct size |
|
366 SizeChanged(); |
|
367 |
|
368 iListBox->ActivateL(); |
|
369 } |
|
370 |
|
371 // -------------------------------------------------------------------------------------------- |
|
372 |
|
373 TInt CFileBrowserFileListContainer::CurrentListBoxItemIndex() |
|
374 { |
|
375 if (iListBox && iSearchField) |
|
376 { |
|
377 TInt currentItemIndex = iListBox->CurrentItemIndex(); |
|
378 |
|
379 if (currentItemIndex >= 0) |
|
380 return static_cast<CAknFilteredTextListBoxModel*>(iListBox->Model())->Filter()->FilteredItemIndex(currentItemIndex); |
|
381 else |
|
382 return KErrNotFound; |
|
383 } |
|
384 else if (iListBox) |
|
385 { |
|
386 return iListBox->CurrentItemIndex(); |
|
387 } |
|
388 else |
|
389 return KErrNotFound; |
|
390 } |
|
391 |
|
392 // -------------------------------------------------------------------------------------------- |
|
393 |
|
394 const CArrayFix<TInt>* CFileBrowserFileListContainer::ListBoxSelectionIndexes() |
|
395 { |
|
396 if (iListBox && iSearchField) |
|
397 { |
|
398 TRAP_IGNORE( static_cast<CAknFilteredTextListBoxModel*>(iListBox->Model())->Filter()->UpdateSelectionIndexesL() ); // !!! |
|
399 return static_cast<CAknFilteredTextListBoxModel*>(iListBox->Model())->Filter()->SelectionIndexes(); |
|
400 } |
|
401 else if (iListBox) |
|
402 { |
|
403 const CListBoxView::CSelectionIndexArray* indices = iListBox->SelectionIndexes(); |
|
404 return static_cast<const CArrayFix<TInt>*>(indices); |
|
405 } |
|
406 else |
|
407 return NULL; |
|
408 } |
|
409 |
|
410 // -------------------------------------------------------------------------------------------- |
|
411 |
|
412 TInt CFileBrowserFileListContainer::ListBoxSelectionIndexesCount() |
|
413 { |
|
414 if (iListBox && iSearchField) |
|
415 { |
|
416 TRAP_IGNORE( static_cast<CAknFilteredTextListBoxModel*>(iListBox->Model())->Filter()->UpdateSelectionIndexesL() ); // !!! |
|
417 return static_cast<CAknFilteredTextListBoxModel*>(iListBox->Model())->Filter()->SelectionIndexes()->Count(); |
|
418 } |
|
419 else if (iListBox) |
|
420 { |
|
421 return iListBox->SelectionIndexes()->Count(); |
|
422 } |
|
423 else |
|
424 return KErrNotFound; |
|
425 } |
|
426 |
|
427 // -------------------------------------------------------------------------------------------- |
|
428 |
|
429 TInt CFileBrowserFileListContainer::ListBoxNumberOfVisibleItems() |
|
430 { |
|
431 if (iListBox && iSearchField) |
|
432 { |
|
433 return static_cast<CAknFilteredTextListBoxModel*>(iListBox->Model())->Filter()->FilteredNumberOfItems(); |
|
434 } |
|
435 else if (iListBox) |
|
436 { |
|
437 return iListBox->Model()->NumberOfItems(); |
|
438 } |
|
439 else |
|
440 return KErrNotFound; |
|
441 } |
|
442 |
|
443 // -------------------------------------------------------------------------------------------- |
|
444 |
|
445 CAknIconArray* CFileBrowserFileListContainer::ListBoxIconArrayL() |
|
446 { |
|
447 if (iListBox) |
|
448 { |
|
449 if (iFileViewMode == EFileViewModeSimple) |
|
450 { |
|
451 return static_cast<CAknIconArray*>(static_cast<CEikColumnListBox*>(iListBox)->ItemDrawer()->ColumnData()->IconArray()); |
|
452 } |
|
453 else if (iFileViewMode == EFileViewModeExtended) |
|
454 { |
|
455 return static_cast<CAknIconArray*>(static_cast<CEikFormattedCellListBox*>(iListBox)->ItemDrawer()->ColumnData()->IconArray()); |
|
456 } |
|
457 } |
|
458 |
|
459 return NULL; |
|
460 } |
|
461 |
|
462 // -------------------------------------------------------------------------------------------- |
|
463 |
|
464 void CFileBrowserFileListContainer::SetListBoxIconArrayL(CAknIconArray* aIconArray) |
|
465 { |
|
466 if (iListBox) |
|
467 { |
|
468 if (iFileViewMode == EFileViewModeSimple) |
|
469 { |
|
470 //CArrayPtr<CGulIcon>* currentIconArray = static_cast<CEikColumnListBox*>(iListBox)->ItemDrawer()->ColumnData()->IconArray(); |
|
471 //delete currentIconArray; |
|
472 //currentIconArray = NULL; |
|
473 static_cast<CEikColumnListBox*>(iListBox)->ItemDrawer()->ColumnData()->SetIconArray(aIconArray); |
|
474 } |
|
475 else if (iFileViewMode == EFileViewModeExtended) |
|
476 { |
|
477 //CArrayPtr<CGulIcon>* currentIconArray = static_cast<CEikFormattedCellListBox*>(iListBox)->ItemDrawer()->ColumnData()->IconArray(); |
|
478 //delete currentIconArray; |
|
479 //currentIconArray = NULL; |
|
480 static_cast<CEikFormattedCellListBox*>(iListBox)->ItemDrawer()->ColumnData()->SetIconArray(aIconArray); |
|
481 } |
|
482 } |
|
483 } |
|
484 |
|
485 // -------------------------------------------------------------------------------------------- |
|
486 |
|
487 void CFileBrowserFileListContainer::SetListBoxTextArrayL(CDesCArray* aTextArray) |
|
488 { |
|
489 if (iListBox) |
|
490 { |
|
491 iListBox->Model()->SetItemTextArray(aTextArray); |
|
492 iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray); |
|
493 iListBox->HandleItemAdditionL(); |
|
494 iListBox->UpdateScrollBarsL(); |
|
495 } |
|
496 } |
|
497 |
|
498 // -------------------------------------------------------------------------------------------- |
|
499 |
|
500 void CFileBrowserFileListContainer::EnableSearchFieldL() |
|
501 { |
|
502 if (iListBox && !iSearchField && iListBox->Model()->NumberOfItems() > 0) |
|
503 { |
|
504 iSearchField = CAknSearchField::NewL(*this, CAknSearchField::ESearch, NULL, KMaxFileName); |
|
505 |
|
506 iSearchField->SetObserver(this); |
|
507 iSearchField->SetFocus(ETrue); |
|
508 iSearchField->MakeVisible(ETrue); |
|
509 iSearchField->ResetL(); |
|
510 |
|
511 iListBox->View()->SetListEmptyTextL(KNoMatches); |
|
512 |
|
513 // enable filtering |
|
514 ((CAknFilteredTextListBoxModel*)iListBox->Model())->CreateFilterL(iListBox, iSearchField); |
|
515 |
|
516 SizeChanged(); |
|
517 |
|
518 // update cba |
|
519 CEikButtonGroupContainer* cbaGroup = CEikButtonGroupContainer::Current(); |
|
520 cbaGroup->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_CANCEL); |
|
521 cbaGroup->DrawNow(); |
|
522 } |
|
523 } |
|
524 |
|
525 // -------------------------------------------------------------------------------------------- |
|
526 |
|
527 TBool CFileBrowserFileListContainer::IsSearchFieldEnabled() |
|
528 { |
|
529 return iSearchField != NULL; |
|
530 } |
|
531 |
|
532 // -------------------------------------------------------------------------------------------- |
|
533 |
|
534 void CFileBrowserFileListContainer::DisableSearchFieldL() |
|
535 { |
|
536 if (iSearchField) |
|
537 { |
|
538 iSearchField->MakeVisible( EFalse ); |
|
539 iSearchField->SetFocusing( EFalse ); |
|
540 |
|
541 delete iSearchField; |
|
542 iSearchField = NULL; |
|
543 |
|
544 iListBox->View()->SetListEmptyTextL(KEmptyDirectory); |
|
545 |
|
546 // disable filtering |
|
547 ((CAknFilteredTextListBoxModel*)iListBox->Model())->RemoveFilter(); |
|
548 |
|
549 SizeChanged(); |
|
550 DrawNow(); |
|
551 |
|
552 // update cba |
|
553 CEikButtonGroupContainer* cbaGroup = CEikButtonGroupContainer::Current(); |
|
554 cbaGroup->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_EXIT); |
|
555 cbaGroup->DrawNow(); |
|
556 |
|
557 // Clear selections because using filter causes selections to go out of sync |
|
558 UpdateToolbar(); |
|
559 AknSelectionService::HandleMarkableListProcessCommandL( EAknUnmarkAll, iListBox ); |
|
560 } |
|
561 } |
|
562 |
|
563 // -------------------------------------------------------------------------------------------- |
|
564 |
|
565 TInt CFileBrowserFileListContainer::CountComponentControls() const |
|
566 { |
|
567 TInt controls(0); |
|
568 |
|
569 if (iListBox) |
|
570 controls++; |
|
571 |
|
572 if (iSearchField) |
|
573 controls++; |
|
574 |
|
575 return controls; |
|
576 } |
|
577 |
|
578 // -------------------------------------------------------------------------------------------- |
|
579 |
|
580 CCoeControl* CFileBrowserFileListContainer::ComponentControl(TInt aIndex) const |
|
581 { |
|
582 switch (aIndex) |
|
583 { |
|
584 case 0: |
|
585 { |
|
586 return iListBox; |
|
587 } |
|
588 case 1: |
|
589 { |
|
590 return iSearchField; |
|
591 } |
|
592 default: |
|
593 { |
|
594 return NULL; |
|
595 } |
|
596 } |
|
597 } |
|
598 |
|
599 // -------------------------------------------------------------------------------------------- |
|
600 |
|
601 void CFileBrowserFileListContainer::SetScreenLayoutL(TInt aLayoutMode) |
|
602 { |
|
603 // make sure that the search field has been disabled |
|
604 DisableSearchFieldL(); |
|
605 |
|
606 // make sure that the title of the application is correct |
|
607 CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); |
|
608 CAknTitlePane* tp = static_cast<CAknTitlePane*>( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
609 tp->SetTextL( _L("FileBrowser") ); |
|
610 |
|
611 // change the layout mode |
|
612 if (aLayoutMode == EDisplayModeFullScreen) |
|
613 sp->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_SMALL); |
|
614 else |
|
615 sp->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL); |
|
616 |
|
617 // update layout |
|
618 HandleResourceChange(KEikDynamicLayoutVariantSwitch); |
|
619 } |
|
620 |
|
621 // -------------------------------------------------------------------------------------------- |
|
622 |
|
623 void CFileBrowserFileListContainer::SetNaviPaneTextL(const TDesC& aText) |
|
624 { |
|
625 if (iNaviDecorator) |
|
626 { |
|
627 delete iNaviDecorator; |
|
628 iNaviDecorator = NULL; |
|
629 } |
|
630 |
|
631 CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); |
|
632 iNaviDecorator = iNaviContainer->CreateMessageLabelL(aText); |
|
633 iNaviContainer->PushL(*iNaviDecorator); |
|
634 } |
|
635 |
|
636 // -------------------------------------------------------------------------------------------- |
|
637 |
|
638 void CFileBrowserFileListContainer::SizeChanged() |
|
639 { |
|
640 if (iListBox && iSearchField) |
|
641 { |
|
642 TSize findPaneSize; |
|
643 AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EFindPane, findPaneSize); |
|
644 |
|
645 TRect mainPaneRect; |
|
646 TRect naviPaneRect; |
|
647 |
|
648 if (Layout_Meta_Data::IsLandscapeOrientation() || |
|
649 iEikonEnv->AppUiFactory()->StatusPane()->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_SMALL) |
|
650 { |
|
651 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
652 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) |
|
653 if ( iToolbar && iModel->Settings().iEnableToolbar ) |
|
654 { |
|
655 iToolbar->ShowToolbarL(); |
|
656 // Get location of softkeys |
|
657 AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); |
|
658 if ( cbaLocation == AknLayoutUtils::EAknCbaLocationBottom ) |
|
659 { |
|
660 // here there is the BSK mode |
|
661 mainPaneRect.iBr.iX -= iToolbar->Rect().Width(); |
|
662 findPaneSize.iWidth -= iToolbar->Rect().Width(); |
|
663 } |
|
664 } |
|
665 #endif |
|
666 } |
|
667 else |
|
668 { |
|
669 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
670 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::ENaviPane, naviPaneRect); |
|
671 mainPaneRect.iTl.iY = naviPaneRect.Height(); |
|
672 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) |
|
673 if ( iToolbar && iModel->Settings().iEnableToolbar ) |
|
674 { |
|
675 iToolbar->ShowToolbarL(); |
|
676 mainPaneRect.iBr.iY -= iToolbar->Rect().Height(); |
|
677 } |
|
678 #endif |
|
679 } |
|
680 |
|
681 mainPaneRect.iBr.iY -= findPaneSize.iHeight; |
|
682 |
|
683 TRect listBoxRect(mainPaneRect.Size()); |
|
684 iListBox->SetRect(listBoxRect); |
|
685 |
|
686 if (iFileViewMode == EFileViewModeSimple) |
|
687 { |
|
688 CAknsListBoxBackgroundControlContext* listBoxContext = static_cast<CAknsListBoxBackgroundControlContext*>(static_cast<CEikColumnListBox*>(iListBox)->ItemDrawer()->ColumnData()->SkinBackgroundContext()); |
|
689 listBoxContext->SetRect(listBoxRect); |
|
690 } |
|
691 else if (iFileViewMode == EFileViewModeExtended) |
|
692 { |
|
693 CAknsListBoxBackgroundControlContext* listBoxContext = static_cast<CAknsListBoxBackgroundControlContext*>(static_cast<CEikFormattedCellListBox*>(iListBox)->ItemDrawer()->ColumnData()->SkinBackgroundContext()); |
|
694 listBoxContext->SetRect(listBoxRect); |
|
695 } |
|
696 |
|
697 iSearchField->SetRect(TRect(TPoint(0,mainPaneRect.Height()), findPaneSize)); |
|
698 |
|
699 if (iSearchField->IsVisible() && iListBox->IsVisible()) |
|
700 iSearchField->SetLinePos(2); |
|
701 |
|
702 } |
|
703 |
|
704 else if (iListBox) |
|
705 { |
|
706 TRect mainPaneRect; |
|
707 TRect naviPaneRect; |
|
708 |
|
709 if (Layout_Meta_Data::IsLandscapeOrientation() || |
|
710 iEikonEnv->AppUiFactory()->StatusPane()->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_SMALL) |
|
711 { |
|
712 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
713 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) |
|
714 if ( iToolbar && iModel->Settings().iEnableToolbar ) |
|
715 { |
|
716 iToolbar->ShowToolbarL(); |
|
717 // Get location of softkeys |
|
718 AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); |
|
719 if ( cbaLocation == AknLayoutUtils::EAknCbaLocationBottom ) |
|
720 { |
|
721 // here there is the BSK mode |
|
722 mainPaneRect.iBr.iX -= iToolbar->Rect().Width(); |
|
723 } |
|
724 } |
|
725 #endif |
|
726 } |
|
727 else |
|
728 { |
|
729 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
730 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::ENaviPane, naviPaneRect); |
|
731 mainPaneRect.iTl.iY = naviPaneRect.Height(); |
|
732 |
|
733 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) |
|
734 if ( iToolbar && iModel->Settings().iEnableToolbar ) |
|
735 { |
|
736 iToolbar->ShowToolbarL(); |
|
737 mainPaneRect.iBr.iY -= iToolbar->Rect().Height(); |
|
738 } |
|
739 #endif |
|
740 } |
|
741 |
|
742 TRect listBoxRect(mainPaneRect.Size()); |
|
743 iListBox->SetRect(listBoxRect); |
|
744 |
|
745 if (iFileViewMode == EFileViewModeSimple) |
|
746 { |
|
747 CAknsListBoxBackgroundControlContext* listBoxContext = static_cast<CAknsListBoxBackgroundControlContext*>(static_cast<CEikColumnListBox*>(iListBox)->ItemDrawer()->ColumnData()->SkinBackgroundContext()); |
|
748 listBoxContext->SetRect(listBoxRect); |
|
749 } |
|
750 else if (iFileViewMode == EFileViewModeExtended) |
|
751 { |
|
752 CAknsListBoxBackgroundControlContext* listBoxContext = static_cast<CAknsListBoxBackgroundControlContext*>(static_cast<CEikFormattedCellListBox*>(iListBox)->ItemDrawer()->ColumnData()->SkinBackgroundContext()); |
|
753 listBoxContext->SetRect(listBoxRect); |
|
754 } |
|
755 } |
|
756 } |
|
757 |
|
758 // -------------------------------------------------------------------------------------------- |
|
759 |
|
760 void CFileBrowserFileListContainer::HandleResourceChange(TInt aType) |
|
761 { |
|
762 CCoeControl::HandleResourceChange(aType); |
|
763 |
|
764 if (aType == KEikDynamicLayoutVariantSwitch) |
|
765 { |
|
766 TRect mainPaneRect; |
|
767 TRect naviPaneRect; |
|
768 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __SERIES60_32__) |
|
769 TBool needToCutSearchFieldLength( EFalse ); |
|
770 #endif |
|
771 |
|
772 if (Layout_Meta_Data::IsLandscapeOrientation() || |
|
773 iEikonEnv->AppUiFactory()->StatusPane()->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_SMALL) |
|
774 { |
|
775 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
776 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __SERIES60_32__) |
|
777 if ( iToolbar && iModel->Settings().iEnableToolbar ) |
|
778 { |
|
779 iToolbar->ShowToolbarL(); |
|
780 // Get location of softkeys |
|
781 AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); |
|
782 if ( cbaLocation == AknLayoutUtils::EAknCbaLocationBottom ) |
|
783 { |
|
784 // here there is the BSK mode |
|
785 mainPaneRect.iBr.iX -= iToolbar->Rect().Width(); |
|
786 needToCutSearchFieldLength = ETrue; |
|
787 } |
|
788 } |
|
789 #endif |
|
790 } |
|
791 else |
|
792 { |
|
793 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
794 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::ENaviPane, naviPaneRect); |
|
795 mainPaneRect.iTl.iY = naviPaneRect.Height(); |
|
796 |
|
797 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __SERIES60_32__) |
|
798 if ( iToolbar && iModel->Settings().iEnableToolbar ) |
|
799 { |
|
800 iToolbar->ShowToolbarL(); |
|
801 mainPaneRect.iBr.iY -= iToolbar->Rect().Height(); |
|
802 } |
|
803 #endif |
|
804 } |
|
805 |
|
806 SetRect(mainPaneRect); |
|
807 |
|
808 if (iListBox && iSearchField) |
|
809 { |
|
810 TSize findPaneSize; |
|
811 AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EFindPane, findPaneSize); |
|
812 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __SERIES60_32__) |
|
813 if ( needToCutSearchFieldLength ) |
|
814 { |
|
815 findPaneSize.iWidth -= iToolbar->Rect().Width(); |
|
816 } |
|
817 #endif |
|
818 mainPaneRect.iBr.iY -= findPaneSize.iHeight; |
|
819 |
|
820 TRect listBoxRect(mainPaneRect.Size()); |
|
821 iListBox->SetRect(listBoxRect); |
|
822 |
|
823 if (iFileViewMode == EFileViewModeSimple) |
|
824 { |
|
825 CAknsListBoxBackgroundControlContext* listBoxContext = static_cast<CAknsListBoxBackgroundControlContext*>(static_cast<CEikColumnListBox*>(iListBox)->ItemDrawer()->ColumnData()->SkinBackgroundContext()); |
|
826 listBoxContext->SetRect(listBoxRect); |
|
827 } |
|
828 else if (iFileViewMode == EFileViewModeExtended) |
|
829 { |
|
830 CAknsListBoxBackgroundControlContext* listBoxContext = static_cast<CAknsListBoxBackgroundControlContext*>(static_cast<CEikFormattedCellListBox*>(iListBox)->ItemDrawer()->ColumnData()->SkinBackgroundContext()); |
|
831 listBoxContext->SetRect(listBoxRect); |
|
832 } |
|
833 |
|
834 iSearchField->SetRect(TRect(TPoint(0,mainPaneRect.Height()), findPaneSize)); |
|
835 |
|
836 if (iSearchField->IsVisible() && iListBox->IsVisible()) |
|
837 iSearchField->SetLinePos(2); |
|
838 |
|
839 TRAP_IGNORE(iListBox->UpdateScrollBarsL()); |
|
840 } |
|
841 else if (iListBox) |
|
842 { |
|
843 TRect listBoxRect(mainPaneRect.Size()); |
|
844 iListBox->SetRect(listBoxRect); |
|
845 |
|
846 if (iFileViewMode == EFileViewModeSimple) |
|
847 { |
|
848 CAknsListBoxBackgroundControlContext* listBoxContext = static_cast<CAknsListBoxBackgroundControlContext*>(static_cast<CEikColumnListBox*>(iListBox)->ItemDrawer()->ColumnData()->SkinBackgroundContext()); |
|
849 listBoxContext->SetRect(listBoxRect); |
|
850 } |
|
851 else if (iFileViewMode == EFileViewModeExtended) |
|
852 { |
|
853 CAknsListBoxBackgroundControlContext* listBoxContext = static_cast<CAknsListBoxBackgroundControlContext*>(static_cast<CEikFormattedCellListBox*>(iListBox)->ItemDrawer()->ColumnData()->SkinBackgroundContext()); |
|
854 listBoxContext->SetRect(listBoxRect); |
|
855 } |
|
856 |
|
857 TRAP_IGNORE(iListBox->UpdateScrollBarsL()); |
|
858 } |
|
859 } |
|
860 } |
|
861 |
|
862 // -------------------------------------------------------------------------------------------- |
|
863 |
|
864 void CFileBrowserFileListContainer::HandleSettingsChangeL() |
|
865 { |
|
866 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) |
|
867 if ( iModel->Settings().iEnableToolbar ) |
|
868 { |
|
869 if ( AknLayoutUtils::PenEnabled() ) |
|
870 { |
|
871 if ( !iToolbar ) |
|
872 { |
|
873 iToolbar = CFileBrowserToolbar::NewL(); |
|
874 } |
|
875 iToolbar->ShowToolbarL(); |
|
876 } |
|
877 } |
|
878 else |
|
879 { |
|
880 HideToolbar(); |
|
881 } |
|
882 SizeChanged(); |
|
883 #endif |
|
884 } |
|
885 |
|
886 // -------------------------------------------------------------------------------------------- |
|
887 |
|
888 void CFileBrowserFileListContainer::HideToolbar() |
|
889 { |
|
890 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) |
|
891 if ( iToolbar && iToolbar->IsShown() ) |
|
892 { |
|
893 iToolbar->HideToolbarL(); |
|
894 } |
|
895 #endif |
|
896 } |
|
897 |
|
898 // -------------------------------------------------------------------------------------------- |
|
899 |
|
900 void CFileBrowserFileListContainer::UpdateToolbar() |
|
901 { |
|
902 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) |
|
903 if ( iToolbar && iToolbar->IsShown() ) |
|
904 { |
|
905 iToolbar->ResetState(); |
|
906 } |
|
907 #endif |
|
908 } |
|
909 |
|
910 // -------------------------------------------------------------------------------------------- |
|
911 // -------------------------------------------------------------------------------------------- |
|
912 |
|
913 CSimpleFileViewListBox::~CSimpleFileViewListBox() |
|
914 { |
|
915 ReleaseFonts(); |
|
916 } |
|
917 |
|
918 // -------------------------------------------------------------------------------------------- |
|
919 |
|
920 void CSimpleFileViewListBox::ReleaseFonts() |
|
921 { |
|
922 if (iFont) |
|
923 { |
|
924 CGraphicsDevice* dev = iCoeEnv->ScreenDevice(); |
|
925 dev->ReleaseFont(iFont); |
|
926 iFont = NULL; |
|
927 } |
|
928 } |
|
929 |
|
930 // -------------------------------------------------------------------------------------------- |
|
931 |
|
932 void CSimpleFileViewListBox::SizeChanged() |
|
933 { |
|
934 // call the base class function first |
|
935 CAknSingleGraphicStyleListBox::SizeChanged(); |
|
936 |
|
937 // customize the list box |
|
938 TRAP_IGNORE(SizeChangedL()); |
|
939 } |
|
940 |
|
941 // -------------------------------------------------------------------------------------------- |
|
942 |
|
943 void CSimpleFileViewListBox::SizeChangedL() |
|
944 { |
|
945 // disable separator line |
|
946 ItemDrawer()->ColumnData()->SetSeparatorLinePosition(ENoLine); |
|
947 |
|
948 // enable marquee |
|
949 ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); |
|
950 |
|
951 // get font |
|
952 ReleaseFonts(); |
|
953 CGraphicsDevice* dev = iCoeEnv->ScreenDevice(); |
|
954 const TSize screenSize = dev->SizeInPixels(); |
|
955 |
|
956 TFontSpec fontSpec = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont)->FontSpecInTwips(); |
|
957 fontSpec.iHeight = IsQHD(screenSize) ? KSimpleViewFontHeightQHD : KSimpleViewFontHeight; |
|
958 dev->GetNearestFontInTwips(iFont, fontSpec); |
|
959 |
|
960 // set fonts |
|
961 ItemDrawer()->ColumnData()->SetColumnFontL(0, iFont); |
|
962 ItemDrawer()->ColumnData()->SetColumnFontL(1, iFont); |
|
963 ItemDrawer()->ColumnData()->SetColumnFontL(2, iFont); |
|
964 ItemDrawer()->ColumnData()->SetColumnFontL(3, iFont); |
|
965 |
|
966 // set row height |
|
967 TInt rowHeight = iFont->HeightInPixels()+4; |
|
968 TSize itemCellSize = View()->ItemDrawer()->ItemCellSize(); |
|
969 itemCellSize.iHeight = rowHeight; |
|
970 SetItemHeightL(rowHeight); |
|
971 View()->ItemDrawer()->SetItemCellSize(itemCellSize); |
|
972 |
|
973 // set icon sizes |
|
974 TInt normalIconSize = rowHeight * 0.9; |
|
975 TInt markingIconSize = rowHeight * 0.8; |
|
976 ItemDrawer()->ColumnData()->SetSubCellIconSize(0, TSize(normalIconSize,normalIconSize)); |
|
977 ItemDrawer()->ColumnData()->SetSubCellIconSize(2, TSize(markingIconSize,markingIconSize)); |
|
978 ItemDrawer()->ColumnData()->SetSubCellIconSize(3, TSize(markingIconSize,markingIconSize)); |
|
979 |
|
980 // set column widths |
|
981 ItemDrawer()->ColumnData()->SetColumnWidthPixelL(0, normalIconSize); |
|
982 ItemDrawer()->ColumnData()->SetColumnWidthPixelL(1, itemCellSize.iWidth-normalIconSize-markingIconSize); |
|
983 ItemDrawer()->ColumnData()->SetColumnWidthPixelL(2, markingIconSize); |
|
984 ItemDrawer()->ColumnData()->SetColumnWidthPixelL(3, markingIconSize); |
|
985 |
|
986 // set baseline for the text |
|
987 ItemDrawer()->ColumnData()->SetColumnBaselinePosL(1, iFont->HeightInPixels()-iFont->BaselineOffsetInPixels()-1); |
|
988 |
|
989 // set margins |
|
990 TMargins iconMargins; |
|
991 iconMargins.iBottom = 0; |
|
992 iconMargins.iLeft = 0; |
|
993 iconMargins.iRight = 0; |
|
994 iconMargins.iTop = 0; |
|
995 |
|
996 TMargins textMargins; |
|
997 textMargins.iBottom = 0; |
|
998 textMargins.iLeft = markingIconSize * 0.15; |
|
999 textMargins.iRight = markingIconSize * 0.15; |
|
1000 textMargins.iTop = 0; |
|
1001 |
|
1002 ItemDrawer()->ColumnData()->SetColumnMarginsL(0, iconMargins); |
|
1003 ItemDrawer()->ColumnData()->SetColumnMarginsL(1, textMargins); |
|
1004 ItemDrawer()->ColumnData()->SetColumnMarginsL(2, iconMargins); |
|
1005 ItemDrawer()->ColumnData()->SetColumnMarginsL(3, iconMargins); |
|
1006 } |
|
1007 |
|
1008 // -------------------------------------------------------------------------------------------- |
|
1009 // -------------------------------------------------------------------------------------------- |
|
1010 |
|
1011 CExtendedFileViewListBox::~CExtendedFileViewListBox() |
|
1012 { |
|
1013 ReleaseFonts(); |
|
1014 } |
|
1015 |
|
1016 // -------------------------------------------------------------------------------------------- |
|
1017 |
|
1018 void CExtendedFileViewListBox::ReleaseFonts() |
|
1019 { |
|
1020 if (iFont1) |
|
1021 { |
|
1022 CGraphicsDevice* dev = iCoeEnv->ScreenDevice(); |
|
1023 dev->ReleaseFont(iFont1); |
|
1024 iFont1 = NULL; |
|
1025 } |
|
1026 |
|
1027 if (iFont2) |
|
1028 { |
|
1029 CGraphicsDevice* dev = iCoeEnv->ScreenDevice(); |
|
1030 dev->ReleaseFont(iFont2); |
|
1031 iFont2 = NULL; |
|
1032 } |
|
1033 } |
|
1034 |
|
1035 // -------------------------------------------------------------------------------------------- |
|
1036 |
|
1037 void CExtendedFileViewListBox::SizeChanged() |
|
1038 { |
|
1039 // call the base class function first |
|
1040 CAknDoubleGraphicStyleListBox::SizeChanged(); |
|
1041 |
|
1042 // customize the list box |
|
1043 TRAP_IGNORE(SizeChangedL()); |
|
1044 } |
|
1045 |
|
1046 // -------------------------------------------------------------------------------------------- |
|
1047 |
|
1048 void CExtendedFileViewListBox::SizeChangedL() |
|
1049 { |
|
1050 // disable separator line |
|
1051 ItemDrawer()->ColumnData()->SetSeparatorLinePosition(ENoLine); |
|
1052 |
|
1053 // enable marquee |
|
1054 ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); |
|
1055 |
|
1056 // get fonts |
|
1057 ReleaseFonts(); |
|
1058 CGraphicsDevice* dev = iCoeEnv->ScreenDevice(); |
|
1059 const TSize screenSize = dev->SizeInPixels(); |
|
1060 |
|
1061 TFontSpec fontSpec1 = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont)->FontSpecInTwips(); |
|
1062 fontSpec1.iHeight = IsQHD(screenSize) ? KExtendedViewFontHeight1QHD : KExtendedViewFontHeight1; |
|
1063 dev->GetNearestFontInTwips(iFont1, fontSpec1); |
|
1064 |
|
1065 TFontSpec fontSpec2 = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont)->FontSpecInTwips(); |
|
1066 fontSpec2.iHeight = IsQHD(screenSize) ? KExtendedViewFontHeight2QHD : KExtendedViewFontHeight2; |
|
1067 dev->GetNearestFontInTwips(iFont2, fontSpec2); |
|
1068 |
|
1069 |
|
1070 // set fonts |
|
1071 ItemDrawer()->ColumnData()->SetSubCellFontL(0, iFont1); |
|
1072 ItemDrawer()->ColumnData()->SetSubCellFontL(1, iFont1); |
|
1073 ItemDrawer()->ColumnData()->SetSubCellFontL(2, iFont2); |
|
1074 ItemDrawer()->ColumnData()->SetSubCellFontL(3, iFont1); |
|
1075 ItemDrawer()->ColumnData()->SetSubCellFontL(4, iFont1); |
|
1076 |
|
1077 // set row height |
|
1078 TInt rowHeight1 = iFont1->HeightInPixels()+3; |
|
1079 TInt rowHeight2 = iFont2->HeightInPixels()+3; |
|
1080 TSize itemCellSize = View()->ItemDrawer()->ItemCellSize(); |
|
1081 itemCellSize.iHeight = rowHeight1+rowHeight2; |
|
1082 SetItemHeightL(rowHeight1+rowHeight2); |
|
1083 View()->ItemDrawer()->SetItemCellSize(itemCellSize); |
|
1084 |
|
1085 |
|
1086 // set icon sizes |
|
1087 TInt normalIconSize = rowHeight1 * 0.9; |
|
1088 TInt markingIconSize = rowHeight1 * 0.8; |
|
1089 ItemDrawer()->ColumnData()->SetSubCellIconSize(0, TSize(normalIconSize,normalIconSize)); |
|
1090 ItemDrawer()->ColumnData()->SetSubCellIconSize(3, TSize(markingIconSize,markingIconSize)); |
|
1091 ItemDrawer()->ColumnData()->SetSubCellIconSize(4, TSize(markingIconSize,markingIconSize)); |
|
1092 |
|
1093 // set sub cell sizes |
|
1094 ItemDrawer()->ColumnData()->SetSubCellSizeL(0, TSize(normalIconSize,rowHeight1+rowHeight2)); |
|
1095 ItemDrawer()->ColumnData()->SetSubCellSizeL(1, TSize(itemCellSize.iWidth-normalIconSize-markingIconSize,rowHeight1)); |
|
1096 ItemDrawer()->ColumnData()->SetSubCellSizeL(2, TSize(itemCellSize.iWidth-normalIconSize-markingIconSize,rowHeight2)); |
|
1097 ItemDrawer()->ColumnData()->SetSubCellSizeL(3, TSize(markingIconSize,rowHeight1+rowHeight2)); |
|
1098 ItemDrawer()->ColumnData()->SetSubCellSizeL(4, TSize(markingIconSize,rowHeight1+rowHeight2)); |
|
1099 |
|
1100 // set sub cell positions |
|
1101 ItemDrawer()->ColumnData()->SetSubCellPositionL(0, TPoint(0,0)); |
|
1102 ItemDrawer()->ColumnData()->SetSubCellPositionL(1, TPoint(normalIconSize,0)); |
|
1103 ItemDrawer()->ColumnData()->SetSubCellPositionL(2, TPoint(normalIconSize,rowHeight1)); |
|
1104 ItemDrawer()->ColumnData()->SetSubCellPositionL(3, TPoint(itemCellSize.iWidth-normalIconSize-markingIconSize,0)); |
|
1105 ItemDrawer()->ColumnData()->SetSubCellPositionL(4, TPoint(itemCellSize.iWidth-normalIconSize-markingIconSize,0)); |
|
1106 |
|
1107 // set baselines for the texts |
|
1108 ItemDrawer()->ColumnData()->SetSubCellBaselinePosL(1, iFont1->HeightInPixels()-iFont1->BaselineOffsetInPixels()-1); |
|
1109 ItemDrawer()->ColumnData()->SetSubCellBaselinePosL(2, rowHeight1+iFont2->HeightInPixels()-iFont2->BaselineOffsetInPixels()-1); |
|
1110 |
|
1111 // set margins |
|
1112 TMargins iconMargins; |
|
1113 iconMargins.iBottom = rowHeight2; |
|
1114 iconMargins.iLeft = 0; |
|
1115 iconMargins.iRight = 0; |
|
1116 iconMargins.iTop = 0; |
|
1117 |
|
1118 TMargins textMargins; |
|
1119 textMargins.iBottom = 0; |
|
1120 textMargins.iLeft = markingIconSize * 0.15; |
|
1121 textMargins.iRight = markingIconSize * 0.15; |
|
1122 textMargins.iTop = 0; |
|
1123 |
|
1124 ItemDrawer()->ColumnData()->SetSubCellMarginsL(0, iconMargins); |
|
1125 ItemDrawer()->ColumnData()->SetSubCellMarginsL(1, textMargins); |
|
1126 ItemDrawer()->ColumnData()->SetSubCellMarginsL(2, textMargins); |
|
1127 ItemDrawer()->ColumnData()->SetSubCellMarginsL(3, iconMargins); |
|
1128 ItemDrawer()->ColumnData()->SetSubCellMarginsL(4, iconMargins); |
|
1129 } |
|
1130 |
|
1131 // -------------------------------------------------------------------------------------------- |
|
1132 |
|
1133 // End of File |