calendarui/controller/inc/calenservicesimpl.h
changeset 89 b57382753122
parent 18 c198609911f9
equal deleted inserted replaced
83:5aadd1120515 89:b57382753122
    17 
    17 
    18 #ifndef CALENSERVICESIMPL_H
    18 #ifndef CALENSERVICESIMPL_H
    19 #define CALENSERVICESIMPL_H
    19 #define CALENSERVICESIMPL_H
    20 
    20 
    21 #include <e32base.h>
    21 #include <e32base.h>
    22 
    22 #include <calennotificationhandler.h>
    23 #include "calennotificationhandler.h"   // TCalenNotification
    23 #include <calsession.h>
    24 #include "calenservices.h"
    24 #include <calenservices.h>
    25 
    25 
    26 // Forward declarations
    26 // Forward declarations
       
    27 class CCalenGlobalData;     // Calendar-wide accessors
    27 class CCalenController;     // Calendar controller
    28 class CCalenController;     // Calendar controller
    28 class HbMainWindow;
    29 class CCalenIcons;
    29 class HbWidget;
    30 class CGulIcon;
    30 class QString;
    31 class CCalenAttachmentModel;
    31 class HbMenu;
    32 class CCalCalendarInfo;
       
    33 class MCalenPreview;
    32 
    34 
    33 /**
    35 /**
    34  * Calendar Services External API implementation.
    36  * Calendar Services External API implementation.
    35  */
    37  */
    36 class CalenServicesImpl  : public MCalenServices
    38 NONSHARABLE_CLASS( CCalenServicesImpl ) : public CBase,
       
    39                                                               public MCalenServices
    37     {
    40     {
    38     	
    41 public:  // Construction and destruction.
    39     public:  // Construction and destruction.
    42 	/**
    40         /**
    43 	 * Two phased constructor. Use this in preference to the C++
    41          * Two phased constructor. Use this in preference to the C++
    44 	 * constructor where possible.
    42          * constructor where possible.
    45 	 * @param aCommandRangeStart    start of the command range
    43          * @param aCommandRangeStart    start of the command range
    46 	 * @param aCommandRangeEnd      end of command range
    44          * @param aCommandRangeEnd      end of command range
    47 	 */
    45          */
    48 	static CCalenServicesImpl* NewL( TInt aCommandRangeStart,
    46         static CalenServicesImpl* NewL( TInt aCommandRangeStart,
    49 												  TInt aCommandRangeEnd );
    47                                                       TInt aCommandRangeEnd );
    50 
    48         /**
    51 	/**
    49          * Two phased constructor. Use this in preference to the C++
    52 	 * Two phased constructor. Use this in preference to the C++
    50          * constructor where possible.
    53 	 * constructor where possible.
    51          */
    54 	 */
    52         static CalenServicesImpl* NewL();
    55 	static CCalenServicesImpl* NewL();
    53         
    56 	
    54         /**
    57 	/**
    55          * Completes construction of this object.
    58 	 * Completes construction of this object.
    56          */
    59 	 */
    57         void ConstructL();
    60 	void ConstructL();
    58 
    61 
    59         /**
    62 	/**
    60          * Performs cleanup of this object.
    63 	 * Performs cleanup of this object.
    61          */
    64 	 */
    62         void Release();
    65 	void Release();
    63 
    66 
    64     public:  // Functions from base classes.
    67 public:  // Functions from base classes.
    65     
    68 	/**
    66     		/**
    69 	 * Retrieve the calendar session currently in use by Calendar
    67          * Get MainWindow
    70 	 * @return CCalSession& currently used by Calendar
    68          * @return reference to HbMainWindow
    71 	 */
    69          */
    72 	 CCalSession& SessionL();
    70         HbMainWindow& MainWindow();
    73 
    71         
    74 	/**
    72         /**
    75 	 * Retrieve the calendar session currently in use by Calendar
    73          * Retrieve the calendar session currently in use by Calendar
    76 	 * @return CCalSession& currently used by Calendar
    74          * @return CCalSession& currently used by Calendar
    77 	 */
    75          */
    78 	 CCalSession& SessionL( const TDesC& aCalendar );
    76         CCalSession& SessionL();
    79 	
    77 
    80 	/**
    78         /**
    81 	 * Retrieve the calendar entry view currently in use by Calendar
    79          * Retrieve the calendar entry view currently in use by Calendar
    82 	 * @return CCalEntryView* currently used by Calendar
    80          * @return CCalEntryView* currently used by Calendar
    83 	 */
    81          */
    84 	 CCalEntryView* EntryViewL();
    82         CCalEntryView* EntryViewL();
    85 
    83 
    86 	
    84         /**
    87 	/**
    85          * Retrieve the calendar instance view currently in use by Calendar
    88 	 * Retrieve the calendar entry view currently in use by Calendar
    86          * @return CCalInstanceView* currently used by Calendar
    89 	 * @return CCalEntryView* currently used by Calendar
    87          */
    90 	 */
    88         CCalInstanceView* InstanceViewL();
    91 	 CCalEntryView* EntryViewL(const TCalCollectionId aCollectionId );
    89 
    92 	
    90 
    93 	
    91         
    94 	/**
    92         /**
    95 	 * Retrieve the calendar instance view currently in use by Calendar
    93          * Register for notifications of Calendar events
    96 	 * @return CCalInstanceView* currently used by Calendar
    94          * @param aHandler the MCalenNotificationHandler to notify
    97 	 */
    95          * @param aNotification single notification to be notified about
    98 	 CCalInstanceView* InstanceViewL();
    96          */
    99 
    97         virtual void RegisterForNotificationsL( MCalenNotificationHandler* aHandler,
   100 	/**
    98                                                         TCalenNotification aNotification );
   101 	 * Retrieve the calendar instance view currently in use by Calendar
    99         
   102 	 * @return CCalInstanceView* currently used by Calendar
   100         /**
   103 	 */
   101          * Register for notifications of Calendar events
   104 	 CCalInstanceView* InstanceViewL( 
   102          * @param aHandler the MCalenNotificationHandler to notify
   105 							const RArray<TInt>& aCollectionIds );
   103          * @param aNotifications array of notifications to be notified about
   106 
   104          */
   107 	/**
   105         virtual void RegisterForNotificationsL( MCalenNotificationHandler* aHandler,
   108 	 * Retrieve the InterimUtils
   106                                                         RArray<TCalenNotification>& aNotifications );
   109 	 * @return CCalenInterimUtils2&
   107 
   110 	 */
   108         /**
   111 	CCalenInterimUtils2& InterimUtilsL();
   109          * Cancel notifications of Calendar events
   112 
   110          * @param aHandler the MCalenNotificationHandler to stop notifying
   113 	TBool QueueKeyEvent( const TKeyEvent& aEvent, TEventCode aType );
   111          */
   114 	TBool GetQueuedKeyEvent( TKeyEvent& aEvent, TEventCode& aType );
   112         void CancelNotifications( MCalenNotificationHandler* aHandler );
   115 	void ResetKeyEventQueue();
   113 
   116 	/**
   114         
   117 	 * Get calendar icon of specific type
   115         /**
   118 	 * @return CGulIcon*
   116          * Issue a notification to Calendar, which will be broadcast
   119 	 */
   117          * synchronously to all registered notification handlers.
   120 	CGulIcon* GetIconL( MCalenServices::TCalenIcons aIndex, const TInt aViewId = 0 ); 
   118          * Only one notification may be issued at once.
   121 
   119          * @param aNotification the notification to broadcast
   122 	/**
   120          */
   123 	 * Register for notifications of Calendar events
   121         void IssueNotificationL( TCalenNotification aNotification );
   124 	 * @param aHandler the MCalenNotificationHandler to notify
   122         
   125 	 * @param aNotification single notification to be notified about
   123         /**
   126 	 */
   124          * Request activation of a specific view
   127 	virtual void RegisterForNotificationsL( MCalenNotificationHandler* aHandler,
   125          * @param aViewId The view to be activated
   128 													TCalenNotification aNotification );
   126          */
   129 	
   127         void RequestActivationL( const TVwsViewId& aViewId );
   130 	/**
   128 
   131 	 * Register for notifications of Calendar events
   129         /**
   132 	 * @param aHandler the MCalenNotificationHandler to notify
   130          * Notify Calendar that a specific view has been activated.
   133 	 * @param aNotifications array of notifications to be notified about
   131          * Custom views must call this on activation
   134 	 */
   132          * @param aViewId The view that was activated
   135 	virtual void RegisterForNotificationsL( MCalenNotificationHandler* aHandler,
   133          */
   136 													RArray<TCalenNotification>& aNotifications );
   134         void ActivationNotificationL( const TVwsViewId& aViewId );
   137 
   135   
   138 	/**
   136     
   139 	 * Cancel notifications of Calendar events
   137         /**
   140 	 * @param aHandler the MCalenNotificationHandler to stop notifying
   138          * Issue a command to be handled by Calendar or a customization
   141 	 */
   139          * All commands will be handled asynchronously.  Calendar may reject
   142 	void CancelNotifications( MCalenNotificationHandler* aHandler );
   140          * @param aCommand the command to be handled
   143 
   141          * @return ETrue, if Calendar will attempt to handle the command
   144 	/**
   142          * @return EFalse, if Calendar will not attempt to handle the command
   145 	 * Issue a command to be handled by Calendar or a customization
   143          */
   146 	 * All commands will be handled asynchronously.  Calendar may reject
   144         TBool IssueCommandL( TInt aCommand);
   147 	 * @param aCommand the command to be handled
   145         
   148 	 * @return ETrue, if Calendar will attempt to handle the command
   146         /**
   149 	 * @return EFalse, if Calendar will not attempt to handle the command
   147          * Returns the context. This includes information such
   150 	 */
   148          * as the currently focused date/instance.
   151 	TBool IssueCommandL( TInt aCommand );
   149          */
   152 
   150         MCalenContext& Context();
   153 	/**
   151         /**        
   154 	 * Issue a notification to Calendar, which will be broadcast
   152          * a control to be displayed in the infobar
   155 	 * synchronously to all registered notification handlers.
   153          * @return info bar control
   156 	 * Only one notification may be issued at once.
   154          */
   157 	 * @param aNotification the notification to broadcast
   155         HbWidget* Infobar();
   158 	 */
   156         /**        
   159 	void IssueNotificationL( TCalenNotification aNotification );
   157          * Returns info bar text
   160 
   158          */
   161 	/**
   159         QString* InfobarTextL();
   162 	 * Returns the context. This includes information such
   160 		
   163 	 * as the currently focused date/instance.
   161 		/**
   164 	 */
   162          * Gets the command range that has been allocated to this MCalenServices 
   165 	MCalenContext& Context();
   163          * instance
   166 
   164          * 
   167 	/**
   165          * @param aCommandRangeStart start of command range
   168 	 * Request activation of a specific view
   166          * @param aCommandRangeEnd end of command range
   169 	 * @param aViewId The view to be activated
   167          */
   170 	 */
   168         void GetCommandRange( TInt& aCommandRangeStart, 
   171 	void RequestActivationL( const TVwsViewId& aViewId );
   169                                           TInt& aCommandRangeEnd ) const;
   172 
   170         
   173 	/**
   171         /**
   174 	 * Notify Calendar that a specific view has been activated.
   172           * Offer the menu to Plugins to customisation
   175 	 * Custom views must call this on activation
   173           * @param aMenu Where the customisation apply to
   176 	 * @param aViewId The view that was activated
   174           */
   177 	 */
   175         void OfferMenu(HbMenu* aHbMenu);
   178 	void ActivationNotificationL( const TVwsViewId& aViewId );
   176         
   179 
   177         /**
   180 	/**
   178         * returns the interface to the agenda database
   181 	 * Offers the menu pane for population, interested parties can
   179         * @return reference to agendainterface
   182 	 * add or remove menu items
   180         */
   183 	 * @param aMenuPane meu pane to be populated
   181         AgendaUtil* agendaInterface();
   184 	 * @param aResourceId   resource id of menu pane
   182         
   185 	 */
   183         /**
   186 	void OfferMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
   184 		 * returns the first view with which calendar has been launched
   187 
   185 		 * @return view Id
   188 	 /**
   186 		 */
   189 	 * Gets the command range that has been allocated to this MCalenServices 
   187 		int getFirstView();
   190 	 * instance
   188 	    
   191 	 * 
   189     private:
   192 	 * @param aCommandRangeStart start of command range
   190         /**
   193 	 * @param aCommandRangeEnd end of command range
   191          * C++ constructor.
   194 	 */
   192          */
   195 	void GetCommandRange( TInt& aCommandRangeStart, 
   193         CalenServicesImpl( TInt aCommandRangeStart, 
   196 									  TInt& aCommandRangeEnd ) const;
   194                                     TInt aCommandRangeEnd );
   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 );
   195 
   268 
   196     private:  // Data
   269     private:  // Data
       
   270         CCalenGlobalData* iGlobalData;
   197         CCalenController* iController;
   271         CCalenController* iController;
   198         
   272         
       
   273 
   199         TInt iCommandRangeStart; // start of the valid command range
   274         TInt iCommandRangeStart; // start of the valid command range
   200         TInt iCommandRangeEnd;   // end of the valid command range
   275         TInt iCommandRangeEnd;   // end of the valid command range
   201     };
   276     };
   202 
   277 
   203 #endif // CALENSERVICESIMPL_H
   278 #endif // CALENSERVICESIMPL_H