calendarui/controller/inc/calenservicesimpl.h
changeset 0 f979ecb2b13e
child 18 c198609911f9
child 21 9711e452b5e9
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Provides services for native Calendar extensions
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CALENSERVICESIMPL_H
       
    19 #define CALENSERVICESIMPL_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <calennotificationhandler.h>
       
    23 #include <calsession.h>
       
    24 #include <calenservices.h>
       
    25 
       
    26 // Forward declarations
       
    27 class CCalenGlobalData;     // Calendar-wide accessors
       
    28 class CCalenController;     // Calendar controller
       
    29 class CCalenIcons;
       
    30 class CGulIcon;
       
    31 class CCalenAttachmentModel;
       
    32 class CCalCalendarInfo;
       
    33 class MCalenPreview;
       
    34 
       
    35 /**
       
    36  * Calendar Services External API implementation.
       
    37  */
       
    38 NONSHARABLE_CLASS( CCalenServicesImpl ) : public CBase,
       
    39                                                               public MCalenServices
       
    40     {
       
    41 public:  // Construction and destruction.
       
    42 	/**
       
    43 	 * Two phased constructor. Use this in preference to the C++
       
    44 	 * constructor where possible.
       
    45 	 * @param aCommandRangeStart    start of the command range
       
    46 	 * @param aCommandRangeEnd      end of command range
       
    47 	 */
       
    48 	static CCalenServicesImpl* NewL( TInt aCommandRangeStart,
       
    49 												  TInt aCommandRangeEnd );
       
    50 
       
    51 	/**
       
    52 	 * Two phased constructor. Use this in preference to the C++
       
    53 	 * constructor where possible.
       
    54 	 */
       
    55 	static CCalenServicesImpl* NewL();
       
    56 	
       
    57 	/**
       
    58 	 * Completes construction of this object.
       
    59 	 */
       
    60 	void ConstructL();
       
    61 
       
    62 	/**
       
    63 	 * Performs cleanup of this object.
       
    64 	 */
       
    65 	void Release();
       
    66 
       
    67 public:  // Functions from base classes.
       
    68 	/**
       
    69 	 * Retrieve the calendar session currently in use by Calendar
       
    70 	 * @return CCalSession& currently used by Calendar
       
    71 	 */
       
    72 	 CCalSession& SessionL();
       
    73 
       
    74 	/**
       
    75 	 * Retrieve the calendar session currently in use by Calendar
       
    76 	 * @return CCalSession& currently used by Calendar
       
    77 	 */
       
    78 	 CCalSession& SessionL( const TDesC& aCalendar );
       
    79 	
       
    80 	/**
       
    81 	 * Retrieve the calendar entry view currently in use by Calendar
       
    82 	 * @return CCalEntryView* currently used by Calendar
       
    83 	 */
       
    84 	 CCalEntryView* EntryViewL();
       
    85 
       
    86 	
       
    87 	/**
       
    88 	 * Retrieve the calendar entry view currently in use by Calendar
       
    89 	 * @return CCalEntryView* currently used by Calendar
       
    90 	 */
       
    91 	 CCalEntryView* EntryViewL(const TCalCollectionId aCollectionId );
       
    92 	
       
    93 	
       
    94 	/**
       
    95 	 * Retrieve the calendar instance view currently in use by Calendar
       
    96 	 * @return CCalInstanceView* currently used by Calendar
       
    97 	 */
       
    98 	 CCalInstanceView* InstanceViewL();
       
    99 
       
   100 	/**
       
   101 	 * Retrieve the calendar instance view currently in use by Calendar
       
   102 	 * @return CCalInstanceView* currently used by Calendar
       
   103 	 */
       
   104 	 CCalInstanceView* InstanceViewL( 
       
   105 							const RArray<TInt>& aCollectionIds );
       
   106 
       
   107 	/**
       
   108 	 * Retrieve the InterimUtils
       
   109 	 * @return CCalenInterimUtils2&
       
   110 	 */
       
   111 	CCalenInterimUtils2& InterimUtilsL();
       
   112 
       
   113 	TBool QueueKeyEvent( const TKeyEvent& aEvent, TEventCode aType );
       
   114 	TBool GetQueuedKeyEvent( TKeyEvent& aEvent, TEventCode& aType );
       
   115 	void ResetKeyEventQueue();
       
   116 	/**
       
   117 	 * Get calendar icon of specific type
       
   118 	 * @return CGulIcon*
       
   119 	 */
       
   120 	CGulIcon* GetIconL( MCalenServices::TCalenIcons aIndex );
       
   121 
       
   122 	/**
       
   123 	 * Register for notifications of Calendar events
       
   124 	 * @param aHandler the MCalenNotificationHandler to notify
       
   125 	 * @param aNotification single notification to be notified about
       
   126 	 */
       
   127 	virtual void RegisterForNotificationsL( MCalenNotificationHandler* aHandler,
       
   128 													TCalenNotification aNotification );
       
   129 	
       
   130 	/**
       
   131 	 * Register for notifications of Calendar events
       
   132 	 * @param aHandler the MCalenNotificationHandler to notify
       
   133 	 * @param aNotifications array of notifications to be notified about
       
   134 	 */
       
   135 	virtual void RegisterForNotificationsL( MCalenNotificationHandler* aHandler,
       
   136 													RArray<TCalenNotification>& aNotifications );
       
   137 
       
   138 	/**
       
   139 	 * Cancel notifications of Calendar events
       
   140 	 * @param aHandler the MCalenNotificationHandler to stop notifying
       
   141 	 */
       
   142 	void CancelNotifications( MCalenNotificationHandler* aHandler );
       
   143 
       
   144 	/**
       
   145 	 * Issue a command to be handled by Calendar or a customization
       
   146 	 * All commands will be handled asynchronously.  Calendar may reject
       
   147 	 * @param aCommand the command to be handled
       
   148 	 * @return ETrue, if Calendar will attempt to handle the command
       
   149 	 * @return EFalse, if Calendar will not attempt to handle the command
       
   150 	 */
       
   151 	TBool IssueCommandL( TInt aCommand );
       
   152 
       
   153 	/**
       
   154 	 * Issue a notification to Calendar, which will be broadcast
       
   155 	 * synchronously to all registered notification handlers.
       
   156 	 * Only one notification may be issued at once.
       
   157 	 * @param aNotification the notification to broadcast
       
   158 	 */
       
   159 	void IssueNotificationL( TCalenNotification aNotification );
       
   160 
       
   161 	/**
       
   162 	 * Returns the context. This includes information such
       
   163 	 * as the currently focused date/instance.
       
   164 	 */
       
   165 	MCalenContext& Context();
       
   166 
       
   167 	/**
       
   168 	 * Request activation of a specific view
       
   169 	 * @param aViewId The view to be activated
       
   170 	 */
       
   171 	void RequestActivationL( const TVwsViewId& aViewId );
       
   172 
       
   173 	/**
       
   174 	 * Notify Calendar that a specific view has been activated.
       
   175 	 * Custom views must call this on activation
       
   176 	 * @param aViewId The view that was activated
       
   177 	 */
       
   178 	void ActivationNotificationL( const TVwsViewId& aViewId );
       
   179 
       
   180 	/**
       
   181 	 * Offers the menu pane for population, interested parties can
       
   182 	 * add or remove menu items
       
   183 	 * @param aMenuPane meu pane to be populated
       
   184 	 * @param aResourceId   resource id of menu pane
       
   185 	 */
       
   186 	void OfferMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   187 
       
   188 	 /**
       
   189 	 * Gets the command range that has been allocated to this MCalenServices 
       
   190 	 * instance
       
   191 	 * 
       
   192 	 * @param aCommandRangeStart start of command range
       
   193 	 * @param aCommandRangeEnd end of command range
       
   194 	 */
       
   195 	void GetCommandRange( TInt& aCommandRangeStart, 
       
   196 									  TInt& aCommandRangeEnd ) const;
       
   197 
       
   198 	  /**
       
   199 	 * Offers a TRect to customisations for the creation of
       
   200 	 * a control to be displayed in the infobar
       
   201 	 * @return info bar control
       
   202 	 */
       
   203 	CCoeControl* Infobar( const TRect& aRect );
       
   204 	
       
   205 	/**
       
   206 	 * Customisation creates the text for display in infobar
       
   207 	 * @return infobar Text
       
   208 	 */
       
   209 	const TDesC& Infobar( );
       
   210 
       
   211         MCalenPreview* CustomPreviewPaneL( TRect& aRect );
       
   212 	/**
       
   213 	 * Offers a TRect to available customisations for the creation of a 
       
   214 	 * control to be displayed in the preview pane
       
   215 	 * @return preview pane control
       
   216 	 */
       
   217 	CCoeControl* PreviewPane( TRect& aRect );
       
   218 	
       
   219 	/**
       
   220 	 * Get a pointer to the Calendar toolbar, or NULL if none is available.
       
   221 	 * Ownership is not transferred.
       
   222 	 * @return Calendar toolbar if available
       
   223 	 */
       
   224 	MCalenToolbar* ToolbarOrNull();
       
   225 	
       
   226 	/**
       
   227 	 * Get Missed alarm store
       
   228 	 * @return reference to Missed alarm store
       
   229 	 */        
       
   230 	CMissedAlarmStore* MissedAlarmStore();
       
   231 	
       
   232 	/**
       
   233 	 * Get missed alarms list
       
   234 	 * @return an array of missed alarms
       
   235 	 */
       
   236 	void GetMissedAlarmsList(RArray<TCalenInstanceId>& aMissedAlarmList);
       
   237 	
       
   238 	/**
       
   239 	 * Get attachment model
       
   240 	 * @return CCalenAttachmentModel* pointer to CCalenAttachmentModel
       
   241 	 */
       
   242 	CCalenAttachmentModel* GetAttachmentData();
       
   243 	
       
   244 	/**
       
   245 	* @brief Get all available calendar info
       
   246 	*
       
   247 	* @param  returns the list of available calendar info iterating 
       
   248 	* through all calendars
       
   249 	*/
       
   250 	void GetAllCalendarInfoL(
       
   251 			RPointerArray<CCalCalendarInfo>& aCalendarInfoList );
       
   252 	
       
   253 	/**
       
   254 	 * @brief get calendar file name for the collection id
       
   255 	 * 
       
   256 	 * @param aCalendarFile reference to the calendar file name
       
   257 	 * @param aCollectionId  collection id of the session for 
       
   258 	 * which calendar file name is required
       
   259 	 */
       
   260 	const TDesC& GetCalFileNameForCollectionId(const TCalCollectionId aCollectionId);
       
   261 	
       
   262 private:
       
   263 	/**
       
   264 	 * C++ constructor.
       
   265 	 */
       
   266 	CCalenServicesImpl( TInt aCommandRangeStart, 
       
   267 								TInt aCommandRangeEnd );
       
   268 
       
   269     private:  // Data
       
   270         CCalenGlobalData* iGlobalData;
       
   271         CCalenController* iController;
       
   272         
       
   273 
       
   274         TInt iCommandRangeStart; // start of the valid command range
       
   275         TInt iCommandRangeEnd;   // end of the valid command range
       
   276     };
       
   277 
       
   278 #endif // CALENSERVICESIMPL_H
       
   279 
       
   280 // End of file