calendarui/views/src/caleneventviewcontainer.cpp
branchRCL_3
changeset 48 bf573002ff72
parent 36 9c5b1510919f
child 59 aba12c885d83
equal deleted inserted replaced
36:9c5b1510919f 48:bf573002ff72
    16 */
    16 */
    17 
    17 
    18 // system includes
    18 // system includes
    19 #include <AknLayoutFont.h>
    19 #include <AknLayoutFont.h>
    20 #include <aknnavide.h>      // CAknNavigationDecorator
    20 #include <aknnavide.h>      // CAknNavigationDecorator
    21 #include <aknnavilabel.h>   // CAknNaviLabel
       
    22 #include <AknsBasicBackgroundControlContext.h>
    21 #include <AknsBasicBackgroundControlContext.h>
    23 #include <AknBidiTextUtils.h>
    22 #include <AknBidiTextUtils.h>
    24 #include <AknsDrawUtils.h>
    23 #include <AknsDrawUtils.h>
    25 #include <calrrule.h>
    24 #include <calrrule.h>
    26 #include <calalarm.h>
    25 #include <calalarm.h>
   156         iNotifier->StopListening();
   155         iNotifier->StopListening();
   157         delete iNotifier;        
   156         delete iNotifier;        
   158         };
   157         };
   159         
   158         
   160     delete iCenRepSession;	
   159     delete iCenRepSession;	
   161     if(iLabel)
       
   162     delete iLabel;
       
   163     
   160     
   164     //Reset the attachment posiitons array
   161     //Reset the attachment posiitons array
   165     iAttachmentPosInfoArray.Reset();
   162     iAttachmentPosInfoArray.Reset();
   166     
   163     
   167 	TRACE_EXIT_POINT;
   164 	TRACE_EXIT_POINT;
   198     iTextEditor->ConstructL(this, 0, 0, CEikEdwin::EReadOnly | CEikEdwin::EAvkonDisableCursor | 
   195     iTextEditor->ConstructL(this, 0, 0, CEikEdwin::EReadOnly | CEikEdwin::EAvkonDisableCursor | 
   199     									CEikEdwin::ENoAutoSelection|CEikEdwin::EAvkonEditor);
   196     									CEikEdwin::ENoAutoSelection|CEikEdwin::EAvkonEditor);
   200     iTextEditor->SetMopParent(this);
   197     iTextEditor->SetMopParent(this);
   201     iTextEditor->SetRect( Rect() );
   198     iTextEditor->SetRect( Rect() );
   202 	
   199 	
   203     iLabel = new (ELeave) CEikLabel;
       
   204     iLabel->SetContainerWindowL(*this);
       
   205     iLabel->SetTextL(_L(""));
       
   206     iLabel->SetRect(Rect());
       
   207         
   200         
   208     iDocHandler->SetExitObserver( this );
   201     iDocHandler->SetExitObserver( this );
   209     iTextEditor->EnableKineticScrollingL(ETrue);
   202     iTextEditor->EnableKineticScrollingL(ETrue);
   210 	TRACE_EXIT_POINT;
   203 	TRACE_EXIT_POINT;
   211 	}
   204 	}
   340 //
   333 //
   341 TInt CCalenEventViewContainer::CountComponentControls() const
   334 TInt CCalenEventViewContainer::CountComponentControls() const
   342     {
   335     {
   343     TRACE_ENTRY_POINT;
   336     TRACE_ENTRY_POINT;
   344     TRACE_EXIT_POINT;
   337     TRACE_EXIT_POINT;
   345     return 2;
   338     return 1;
   346     }
   339     }
   347 
   340 
   348 // ----------------------------------------------------------------------------
   341 // ----------------------------------------------------------------------------
   349 // CCalenEventViewContainer::ComponentControl
   342 // CCalenEventViewContainer::ComponentControl
   350 // Return child control pointer.
   343 // Return child control pointer.
   357     CCoeControl* control ( NULL );
   350     CCoeControl* control ( NULL );
   358     switch(aIndex)
   351     switch(aIndex)
   359         {
   352         {
   360         case 0:
   353         case 0:
   361             control = iTextEditor;
   354             control = iTextEditor;
   362             break;
       
   363             
       
   364         case 1:
       
   365             control = iLabel;
       
   366             break;
   355             break;
   367             
   356             
   368         default:
   357         default:
   369             __ASSERT_DEBUG( 0, User::Invariant() );
   358             __ASSERT_DEBUG( 0, User::Invariant() );
   370             break;
   359             break;
   781 	{
   770 	{
   782 	TRACE_ENTRY_POINT;
   771 	TRACE_ENTRY_POINT;
   783 	// Initialize icon drawer
   772 	// Initialize icon drawer
   784 	CCalenIconDrawer* iconDrawer = CreateAndInitializeIconsDrawerL();
   773 	CCalenIconDrawer* iconDrawer = CreateAndInitializeIconsDrawerL();
   785 	
   774 	
   786 	SetLabelContentL(*iLabel);
       
   787 	// add subject field
   775 	// add subject field
   788 	AddSubjectFieldL();	
   776 	AddSubjectFieldL();	
   789 	
   777 	
   790 	switch ( iEntry->EntryTypeL() )
   778 	switch ( iEntry->EntryTypeL() )
   791         {
   779         {
  1005          
   993          
  1006      TAknLayoutRect listscroll_cale_day_pane;
   994      TAknLayoutRect listscroll_cale_day_pane;
  1007      listscroll_cale_day_pane.LayoutRect( main_cale_day_pane.Rect(), 
   995      listscroll_cale_day_pane.LayoutRect( main_cale_day_pane.Rect(), 
  1008              AknLayoutScalable_Apps::listscroll_cale_day_pane( 0 ).LayoutLine() );
   996              AknLayoutScalable_Apps::listscroll_cale_day_pane( 0 ).LayoutLine() );
  1009 
   997 
  1010      iLabel->SetRect(GetLabelRectL());
       
  1011    
   998    
  1012       // Listbox layout
   999       // Listbox layout
  1013       TAknLayoutRect list_cale_pane;
  1000       TAknLayoutRect list_cale_pane;
  1014       list_cale_pane.LayoutRect( main_cale_day_pane.Rect(), AknLayoutScalable_Apps::list_cale_pane( 3 ).LayoutLine() );
  1001       list_cale_pane.LayoutRect( main_cale_day_pane.Rect(), AknLayoutScalable_Apps::list_cale_pane( 3 ).LayoutLine() );
  1015  
  1002  
  2456     TRACE_EXIT_POINT;
  2443     TRACE_EXIT_POINT;
  2457     return (!retVal);
  2444     return (!retVal);
  2458     }
  2445     }
  2459 
  2446 
  2460 // ----------------------------------------------------------------------------
  2447 // ----------------------------------------------------------------------------
  2461 // CCalenEventViewContainer::LabelRectL
       
  2462 // Returns the available label rect for this container
       
  2463 // ----------------------------------------------------------------------------
       
  2464 TRect CCalenEventViewContainer::GetLabelRectL()
       
  2465     {
       
  2466     TRACE_ENTRY_POINT;
       
  2467    
       
  2468     // Get the main pane
       
  2469     TAknLayoutRect main_cale_day_pane;
       
  2470     main_cale_day_pane.LayoutRect( Rect(), 
       
  2471                     AknLayoutScalable_Apps::main_cale_day_pane().LayoutLine() );
       
  2472         
       
  2473     TAknLayoutRect listscroll_cale_day_pane;
       
  2474     listscroll_cale_day_pane.LayoutRect( main_cale_day_pane.Rect(), 
       
  2475             AknLayoutScalable_Apps::listscroll_cale_day_pane(1).LayoutLine() );
       
  2476 
       
  2477     // Create a dummy label to find the layout rect
       
  2478     CEikLabel* dummyLabel = new( ELeave ) CEikLabel;
       
  2479     CleanupStack::PushL( dummyLabel );
       
  2480 
       
  2481            
       
  2482     AknLayoutUtils::LayoutLabel( dummyLabel, listscroll_cale_day_pane.Rect(),
       
  2483         AknLayoutScalable_Apps::listscroll_cale_day_pane_t1( 0 ).LayoutLine() );        
       
  2484               
       
  2485     TRect labelRect = dummyLabel->Rect();
       
  2486 
       
  2487     // Discard the label
       
  2488     CleanupStack::PopAndDestroy( dummyLabel );
       
  2489     
       
  2490     TRACE_EXIT_POINT;
       
  2491     return labelRect;
       
  2492     }
       
  2493 // ----------------------------------------------------------------------------
       
  2494 // CCalenEventViewContainer::SetLabelContentL
       
  2495 // ----------------------------------------------------------------------------
       
  2496 //
       
  2497 void CCalenEventViewContainer::SetLabelContentL( CEikLabel& aLabel ) 
       
  2498     {
       
  2499     TRACE_ENTRY_POINT;
       
  2500     const CFont*  labelFont = NULL;
       
  2501     labelFont = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont,NULL);
       
  2502     aLabel.SetFont( labelFont );
       
  2503     aLabel.SetLabelAlignment(ELayoutAlignLeft);
       
  2504     aLabel.OverrideColorL( EColorLabelTextEmphasis, KRgbBlack );
       
  2505     
       
  2506     // get the multiple db data from services
       
  2507     RPointerArray<CCalCalendarInfo> calendarInfoList;
       
  2508     iServices.GetAllCalendarInfoL(calendarInfoList);
       
  2509     CleanupClosePushL(calendarInfoList);
       
  2510 
       
  2511     TCalCollectionId colId; 
       
  2512         colId = iServices.Context().InstanceId().iColId;
       
  2513   
       
  2514     HBufC* calendarFileName = iServices.GetCalFileNameForCollectionId(colId).AllocLC();
       
  2515     TInt calIndex = calendarInfoList.Find( *calendarFileName, 
       
  2516             CCalenEventViewContainer::CalendarInfoIdentifierL);
       
  2517     CleanupStack::PopAndDestroy(calendarFileName);
       
  2518     
       
  2519     if(calIndex != KErrNotFound)
       
  2520         {
       
  2521         // add the calendar info's text field
       
  2522         aLabel.SetTextL(calendarInfoList[calIndex]->NameL());
       
  2523         
       
  2524         TInt calendarColor = calendarInfoList[calIndex]->Color().Value();
       
  2525         aLabel.OverrideColorL( EColorLabelHighlightFullEmphasis, calendarColor );
       
  2526         
       
  2527         // Increment the iNumOfLinesBeforeLocField so that map icon is drwan at proper place
       
  2528         iNumOfLinesBeforeLocField = 1;
       
  2529         }
       
  2530     CleanupStack::PopAndDestroy(&calendarInfoList);
       
  2531 
       
  2532     aLabel.CropText();
       
  2533     aLabel.SetEmphasis( CEikLabel::EFullEmphasis );  
       
  2534     TRACE_EXIT_POINT;
       
  2535     }
       
  2536 
       
  2537 // ----------------------------------------------------------------------------
  2448 // ----------------------------------------------------------------------------
  2538 // CCalenEventViewContainer::AddAttachmentFieldL
  2449 // CCalenEventViewContainer::AddAttachmentFieldL
  2539 // Adds attachment field
  2450 // Adds attachment field
  2540 // ----------------------------------------------------------------------------
  2451 // ----------------------------------------------------------------------------
  2541 //
  2452 //