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