calendarui/views/src/calenmissedeventcontainer.cpp
branchRCL_3
changeset 66 bd7edf625bdd
child 67 1539a383d7b6
child 74 97232defd20e
equal deleted inserted replaced
65:12af337248b1 66:bd7edf625bdd
       
     1 /*
       
     2 * Copyright (c) 2008 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:   Missed event view's container implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // system includes
       
    21 #include <AknLayoutFont.h>
       
    22 #include <aknnavide.h>      // CAknNavigationDecorator
       
    23 #include <aknnavilabel.h>   // CAknNaviLabel
       
    24 #include <AknsBasicBackgroundControlContext.h>
       
    25 #include <AknBidiTextUtils.h>
       
    26 #include <AknsDrawUtils.h>
       
    27 #include <calrrule.h>
       
    28 #include <calalarm.h>
       
    29 #include <calentry.h>
       
    30 #include <calinstance.h>
       
    31 #include <eikappui.h>
       
    32 #include <eikdef.h>
       
    33 #include <eikedwin.h>
       
    34 #include <eikenv.h>
       
    35 #include <eikmenup.h>   // CEikMenuPane
       
    36 #include <eikmfne.h>
       
    37 #include <featmgr.h>    // FeatureManager
       
    38 #include <eikrted.h>    // CEikRichTextEditor
       
    39 #include <finditemdialog.h>
       
    40 #include <StringLoader.h>
       
    41 #include <txtrich.h>    // CRichText
       
    42 #include <gdi.h>
       
    43 #include <ItemFinder.h> //Autofinder 
       
    44 #include <finditemmenu.h>
       
    45 #include <finditem.hrh>
       
    46 #include <centralrepository.h>
       
    47 #include <cenrepnotifyhandler.h>
       
    48 #include <CommonUiInternalCRKeys.h>
       
    49 #include <AknUtils.h> 
       
    50 #include <avkon.hrh>    // EAknCmdHelp
       
    51 #include <avkon.mbg>
       
    52 #include <avkon.rsg>
       
    53 #include <aknlayoutscalable_apps.cdl.h>
       
    54 #include <csxhelp/cale.hlp.hrh>
       
    55 #include <calendateutils.h>
       
    56 #include <calenagendautils.h>
       
    57 #include <CalenInterimUtils2.h>
       
    58 #include <calentryview.h>
       
    59 #include <calcommon.h>
       
    60 #include <calendar.mbg>
       
    61 #include <Calendar.rsg>
       
    62 #include <calencommands.hrh>            // Calendar commands
       
    63 #include <calencontext.h>
       
    64 #include <caleninstanceid.h>            // TCalenInstanceId
       
    65 #include <calenservices.h>
       
    66 #include <calentoolbar.h>
       
    67 
       
    68 // user includes
       
    69 #include "calenmissedeventcontainer.h"
       
    70 #include "calennativeview.h"
       
    71 #include "calendarui_debug.h"
       
    72 #include "calenicondrawer.h"
       
    73 #include "calennotedatautil.h"
       
    74 #include "calenentryutil.h"
       
    75 #include "CalenUid.h"   // KUidCalendar
       
    76 #include "calenlocationutil.h"
       
    77 
       
    78 // LOCAL CONSTANTS AND MACROS
       
    79 _LIT( KWesternSummaryMarker, "\x200E" );
       
    80 _LIT( KArabicSummaryMarker , "\x200F" );
       
    81 _LIT(KSpace, " ");
       
    82 _LIT(KYearFormatString,"%F%Y");
       
    83 
       
    84 const TInt KDefaultRightMargin=0;
       
    85 const TInt KScrollViewerUp = 1;
       
    86 const TInt KScrollViewerDown = -1;
       
    87 const TInt KMaxDateLength = 32;
       
    88 
       
    89 //PANIC CODE
       
    90 enum TPanicCode
       
    91     {   
       
    92     EPanicArrayOfSizeZero=2,
       
    93     };
       
    94     
       
    95 // ----------------------------------------------------------------------------
       
    96 // CCalenMissedEventContainer::CCalenMissedEventContainer
       
    97 // C++ constructor.
       
    98 // ----------------------------------------------------------------------------
       
    99 //
       
   100 CCalenMissedEventContainer::CCalenMissedEventContainer(CCalenNativeView* aView,
       
   101                               MCalenServices& aServices  )
       
   102     : CCalenContainer( aView, aServices ),
       
   103     					  iEntry(NULL)
       
   104     					 
       
   105     {
       
   106 	TRACE_ENTRY_POINT;
       
   107 	TRACE_EXIT_POINT;
       
   108     }
       
   109  
       
   110 // ----------------------------------------------------------------------------
       
   111 // CCalenMissedEventContainer::~CCalenMissedEventContainer
       
   112 // Destructor
       
   113 // ----------------------------------------------------------------------------
       
   114 //
       
   115 CCalenMissedEventContainer::~CCalenMissedEventContainer()
       
   116 	{
       
   117 	TRACE_ENTRY_POINT;
       
   118 	
       
   119 	if(iEntry)
       
   120 		{
       
   121 		delete iEntry;
       
   122 		}
       
   123 	
       
   124 	iFetchedEntries.ResetAndDestroy();
       
   125 	
       
   126 	delete iParaFormat;	
       
   127 	delete iSearchBuf;
       
   128 	delete iEventViewData;
       
   129 	delete iTextEditor;
       
   130 	delete iBgContext;
       
   131     delete iTimeFormat;
       
   132     delete iDateFormat;
       
   133     
       
   134  
       
   135     delete iFindMenu;
       
   136     
       
   137     if( iNotifier )
       
   138         {
       
   139         iNotifier->StopListening();
       
   140         delete iNotifier;        
       
   141         };
       
   142         
       
   143     delete iCenRepSession;	
       
   144 	TRACE_EXIT_POINT;
       
   145 	}
       
   146 
       
   147 // ----------------------------------------------------------------------------
       
   148 // CCalenMissedEventContainer::ConstructImplL
       
   149 // Third phase constructor.
       
   150 // This function was called CCalenNativeView::ConstructL().
       
   151 // (other items were commented in a header).
       
   152 // ----------------------------------------------------------------------------
       
   153 //
       
   154 void CCalenMissedEventContainer::ConstructImplL()
       
   155 	{
       
   156 	TRACE_ENTRY_POINT;
       
   157 	
       
   158 	iTimeFormat = StringLoader::LoadL( R_QTN_TIME_USUAL_WITH_ZERO, CEikonEnv::Static() );
       
   159     iDateFormat = StringLoader::LoadL( R_QTN_DATE_USUAL_WITH_ZERO, CEikonEnv::Static() );
       
   160 	
       
   161     iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain,
       
   162                                                            Rect(),
       
   163                                                            ETrue );
       
   164      
       
   165    
       
   166     iFindMenu = CFindItemMenu::NewL( EFindItemMenuPlaceHolder );
       
   167     iFindMenu->AttachItemFinderMenuL(0);
       
   168     
       
   169     iParaFormat = CParaFormat::NewL();
       
   170 
       
   171 	
       
   172 	iTextEditor = new (ELeave) CEikRichTextEditor;
       
   173     iTextEditor->ConstructL(this, 0, 0, CEikEdwin::EReadOnly | CEikEdwin::EAvkonDisableCursor | 
       
   174     									CEikEdwin::ENoAutoSelection|CEikEdwin::EAvkonEditor); 
       
   175     iTextEditor->SetMopParent(this);
       
   176     iTextEditor->SetRect( Rect() );
       
   177 	
       
   178     
       
   179 	iTextEditor->EnableKineticScrollingL(ETrue);
       
   180 	
       
   181 	//Set toolbar visibility to false, bcoz this view is not using the ToolBar
       
   182 	MCalenToolbar* toolbar = iServices.ToolbarOrNull(); 
       
   183     if(toolbar)
       
   184       {
       
   185       toolbar->SetToolbarVisibilityL(EFalse);  
       
   186       }
       
   187 	    
       
   188    	TRACE_EXIT_POINT;
       
   189 	}
       
   190 
       
   191 // ----------------------------------------------------------------------------
       
   192 // CCalenMissedEventContainer::UpdateSize
       
   193 // Do layout changes after calendar settings are
       
   194 // changed.  No necessary actions for this view.
       
   195 // ----------------------------------------------------------------------------
       
   196 //
       
   197 void CCalenMissedEventContainer::UpdateSize()
       
   198 	{
       
   199 	TRACE_ENTRY_POINT;
       
   200 	
       
   201 	TRACE_EXIT_POINT;
       
   202 	}
       
   203 
       
   204 // ----------------------------------------------------------------------------
       
   205 // CCalenMissedEventContainer::CreateIconIndicesL
       
   206 // Second and final stage of population.
       
   207 // (other items were commented in a header).
       
   208 // ----------------------------------------------------------------------------
       
   209 //
       
   210 void CCalenMissedEventContainer::CreateIconIndicesL( RArray<MCalenServices::TCalenIcons>& /*aIndexArray*/ )
       
   211     {
       
   212     TRACE_ENTRY_POINT;
       
   213 
       
   214     TRACE_EXIT_POINT;
       
   215     }
       
   216 
       
   217 // ----------------------------------------------------------------------------
       
   218 // CCalenMissedEventContainer::CompletePopulationL
       
   219 // Complete population
       
   220 // (other items were commented in a header).
       
   221 // ----------------------------------------------------------------------------
       
   222 //
       
   223 void CCalenMissedEventContainer::CompletePopulationL()
       
   224 	{
       
   225 	TRACE_ENTRY_POINT;
       
   226     
       
   227     iTextEditor->SetFocus(ETrue);
       
   228 	ActivateL();
       
   229 	AddToStackAndMakeVisibleL();
       
   230 	DrawDeferred();
       
   231 	
       
   232 	TRACE_EXIT_POINT;
       
   233 	}
       
   234 
       
   235 // ----------------------------------------------------------------------------
       
   236 // CCalenMissedEventContainer::HandleNaviDecoratorEventL
       
   237 // ?implementation_description
       
   238 // (other items were commented in a header).
       
   239 // ----------------------------------------------------------------------------
       
   240 //
       
   241 void CCalenMissedEventContainer::HandleNaviDecoratorEventL( TInt /*aEventID*/ )
       
   242 	{
       
   243 	TRACE_ENTRY_POINT;
       
   244 	
       
   245 	TRACE_EXIT_POINT;	
       
   246 	}
       
   247 
       
   248 // ----------------------------------------------------------------------------
       
   249 // CCalenMissedEventContainer::HandleLongTapEventL
       
   250 // processing of a long tap event
       
   251 // (other items were commented in a header).
       
   252 // ----------------------------------------------------------------------------
       
   253 //
       
   254 void CCalenMissedEventContainer::HandleLongTapEventL( const TPoint& /*aPenEventLocation*/,
       
   255                                               const TPoint& /*aPenEventScreenLocation*/ )
       
   256     {
       
   257     TRACE_ENTRY_POINT;
       
   258 
       
   259     TRACE_EXIT_POINT;
       
   260     }
       
   261 
       
   262 // ----------------------------------------------------------------------------
       
   263 // CCalenMissedEventContainer::Draw
       
   264 // (other items were commented in a header).
       
   265 // ----------------------------------------------------------------------------
       
   266 //
       
   267 void CCalenMissedEventContainer::Draw(const TRect& /*aRect*/) const
       
   268 	{
       
   269 	TRACE_ENTRY_POINT;
       
   270 	
       
   271 	CWindowGc& gc = SystemGc();
       
   272         
       
   273     TRect mainPane;
       
   274     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane );
       
   275     TRect bgContextRect( TPoint(0, 0), mainPane.Size() );
       
   276     iBgContext->SetRect( bgContextRect);
       
   277     iBgContext->SetParentPos(mainPane.iTl);
       
   278     AknsDrawUtils::Background( AknsUtils::SkinInstance(), iBgContext, this, gc, Rect());
       
   279 
       
   280 	
       
   281 	TRACE_EXIT_POINT;
       
   282 	}
       
   283 
       
   284 // ----------------------------------------------------------------------------
       
   285 // CCalenMissedEventContainer::Sizechanged
       
   286 // Child control was resized.
       
   287 // (other items were commented in a header)
       
   288 // ----------------------------------------------------------------------------
       
   289 //
       
   290 void CCalenMissedEventContainer::SizeChanged()
       
   291     {
       
   292     TRACE_ENTRY_POINT;
       
   293 
       
   294      if (iTextEditor)
       
   295         {
       
   296      	TRAPD(error,iTextEditor->HandleTextChangedL() );
       
   297 		if(error!=KErrNone)
       
   298 	    	{
       
   299 	    	// Do nothing to avoid warning
       
   300 	    	}
       
   301    	    }
       
   302     
       
   303     TRACE_EXIT_POINT;    
       
   304     }
       
   305     
       
   306 // ----------------------------------------------------------------------------
       
   307 // CCalenMissedEventContainer::CountComponentControls
       
   308 // Return child control count.
       
   309 // (other items were commented in a header).
       
   310 // ----------------------------------------------------------------------------
       
   311 //
       
   312 TInt CCalenMissedEventContainer::CountComponentControls() const
       
   313     {
       
   314     TRACE_ENTRY_POINT;
       
   315     TRACE_EXIT_POINT;
       
   316     return 1;
       
   317     }
       
   318 
       
   319 // ----------------------------------------------------------------------------
       
   320 // CCalenMissedEventContainer::ComponentControl
       
   321 // Return child control pointer.
       
   322 // (other items were commented in a header).
       
   323 // ----------------------------------------------------------------------------
       
   324 //
       
   325 CCoeControl* CCalenMissedEventContainer::ComponentControl(TInt /*aIndex*/) const     // Child control index
       
   326     {
       
   327     TRACE_ENTRY_POINT;
       
   328     TRACE_EXIT_POINT;
       
   329     return iTextEditor;
       
   330     }
       
   331 
       
   332 // ----------------------------------------------------------------------------
       
   333 // CCalenMissedEventContainer::OfferKeyEventL
       
   334 // Process key event.
       
   335 // (other items were commented in a header).
       
   336 // ----------------------------------------------------------------------------
       
   337 //
       
   338 TKeyResponse CCalenMissedEventContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
       
   339     {
       
   340     TRACE_ENTRY_POINT;
       
   341 
       
   342     TKeyResponse keyResponse(EKeyWasNotConsumed);
       
   343 
       
   344     if (aType == EEventKey)
       
   345         {
       
   346         switch (aKeyEvent.iCode)
       
   347             {
       
   348             case EKeyUpArrow:
       
   349                 {
       
   350                
       
   351                 // Scroll the text view up by one line
       
   352                 iTextEditor->MakeVisible(EFalse);
       
   353                 TInt scrollLines = KScrollViewerUp;
       
   354                 iTextEditor->TextView()->ScrollDisplayLinesL(scrollLines);
       
   355                 iTextEditor->UpdateScrollBarsL();
       
   356                 iTextEditor->MakeVisible(ETrue);
       
   357                 //Set focus immediately for highlight of auto find text 
       
   358                 iTextEditor->SetFocus(ETrue);
       
   359                 keyResponse = EKeyWasConsumed;
       
   360                 }
       
   361                 break;
       
   362 
       
   363             case EKeyDownArrow:
       
   364                 {
       
   365                
       
   366                 // Scroll the text view down by one line
       
   367                 iTextEditor->MakeVisible(EFalse);
       
   368                 TInt scrollLines = KScrollViewerDown;
       
   369                 iTextEditor->TextView()->ScrollDisplayLinesL(scrollLines);
       
   370                 iTextEditor->UpdateScrollBarsL();
       
   371                 iTextEditor->MakeVisible(ETrue);
       
   372                 //Set focus immediately for highlight of auto find text
       
   373                 iTextEditor->SetFocus(ETrue);
       
   374                 keyResponse = EKeyWasConsumed;
       
   375                 }
       
   376                 break;
       
   377                 
       
   378             case EKeyOK:
       
   379             	{            	
       
   380               	iView->HandleCommandL(ECalenCmdPromptThenEdit);
       
   381                 keyResponse = EKeyWasConsumed;
       
   382             	}
       
   383                 break;
       
   384             case EKeyEscape:
       
   385             	{
       
   386             	// Calendar relaunched from cmd line - close viewer
       
   387                 iView->HandleCommandL(EAknSoftkeyBack);
       
   388                 keyResponse = EKeyWasConsumed;
       
   389             	}
       
   390                 break;
       
   391             case EKeyPhoneSend:
       
   392              	{
       
   393                 if(CCalenLocationUtil::IsMapProviderAvailableL())	
       
   394 					{
       
   395 					iServices.IssueCommandL(ECalenGetLocationAndSave);
       
   396     				keyResponse = EKeyWasConsumed;		
       
   397 					}
       
   398                 break;
       
   399               }
       
   400             case EKeyApplication0:
       
   401             	{
       
   402             	TPtrC location = iEntry->LocationL();
       
   403 				if(location.Length() || iEntry->GeoValueL())
       
   404 					{
       
   405 					if(CCalenLocationUtil::IsMapProviderAvailableL())	
       
   406     					{
       
   407     					iServices.IssueCommandL(ECalenShowLocation);
       
   408         				keyResponse = EKeyWasConsumed;		
       
   409     					}
       
   410 					}	
       
   411              	}
       
   412                 break;
       
   413             case EKeyBackspace:  /* fall through... */
       
   414             case EKeyDelete:
       
   415             	{            
       
   416              	iView->HandleCommandL( ECalenDeleteCurrentEntry );            	
       
   417             	}
       
   418                 break;
       
   419             default:
       
   420                 break;
       
   421             }
       
   422         }
       
   423 
       
   424     // Swallow all other keyevents to prevent the active container processing them.
       
   425     keyResponse = EKeyWasConsumed;
       
   426 
       
   427     TRACE_EXIT_POINT;
       
   428     return keyResponse;
       
   429 
       
   430  
       
   431     }
       
   432 
       
   433 
       
   434 // ----------------------------------------------------------------------------
       
   435 // CCalenMissedEventContainer::HandlePointerEventL
       
   436 // Process pointer event.
       
   437 // (other items were commented in a header).
       
   438 // ----------------------------------------------------------------------------
       
   439 //
       
   440 void CCalenMissedEventContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent)
       
   441     {
       
   442     TRACE_ENTRY_POINT;
       
   443     
       
   444     if(!AknLayoutUtils::PenEnabled())
       
   445 	 {
       
   446 	 	return;
       
   447 	 }
       
   448     CCalenContainer::HandlePointerEventL( aPointerEvent );
       
   449     if(iTextEditor->Rect().Contains(aPointerEvent.iPosition))
       
   450     	{
       
   451     	switch(aPointerEvent.iType)
       
   452     		{
       
   453     		case TPointerEvent::EButton1Down:
       
   454     			{
       
   455     			iTextEditor->SetFocus(ETrue);
       
   456     			break;
       
   457     			}
       
   458     		case TPointerEvent::EDrag:
       
   459     			{
       
   460     			iTextEditor->SetFocus(ETrue);
       
   461     			break;
       
   462     			}
       
   463     		case TPointerEvent::EButton1Up:
       
   464     			{
       
   465     			iTextEditor->SetFocus(ETrue);
       
   466     			TInt curPos = iTextEditor->CursorPos();	
       
   467 		        TRect rect = iTextEditor->Rect();  
       
   468     			break;	
       
   469     			}
       
   470     		default:
       
   471     			{
       
   472     			break;	
       
   473     			}	
       
   474     		}
       
   475        	}    
       
   476        	
       
   477     TRACE_EXIT_POINT;
       
   478     }
       
   479     
       
   480 // ----------------------------------------------------------------------------
       
   481 // CCalenMissedEventContainer::GetHelpContext
       
   482 // Get help context.
       
   483 // (other items were commented in a header).
       
   484 // ----------------------------------------------------------------------------
       
   485 //
       
   486 void CCalenMissedEventContainer::GetHelpContext(TCoeHelpContext& aContext) const
       
   487     {
       
   488     TRACE_ENTRY_POINT;
       
   489     
       
   490     aContext.iMajor = KUidCalendar;
       
   491     aContext.iContext = KCALE_HLP_NOTE_VIEWER; // need to change	
       
   492 	
       
   493     TRACE_EXIT_POINT;
       
   494     }
       
   495 
       
   496 // ----------------------------------------------------------------------------
       
   497 // CCalenMissedEventContainer::HandleResourceChange
       
   498 // Handles a resource relative event
       
   499 // (other items were commented in a header).
       
   500 // ----------------------------------------------------------------------------
       
   501 //
       
   502 void CCalenMissedEventContainer::HandleResourceChange(TInt aType)
       
   503     {
       
   504     TRACE_ENTRY_POINT; 
       
   505 
       
   506     CCalenContainer::HandleResourceChange( aType );
       
   507     
       
   508     if(( aType == KUidValueCoeColorSchemeChangeEvent ) ||
       
   509         ( aType == KUidValueCoeZoomChangeEvent ) ||
       
   510         ( aType == KUidValueCoeFontChangeEvent ))
       
   511         {
       
   512         CEikAppUi* appUi = static_cast<CEikAppUi*>( ControlEnv()->AppUi() );
       
   513         SetRect( appUi->ClientRect() );
       
   514         /*TRect mainPane;
       
   515         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane );
       
   516         SetRect( mainPane );*/
       
   517         }
       
   518     
       
   519     if(aType == KAknsMessageSkinChange || aType == KEikDynamicLayoutVariantSwitch)
       
   520         {
       
   521         SizeChanged();
       
   522 
       
   523         SetupFontL();
       
   524         // refresh
       
   525         TRAPD(err,iView->BeginRepopulationL());
       
   526         if(err!=KErrNone)
       
   527             {
       
   528             // do avoid warning
       
   529             } 
       
   530         }
       
   531     
       
   532     CCoeControl::HandleResourceChange( aType );
       
   533     
       
   534     TRACE_EXIT_POINT;
       
   535     }
       
   536 
       
   537 // ----------------------------------------------------------------------------
       
   538 // CCalenMissedEventContainer::BuildTextEditorL
       
   539 // Build text editor
       
   540 // (other items were commented in a header).
       
   541 // ----------------------------------------------------------------------------
       
   542 //
       
   543 void CCalenMissedEventContainer::BuildTextEditorL()
       
   544 	{
       
   545 	TRACE_ENTRY_POINT; 
       
   546         
       
   547     iTextEditor->SetFocus(EFalse);    
       
   548     iTextEditor->SetRect( Rect() );
       
   549     iTextEditor->RichText()->Reset();
       
   550     
       
   551     // Create the scroll bars.
       
   552     iTextEditor->CreateScrollBarFrameL();
       
   553     iTextEditor->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
       
   554     iTextEditor->SetAknEditorFlags(EAknEditorFlagEnableScrollBars);
       
   555     iTextEditor->ScrollBarFrame()->VerticalScrollBar()->SetMopParent(this);
       
   556     
       
   557     iTextEditor->ScrollBarFrame()->SetScrollBarFrameObserver(this);
       
   558     
       
   559     TEikScrollBarModel h,v;
       
   560     TEikScrollBarFrameLayout lay;
       
   561     CEikAppUi* appUi = static_cast<CEikAppUi*>( ControlEnv()->AppUi() );
       
   562     TRect rec = appUi->ClientRect();
       
   563  //   ASSERT( iTextEditor->ScrollBarFrame()->TileL( &h, &v, rec, rec, lay) );
       
   564     
       
   565     SetLayoutFromLookAndFeel();
       
   566     
       
   567     SetupFontL();
       
   568     
       
   569     TRACE_EXIT_POINT;
       
   570 	}
       
   571 
       
   572 // ----------------------------------------------------------------------------
       
   573 // CCalenMissedEventContainer::SetIconsL
       
   574 // Set the icons
       
   575 // (other items were commented in a header).
       
   576 // ----------------------------------------------------------------------------
       
   577 //
       
   578 void CCalenMissedEventContainer::SetIconsL()
       
   579 	{
       
   580 	// Create and populate the icon drawer.  We need to do this first to prevent a long
       
   581     // summary text being drawn over the icons
       
   582     CCalenIconDrawer* iconDrawer = CCalenIconDrawer::NewL( iServices );
       
   583     CleanupStack::PushL(iconDrawer);
       
   584     PopulateIconDrawerL(*iconDrawer);
       
   585 
       
   586     // Get rid of the last paragraph delimiter so we can't scroll past the bottom of the text.
       
   587     iTextEditor->RichText()->DeleteL( iTextEditor->RichText()->DocumentLength()-1, 1 );
       
   588 
       
   589     // Create a TPictureHeader to insert our icons into the viewer
       
   590     TPictureHeader header;
       
   591     header.iPicture = TSwizzle<CPicture>(iconDrawer);
       
   592 
       
   593     // Insert the icon drawer into the Rich Text Editor.  This takes
       
   594     // ownership of the icon drawer.
       
   595     // Insert at index 0 in the document to cause the icons to be drawn when
       
   596     // the first line is visible.  The icons will not be drawn at position 0,
       
   597     // but this position must be on the screen for the icons to be drawn.
       
   598     iTextEditor->RichText()->InsertL( 0, header );
       
   599 
       
   600     // Ownership of icon drawer transferred to rich text editor
       
   601     CleanupStack::Pop(iconDrawer);
       
   602 
       
   603     // Tell the text editor that it has been updated.  This will cause
       
   604     // a redraw.
       
   605     iTextEditor->HandleTextChangedL();
       
   606 	
       
   607 	}
       
   608 
       
   609 // ----------------------------------------------------------------------------
       
   610 // CCalenMissedEventContainer::RequestInstanceViewL
       
   611 // Request for instance view
       
   612 // (other items were commented in a header).
       
   613 // ----------------------------------------------------------------------------
       
   614 //
       
   615 void CCalenMissedEventContainer::RequestInstanceViewL()
       
   616 	{
       
   617 	TRACE_ENTRY_POINT; 
       
   618 
       
   619     MCalenContext& context = iServices.Context();
       
   620     TCalLocalUid instanceId = context.InstanceId().iEntryLocalUid;
       
   621 	
       
   622 	if(iEntry)
       
   623 		{
       
   624 		delete iEntry;
       
   625 		iEntry = NULL;
       
   626 		}
       
   627 	
       
   628 	iEntry = iServices.EntryViewL(context.InstanceId().iColId)->FetchL(instanceId);
       
   629 	
       
   630 	TCalTime instanceDateTime;
       
   631 	instanceDateTime.SetTimeLocalL( context.InstanceId().iInstanceTime );
       
   632     
       
   633     if(iEventViewData)
       
   634     	{
       
   635     	delete iEventViewData;
       
   636     	iEventViewData = NULL;
       
   637     	}
       
   638     iEventViewData = CCalenEntryUtil::NewL( *iEntry, instanceDateTime );
       
   639     
       
   640     TRACE_EXIT_POINT;
       
   641 	}
       
   642 
       
   643 // ----------------------------------------------------------------------------
       
   644 // CCalenMissedEventContainer::AddFieldsL
       
   645 // Add the data fields
       
   646 // (other items were commented in a header).
       
   647 // ----------------------------------------------------------------------------
       
   648 //
       
   649 void CCalenMissedEventContainer::AddFieldsL()
       
   650 	{
       
   651 	TRACE_ENTRY_POINT;
       
   652 	
       
   653 	// add subject field
       
   654 	AddSubjectFieldL();	
       
   655 	
       
   656 	switch ( iEntry->EntryTypeL() )
       
   657         {
       
   658         case CCalEntry::EReminder:
       
   659         case CCalEntry::EAppt:
       
   660         	{
       
   661         	// start time
       
   662 		    AddTimeFieldL();
       
   663 
       
   664 		    // location
       
   665 		    AddLocationFieldL();
       
   666 
       
   667 		    // extra empty line between primary and secondary information
       
   668 		    AddEmptyLineL();
       
   669 
       
   670 		    // alarm
       
   671 		    AddAlarmDateTimeFieldL();
       
   672 
       
   673 		    // We want to show the repeat fields for repeating parent entries or 
       
   674 		    // child entries.  If the entry is a child then the repeat information from the
       
   675 		    // parent will be shown
       
   676 		    //if ((iEventViewData->IsRepeating()) || (Handler().Edited()->Entry().RecurrenceIdL().TimeUtcL() != Time::NullTTime()))
       
   677 		    if ((iEventViewData->IsRepeating()) || (iEntry->RecurrenceIdL().TimeUtcL() != Time::NullTTime()))
       
   678 		        {
       
   679 		        AddRepeatFieldL();
       
   680 		        }
       
   681 		    iTitleTextId = R_CALEN_EVENT_VIEW_MEETING_TITLE;    
       
   682 		   	}
       
   683             break;
       
   684 
       
   685         case CCalEntry::EAnniv:
       
   686             {
       
   687             // date field
       
   688             AddDateFieldL(iEventViewData->StartDateTime());
       
   689     		
       
   690     		// Add the time
       
   691     		//AddTimeFieldL();
       
   692 
       
   693     		// extra empty line between primary and secondary information
       
   694     		AddEmptyLineL();
       
   695 
       
   696     		// alarm
       
   697     		AddAlarmDateTimeFieldL();
       
   698 
       
   699     		// Add the 'since' field.
       
   700     		AddSinceFieldL();
       
   701 
       
   702 		    iTitleTextId = R_CALEN_EVENT_VIEW_ANNIV_TITLE;      		
       
   703 	        }
       
   704             break;
       
   705  
       
   706         case CCalEntry::EEvent:
       
   707  			{
       
   708 		 	// If the start time is on the same day as the end time, just show the date.
       
   709 			// Otherwise, show "start date - end date".
       
   710 			TTime startTime = iEventViewData->StartDateTime();
       
   711 			TTime endTime = iEventViewData->EndDateTime();
       
   712 
       
   713 			if( CalenDateUtils::OnSameDay(startTime, endTime) )
       
   714 				{
       
   715 				AddDateFieldL(startTime );
       
   716 				}
       
   717 			else
       
   718 				{
       
   719 				AddDateDateFieldL(startTime, endTime);
       
   720 				}
       
   721 
       
   722 		    // extra empty line between primary and secondary information
       
   723 		    AddEmptyLineL();
       
   724 
       
   725 		    // alarm    
       
   726 		    AddAlarmDateTimeFieldL();
       
   727 		    
       
   728 		    // Currently it's not possible to create a repeating day note in the UI.
       
   729 		    // However, it is possible to import one from an iCalendar file or create
       
   730 		    // one in code. Therefore the repeat properties of day notes are shown
       
   731 		    // if they exist. If the entry is modified (in the editor), the repeat
       
   732 		    // properties will be lost.
       
   733 		    if(iEventViewData->IsRepeating())
       
   734 		        {
       
   735 		        AddRepeatFieldL();
       
   736 		        }
       
   737 		        
       
   738 		
       
   739 		    iTitleTextId = R_CALEN_EVENT_VIEW_ALLDAY_TITLE;
       
   740 		    
       
   741  			}
       
   742             break;
       
   743 
       
   744         case CCalEntry::ETodo:
       
   745             {
       
   746 		    // extra empty line between primary and secondary information
       
   747 		    AddEmptyLineL();
       
   748 
       
   749 			// Due date
       
   750 			TTime dueDate = iEventViewData->EventDateTime();
       
   751 		    AddDateFieldL(R_QTN_CALE_EVENT_VIEW_DUE_DATE, dueDate);
       
   752 
       
   753 		    // Alarm is only shown if the todo is not complete.
       
   754 		    //if (Handler().Entry().StatusL() != CCalEntry::ETodoCompleted)
       
   755 			if (iEntry->StatusL() != CCalEntry::ETodoCompleted)
       
   756 		        {
       
   757 		        AddAlarmDateTimeFieldL();
       
   758 		        }
       
   759 
       
   760 		    // Show completion date if complete
       
   761 		    else
       
   762 		        {
       
   763 		        AddDateFieldL(R_QTN_CALE_EVENT_VIEW_COMPLETED, iEntry->CompletedTimeL().TimeLocalL());
       
   764 		        }
       
   765 
       
   766 		    // Priority
       
   767 		    AddPriorityFieldL();
       
   768 		    
       
   769 		    // Repeat rules.  Supporting repeating todos sounds like asking for trouble to me.
       
   770 		    if (iEventViewData->IsRepeating())
       
   771 		        {
       
   772 		        AddRepeatFieldL();
       
   773 		        }
       
   774 		        
       
   775 		    iTitleTextId = R_CALEN_EVENT_VIEW_TODO_TITLE;  			
       
   776             }
       
   777             break;
       
   778 
       
   779         default:
       
   780             __ASSERT_DEBUG(EFalse, User::Invariant());
       
   781             break;
       
   782         }
       
   783 
       
   784 	// Add Description
       
   785     AddDescriptionFieldL();
       
   786 	
       
   787 	SetIconsL();
       
   788 	TRACE_EXIT_POINT;
       
   789 	}
       
   790 
       
   791 // ----------------------------------------------------------------------------
       
   792 // CCalenMissedEventContainer::SetLayoutFromLookAndFeel
       
   793 // Set the layout data
       
   794 // (other items were commented in a header).
       
   795 // ----------------------------------------------------------------------------
       
   796 //
       
   797 void CCalenMissedEventContainer::SetLayoutFromLookAndFeel()
       
   798 	{
       
   799     TRACE_ENTRY_POINT;
       
   800 
       
   801     iParaFormat->Reset();
       
   802     iParaFormatMask.ClearAll();
       
   803     iCharFormatMask.ClearAll();
       
   804 
       
   805     iParaFormatMask.SetAttrib(EAttLeftMargin);
       
   806     iParaFormatMask.SetAttrib(EAttRightMargin);
       
   807 
       
   808     // Get the main pane
       
   809     TSize main_pane_size;
       
   810     AknLayoutUtils::LayoutMetricsSize (AknLayoutUtils::EMainPane, main_pane_size);
       
   811     TRect main_pane(main_pane_size);
       
   812 
       
   813     // Get main_cale_event_viewer_pane with main_pane as parent
       
   814     TAknLayoutRect main_cale_event_viewer_pane;
       
   815     main_cale_event_viewer_pane.LayoutRect(main_pane, AknLayoutScalable_Apps::main_cale_event_viewer_pane().LayoutLine() );
       
   816 
       
   817     // Get listscroll_cale_event_viewer_pane with main_cale_event_viewer_pane as parent
       
   818     TAknLayoutRect listscroll_cale_event_viewer_pane;
       
   819     listscroll_cale_event_viewer_pane.LayoutRect(main_cale_event_viewer_pane.Rect(), AknLayoutScalable_Apps::listscroll_cale_event_viewer_pane().LayoutLine() );
       
   820 
       
   821     // Get list_cale_ev2_pane with listscroll_cale_event_viewer_pane as parent
       
   822     TAknLayoutRect list_cale_ev2_pane;
       
   823     list_cale_ev2_pane.LayoutRect(listscroll_cale_event_viewer_pane.Rect(), AknLayoutScalable_Apps::list_cale_ev2_pane().LayoutLine() );
       
   824     iTextEditor->SetRect(list_cale_ev2_pane.Rect());
       
   825 
       
   826     //TAknLayoutRect scroll_pane_cp023;
       
   827     //scroll_pane_cp023.LayoutRect(listscroll_cale_event_viewer_pane.Rect(), AknLayoutScalable_Apps::scroll_pane_cp023().LayoutLine() );
       
   828     //iTextEditor->ScrollBarFrame()->VerticalScrollBar()->SetRect( scroll_pane_cp023.Rect() );
       
   829     //layoutVariant = lay.LayoutVariantIndex(2);
       
   830     AknLayoutUtils::LayoutVerticalScrollBar( iTextEditor->ScrollBarFrame(),
       
   831                                              listscroll_cale_event_viewer_pane.Rect(),
       
   832                                              AknLayoutScalable_Apps::scroll_pane_cp023().LayoutLine() );
       
   833 
       
   834     // Get field_cale_ev2_pane with list_cale_ev2_pane as parent
       
   835     TAknLayoutRect field_cale_ev2_pane;
       
   836     field_cale_ev2_pane.LayoutRect(list_cale_ev2_pane.Rect(), AknLayoutScalable_Apps::field_cale_ev2_pane(0).LayoutLine() );
       
   837 
       
   838     // Get field_cale_ev2_pane_t1
       
   839     TAknTextLineLayout field_cale_ev2_pane_t1 = AknLayoutScalable_Apps::field_cale_ev2_pane_t1(0).LayoutLine();
       
   840 
       
   841     // Get heading layout properties from field_cale_ev2_pane_t1 with list_cale_ev2_pane as parent
       
   842     TAknLayoutText headingTextLayout;
       
   843     headingTextLayout.LayoutText(list_cale_ev2_pane.Rect(), field_cale_ev2_pane_t1);
       
   844 
       
   845     // Set heading indenting and font
       
   846     if (!AknLayoutUtils::LayoutMirrored())
       
   847         {
       
   848         // Normal L-R layout.
       
   849         // Heading indent is heading text layout rect left x pos -
       
   850         // text editor rect left xpos.  The heading text layout rect gives us an absolute
       
   851         // screen position, but the value that we need should be relative to
       
   852         // the text editor itself
       
   853         TInt headingIndentPixels =  headingTextLayout.TextRect().iTl.iX -
       
   854                                     list_cale_ev2_pane.Rect().iTl.iX;
       
   855         iHeadingIndent    = PixelsToTwips(headingIndentPixels);
       
   856         }
       
   857     else
       
   858         {
       
   859         // Mirrored, R-L layout.
       
   860         // Heading indent is the text editor rect right x pos -
       
   861         // the heading text layout rect right x pos
       
   862         TInt headingIndentPixels =  list_cale_ev2_pane.Rect().iBr.iX -
       
   863                                     headingTextLayout.TextRect().iBr.iX;
       
   864         iHeadingIndent    = PixelsToTwips(headingIndentPixels);
       
   865         }
       
   866 
       
   867     iHeadingFontSpec  = headingTextLayout.Font()->FontSpecInTwips();
       
   868     iHeadingFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
       
   869     iEmptyLineHeight  = PixelsToTwips(headingTextLayout.TextRect().Height() / 2);
       
   870 
       
   871     // Get field_cale_ev2_pane_t2
       
   872     TAknTextLineLayout field_cale_ev2_pane_t2 = AknLayoutScalable_Apps::field_cale_ev2_pane_t2(0).LayoutLine();
       
   873 
       
   874     // Get body layout properties from field_cale_ev2_pane_t2 // with field_ev_content_pane as parent
       
   875     TAknLayoutText bodyTextLayout;
       
   876     bodyTextLayout.LayoutText(list_cale_ev2_pane.Rect(), field_cale_ev2_pane_t2);
       
   877     iMaxWidth = bodyTextLayout.TextRect().Width();
       
   878 
       
   879     // Set body indenting and font
       
   880     if (!AknLayoutUtils::LayoutMirrored())
       
   881         {
       
   882         // Normal L-R layout.
       
   883         // Body text indent is body text layout rect left x pos -
       
   884         // text editor rect left xpos.  The heading text layout rect gives us an absolute
       
   885         // screen position, but the value that we need should be relative to
       
   886         // the text editor itself
       
   887         TInt bodyIndentPixels = bodyTextLayout.TextRect().iTl.iX -
       
   888                                 list_cale_ev2_pane.Rect().iTl.iX;
       
   889         iBodyIndent    = PixelsToTwips(bodyIndentPixels);
       
   890         }
       
   891     else
       
   892         {
       
   893         // Mirrored, R-L layout.
       
   894         // Body indent is the text editor rect right x pos -
       
   895         // the body text layout rect right x pos
       
   896         TInt bodyIndentPixels = list_cale_ev2_pane.Rect().iBr.iX -
       
   897                                 bodyTextLayout.TextRect().iBr.iX;
       
   898         iBodyIndent = PixelsToTwips(bodyIndentPixels);
       
   899         }
       
   900 
       
   901     iBodyFontSpec = bodyTextLayout.Font()->FontSpecInTwips();
       
   902     iBodyFont = bodyTextLayout.Font(); // Used for TryToFitL	
       
   903 	
       
   904 	TRACE_EXIT_POINT;
       
   905 	}		
       
   906 
       
   907 // ----------------------------------------------------------------------------
       
   908 // CCalenMissedEventContainer::SetupFontL
       
   909 // Set the font colour, and set default para/char format layers to the
       
   910 // rich text editor.
       
   911 // (other items were commented in a header).
       
   912 // ----------------------------------------------------------------------------
       
   913 //
       
   914 void CCalenMissedEventContainer::SetupFontL()	
       
   915 	{
       
   916     TRACE_ENTRY_POINT;
       
   917 
       
   918     // Set desired character formatting attributes. Gets sensible text colour based on theme.
       
   919     TRgb textColourFromSkin(255,0,0);					 // If you see bright red text, the skins api is broken!
       
   920     MAknsSkinInstance* skin = AknsUtils::SkinInstance(); // Does not transfer ownership.
       
   921     AknsUtils::GetCachedColor(skin, textColourFromSkin, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6);
       
   922 
       
   923     TCharFormat charFormat;
       
   924     TCharFormatMask charFormatMask;
       
   925     // Set the text colour we found.
       
   926     charFormat.iFontPresentation.iTextColor = TLogicalRgb(textColourFromSkin);
       
   927     charFormatMask.SetAttrib(EAttColor);
       
   928 
       
   929     // Set up our paragraph formatting attributes.
       
   930     CParaFormat* paraFormat = CParaFormat::NewLC();
       
   931     TParaFormatMask paraFormatMask;
       
   932 
       
   933     // Set up the default font so it's the same as the body text used.
       
   934     // This means we can do without setting the para/char format layers
       
   935     // when adding body text.
       
   936     paraFormat->iLeftMarginInTwips = iBodyIndent;
       
   937     paraFormatMask.SetAttrib(EAttLeftMargin);
       
   938     paraFormatMask.SetAttrib(EAttRightMargin);
       
   939 
       
   940     charFormat.iFontSpec = iBodyFontSpec;
       
   941     charFormatMask.SetAttrib(EAttFontHeight);
       
   942     charFormatMask.SetAttrib(EAttFontTypeface);
       
   943     charFormatMask.SetAttrib(EAttFontStrokeWeight);
       
   944 
       
   945     // Create some format layers based on the attributes we specified above.
       
   946     // The underlying Edwin will take ownership of the format objects created below, so don't need to delete.
       
   947     CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL(paraFormat, paraFormatMask);
       
   948     CleanupStack::PushL(paraFormatLayer);
       
   949     CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL(charFormat, charFormatMask);
       
   950     CleanupStack::Pop(paraFormatLayer);
       
   951 
       
   952     // Set the format layers.
       
   953     iTextEditor->SetParaFormatLayer(paraFormatLayer);
       
   954     iTextEditor->SetCharFormatLayer(charFormatLayer);
       
   955 
       
   956     // And get rid of paraFormat. All other allocations are owned by the CEikRichTextEditor.
       
   957     CleanupStack::PopAndDestroy(paraFormat);	
       
   958 
       
   959 	TRACE_EXIT_POINT;
       
   960 	}		
       
   961 
       
   962 // -----------------------------------------------------------------------------
       
   963 // CCalenViewerBase::PopulateIconDrawerL
       
   964 // Ask IconDrawer to prepare icons that are going to be drawn
       
   965 // (other items were commented in a header).
       
   966 // -----------------------------------------------------------------------------
       
   967 //
       
   968 void CCalenMissedEventContainer::PopulateIconDrawerL(CCalenIconDrawer& aIconDrawer)
       
   969     {
       
   970     TRACE_ENTRY_POINT;
       
   971 
       
   972     // Alarm icon?
       
   973     if( iEventViewData->IsAlarmActivated() )
       
   974         {
       
   975         // For todos, only add the alarm icon if it's not completed.
       
   976         if ( iEventViewData->EntryType() == CCalEntry::ETodo )
       
   977             {
       
   978           //  if(iEditedCalEntry.StatusL() != CCalEntry::ETodoCompleted)
       
   979           	if(iEntry->StatusL() != CCalEntry::ETodoCompleted)	
       
   980                 {
       
   981                 aIconDrawer.AddIconL( MCalenServices::ECalenAlarmIcon );
       
   982                 }
       
   983             }
       
   984         else
       
   985             {
       
   986             aIconDrawer.AddIconL( MCalenServices::ECalenAlarmIcon );
       
   987             }
       
   988         }
       
   989 
       
   990     // Repeat / exception icon?
       
   991     if (iEventViewData->IsRepeating())
       
   992         {
       
   993         aIconDrawer.AddIconL( MCalenServices::ECalenRepeatIcon );
       
   994         }
       
   995     else
       
   996         {
       
   997         if (iEntry->RecurrenceIdL().TimeUtcL() != Time::NullTTime())
       
   998             {
       
   999             aIconDrawer.AddIconL( MCalenServices::ECalenRepeatExceptionIcon );
       
  1000             }
       
  1001         }
       
  1002 
       
  1003     // Todo priority icon?
       
  1004     if (iEventViewData->EntryType() == CCalEntry::ETodo)
       
  1005         {
       
  1006         CCalenEntryUtil::TTodoPriority priority = iEventViewData->Priority();
       
  1007         if (priority == CCalenEntryUtil::ETodoPriorityHigh)
       
  1008             {
       
  1009             aIconDrawer.AddIconL( MCalenServices::ECalenNotePriorityHigh );
       
  1010             }
       
  1011         else if (priority == CCalenEntryUtil::ETodoPriorityLow)
       
  1012             {
       
  1013             aIconDrawer.AddIconL( MCalenServices::ECalenNotePriorityLow );
       
  1014             }
       
  1015         else
       
  1016             {
       
  1017             // nothing
       
  1018             }
       
  1019         }
       
  1020      // Map icon if event has geo coordinates
       
  1021      CCalGeoValue* geovalue = iEntry->GeoValueL();
       
  1022     if(geovalue)
       
  1023 	     {
       
  1024 	     aIconDrawer.AddIconL( MCalenServices::ECalenMapIcon );
       
  1025 	     delete geovalue;
       
  1026 	     }
       
  1027     // Set the icon sizes
       
  1028     aIconDrawer.SetIconSizesFromLayout();
       
  1029 
       
  1030     // Get the icon drawer width
       
  1031     iIconDrawerWidthInPixels = aIconDrawer.WidthInPixels();
       
  1032 
       
  1033     TRACE_EXIT_POINT;
       
  1034     }
       
  1035 
       
  1036 // -----------------------------------------------------------------------------
       
  1037 // CCalenMissedEventContainer::SetFormatAndAddHeadingL
       
  1038 // 
       
  1039 // -----------------------------------------------------------------------------
       
  1040 //
       
  1041 void CCalenMissedEventContainer::SetFormatAndAddHeadingL(const TDesC& aHeading)
       
  1042     {
       
  1043 	TRACE_ENTRY_POINT;
       
  1044 
       
  1045     iCharFormatMask.ClearAll();
       
  1046     iParaFormat->iLeftMarginInTwips = iHeadingIndent;
       
  1047     iCharFormat.iFontSpec = iHeadingFontSpec;
       
  1048     iCharFormatMask.SetAttrib( EAttFontHeight );
       
  1049     iCharFormatMask.SetAttrib( EAttFontTypeface );
       
  1050     iCharFormatMask.SetAttrib( EAttFontStrokeWeight );
       
  1051     AddFormattedTextL( aHeading );
       
  1052 	
       
  1053 	TRACE_EXIT_POINT;
       
  1054     }
       
  1055 
       
  1056 // -----------------------------------------------------------------------------
       
  1057 // CCalenMissedEventContainer::SetFormatAndAddBodyL
       
  1058 // 
       
  1059 // -----------------------------------------------------------------------------
       
  1060 //
       
  1061 void CCalenMissedEventContainer::SetFormatAndAddBodyL(const TDesC& aBody)
       
  1062     {
       
  1063     TRACE_ENTRY_POINT;
       
  1064 
       
  1065     iCharFormatMask.ClearAll();
       
  1066     iParaFormat->iLeftMarginInTwips = iBodyIndent;
       
  1067     iCharFormat.iFontSpec = iBodyFontSpec;
       
  1068     iCharFormatMask.SetAttrib( EAttFontHeight );
       
  1069     iCharFormatMask.SetAttrib( EAttFontTypeface );
       
  1070     iCharFormatMask.SetAttrib( EAttFontStrokeWeight );
       
  1071     AddFormattedTextL( aBody );
       
  1072 
       
  1073     TRACE_EXIT_POINT;
       
  1074     }
       
  1075 
       
  1076 // -----------------------------------------------------------------------------
       
  1077 // CCalenMissedEventContainer::AddEmptyLineL
       
  1078 // 
       
  1079 // -----------------------------------------------------------------------------
       
  1080 //
       
  1081 void CCalenMissedEventContainer::AddEmptyLineL()
       
  1082     {
       
  1083    	TRACE_ENTRY_POINT; 
       
  1084 
       
  1085     CParaFormat* paraFormat = CParaFormat::NewLC();
       
  1086     TParaFormatMask paraFormatMask;
       
  1087     paraFormat->iLineSpacingControl = CParaFormat::ELineSpacingExactlyInTwips;
       
  1088     paraFormatMask.SetAttrib(EAttLineSpacingControl);
       
  1089     paraFormat->iLineSpacingInTwips = iEmptyLineHeight;
       
  1090     paraFormatMask.SetAttrib(EAttLineSpacing);
       
  1091     paraFormatMask.SetAttrib(EAttFontHighlightColor);
       
  1092 
       
  1093     CRichText* richText = iTextEditor->RichText();
       
  1094     TInt startPos = richText->DocumentLength();
       
  1095     richText->InsertL(richText->DocumentLength(), CEditableText::EParagraphDelimiter);
       
  1096     TInt endPos = richText->DocumentLength();
       
  1097 
       
  1098     richText->ApplyParaFormatL(paraFormat, paraFormatMask, startPos, endPos - startPos);
       
  1099 
       
  1100     CleanupStack::PopAndDestroy(paraFormat);
       
  1101 
       
  1102 	TRACE_EXIT_POINT;    
       
  1103     }
       
  1104 
       
  1105 // -----------------------------------------------------------------------------
       
  1106 // CCalenMissedEventContainer::AddFormattedTextL
       
  1107 // Add a string to the view.
       
  1108 // (other items were commented in a header).
       
  1109 // -----------------------------------------------------------------------------
       
  1110 //
       
  1111 void CCalenMissedEventContainer::AddFormattedTextL(const TDesC& aText)
       
  1112     {
       
  1113     TRACE_ENTRY_POINT;
       
  1114 
       
  1115     CRichText* richText = iTextEditor->RichText();
       
  1116     TInt startPos = richText->DocumentLength();
       
  1117     HBufC* text = HBufC::NewLC( aText.Length() + 10);
       
  1118     TPtr target = text->Des();
       
  1119     if(AknLayoutUtils::LayoutMirrored())
       
  1120     	{
       
  1121         target.Append(KArabicSummaryMarker);    
       
  1122     	}
       
  1123     else
       
  1124     	{
       
  1125         target.Append(KWesternSummaryMarker);
       
  1126     	}
       
  1127     target.Append(aText);
       
  1128     
       
  1129     richText->InsertL(startPos, target);
       
  1130     richText->InsertL(richText->DocumentLength(), CEditableText::EParagraphDelimiter);
       
  1131     TInt endPos = richText->DocumentLength();
       
  1132 
       
  1133     richText->ApplyCharFormatL(iCharFormat, iCharFormatMask, startPos, endPos - startPos);
       
  1134     ++startPos;  // Without this the previous paragraph is formatted as well, ie no indent
       
  1135     richText->ApplyParaFormatL(iParaFormat, iParaFormatMask, startPos, endPos - startPos);
       
  1136     CleanupStack::PopAndDestroy(text);
       
  1137 
       
  1138     TRACE_EXIT_POINT;
       
  1139     }
       
  1140 
       
  1141 // -----------------------------------------------------------------------------
       
  1142 // CCalenMissedEventContainer::AddDescriptionFieldL
       
  1143 // Add a description field to the view.
       
  1144 // (other items were commented in a header).
       
  1145 // -----------------------------------------------------------------------------
       
  1146 //
       
  1147 void CCalenMissedEventContainer::AddDescriptionFieldL()
       
  1148     {
       
  1149     TRACE_ENTRY_POINT;
       
  1150     //Add description
       
  1151     if (iEventViewData->Description() != KNullDesC)
       
  1152         {
       
  1153         AddTextFieldL(R_QTN_CALE_EVENT_VIEW_DESC, iEventViewData->Description());
       
  1154         // Add in a paragraph delimeter character
       
  1155         // Without this, long descriptions get cut off half way down the last line.
       
  1156         CRichText* richText = iTextEditor->RichText();
       
  1157         richText->InsertL(richText->DocumentLength(), CEditableText::EParagraphDelimiter);
       
  1158         }
       
  1159     TRACE_EXIT_POINT;
       
  1160     }
       
  1161 
       
  1162 // -----------------------------------------------------------------------------
       
  1163 // CCalenMissedEventContainer::AddSinceFieldL
       
  1164 // Add a since field to the view.
       
  1165 // (other items were commented in a header).
       
  1166 // -----------------------------------------------------------------------------
       
  1167 //
       
  1168 void CCalenMissedEventContainer::AddSinceFieldL()
       
  1169     {
       
  1170     TRACE_ENTRY_POINT;
       
  1171 
       
  1172     // Add since field, if the since year is different from the year of the instance opened.
       
  1173 	//    TInt instanceYear = Handler().Original().StartDateTime().DateTime().Year();
       
  1174 	TInt instanceYear = iEventViewData->StartDateTime().DateTime().Year();
       
  1175     TTime seriesTime = ParentEntryL().StartTimeL().TimeLocalL();
       
  1176     TInt seriesYear = seriesTime.DateTime().Year();
       
  1177 
       
  1178     if( seriesYear != instanceYear )
       
  1179         {
       
  1180         TBuf<32> formattedYear;
       
  1181         seriesTime.FormatL(formattedYear, KYearFormatString);
       
  1182         AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedYear);
       
  1183         AddTextFieldL(R_QTN_CALE_EVENT_VIEW_SINCE, formattedYear);
       
  1184         }
       
  1185     TRACE_EXIT_POINT;
       
  1186     }
       
  1187 
       
  1188 // -----------------------------------------------------------------------------
       
  1189 // CCalenMissedEventContainer::AddTextFieldL
       
  1190 // Add a text field to the view.
       
  1191 // (other items were commented in a header).
       
  1192 // -----------------------------------------------------------------------------
       
  1193 //
       
  1194 void CCalenMissedEventContainer::AddTextFieldL(TInt aHeadingResource, TInt aBodyResource)
       
  1195     {
       
  1196     TRACE_ENTRY_POINT;
       
  1197     HBufC* textHeading = StringLoader::LoadLC(aHeadingResource);
       
  1198     SetFormatAndAddHeadingL(*textHeading);
       
  1199     CleanupStack::PopAndDestroy(textHeading);
       
  1200 
       
  1201     HBufC* textBody = StringLoader::LoadLC(aBodyResource);
       
  1202     SetFormatAndAddBodyL(*textBody);
       
  1203     CleanupStack::PopAndDestroy(textBody);
       
  1204     TRACE_EXIT_POINT;
       
  1205     }
       
  1206 
       
  1207 // -----------------------------------------------------------------------------
       
  1208 // CCalenMissedEventContainer::AddTextFieldL
       
  1209 // Add a text field to the view.
       
  1210 // (other items were commented in a header).
       
  1211 // -----------------------------------------------------------------------------
       
  1212 //
       
  1213 void CCalenMissedEventContainer::AddTextFieldL(TInt aHeadingResource, const TDesC& aBody)
       
  1214     {
       
  1215     TRACE_ENTRY_POINT;
       
  1216 
       
  1217     HBufC* textHeading = StringLoader::LoadLC(aHeadingResource);
       
  1218     SetFormatAndAddHeadingL(*textHeading);
       
  1219     CleanupStack::PopAndDestroy(textHeading);
       
  1220 
       
  1221     // If the value is empty, put a space in the output so we don't compress the empty line.
       
  1222     if( CalenAgendaUtils::IsEmptyText(aBody) )
       
  1223         {
       
  1224         SetFormatAndAddBodyL(KSpace);
       
  1225         }
       
  1226     else
       
  1227         {
       
  1228         SetFormatAndAddBodyL(aBody);
       
  1229         }
       
  1230     TRACE_EXIT_POINT;
       
  1231     }
       
  1232 
       
  1233 // -----------------------------------------------------------------------------
       
  1234 // CCalenMissedEventContainer::AddSubjectFieldL
       
  1235 // Adds the entry's subject to the view.
       
  1236 // (other items were commented in a header).
       
  1237 // -----------------------------------------------------------------------------
       
  1238 //
       
  1239 void CCalenMissedEventContainer::AddSubjectFieldL()
       
  1240     {
       
  1241     TRACE_ENTRY_POINT;
       
  1242 
       
  1243     iParaFormat->iRightMarginInTwips = PixelsToTwips(iIconDrawerWidthInPixels);
       
  1244     if (iEventViewData->Summary() != KNullDesC)
       
  1245         {
       
  1246         SetFormatAndAddHeadingL(iEventViewData->Summary());
       
  1247         }
       
  1248     else
       
  1249         {
       
  1250         HBufC* untitled = StringLoader::LoadLC(R_QTN_CALE_EVENT_VIEW_EMPTY_SUBJECT);
       
  1251         SetFormatAndAddHeadingL(*untitled);
       
  1252         CleanupStack::PopAndDestroy(untitled);
       
  1253         }
       
  1254     iParaFormat->iRightMarginInTwips = KDefaultRightMargin;
       
  1255 
       
  1256     TRACE_EXIT_POINT;
       
  1257     }
       
  1258 
       
  1259 // -----------------------------------------------------------------------------
       
  1260 // CCalenMissedEventContainer::AddLocationFieldL
       
  1261 // Adds the entry's location to the view.
       
  1262 // (other items were commented in a header).
       
  1263 // -----------------------------------------------------------------------------
       
  1264 //
       
  1265 void CCalenMissedEventContainer::AddLocationFieldL()
       
  1266     {
       
  1267     TRACE_ENTRY_POINT;
       
  1268 
       
  1269     if (iEventViewData->Location() != KNullDesC )
       
  1270         {
       
  1271         SetFormatAndAddBodyL(iEventViewData->Location());
       
  1272         }
       
  1273     TRACE_EXIT_POINT;
       
  1274     }
       
  1275 
       
  1276 // -----------------------------------------------------------------------------
       
  1277 // CCalenMissedEventContainer::AddPriorityFieldL
       
  1278 // Reads the priority from the entry and adds a field to the form accordingly.
       
  1279 // (other items were commented in a header).
       
  1280 // -----------------------------------------------------------------------------
       
  1281 //
       
  1282 void CCalenMissedEventContainer::AddPriorityFieldL()
       
  1283     {
       
  1284     TRACE_ENTRY_POINT;
       
  1285 
       
  1286     CCalenEntryUtil::TTodoPriority priority = iEventViewData->Priority();
       
  1287 
       
  1288     // Don't add the priority field if it's normal priority.
       
  1289     if( priority != CCalenEntryUtil::ETodoPriorityNormal )
       
  1290         {
       
  1291         CDesCArrayFlat* priorities = ControlEnv()->ReadDesCArrayResourceL(R_CALE_EVENT_VIEW_TODO_PRIORITY);
       
  1292         CleanupStack::PushL(priorities);
       
  1293         const TDesC& priorityText = (*priorities)[CalendarPriorityToFormPriority(priority)];
       
  1294         AddTextFieldL(R_QTN_CALE_EVENT_VIEW_PRIO, priorityText);
       
  1295         CleanupStack::PopAndDestroy(); // priorities
       
  1296         }
       
  1297     TRACE_EXIT_POINT;
       
  1298     }
       
  1299 
       
  1300 
       
  1301 // -----------------------------------------------------------------------------
       
  1302 // CCalenMissedEventContainer::AddTimeFieldL
       
  1303 // Add a time field to the form.
       
  1304 // (other items were commented in a header).
       
  1305 // -----------------------------------------------------------------------------
       
  1306 //
       
  1307 void CCalenMissedEventContainer::AddTimeFieldL(TInt aLabelResource, const TTime& aTime)
       
  1308     {
       
  1309     TRACE_ENTRY_POINT;
       
  1310 
       
  1311     TBuf<32> formattedTime;
       
  1312     aTime.FormatL(formattedTime, *iTimeFormat);
       
  1313     AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedTime);
       
  1314     AddTextFieldL(aLabelResource, formattedTime);
       
  1315 
       
  1316     TRACE_EXIT_POINT;
       
  1317     }
       
  1318 
       
  1319 // -----------------------------------------------------------------------------
       
  1320 // CCalenMissedEventContainer::AddDateFieldL
       
  1321 // Add a date field to the form.
       
  1322 // (other items were commented in a header).
       
  1323 // -----------------------------------------------------------------------------
       
  1324 //
       
  1325 void CCalenMissedEventContainer::AddDateFieldL(const TTime& aDate)
       
  1326     {
       
  1327     TRACE_ENTRY_POINT;
       
  1328 
       
  1329     TBuf<32> formattedDate;
       
  1330     aDate.FormatL(formattedDate, *iDateFormat);
       
  1331     AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedDate);
       
  1332     SetFormatAndAddBodyL(formattedDate);
       
  1333 
       
  1334     TRACE_EXIT_POINT;
       
  1335     }
       
  1336 
       
  1337 // -----------------------------------------------------------------------------
       
  1338 // CCalenMissedEventContainer::AddDateFieldL
       
  1339 // Add a date field to the form.
       
  1340 // (other items were commented in a header).
       
  1341 // -----------------------------------------------------------------------------
       
  1342 //
       
  1343 void CCalenMissedEventContainer::AddDateFieldL(TInt aHeadingResource, const TTime& aDate)
       
  1344     {
       
  1345     TRACE_ENTRY_POINT;
       
  1346     
       
  1347     HBufC* textHeading = StringLoader::LoadLC(aHeadingResource);
       
  1348     SetFormatAndAddHeadingL(*textHeading);
       
  1349     CleanupStack::PopAndDestroy(textHeading);
       
  1350     AddDateFieldL(aDate);
       
  1351 
       
  1352     TRACE_EXIT_POINT;
       
  1353     }
       
  1354 // -----------------------------------------------------------------------------
       
  1355 // CCalenMissedEventContainer::AddDateFieldL
       
  1356 // Add a field to the form in the format "DATE - DATE".
       
  1357 // (other items were commented in a header).
       
  1358 // -----------------------------------------------------------------------------
       
  1359 //
       
  1360 void CCalenMissedEventContainer::AddDateDateFieldL(const TTime& aStartDate, const TTime& aEndDate)
       
  1361     {
       
  1362     TRACE_ENTRY_POINT;
       
  1363 
       
  1364     CDesCArrayFlat* strings = new CDesCArrayFlat( 2 );
       
  1365     CleanupStack::PushL( strings );
       
  1366 
       
  1367     TBuf<KMaxDateLength> firstDate;
       
  1368     aStartDate.FormatL( firstDate, *iDateFormat );
       
  1369     AknTextUtils::DisplayTextLanguageSpecificNumberConversion(firstDate);
       
  1370     strings->AppendL( firstDate );
       
  1371 
       
  1372     TBuf<KMaxDateLength> secondDate;
       
  1373     aEndDate.FormatL( secondDate, *iDateFormat );
       
  1374     AknTextUtils::DisplayTextLanguageSpecificNumberConversion(secondDate);
       
  1375     strings->AppendL( secondDate );
       
  1376 
       
  1377     HBufC* stringholder = StringLoader::LoadL( R_QTN_CALE_EVENT_VIEW_VALID_LIMITED, *strings );
       
  1378     CleanupStack::PopAndDestroy( strings );
       
  1379     CleanupStack::PushL( stringholder );
       
  1380 
       
  1381     SetFormatAndAddBodyL(*stringholder);
       
  1382     CleanupStack::PopAndDestroy(stringholder);
       
  1383 
       
  1384     TRACE_EXIT_POINT;
       
  1385     }
       
  1386 
       
  1387 // -----------------------------------------------------------------------------
       
  1388 // CCalenMissedEventContainer::AddAlarmDateAndTimeFieldL
       
  1389 // Add a date and time field to the form, in the ordering according to
       
  1390 // localisation (date followed by the time).
       
  1391 // (other items were commented in a header).
       
  1392 // -----------------------------------------------------------------------------
       
  1393 //
       
  1394 void CCalenMissedEventContainer::AddAlarmDateAndTimeFieldL( const TTime& aTime )
       
  1395     {
       
  1396     TRACE_ENTRY_POINT;
       
  1397 
       
  1398     CDesCArrayFlat* strings = new CDesCArrayFlat( 2 );
       
  1399     CleanupStack::PushL( strings );
       
  1400 
       
  1401     TBuf<KMaxDateLength> formattedTime;
       
  1402     aTime.FormatL( formattedTime, *iTimeFormat );
       
  1403     AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedTime);
       
  1404     strings->AppendL( formattedTime );
       
  1405 
       
  1406     TBuf<KMaxDateLength> formattedDate;
       
  1407     aTime.FormatL( formattedDate, *iDateFormat );
       
  1408     AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedDate);
       
  1409     strings->AppendL( formattedDate );
       
  1410 
       
  1411     HBufC* stringholder = StringLoader::LoadL( R_QTN_CALE_EVENT_VIEW_ALARM_TIME, *strings );
       
  1412     CleanupStack::PopAndDestroy( strings );
       
  1413     CleanupStack::PushL( stringholder );
       
  1414 
       
  1415     AddTextFieldL( R_QTN_CALE_EVENT_VIEW_ALARM, *stringholder );
       
  1416     CleanupStack::PopAndDestroy( stringholder );
       
  1417 
       
  1418     TRACE_EXIT_POINT;
       
  1419     }
       
  1420 
       
  1421 // -----------------------------------------------------------------------------
       
  1422 // CCalenMissedEventContainer::AddAlarmDateTimeFieldL
       
  1423 // Reads the alarm from the entry and add a field containing its date-time.
       
  1424 // If the alarm is on the same day as the entry, only the time is shown.
       
  1425 // If no alarm is present, the field is not shown
       
  1426 // (other items were commented in a header).
       
  1427 // -----------------------------------------------------------------------------
       
  1428 //
       
  1429 void CCalenMissedEventContainer::AddAlarmDateTimeFieldL()
       
  1430     {
       
  1431     TRACE_ENTRY_POINT;
       
  1432     if( iEventViewData->IsAlarmActivated() )
       
  1433         {
       
  1434         TTime alarmTime = iEventViewData->AlarmDateTime();
       
  1435         alarmTime = CalenDateUtils::LimitToValidTime( alarmTime );
       
  1436 
       
  1437         // If alarm is on the same day as the entry, AND the meeting only lasts one day,
       
  1438         // just show the alarm time and not the date.
       
  1439         if( CalenDateUtils::OnSameDay( alarmTime, iEventViewData->StartDateTime() ) &&
       
  1440             CalenDateUtils::OnSameDay( iEventViewData->StartDateTime(), iEventViewData->EndDateTime() ) )
       
  1441             {
       
  1442             // On same day, only show time.
       
  1443             AddTimeFieldL( R_QTN_CALE_EVENT_VIEW_ALARM, alarmTime );
       
  1444             }
       
  1445         else
       
  1446             {
       
  1447             // Different days, show both date and time.
       
  1448             AddAlarmDateAndTimeFieldL( alarmTime );
       
  1449             }
       
  1450         }
       
  1451     TRACE_EXIT_POINT;
       
  1452     }
       
  1453 
       
  1454 // -----------------------------------------------------------------------------
       
  1455 // CCalenMissedEventContainer::GetMinAndMaxTimesL
       
  1456 // Find the maximum and minimum times from the given array.
       
  1457 // (other items were commented in a header).
       
  1458 // -----------------------------------------------------------------------------
       
  1459 //
       
  1460 void CCalenMissedEventContainer::GetMinAndMaxTimesL( RArray<TCalTime>& aTimes,
       
  1461                                                                TCalTime& aMinTime,
       
  1462                                                                TCalTime& aMaxTime )
       
  1463     {
       
  1464     TRACE_ENTRY_POINT;
       
  1465 
       
  1466     TInt minIndex=0;
       
  1467     TInt maxIndex=0;
       
  1468 
       
  1469     for( TInt i=1; i<aTimes.Count(); ++i )
       
  1470         {
       
  1471         if( aTimes[i].TimeUtcL() > aTimes[maxIndex].TimeUtcL() )
       
  1472             {
       
  1473             maxIndex = i;
       
  1474             }
       
  1475         else
       
  1476             {
       
  1477             if( aTimes[i].TimeUtcL() < aTimes[minIndex].TimeUtcL() )
       
  1478                 {
       
  1479                 minIndex = i;
       
  1480                 }
       
  1481             }
       
  1482         }
       
  1483 
       
  1484     aMinTime = aTimes[minIndex];
       
  1485     aMaxTime = aTimes[maxIndex];
       
  1486 
       
  1487     TRACE_EXIT_POINT;
       
  1488     }
       
  1489 // -----------------------------------------------------------------------------
       
  1490 // CCalenMissedEventContainer::RemoveDuplicateTimesL
       
  1491 // If there is more than one time at the same time, leave only one in the array.
       
  1492 // (other items were commented in a header).
       
  1493 // -----------------------------------------------------------------------------
       
  1494 //
       
  1495 void CCalenMissedEventContainer::RemoveDuplicateTimesL( RArray<TCalTime>& aTimes )
       
  1496     {
       
  1497     TRACE_ENTRY_POINT;
       
  1498 
       
  1499     for( TInt i=0; i<aTimes.Count(); ++i )
       
  1500         {
       
  1501         for( TInt j=aTimes.Count()-1; j>i; --j )
       
  1502             {
       
  1503             if( aTimes[i].TimeUtcL() == aTimes[j].TimeUtcL() )
       
  1504                 {
       
  1505                 aTimes.Remove( j );
       
  1506                 }
       
  1507             }
       
  1508         }
       
  1509 
       
  1510     TRACE_EXIT_POINT;
       
  1511     }
       
  1512 
       
  1513 // -----------------------------------------------------------------------------
       
  1514 // CCalenMissedEventContainer::RemoveExcludedTimesL
       
  1515 // From the given array of start dates, remove any which match up with an
       
  1516 // exception date and also have no child associated with them.
       
  1517 // (other items were commented in a header).
       
  1518 // -----------------------------------------------------------------------------
       
  1519 //
       
  1520 void CCalenMissedEventContainer::RemoveExcludedTimesL( RArray<TCalTime>& aStartDates,
       
  1521                                                                  RArray<TCalTime>& aExDates,
       
  1522                                                                  RPointerArray<CCalEntry>& aChildEntries )
       
  1523     {
       
  1524     TRACE_ENTRY_POINT;
       
  1525 
       
  1526     for( TInt i=0; i<aExDates.Count(); ++i )
       
  1527         {
       
  1528         for( TInt j=aStartDates.Count()-1; j>=0; --j )
       
  1529             {
       
  1530             if( aStartDates[j].TimeUtcL() == aExDates[i].TimeUtcL() )
       
  1531                 {
       
  1532                 TBool hasChild = EFalse;
       
  1533                 for( TInt k=0; k<aChildEntries.Count(); ++k )
       
  1534                     {
       
  1535                     if( aChildEntries[k]->RecurrenceIdL().TimeUtcL() == aStartDates[j].TimeUtcL() )
       
  1536                         {
       
  1537                         hasChild = ETrue;
       
  1538                         break;
       
  1539                         }
       
  1540                     }
       
  1541 
       
  1542                 if( !hasChild )
       
  1543                     {
       
  1544                     aStartDates.Remove( j );
       
  1545                     break;
       
  1546                     }
       
  1547                 }
       
  1548             }
       
  1549         }
       
  1550 
       
  1551     TRACE_EXIT_POINT;
       
  1552     }
       
  1553 
       
  1554 // ----------------------------------------------------
       
  1555 // CCalenMissedEventContainer::CalendaryPriorityToFormPriority
       
  1556 // Convert replication to confidentiality
       
  1557 // (other items were commented in a header).
       
  1558 // ----------------------------------------------------
       
  1559 //
       
  1560 TInt CCalenMissedEventContainer::CalendarPriorityToFormPriority(CCalenEntryUtil::TTodoPriority aCalPriority)
       
  1561     {
       
  1562     TRACE_ENTRY_POINT;
       
  1563     // Calendar priority is in same order as resource, starting from one number lower.
       
  1564     TRACE_EXIT_POINT;
       
  1565     return aCalPriority-1;
       
  1566     }
       
  1567 
       
  1568 // -----------------------------------------------------------------------------
       
  1569 // CCalenMissedEventContainer::TryToFitL
       
  1570 // Returns ETrue if the given string fits into aMaxWidth, 
       
  1571 // using the font aFont - EFalse otherwise
       
  1572 // (other items were commented in a header).
       
  1573 // -----------------------------------------------------------------------------
       
  1574 //
       
  1575 TBool CCalenMissedEventContainer::TryToFitL( const TDesC& aStr, TInt aMaxWidth, const CFont& aFont )
       
  1576     {
       
  1577     TRACE_ENTRY_POINT;
       
  1578 
       
  1579     TInt width = aFont.TextWidthInPixels(aStr);
       
  1580     // We add one because it seems the edwin wrapping doesn't quite agree with CFont's width.
       
  1581     ++width;
       
  1582 
       
  1583     TRACE_EXIT_POINT;
       
  1584     return width < aMaxWidth;
       
  1585     }
       
  1586 
       
  1587 // -----------------------------------------------------------------------------
       
  1588 // CCalenMissedEventContainer::PixelsToTwips
       
  1589 // Convert pixels to twips
       
  1590 // (other items were commented in a header).
       
  1591 // -----------------------------------------------------------------------------
       
  1592 //
       
  1593 TInt CCalenMissedEventContainer::PixelsToTwips(TInt aPixels)
       
  1594     {
       
  1595     TRACE_ENTRY_POINT;
       
  1596 
       
  1597     CWindowGc& windowGc = ControlEnv()->SystemGc();
       
  1598     TInt twips = windowGc.Device()->HorizontalPixelsToTwips(aPixels);
       
  1599 
       
  1600     TRACE_EXIT_POINT;
       
  1601     return twips;
       
  1602     }
       
  1603     
       
  1604 // -----------------------------------------------------------------------------
       
  1605 // CCalenMissedEventContainer::GetSeriesRepeatInformationL
       
  1606 // Attempts to calculate the start and end dates of the series by looking at the
       
  1607 // given entry's RDates and RRule. If these dates have successfully been
       
  1608 // calculated, the function returns ETrue, or EFalse otherwise.
       
  1609 // (other items were commented in a header).
       
  1610 // -----------------------------------------------------------------------------
       
  1611 //
       
  1612 TBool CCalenMissedEventContainer::GetSeriesRepeatInformationL( CCalEntry& aEntry,
       
  1613                                                      TCalenRepeatIndex& aRepeatIndex,
       
  1614                                                      TTime& aSeriesStart,
       
  1615                                                      TTime& aSeriesEnd )
       
  1616     {
       
  1617     TRACE_ENTRY_POINT;
       
  1618 
       
  1619     TBool success;
       
  1620 
       
  1621     RArray<TCalTime> rdates;
       
  1622     CleanupClosePushL( rdates );
       
  1623 
       
  1624     aEntry.GetRDatesL(rdates);
       
  1625 
       
  1626     if( rdates.Count() )
       
  1627         {
       
  1628         // Calculate the start and end dates from the RDates.
       
  1629 
       
  1630         // We need to expand the RDates. This involves getting all the instance start dates,
       
  1631         // then removing any start date with an exdate but no modifying child for that instance.
       
  1632         // Include the entry start date in this, as that counts as part of the series.
       
  1633         rdates.AppendL( aEntry.StartTimeL() );
       
  1634 
       
  1635         RemoveDuplicateTimesL( rdates );
       
  1636 
       
  1637         RArray<TCalTime> exdates;
       
  1638         CleanupClosePushL( exdates );
       
  1639         aEntry.GetExceptionDatesL( exdates );
       
  1640         if( exdates.Count() )
       
  1641             {
       
  1642             RemoveExcludedTimesL( rdates, exdates, AllInstancesL() );
       
  1643             }
       
  1644         CleanupStack::PopAndDestroy( &exdates );
       
  1645 
       
  1646         TCalRRule rrule;
       
  1647         if( iEntry->GetRRuleL(rrule) )
       
  1648             {
       
  1649             // Hopefully no UI would create an entry with an RRule as well as RDates.
       
  1650             // Although the spec says it's possible, Calendar certainly can't.
       
  1651             // We have a vague go at including the RRule in the min/max date but
       
  1652             // don't bother removing exdates from it as we would then need to expand
       
  1653             // every instance of the RRule.
       
  1654             rdates.AppendL( rrule.DtStart() );
       
  1655             rdates.AppendL( rrule.Until() );
       
  1656             RemoveDuplicateTimesL( rdates );
       
  1657             }
       
  1658 
       
  1659         // The true instance dates should be in the 'rdates' array. Now we just need
       
  1660         // the minimum and maximum times from here.
       
  1661         TCalTime min, max;
       
  1662         GetMinAndMaxTimesL( rdates, min, max );
       
  1663         aSeriesStart = min.TimeLocalL();
       
  1664         aSeriesEnd = max.TimeLocalL();
       
  1665 
       
  1666         // Set the repeat type to "Other" for rdates.
       
  1667         aRepeatIndex = ERepeatOther;
       
  1668         success = ETrue;
       
  1669         }
       
  1670     else
       
  1671         {
       
  1672         TCalRRule rrule;
       
  1673         if( aEntry.GetRRuleL( rrule ) )
       
  1674             {
       
  1675             // This 'switch' differs slightly from CalenNoteDataUtil::RepeatIndex in
       
  1676             // that we are a bit more generous in awarding repeat types instead of
       
  1677             // falling back to 'other' repeat type.
       
  1678             aRepeatIndex = ERepeatOther;
       
  1679             switch( rrule.Type() )
       
  1680                 {
       
  1681                 case TCalRRule::EDaily:
       
  1682                     if( rrule.Interval() == 1 )
       
  1683                         {
       
  1684                         aRepeatIndex = ERepeatDaily;
       
  1685                         }
       
  1686                     else if( rrule.Interval() == 7 )
       
  1687                         {
       
  1688                         aRepeatIndex = ERepeatWeekly;
       
  1689                         }
       
  1690                     else if( rrule.Interval() == 14 )
       
  1691                         {
       
  1692                         aRepeatIndex = ERepeatBiWeekly;
       
  1693                         }
       
  1694                     else
       
  1695                         {
       
  1696                         // nothing
       
  1697                         }
       
  1698                     break;
       
  1699 
       
  1700                 case TCalRRule::EWeekly:
       
  1701                     if( rrule.Interval() == 1 )
       
  1702                         {
       
  1703                         aRepeatIndex = ERepeatWeekly;
       
  1704                         }
       
  1705                     else
       
  1706                         {
       
  1707                         if( rrule.Interval() == 2 )
       
  1708                             {
       
  1709                             aRepeatIndex = ERepeatBiWeekly;
       
  1710                             }
       
  1711                         }
       
  1712                     break;
       
  1713 
       
  1714                 case TCalRRule::EMonthly:
       
  1715                     if( rrule.Interval() == 1 )
       
  1716                         {
       
  1717                         aRepeatIndex = ERepeatMonthly;
       
  1718                         }
       
  1719                     break;
       
  1720 
       
  1721                 case TCalRRule::EYearly:
       
  1722                     if( rrule.Interval() == 1 )
       
  1723                         {
       
  1724                         aRepeatIndex = ERepeatYearly;
       
  1725                         }
       
  1726                     break;
       
  1727 
       
  1728                 default:
       
  1729                     break;
       
  1730                 }
       
  1731 
       
  1732             aSeriesStart = rrule.DtStart().TimeLocalL();
       
  1733             aSeriesEnd = rrule.Until().TimeLocalL();
       
  1734             success = ETrue;
       
  1735             }
       
  1736         else
       
  1737             {
       
  1738             // No repeat information.
       
  1739             success = EFalse;
       
  1740             }
       
  1741         }
       
  1742 
       
  1743     CleanupStack::PopAndDestroy( &rdates );
       
  1744 
       
  1745     return success;
       
  1746 
       
  1747     TRACE_EXIT_POINT;
       
  1748     }
       
  1749 
       
  1750 // -----------------------------------------------------------------------------
       
  1751 // CCalenMissedEventContainer::AddRepeatFieldL
       
  1752 // Add repeat text field to the 
       
  1753 // (other items were commented in a header).
       
  1754 // -----------------------------------------------------------------------------
       
  1755 //
       
  1756 void CCalenMissedEventContainer::AddRepeatFieldL()
       
  1757     {
       
  1758     TRACE_ENTRY_POINT;
       
  1759     // Get the repeat rule from the entry.  If this is a child entry,
       
  1760     // find the parent and get the repeat rule from that.
       
  1761     TCalRRule rrule;
       
  1762     TCalenRepeatIndex repeatIndex;
       
  1763     // 'start' is the start time of the series, not the start time of the instance we are viewing
       
  1764     TTime start;
       
  1765     TTime until;
       
  1766 
       
  1767     if( !GetSeriesRepeatInformationL( *iEntry, repeatIndex, start, until ) )
       
  1768         {
       
  1769         // An entry with no RDates or RRule but a non-null recurrence id.
       
  1770         // This entry is a child. We have to get the parent to see the repeat information.
       
  1771         // We assert here - a parent really should have some form of repeat information.
       
  1772         __ASSERT_ALWAYS( GetSeriesRepeatInformationL( ParentEntryL(), repeatIndex, start, until ),
       
  1773                          User::Invariant() );
       
  1774         }
       
  1775 
       
  1776     // Set repIndex to be the resource used for the heading.
       
  1777     // This will be "Repeats daily", "Repeats weekly" etc.
       
  1778     TInt repIndex = -1;
       
  1779 
       
  1780     switch(repeatIndex)
       
  1781         {
       
  1782         case ERepeatDaily:
       
  1783             repIndex = R_QTN_CALE_EVENT_VIEW_REPEAT_DAILY;
       
  1784             break;
       
  1785         case ERepeatWeekly:
       
  1786             repIndex = R_QTN_CALE_EVENT_VIEW_REPEAT_WEEKLY;
       
  1787             break;
       
  1788         case ERepeatBiWeekly:
       
  1789             repIndex = R_QTN_CALE_EVENT_VIEW_REPEAT_FORTNIGHTLY;
       
  1790             break;
       
  1791         case ERepeatMonthly:
       
  1792             repIndex = R_QTN_CALE_EVENT_VIEW_REPEAT_MONTHLY;
       
  1793             break;
       
  1794         case ERepeatYearly:
       
  1795             repIndex = R_QTN_CALE_EVENT_VIEW_REPEAT_YEARLY;
       
  1796             break;
       
  1797         case ERepeatOther:
       
  1798             repIndex = R_QTN_CALE_EVENT_VIEW_REPEAT_OTHER;
       
  1799             break;
       
  1800         default:
       
  1801             ASSERT(EFalse);
       
  1802             break;
       
  1803         }
       
  1804 
       
  1805     TBuf<64> dateString;
       
  1806 
       
  1807     // Infinite repeat if repeat until is on or after the max time, or if repeat until is null.
       
  1808     TBool finiteRepeat = until < CalenDateUtils::BeginningOfDay( CalenDateUtils::MaxTime() )
       
  1809                          && until != Time::NullTTime();
       
  1810 
       
  1811     if( finiteRepeat )
       
  1812         {
       
  1813         // Finite repeat, string (e.g.) "17/01/2006 - 27/01/2006"
       
  1814         CDesCArrayFlat* strings = new CDesCArrayFlat( 2 );
       
  1815         CleanupStack::PushL( strings );
       
  1816 
       
  1817         TBuf<KMaxDateLength> formattedTime;
       
  1818         start.FormatL( formattedTime, *iDateFormat );
       
  1819         AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedTime);
       
  1820         strings->AppendL( formattedTime );
       
  1821 
       
  1822         TBuf<KMaxDateLength> formattedDate;
       
  1823         until.FormatL( formattedDate, *iDateFormat );
       
  1824         AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedDate);
       
  1825         strings->AppendL( formattedDate );
       
  1826 
       
  1827         HBufC* stringholder = StringLoader::LoadL( R_QTN_CALE_EVENT_VIEW_VALID_LIMITED, *strings );
       
  1828         CleanupStack::PopAndDestroy( strings );
       
  1829         CleanupStack::PushL( stringholder );
       
  1830 
       
  1831         AddTextFieldL( repIndex, *stringholder );
       
  1832         CleanupStack::PopAndDestroy( stringholder );
       
  1833         }
       
  1834     else
       
  1835         {
       
  1836         // Repeats forever, string (e.g.) "From 17/01/2006"
       
  1837         CDesCArrayFlat* strings = new CDesCArrayFlat( 1 );
       
  1838         CleanupStack::PushL( strings );
       
  1839 
       
  1840         TBuf<KMaxDateLength> formattedTime;
       
  1841         start.FormatL( formattedTime, *iDateFormat );
       
  1842         AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedTime);
       
  1843         strings->AppendL( formattedTime );
       
  1844 
       
  1845         HBufC* stringholder = StringLoader::LoadL( R_QTN_CALE_EVENT_VIEW_VALID_FOREVER, *strings );
       
  1846         CleanupStack::PopAndDestroy( strings );
       
  1847         CleanupStack::PushL( stringholder );
       
  1848 
       
  1849         AddTextFieldL( repIndex, *stringholder );
       
  1850         CleanupStack::PopAndDestroy( stringholder );
       
  1851         }
       
  1852 
       
  1853     TRACE_EXIT_POINT;
       
  1854     }
       
  1855 
       
  1856 // -----------------------------------------------------------------------------
       
  1857 // CCalenMissedEventContainer::AddTimeFieldL
       
  1858 // Add entry time field text to the 
       
  1859 // (other items were commented in a header).
       
  1860 // -----------------------------------------------------------------------------
       
  1861 //
       
  1862 void CCalenMissedEventContainer::AddTimeFieldL()
       
  1863     {
       
  1864     TRACE_ENTRY_POINT;
       
  1865     // If the start time is on the same day as the end time, just show the date.
       
  1866     // Otherwise, show "start date - end date".
       
  1867     TTime startTime = iEventViewData->StartDateTime();
       
  1868     TTime endTime = iEventViewData->EndDateTime();
       
  1869 
       
  1870     TBuf<64> concatString;
       
  1871 
       
  1872     if( CalenDateUtils::OnSameDay(startTime, endTime) )
       
  1873         {
       
  1874         // String looks like (e.g.) "14:00 - 16:00 17/01/2006"
       
  1875         CDesCArrayFlat* strings = new CDesCArrayFlat( 3 );
       
  1876         CleanupStack::PushL( strings );
       
  1877 
       
  1878         TBuf<KMaxDateLength> formattedStartTime;
       
  1879         startTime.FormatL( formattedStartTime, *iTimeFormat );
       
  1880         AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedStartTime);
       
  1881         strings->AppendL( formattedStartTime );
       
  1882 
       
  1883         TBuf<KMaxDateLength> formattedEndTime;
       
  1884         endTime.FormatL( formattedEndTime, *iTimeFormat );
       
  1885         AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedEndTime);
       
  1886         strings->AppendL( formattedEndTime );
       
  1887 
       
  1888         TBuf<KMaxDateLength> formattedStartDate;
       
  1889         startTime.FormatL( formattedStartDate, *iDateFormat );
       
  1890         AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedStartDate);
       
  1891         strings->AppendL( formattedStartDate );
       
  1892 
       
  1893         HBufC* stringholder = StringLoader::LoadLC( R_QTN_CALE_EVENT_VIEW_TIME_DAY, *strings );
       
  1894 
       
  1895         TBool fits = TryToFitL(*stringholder, iMaxWidth, *iBodyFont);
       
  1896         if (fits)
       
  1897             {
       
  1898             SetFormatAndAddBodyL(*stringholder);
       
  1899             }
       
  1900         else
       
  1901             {
       
  1902             HBufC* wrappedStringholder = StringLoader::LoadLC( R_QTN_CALE_EVENT_VIEW_TIME_DAY_WRAPPED, *strings );
       
  1903             SetFormatAndAddBodyL(*wrappedStringholder);
       
  1904             CleanupStack::PopAndDestroy(wrappedStringholder);
       
  1905             }
       
  1906 
       
  1907         CleanupStack::PopAndDestroy( stringholder );
       
  1908         CleanupStack::PopAndDestroy( strings );
       
  1909         }
       
  1910     else
       
  1911         {
       
  1912         // String looks like (e.g.) "14:00 16/01/2006 - 16:00 19/01/2006"
       
  1913         CDesCArrayFlat* strings = new CDesCArrayFlat( 3 );
       
  1914         CleanupStack::PushL( strings );
       
  1915 
       
  1916         TBuf<KMaxDateLength> formattedStartTime;
       
  1917         startTime.FormatL( formattedStartTime, *iTimeFormat );
       
  1918         AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedStartTime);
       
  1919         strings->AppendL( formattedStartTime );
       
  1920 
       
  1921         TBuf<KMaxDateLength> formattedStartDate;
       
  1922         startTime.FormatL( formattedStartDate, *iDateFormat );
       
  1923         AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedStartDate);
       
  1924         strings->AppendL( formattedStartDate );
       
  1925 
       
  1926         TBuf<KMaxDateLength> formattedEndTime;
       
  1927         endTime.FormatL( formattedEndTime, *iTimeFormat );
       
  1928         AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedEndTime);
       
  1929         strings->AppendL( formattedEndTime );
       
  1930 
       
  1931         TBuf<KMaxDateLength> formattedEndDate;
       
  1932         endTime.FormatL( formattedEndDate, *iDateFormat );
       
  1933         AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedEndDate);
       
  1934         strings->AppendL( formattedEndDate );
       
  1935 
       
  1936         HBufC* stringholder = StringLoader::LoadLC( R_QTN_CALE_EVENT_VIEW_TIME_DAYS, *strings );
       
  1937 
       
  1938         TBool fits = TryToFitL(*stringholder, iMaxWidth, *iBodyFont);
       
  1939         if (fits)
       
  1940             {
       
  1941             SetFormatAndAddBodyL(*stringholder);
       
  1942             }
       
  1943         else
       
  1944             {
       
  1945             HBufC* wrappedStringholder = StringLoader::LoadLC( R_QTN_CALE_EVENT_VIEW_TIME_DAYS_WRAPPED, *strings );
       
  1946             SetFormatAndAddBodyL(*wrappedStringholder);
       
  1947             CleanupStack::PopAndDestroy(wrappedStringholder);
       
  1948             }
       
  1949 
       
  1950         CleanupStack::PopAndDestroy( stringholder );
       
  1951         CleanupStack::PopAndDestroy( strings );
       
  1952         }
       
  1953 
       
  1954     TRACE_EXIT_POINT;
       
  1955     }
       
  1956 
       
  1957 // -----------------------------------------------------------------------------
       
  1958 // CCalenMissedEventContainer::MopSupplyObject
       
  1959 // Pass the skin information
       
  1960 // (other items were commented in a header).
       
  1961 // -----------------------------------------------------------------------------
       
  1962 //
       
  1963 TTypeUid::Ptr CCalenMissedEventContainer::MopSupplyObject( TTypeUid aId )
       
  1964     {
       
  1965     return MAknsControlContext::SupplyMopObject( aId, iBgContext );
       
  1966     }    
       
  1967 
       
  1968 
       
  1969 // -----------------------------------------------------------------------------
       
  1970 // CCalenMissedEventContainer::BuildSearchBufferL
       
  1971 // Generate the text string to use for text searches
       
  1972 // (other items were commented in a header).
       
  1973 // -----------------------------------------------------------------------------
       
  1974 //
       
  1975 void CCalenMissedEventContainer::BuildSearchBufferL()
       
  1976     {
       
  1977     TRACE_ENTRY_POINT;
       
  1978 
       
  1979     // Get the full text from the form to use for search API.
       
  1980     TInt textLength = iTextEditor->RichText()->DocumentLength();
       
  1981 
       
  1982     // Delete any existing search buffer
       
  1983     if (iSearchBuf)
       
  1984         {
       
  1985         delete iSearchBuf;
       
  1986         iSearchBuf = NULL;
       
  1987         }
       
  1988 
       
  1989     // Text searched is currently summary , location and description
       
  1990     iSearchBuf = HBufC::NewL(textLength);
       
  1991     TPtr searchPtr = iSearchBuf->Des();
       
  1992     GetTextFieldsFromFormL(searchPtr);
       
  1993 
       
  1994     TRACE_EXIT_POINT;
       
  1995     } 
       
  1996 
       
  1997 // -----------------------------------------------------------------------------
       
  1998 // CCalenMissedEventContainer::GetTextFieldsFromFormL
       
  1999 // Gets the text fields from the form into a descriptor for
       
  2000 // the find api to use.
       
  2001 // Currently uses subject, location and description only
       
  2002 // (other items were commented in a header).
       
  2003 // -----------------------------------------------------------------------------
       
  2004 //
       
  2005 void CCalenMissedEventContainer::GetTextFieldsFromFormL(TDes& aDesc)
       
  2006     {
       
  2007     TRACE_ENTRY_POINT;
       
  2008 
       
  2009     aDesc.Append(iEventViewData->Summary());
       
  2010     aDesc.Append(_L(" \r\n"));
       
  2011     aDesc.Append(iEventViewData->Location());
       
  2012     aDesc.Append(_L(" \r\n"));
       
  2013     aDesc.Append(iEventViewData->Description());
       
  2014     aDesc.Append(_L(" \r\n"));
       
  2015 
       
  2016     TRACE_EXIT_POINT;
       
  2017     }
       
  2018 
       
  2019 // -----------------------------------------------------------------------------
       
  2020 // CCalenMissedEventContainer::GetTitleTextId
       
  2021 // Gets the title text resource
       
  2022 // -----------------------------------------------------------------------------
       
  2023 //
       
  2024 TInt CCalenMissedEventContainer::GetTitleTextId()
       
  2025 	{
       
  2026 	TRACE_ENTRY_POINT;
       
  2027 	TRACE_EXIT_POINT;
       
  2028 	return iTitleTextId;
       
  2029 	}
       
  2030 	
       
  2031 // -----------------------------------------------------------------------------
       
  2032 // CCalenMissedEventContainer::ParentEntryL
       
  2033 // Returns the parent entry of the entry being edited.
       
  2034 // (other items were commented in a header).
       
  2035 // -----------------------------------------------------------------------------
       
  2036 //
       
  2037 CCalEntry& CCalenMissedEventContainer::ParentEntryL()
       
  2038     {
       
  2039     TRACE_ENTRY_POINT;
       
  2040 
       
  2041     if(iFetchedEntries.Count() == 0)
       
  2042         {
       
  2043         MCalenContext& context = iServices.Context();
       
  2044         iServices.EntryViewL(context.InstanceId().iColId)->FetchL( iEntry->UidL(), iFetchedEntries );
       
  2045         }
       
  2046     __ASSERT_ALWAYS( iFetchedEntries.Count() > 0, User::Panic(_L("CCalenMissedEventContainer::ParentEntryL"),EPanicArrayOfSizeZero));
       
  2047 
       
  2048     TRACE_EXIT_POINT;
       
  2049     return *iFetchedEntries[0];
       
  2050     }
       
  2051 
       
  2052 // -----------------------------------------------------------------------------
       
  2053 // CCalenMissedEventContainer::AllInstancesL
       
  2054 // Returns all the instances associated with the entry being edited.
       
  2055 // (other items were commented in a header).
       
  2056 // -----------------------------------------------------------------------------
       
  2057 //
       
  2058 RPointerArray<CCalEntry>& CCalenMissedEventContainer::AllInstancesL()
       
  2059     {
       
  2060     TRACE_ENTRY_POINT;
       
  2061 
       
  2062     if(iFetchedEntries.Count() == 0)
       
  2063         {
       
  2064         MCalenContext& context = iServices.Context();
       
  2065         iServices.EntryViewL(context.InstanceId().iColId)->FetchL( iEntry->UidL(), iFetchedEntries );
       
  2066         }
       
  2067 
       
  2068     TRACE_EXIT_POINT;
       
  2069     return iFetchedEntries;
       
  2070     }
       
  2071 
       
  2072 // -----------------------------------------------------------------------------
       
  2073 // CCalenMissedEventContainer::GetEventViewData
       
  2074 // Gets the Event View Data
       
  2075 // -----------------------------------------------------------------------------
       
  2076 //	
       
  2077 CCalenEntryUtil* CCalenMissedEventContainer::GetEventViewData()
       
  2078 	{
       
  2079 	TRACE_ENTRY_POINT;
       
  2080 	TRACE_EXIT_POINT;
       
  2081 	return iEventViewData;	
       
  2082 	}
       
  2083 
       
  2084 
       
  2085 // -----------------------------------------------------------------------------
       
  2086 // CCalenMissedEventContainer::HandleNotifyError
       
  2087 // From MCenRepNotifyHandlerCallback
       
  2088 // -----------------------------------------------------------------------------
       
  2089 //	
       
  2090 void CCalenMissedEventContainer::HandleNotifyError( TUint32 /*aId*/,TInt /*aError*/,
       
  2091 												CCenRepNotifyHandler* /*aHandler*/ )
       
  2092 	{
       
  2093 	TRACE_ENTRY_POINT;
       
  2094 	
       
  2095 	if( iNotifier )
       
  2096         {
       
  2097         iNotifier->StopListening();       
       
  2098         delete iNotifier;
       
  2099         iNotifier = NULL;
       
  2100         }
       
  2101         
       
  2102     delete iCenRepSession;    
       
  2103     iCenRepSession = NULL;
       
  2104 	
       
  2105 	TRACE_EXIT_POINT;
       
  2106 	}
       
  2107 
       
  2108 
       
  2109 // -----------------------------------------------------------------------------
       
  2110 // CCalenMissedEventContainer::GetFindItemMenu
       
  2111 // -----------------------------------------------------------------------------
       
  2112 //
       
  2113 CFindItemMenu* CCalenMissedEventContainer::GetFindItemMenu()
       
  2114 	{
       
  2115 	TRACE_ENTRY_POINT;
       
  2116 	TRACE_EXIT_POINT;
       
  2117 	
       
  2118 	return iFindMenu;
       
  2119 	}
       
  2120 
       
  2121 // -----------------------------------------------------------------------------
       
  2122 //  CCalenMissedEventContainer::HandleScrollEventL
       
  2123 //  Handles scroll events
       
  2124 // -----------------------------------------------------------------------------
       
  2125 //   
       
  2126 void CCalenMissedEventContainer::HandleScrollEventL(CEikScrollBar* aScrollBar, 
       
  2127                                           TEikScrollEvent aEventType)
       
  2128     {
       
  2129     TRACE_ENTRY_POINT;
       
  2130 
       
  2131     iTextEditor->HandleScrollEventL(aScrollBar,aEventType);
       
  2132     
       
  2133     TRACE_EXIT_POINT;    
       
  2134     } 
       
  2135 	
       
  2136 // ----------------------------------------------------------------------------
       
  2137 // CCalenMissedEventContainer::IsEventHasMapLocationOrNoLocationTextL
       
  2138 // Stores the necessary information in the context
       
  2139 // and returns ETrue if event has geo coordinates else EFalse
       
  2140 // ----------------------------------------------------------------------------
       
  2141 TBool CCalenMissedEventContainer::IsEventHasMapLocationL()
       
  2142 	{
       
  2143 	CCalGeoValue* geoValue = iEntry->GeoValueL();
       
  2144 	if(geoValue)
       
  2145 		{
       
  2146 		delete geoValue;
       
  2147 		return 	ETrue;
       
  2148 		}
       
  2149 	else
       
  2150 		{
       
  2151 		return 	EFalse;
       
  2152 		}
       
  2153 	}
       
  2154 
       
  2155 // ----------------------------------------------------------------------------
       
  2156 // CCalenMissedEventContainer::IsEventHasNoLocationTextL
       
  2157 // Returns ETrue if event has location text else EFalse
       
  2158 // ----------------------------------------------------------------------------
       
  2159 TBool CCalenMissedEventContainer::IsEventHasNoLocationTextL()
       
  2160 	{
       
  2161 	TPtrC location = iEntry->LocationL();
       
  2162 	if(!location.Length())
       
  2163 		{
       
  2164 		return ETrue;
       
  2165 		}
       
  2166 	else
       
  2167 		{
       
  2168 		return EFalse;
       
  2169 		}
       
  2170 	}
       
  2171 // -----------------------------------------------------------------------------
       
  2172 // OnCmdFindPhoneNumL
       
  2173 // Find phone numbers in the form.
       
  2174 // (other items were commented in a header).
       
  2175 // -----------------------------------------------------------------------------
       
  2176 //
       
  2177 void CCalenMissedEventContainer::OnCmdFindPhoneNumL()
       
  2178     {
       
  2179     TRACE_ENTRY_POINT;
       
  2180     
       
  2181     BuildSearchBufferL();
       
  2182     CFindItemDialog* finder = CFindItemDialog::NewL( *iSearchBuf, CFindItemEngine::EFindItemSearchPhoneNumberBin);
       
  2183     finder->ExecuteLD();
       
  2184        
       
  2185     TRACE_EXIT_POINT;
       
  2186     }
       
  2187 
       
  2188 // -----------------------------------------------------------------------------
       
  2189 // OnCmdFindUrlL
       
  2190 // Find urls in the form.
       
  2191 // (other items were commented in a header).
       
  2192 // -----------------------------------------------------------------------------
       
  2193 //
       
  2194 void CCalenMissedEventContainer::OnCmdFindUrlL()
       
  2195     {
       
  2196     TRACE_ENTRY_POINT;
       
  2197    
       
  2198     BuildSearchBufferL();
       
  2199     CFindItemDialog* finder = CFindItemDialog::NewL( *iSearchBuf, CFindItemEngine::EFindItemSearchURLBin);
       
  2200     finder->ExecuteLD();
       
  2201   
       
  2202     TRACE_EXIT_POINT;
       
  2203     }
       
  2204 
       
  2205 // -----------------------------------------------------------------------------
       
  2206 // OnCmdFindEmailL
       
  2207 // Find email addresses in the form.
       
  2208 // (other items were commented in a header).
       
  2209 // -----------------------------------------------------------------------------
       
  2210 //
       
  2211 void CCalenMissedEventContainer::OnCmdFindEmailL()
       
  2212     {
       
  2213     TRACE_ENTRY_POINT;
       
  2214     
       
  2215     BuildSearchBufferL();
       
  2216     CFindItemDialog* finder = CFindItemDialog::NewL( *iSearchBuf, CFindItemEngine::EFindItemSearchMailAddressBin);
       
  2217     finder->ExecuteLD();
       
  2218     
       
  2219     TRACE_EXIT_POINT;
       
  2220     }
       
  2221 	
       
  2222 // end of file
       
  2223