calendarui/views/inc/calenmissedeventcontainer.h
branchRCL_3
changeset 66 bd7edf625bdd
child 67 1539a383d7b6
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:   For Event view container of calendar application.
       
    15 *                The class derived from CCalenContainer
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CALENMISSEDEVENTCONTAINER_H
       
    22 #define CALENMISSEDEVENTCONTAINER_H
       
    23 
       
    24 // system includes
       
    25 
       
    26 // user includes
       
    27 #include "calenentryutil.h"
       
    28 #include "calencontainer.h"
       
    29 #include <eikmenup.h>
       
    30 #include <cenrepnotifyhandler.h>
       
    31 
       
    32 // forward declarations
       
    33 class CEikRichTextEditor;
       
    34 class CCalenEntryUtil;
       
    35 class CCalenIconDrawer;
       
    36 class CItemFinder;
       
    37 class CRepository;
       
    38 class CCenRepNotifyHandler;
       
    39 class CFindItemMenu;
       
    40 
       
    41 // class declaration
       
    42 /**
       
    43  * CCalenEventContainer container control class for EventView.
       
    44  */
       
    45 NONSHARABLE_CLASS(CCalenMissedEventContainer):public CCalenContainer,
       
    46 											public MCenRepNotifyHandlerCallback,
       
    47 											public MEikScrollBarObserver
       
    48 	{
       
    49 public:
       
    50 	/**
       
    51      * C++ constructor.
       
    52      */
       
    53     CCalenMissedEventContainer( CCalenNativeView* aView,
       
    54                               MCalenServices& aServices );
       
    55                          
       
    56     /**
       
    57      * Destructor.
       
    58      */
       
    59     virtual ~CCalenMissedEventContainer();                     
       
    60 
       
    61 private: // Functions from base classes
       
    62     /**
       
    63      * From CCoeControl, child control was resized.
       
    64      */
       
    65     void SizeChanged();
       
    66 
       
    67     /**
       
    68      * From CCoeControl, return child control count.
       
    69      * @return Control count
       
    70      */
       
    71     TInt CountComponentControls() const;
       
    72 
       
    73     /**
       
    74      * From CCoeControl, return child control pointer.
       
    75      * @param aIndex Child control index
       
    76      * @return Child control pointer.
       
    77      */
       
    78     CCoeControl* ComponentControl(TInt aIndex) const;
       
    79 
       
    80     /**
       
    81      * From CCoeControl, process key event.
       
    82      * @param aKeyEvent The key event.
       
    83      * @param aType EEventKey | EEventKeyUp | EEventKeyDown.
       
    84      * @return EKeyWasNotConsumed : Key event was not consumed.
       
    85      */
       
    86     TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
       
    87                                     TEventCode aType);
       
    88 
       
    89     /**
       
    90      * From CCoeControl, process pointer event.
       
    91      */
       
    92     void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
    93 
       
    94    /**
       
    95     * From CCoeControl
       
    96     */  
       
    97     void Draw(const TRect& /*aRect*/) const;
       
    98 
       
    99     /**
       
   100      * Pass skin information if needed
       
   101      */
       
   102     TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
       
   103 
       
   104     /**
       
   105      * From CCoeControl, Get help context.
       
   106      * @param aContext Help context
       
   107      */
       
   108     void GetHelpContext(TCoeHelpContext& aContext) const;
       
   109 
       
   110     /**
       
   111      * From MActiveStep, refresh EventView data.
       
   112      */
       
   113     TInt DoStepL();
       
   114 
       
   115     /**
       
   116      * From CCoeControl Handles a resource relative event
       
   117      */
       
   118     void HandleResourceChange(TInt aType);                              
       
   119 
       
   120 
       
   121 private:    // From CCalenContainer
       
   122     /**
       
   123      * From CCalenContainer Third phase constructor.
       
   124      * This function was called CCalenView::ConstructL().
       
   125      */
       
   126     void ConstructImplL();
       
   127     
       
   128     /**
       
   129      * From CCalenContainer.
       
   130      * This methods is called after calendar settings have changed.
       
   131      */
       
   132     void UpdateSize();
       
   133  	
       
   134     /**
       
   135      * Create icon index
       
   136      */
       
   137     void CreateIconIndicesL( RArray<MCalenServices::TCalenIcons>& aIndexArray );
       
   138 	
       
   139 
       
   140     /**
       
   141      * This method is called after pointer event in Navi
       
   142      * decoration object.
       
   143      * @param aDirection right or left
       
   144      */
       
   145     void HandleNaviDecoratorEventL(TInt aEventID);
       
   146     
       
   147     void HandleLongTapEventL( const TPoint& aPenEventLocation, 
       
   148                               const TPoint& aPenEventScreenLocation );
       
   149 
       
   150 
       
   151 public: // New methods
       
   152  
       
   153  	/**
       
   154  	 * Build text editor
       
   155  	 */
       
   156  	void BuildTextEditorL();
       
   157  	
       
   158  	/**
       
   159  	 * Request for instance view
       
   160  	 */
       
   161  	void RequestInstanceViewL();
       
   162  	
       
   163  	/**
       
   164  	 * Add the data fields
       
   165  	 */ 
       
   166  	void AddFieldsL();
       
   167  	
       
   168     /**
       
   169      * Complete population
       
   170   	 */	
       
   171     void CompletePopulationL();
       
   172  	
       
   173     /**
       
   174      * Getter for titlepane
       
   175      */ 	
       
   176  	TInt GetTitleTextId();
       
   177  	
       
   178     /**
       
   179 	 * Getter for event view data
       
   180 	 */	
       
   181  	CCalenEntryUtil* GetEventViewData();
       
   182  	
       
   183     /**
       
   184      * Complete a todo entry
       
   185      */
       
   186     void OnCmdCompleteTaskL();
       
   187 
       
   188     /**
       
   189      * Restore a todo entry
       
   190      */
       
   191     void OnCmdRestoreTaskL();
       
   192     /**
       
   193      * Get find item menu
       
   194      */
       
   195     CFindItemMenu* GetFindItemMenu();
       
   196     
       
   197     /**
       
   198      * Returns ETrue if event has geo coordinates else EFalse
       
   199      */
       
   200     TBool IsEventHasMapLocationL();
       
   201     
       
   202     /**
       
   203      * Returns ETrue if event has location text else EFalse
       
   204      */
       
   205     TBool IsEventHasNoLocationTextL();
       
   206     
       
   207     /**
       
   208      * Find a phone number in the form
       
   209      */
       
   210     void OnCmdFindPhoneNumL();
       
   211     
       
   212     /**
       
   213      * Find an email address in the form
       
   214      */
       
   215     void OnCmdFindEmailL();
       
   216     
       
   217     /**
       
   218      * Find a URL in the form
       
   219      */
       
   220     void OnCmdFindUrlL();
       
   221     
       
   222     
       
   223  private:
       
   224  	
       
   225  	/**
       
   226  	 * Set the layout data for LAF
       
   227  	 */
       
   228  	void SetLayoutFromLookAndFeel(); 	
       
   229     
       
   230     /**
       
   231      * Convert values from twips to pixels
       
   232     */
       
   233     TInt PixelsToTwips(TInt aPixels);
       
   234  	
       
   235  	/**
       
   236  	 * Set up the Font style
       
   237  	 */
       
   238  	void SetupFontL(); 	
       
   239  	
       
   240     /**
       
   241      * Set the icons
       
   242      */	
       
   243  	void SetIconsL();
       
   244  	
       
   245  	/**
       
   246      * Populate the icon drawer with the icons for this entry
       
   247      */
       
   248     void PopulateIconDrawerL( CCalenIconDrawer& aIconDrawer );
       
   249     
       
   250     /**
       
   251      * Formats the heading and adds it the the view
       
   252      * Headings are bolded with no indentation.
       
   253      */
       
   254     void SetFormatAndAddHeadingL( const TDesC& aHeading );
       
   255 
       
   256     /**
       
   257      * Formats the body and adds it the the view
       
   258      * Body text is not bolded and indented from the leading margin
       
   259      * according to the Calendar viewer LAF
       
   260      */
       
   261     void SetFormatAndAddBodyL( const TDesC& aBody );
       
   262 
       
   263     /**
       
   264      * Formats the text and adds it to the view
       
   265      */
       
   266     void AddFormattedTextL( const TDesC& aText );
       
   267 
       
   268     /**
       
   269      * Add a text field to the view.
       
   270      */
       
   271     void AddTextFieldL( TInt aHeadingResource, const TDesC& aBody );
       
   272 
       
   273     /**
       
   274      * Add a text field to the view.
       
   275      */
       
   276     void AddTextFieldL( TInt aHeadingResource, TInt aBodyResource );
       
   277 
       
   278     /**
       
   279      * Add a empty line to the view.
       
   280      */
       
   281     void AddEmptyLineL();
       
   282 
       
   283     /**
       
   284      * Add a subject field to the view.
       
   285      */
       
   286     void AddSubjectFieldL();
       
   287 
       
   288     /**
       
   289      * Add a location field to the view.
       
   290      */
       
   291     void AddLocationFieldL();
       
   292 
       
   293     /**
       
   294      * Add a priority field to the form.
       
   295      */
       
   296     void AddPriorityFieldL();
       
   297 
       
   298     /**
       
   299      * Add a time field to the form.
       
   300      */
       
   301     void AddTimeFieldL( TInt aHeadingResource, const TTime& aTime );
       
   302 
       
   303     /**
       
   304      * Add a date field to the form.
       
   305      */
       
   306     void AddDateFieldL( const TTime& aDate );
       
   307 
       
   308     /**
       
   309      * Add a date field to the form.
       
   310      */
       
   311     void AddDateFieldL( TInt aHeadingResource, const TTime& aDate );
       
   312 
       
   313     /**
       
   314      * Add a "date - date" field to the form.
       
   315      */
       
   316     void AddDateDateFieldL( const TTime& aStartDate, const TTime& aEndDate );
       
   317 
       
   318     /**
       
   319      * Add an alarm date-time field to the form, in the order: DD.DD.DDDD TT:TT according to localisation.
       
   320      */
       
   321     void AddAlarmDateAndTimeFieldL( const TTime& aTime );
       
   322 
       
   323     /**
       
   324      * Set alarm to form.
       
   325      */
       
   326     void AddAlarmDateTimeFieldL();
       
   327 
       
   328     /**
       
   329      * Add the repeat information to the form for a recurring appointment
       
   330      * @since Series 60 3.1
       
   331      */
       
   332     void AddRepeatFieldL();
       
   333 
       
   334     /**
       
   335      * Add the time fields to the form
       
   336      * @since Series 60 3.1
       
   337      */
       
   338     void AddTimeFieldL();
       
   339 
       
   340     /**
       
   341      * Add a description to the form
       
   342      * @since Series 60 3.1
       
   343      */
       
   344     void AddDescriptionFieldL();
       
   345 
       
   346     /**
       
   347      * Add a since field to the form
       
   348      * @since Series 60 3.1
       
   349      */
       
   350     void AddSinceFieldL();
       
   351 	
       
   352    /**
       
   353     * Getter for min and max times
       
   354     */ 
       
   355     void GetMinAndMaxTimesL( RArray<TCalTime>& aTimes,
       
   356                          TCalTime& aMinTime,
       
   357                          TCalTime& aMaxTime );
       
   358    /**
       
   359     * Remove duplicate times
       
   360     */ 	
       
   361     void RemoveDuplicateTimesL( RArray<TCalTime>& aTimes );  
       
   362 
       
   363    /**
       
   364     * Remove excluded times
       
   365     */  
       
   366     void RemoveExcludedTimesL( RArray<TCalTime>& aStartDates,
       
   367                                RArray<TCalTime>& aExDates,
       
   368                                RPointerArray<CCalEntry>& aChildEntries );                          
       
   369    /**
       
   370     * RDate expansion stuff
       
   371     */	
       
   372 	TBool GetSeriesRepeatInformationL( CCalEntry& aEntry,
       
   373 	                                   TCalenRepeatIndex& aRepeatIndex,
       
   374 	                                   TTime& aSeriesStart,
       
   375 	                                   TTime& aSeriesEnd );
       
   376 
       
   377 
       
   378     /**
       
   379      * Check if the given text will fit in the the given width
       
   380      * Used to determine if dates will wrap or not
       
   381      */
       
   382     TBool TryToFitL( const TDesC& aStr, TInt aMaxWidth, const CFont& aFont );
       
   383 	
       
   384     /**
       
   385      * Convert from a calendar TUint priority to a TInt for the form.
       
   386      */
       
   387     TInt CalendarPriorityToFormPriority( CCalenEntryUtil::TTodoPriority aCalPriority );	
       
   388 	
       
   389    /**
       
   390     * Build Search Buffer
       
   391     */ 
       
   392     void BuildSearchBufferL();
       
   393     
       
   394     /**
       
   395      * Get the text fields from the form as a descriptior.
       
   396      */
       
   397     void GetTextFieldsFromFormL( TDes& aDesc );
       
   398     
       
   399     /**
       
   400      * Fetch the current entry's parent from agenda. This should be used
       
   401      * sparingly as it is expensive. It may be worth seeing if there
       
   402      * is any performance improvement by fetching the parent from
       
   403      * CCalenDefaultViewers and passing it through to the constructor of
       
   404      * the editors and viewers, instead of fetching it internally to each
       
   405      * viewer/editor.
       
   406      */
       
   407     CCalEntry& ParentEntryL();
       
   408 
       
   409     /**
       
   410      * Fetch all the instances of an entry from agenda. This should be used
       
   411      * sparingly as it is expensive. It may be worth seeing if there
       
   412      * is any performance improvement by fetching the parent from
       
   413      * CCalenDefaultViewers and passing it through to the constructor of
       
   414      * the editors and viewers, instead of fetching it internally to each
       
   415      * viewer/editor.
       
   416      */
       
   417     RPointerArray<CCalEntry>& AllInstancesL();
       
   418 private: //Auto highlight methods
       
   419 
       
   420    
       
   421 
       
   422     /**
       
   423     * From MCenRepNotifyHandlerCallback
       
   424     * Handles the notifier errors
       
   425     * @since Series60 3.0
       
   426     * @param aId, Key that has changed
       
   427     * @param aNewValue, New value of the key    
       
   428     */
       
   429     void HandleNotifyError( TUint32 aId,TInt aError,CCenRepNotifyHandler* aHandler );
       
   430     
       
   431 
       
   432 public:
       
   433     
       
   434     /**
       
   435      * From MEikScrollBarObserver: to Handle scrollbar events
       
   436      * @param CEikScrollBar* : Pointer to the scrollbar
       
   437      * @param TEikScrollEvent : Event on the Scrollbar
       
   438      */
       
   439      void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType);
       
   440      
       
   441 private:
       
   442  
       
   443  	HBufC* iSearchBuf;  //Buffer for search text used by find api
       
   444     HBufC* iTimeFormat; // buffer for the time format string
       
   445     HBufC* iDateFormat; // buffer for the date format string 
       
   446  	 
       
   447     CParaFormat* iParaFormat;   // para format for the rich text obj. owned
       
   448     TParaFormatMask iParaFormatMask;    // specifying validity of paraformat
       
   449 
       
   450     TCharFormat iCharFormat;                // character formating for the rich text obj
       
   451     TCharFormatMask iCharFormatMask;  // specifying validity of icharformat
       
   452 
       
   453     TFontSpec iHeadingFontSpec;     // font weight of heading text
       
   454     TFontSpec iBodyFontSpec;          // font weight of body text
       
   455 
       
   456     const CFont* iBodyFont; // not owned
       
   457     TInt iMaxWidth;         // maximum width in pixel of text area of the rich text
       
   458     TInt iHeadingIndent;    // indent of the heading text measured in twips
       
   459     TInt iBodyIndent;   // indent of the body text measured in twips
       
   460     TInt iIconDrawerWidthInPixels; // width of the icon drawer in pixels
       
   461     TInt iEmptyLineHeight;  // height of the empty line in twips 
       
   462 
       
   463     CEikRichTextEditor* iTextEditor;    // rich text obj. owned
       
   464     CAknsBasicBackgroundControlContext* iBgContext; // for skins support   
       
   465     
       
   466     CCalenEntryUtil* iEventViewData; // event view data
       
   467     
       
   468     CCalEntry* iEntry; //entry viewed in event view
       
   469     TInt iTitleTextId; // title pane text id
       
   470          
       
   471      // The array of entries returned from FetchL(), based on the entry being edited.
       
   472      // This allows retrieving of the parent entry using ParentEntryL(), which should
       
   473      // be used instead of direct access to this array.
       
   474      RPointerArray<CCalEntry> iFetchedEntries;
       
   475      
       
   476 private:
       
   477      CRepository* iCenRepSession; // Central Repository session
       
   478      // Notifier to listen changes of offline state
       
   479      CCenRepNotifyHandler* iNotifier;
       
   480      CFindItemMenu* iFindMenu;  
       
   481     
       
   482 	};
       
   483 
       
   484 #endif // CALENMISSEDEVENTCONTAINER_H