calendarui/views/inc/calenmissedeventcontainer.h
changeset 0 f979ecb2b13e
child 20 9c5b1510919f
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     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 item finder
       
   194      */
       
   195     CItemFinder* GetItemFinder();
       
   196     /**
       
   197      * Get find item menu
       
   198      */
       
   199     CFindItemMenu* GetFindItemMenu();
       
   200     
       
   201     /**
       
   202      * Returns ETrue if event has geo coordinates else EFalse
       
   203      */
       
   204     TBool IsEventHasMapLocationL();
       
   205     
       
   206     /**
       
   207      * Returns ETrue if event has location text else EFalse
       
   208      */
       
   209     TBool IsEventHasNoLocationTextL();
       
   210   
       
   211     
       
   212  private:
       
   213  	
       
   214  	/**
       
   215  	 * Set the layout data for LAF
       
   216  	 */
       
   217  	void SetLayoutFromLookAndFeel(); 	
       
   218     
       
   219     /**
       
   220      * Convert values from twips to pixels
       
   221     */
       
   222     TInt PixelsToTwips(TInt aPixels);
       
   223  	
       
   224  	/**
       
   225  	 * Set up the Font style
       
   226  	 */
       
   227  	void SetupFontL(); 	
       
   228  	
       
   229     /**
       
   230      * Set the icons
       
   231      */	
       
   232  	void SetIconsL();
       
   233  	
       
   234  	/**
       
   235      * Populate the icon drawer with the icons for this entry
       
   236      */
       
   237     void PopulateIconDrawerL( CCalenIconDrawer& aIconDrawer );
       
   238     
       
   239     /**
       
   240      * Formats the heading and adds it the the view
       
   241      * Headings are bolded with no indentation.
       
   242      */
       
   243     void SetFormatAndAddHeadingL( const TDesC& aHeading );
       
   244 
       
   245     /**
       
   246      * Formats the body and adds it the the view
       
   247      * Body text is not bolded and indented from the leading margin
       
   248      * according to the Calendar viewer LAF
       
   249      */
       
   250     void SetFormatAndAddBodyL( const TDesC& aBody );
       
   251 
       
   252     /**
       
   253      * Formats the text and adds it to the view
       
   254      */
       
   255     void AddFormattedTextL( const TDesC& aText );
       
   256 
       
   257     /**
       
   258      * Add a text field to the view.
       
   259      */
       
   260     void AddTextFieldL( TInt aHeadingResource, const TDesC& aBody );
       
   261 
       
   262     /**
       
   263      * Add a text field to the view.
       
   264      */
       
   265     void AddTextFieldL( TInt aHeadingResource, TInt aBodyResource );
       
   266 
       
   267     /**
       
   268      * Add a empty line to the view.
       
   269      */
       
   270     void AddEmptyLineL();
       
   271 
       
   272     /**
       
   273      * Add a subject field to the view.
       
   274      */
       
   275     void AddSubjectFieldL();
       
   276 
       
   277     /**
       
   278      * Add a location field to the view.
       
   279      */
       
   280     void AddLocationFieldL();
       
   281 
       
   282     /**
       
   283      * Add a priority field to the form.
       
   284      */
       
   285     void AddPriorityFieldL();
       
   286 
       
   287     /**
       
   288      * Add a time field to the form.
       
   289      */
       
   290     void AddTimeFieldL( TInt aHeadingResource, const TTime& aTime );
       
   291 
       
   292     /**
       
   293      * Add a date field to the form.
       
   294      */
       
   295     void AddDateFieldL( const TTime& aDate );
       
   296 
       
   297     /**
       
   298      * Add a date field to the form.
       
   299      */
       
   300     void AddDateFieldL( TInt aHeadingResource, const TTime& aDate );
       
   301 
       
   302     /**
       
   303      * Add a "date - date" field to the form.
       
   304      */
       
   305     void AddDateDateFieldL( const TTime& aStartDate, const TTime& aEndDate );
       
   306 
       
   307     /**
       
   308      * Add an alarm date-time field to the form, in the order: DD.DD.DDDD TT:TT according to localisation.
       
   309      */
       
   310     void AddAlarmDateAndTimeFieldL( const TTime& aTime );
       
   311 
       
   312     /**
       
   313      * Set alarm to form.
       
   314      */
       
   315     void AddAlarmDateTimeFieldL();
       
   316 
       
   317     /**
       
   318      * Add the repeat information to the form for a recurring appointment
       
   319      * @since Series 60 3.1
       
   320      */
       
   321     void AddRepeatFieldL();
       
   322 
       
   323     /**
       
   324      * Add the time fields to the form
       
   325      * @since Series 60 3.1
       
   326      */
       
   327     void AddTimeFieldL();
       
   328 
       
   329     /**
       
   330      * Add a description to the form
       
   331      * @since Series 60 3.1
       
   332      */
       
   333     void AddDescriptionFieldL();
       
   334 
       
   335     /**
       
   336      * Add a since field to the form
       
   337      * @since Series 60 3.1
       
   338      */
       
   339     void AddSinceFieldL();
       
   340 	
       
   341    /**
       
   342     * Getter for min and max times
       
   343     */ 
       
   344     void GetMinAndMaxTimesL( RArray<TCalTime>& aTimes,
       
   345                          TCalTime& aMinTime,
       
   346                          TCalTime& aMaxTime );
       
   347    /**
       
   348     * Remove duplicate times
       
   349     */ 	
       
   350     void RemoveDuplicateTimesL( RArray<TCalTime>& aTimes );  
       
   351 
       
   352    /**
       
   353     * Remove excluded times
       
   354     */  
       
   355     void RemoveExcludedTimesL( RArray<TCalTime>& aStartDates,
       
   356                                RArray<TCalTime>& aExDates,
       
   357                                RPointerArray<CCalEntry>& aChildEntries );                          
       
   358    /**
       
   359     * RDate expansion stuff
       
   360     */	
       
   361 	TBool GetSeriesRepeatInformationL( CCalEntry& aEntry,
       
   362 	                                   TCalenRepeatIndex& aRepeatIndex,
       
   363 	                                   TTime& aSeriesStart,
       
   364 	                                   TTime& aSeriesEnd );
       
   365 
       
   366 
       
   367     /**
       
   368      * Check if the given text will fit in the the given width
       
   369      * Used to determine if dates will wrap or not
       
   370      */
       
   371     TBool TryToFitL( const TDesC& aStr, TInt aMaxWidth, const CFont& aFont );
       
   372 	
       
   373     /**
       
   374      * Convert from a calendar TUint priority to a TInt for the form.
       
   375      */
       
   376     TInt CalendarPriorityToFormPriority( CCalenEntryUtil::TTodoPriority aCalPriority );	
       
   377 	
       
   378    /**
       
   379     * Build Search Buffer
       
   380     */ 
       
   381     void BuildSearchBufferL();
       
   382     
       
   383     /**
       
   384      * Get the text fields from the form as a descriptior.
       
   385      */
       
   386     void GetTextFieldsFromFormL( TDes& aDesc );
       
   387     
       
   388     /**
       
   389      * Fetch the current entry's parent from agenda. This should be used
       
   390      * sparingly as it is expensive. It may be worth seeing if there
       
   391      * is any performance improvement by fetching the parent from
       
   392      * CCalenDefaultViewers and passing it through to the constructor of
       
   393      * the editors and viewers, instead of fetching it internally to each
       
   394      * viewer/editor.
       
   395      */
       
   396     CCalEntry& ParentEntryL();
       
   397 
       
   398     /**
       
   399      * Fetch all the instances of an entry from agenda. This should be used
       
   400      * sparingly as it is expensive. It may be worth seeing if there
       
   401      * is any performance improvement by fetching the parent from
       
   402      * CCalenDefaultViewers and passing it through to the constructor of
       
   403      * the editors and viewers, instead of fetching it internally to each
       
   404      * viewer/editor.
       
   405      */
       
   406     RPointerArray<CCalEntry>& AllInstancesL();
       
   407 private: //Auto highlight methods
       
   408 
       
   409     /**
       
   410     * Reads the shared data value used to initialize automatic highlighting
       
   411     * @return TBool, ETrue if automatic highlighting is to be used
       
   412     */
       
   413     void ReadAutoHlCenRepValueAndSetNotifyL();
       
   414     
       
   415     /**
       
   416     * From MCenRepNotifyHandlerCallback
       
   417     * Handles the incoming notifications of key changes
       
   418     * @since Series60 3.0
       
   419     * @param aId, Key that has changed
       
   420     * @param aNewValue, New value of the key    
       
   421     */
       
   422     void HandleNotifyInt( TUint32 aId, TInt aNewValue );
       
   423 
       
   424     /**
       
   425     * From MCenRepNotifyHandlerCallback
       
   426     * Handles the notifier errors
       
   427     * @since Series60 3.0
       
   428     * @param aId, Key that has changed
       
   429     * @param aNewValue, New value of the key    
       
   430     */
       
   431     void HandleNotifyError( TUint32 aId,TInt aError,CCenRepNotifyHandler* aHandler );
       
   432     
       
   433 	/**
       
   434 	* Set the state of automatic highlighting
       
   435 	* @param aSwitchON, ETrue if automatic highlighting is to used, otherwise EFalse
       
   436 	*/
       
   437     void SetAutomaticHighlightL( const TBool aSwitchON );
       
   438     
       
   439     /**
       
   440 	* This method is used when phone number is 
       
   441 	* found and pressing phone key would make call
       
   442 	*/
       
   443     void HandleNumberCallL();
       
   444 
       
   445 public:
       
   446     
       
   447     /**
       
   448      * From MEikScrollBarObserver: to Handle scrollbar events
       
   449      * @param CEikScrollBar* : Pointer to the scrollbar
       
   450      * @param TEikScrollEvent : Event on the Scrollbar
       
   451      */
       
   452      void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType);
       
   453      
       
   454 private:
       
   455  
       
   456  	HBufC* iSearchBuf;  //Buffer for search text used by find api
       
   457     HBufC* iTimeFormat; // buffer for the time format string
       
   458     HBufC* iDateFormat; // buffer for the date format string 
       
   459  	 
       
   460     CParaFormat* iParaFormat;   // para format for the rich text obj. owned
       
   461     TParaFormatMask iParaFormatMask;    // specifying validity of paraformat
       
   462 
       
   463     TCharFormat iCharFormat;                // character formating for the rich text obj
       
   464     TCharFormatMask iCharFormatMask;  // specifying validity of icharformat
       
   465 
       
   466     TFontSpec iHeadingFontSpec;     // font weight of heading text
       
   467     TFontSpec iBodyFontSpec;          // font weight of body text
       
   468 
       
   469     const CFont* iBodyFont; // not owned
       
   470     TInt iMaxWidth;         // maximum width in pixel of text area of the rich text
       
   471     TInt iHeadingIndent;    // indent of the heading text measured in twips
       
   472     TInt iBodyIndent;   // indent of the body text measured in twips
       
   473     TInt iIconDrawerWidthInPixels; // width of the icon drawer in pixels
       
   474     TInt iEmptyLineHeight;  // height of the empty line in twips 
       
   475 
       
   476     CEikRichTextEditor* iTextEditor;    // rich text obj. owned
       
   477     CAknsBasicBackgroundControlContext* iBgContext; // for skins support   
       
   478     
       
   479     CCalenEntryUtil* iEventViewData; // event view data
       
   480     
       
   481     CCalEntry* iEntry; //entry viewed in event view
       
   482     TInt iTitleTextId; // title pane text id
       
   483          
       
   484      // The array of entries returned from FetchL(), based on the entry being edited.
       
   485      // This allows retrieving of the parent entry using ParentEntryL(), which should
       
   486      // be used instead of direct access to this array.
       
   487      RPointerArray<CCalEntry> iFetchedEntries;
       
   488      
       
   489 private:
       
   490      CRepository* iCenRepSession; // Central Repository session
       
   491      // Notifier to listen changes of offline state
       
   492      CCenRepNotifyHandler* iNotifier;
       
   493      TBool iAutomaticHlValue;
       
   494      TBool iAutomaticHlInitialized;   
       
   495      CItemFinder*  iAutoFinder; // text finder 
       
   496      CFindItemMenu* iFindMenu;  
       
   497     
       
   498 	};
       
   499 
       
   500 #endif // CALENMISSEDEVENTCONTAINER_H