calendarui/globaldata/inc/calencontextimpl.h
changeset 89 b57382753122
parent 83 5aadd1120515
equal deleted inserted replaced
83:5aadd1120515 89:b57382753122
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Implementation of calendar context.
    14 * Description:   Implementation of calendar context.
    15 *
    15 *
    16 */
    16 */
       
    17 
    17 
    18 
    18 
    19 
    19 #ifndef CALENCONTEXTIMPL_H
    20 #ifndef CALENCONTEXTIMPL_H
    20 #define CALENCONTEXTIMPL_H
    21 #define CALENCONTEXTIMPL_H
    21 
    22 
    22 // FORWARD DECLARATIONS
    23 // FORWARD DECLARATIONS
    23 class MCalenContextChangeObserver;
    24 class MCalenContextChangeObserver;
    24 
    25 
    25 // INCLUDES
    26 // INCLUDES
    26 #include "calencontext.h"
    27 #include <calencontext.h>
    27 #include "caleninstanceid.h"
    28 #include <caleninstanceid.h>            // TCalenInstanceId
       
    29 #include <calentry.h>
    28 #include <vwsdef.h>
    30 #include <vwsdef.h>
    29 
    31 #include <EPos_CPosLandmark.h>
    30 #ifdef  CALENGLOBALDATA_DLL
       
    31 #define CALENCONTEXTIMPL_EXPORT Q_DECL_EXPORT
       
    32 #else
       
    33 #define CALENCONTEXTIMPL_EXPORT Q_DECL_IMPORT
       
    34 #endif
       
    35 
    32 
    36 // CLASS DEFINITIONS
    33 // CLASS DEFINITIONS
    37 /**
    34 /**
    38  * The controller handles events from the rest of Calendar and delegates
    35  * The controller handles events from the rest of Calendar and delegates
    39  * them to the appropriate place (i.e. the action ui classes).
    36  * them to the appropriate place (i.e. the action ui classes).
    40  */
    37  */
    41 class CalenContextImpl : public MCalenContext
    38 class CCalenContextImpl : public CBase, public MCalenContext
    42     {
    39     {
    43     public:  // Construction and destruction
    40 
    44         /**
    41 public:  // Construction and destruction
    45          * The only reason this should be created outside of this dll is for
    42     
    46          * SCalenCommand, which needs a default constructor. Normal usage is
    43     /**
    47          * to use the accessor from the global data. Attempting to call
    44      * The only reason this should be created outside of this dll is for
    48          * "setters" on any context not from the global data will panic.
    45      * SCalenCommand, which needs a default constructor. Normal usage is
    49          */
    46      * to use the accessor from the global data. Attempting to call
    50         CALENCONTEXTIMPL_EXPORT CalenContextImpl( MCalenContextChangeObserver* observer );
    47      * "setters" on any context not from the global data will panic.
    51         CALENCONTEXTIMPL_EXPORT CalenContextImpl();
    48      */
    52         CALENCONTEXTIMPL_EXPORT CalenContextImpl( const CalenContextImpl& context );
    49     CCalenContextImpl( MCalenContextChangeObserver* aObserver );
    53         CALENCONTEXTIMPL_EXPORT ~CalenContextImpl();
    50     CCalenContextImpl();
    54 
    51     CCalenContextImpl( const CCalenContextImpl& aContext );
    55     public:  // from MCalenContext
    52     ~CCalenContextImpl();
       
    53 
       
    54 public:  // from MCalenContext
       
    55     
    56     // Utils
    56     // Utils
    57         /**
    57     /**
    58          * Returns the default time for views. (Normally 8am.) This would be
    58      * Returns the default time for views. (Normally 8am.) This would be
    59          * used for example by the month view, which sets the focus time to
    59      * used for example by the month view, which sets the focus time to
    60          * 8am on a day. Then when opening the week view, a sane time is shown.
    60      * 8am on a day. Then when opening the week view, a sane time is shown.
    61          */
    61      */
    62         int defaultTimeForViewsInMinnutes() const;
    62     TTimeIntervalMinutes DefaultTimeForViews() const;
    63 
    63 
    64         /**
    64     /**
    65          * Returns the default TCalTime for views. (Normally 8am today.) This
    65      * Returns the default TCalTime for views. (Normally 8am today.) This
    66          * would be used for example when a view is the first view loaded in
    66      * would be used for example when a view is the first view loaded in
    67          * Calendar.
    67      * Calendar.
    68          */
    68      */
    69         QDateTime defaultCalTimeForViewsL() const;
    69     TCalTime DefaultCalTimeForViewsL() const;
    70 
    70 
    71     // Setters
    71     // Setters
    72         /**
    72     /**
    73          * Sets the date and time currently focused.
    73      * Sets the date and time currently focused.
    74          * @param aFocusTime The new focus date and time.
    74      * @param aFocusTime The new focus date and time.
    75          */
    75      * @param aViewId The view id of the currently active view.
    76         void setFocusDateAndTime( const QDateTime& focusDateTime);
    76      */
    77 
    77     void SetFocusDateAndTimeL( const TCalTime& aFocusDateTime,
    78         /**
    78             const TVwsViewId& aViewId );
    79          * Sets the date currently focused. When retrieving the focus
    79 
    80          * date and time after calling this function, the time component
    80     /**
    81          * will be set to the default of view. When retrieving the focus
    81      * Sets the date currently focused. When retrieving the focus
    82          * time only, it will be set to -1.
    82      * date and time after calling this function, the time component
    83          * @param aFocusDate The new focus date and time.
    83      * will be set to the default of view. When retrieving the focus
    84          */
    84      * time only, it will be set to -1.
    85         void setFocusDate( const QDateTime& focusDateTime );
    85      * @param aFocusDate The new focus date and time.
    86 
    86      * @param aViewId The view id of the currently active view.
    87         /**
    87      */
    88          * Sets the id of the instance currently focused.
    88     void SetFocusDateL( const TCalTime& aFocusDate,
    89          * @param aInstanceId the id of the focused instance.
    89             const TVwsViewId& aViewId );
    90          */
    90 
    91         void setInstanceId( const TCalenInstanceId& instanceId );
    91     /**
    92 
    92      * Sets the id of the instance currently focused.
    93         /**
    93      * @param aInstanceId the id of the focused instance.
    94          * Sets the time and instance currently focused.
    94      * @param aViewId The view id of the currently active view.
    95          * @param aFocusTime The new focus time. If no time is focused, set
    95      */
    96          * the Utc time of this object to be Time::NullTTime.
    96     void SetInstanceIdL( const TCalenInstanceId& aInstanceId,
    97          * @param aInstanceId the id of the focused instance.
    97             const TVwsViewId& aViewId );
    98          */
    98 
    99         void setFocusDateAndTimeAndInstance( const QDateTime& focusDateTime,
    99     /**
   100                                               const TCalenInstanceId& aInstanceId);
   100      * Sets the time and instance currently focused.
   101         
   101      * @param aFocusTime The new focus time. If no time is focused, set
   102         /**
   102      * the Utc time of this object to be Time::NullTTime.
   103          * Sets start date and time that should be used for creating new instance.
   103      * @param aInstanceId the id of the focused instance.
   104          * 
   104      * @param aViewId The view id of the currently active view.
   105          * @param startDateTime Start date and time for new instance
   105      */
   106          */
   106     void SetFocusDateAndTimeAndInstanceL( const TCalTime& aFocusDateTime,
   107         void setStartDateAndTimeForNewInstance(const QDateTime &startDateTime);
   107             const TCalenInstanceId& aInstanceId,
       
   108             const TVwsViewId& aViewId );
   108 
   109 
   109     // Getters
   110     // Getters
   110         /**
   111     /**
   111          * Gets the date and time currently focused.
   112      * Gets the date and time currently focused.
   112          * @return The currently focused date and time. When no time is
   113      * @return The currently focused date and time. When no time is
   113          * focused, the default time on the current date will be returned.
   114      * focused, the default time on the current date will be returned.
   114          */
   115      */
   115         QDateTime focusDateAndTime() const;
   116     TCalTime FocusDateAndTimeL() const;
   116 
   117 
   117         /**
   118     /**
   118          * Gets the time currently focused.
   119      * Gets the time currently focused.
   119          * @return The currently focused time. When no time is
   120      * @return The currently focused time. When no time is
   120          * focused, -1 will be returned.
   121      * focused, -1 will be returned.
   121          */
   122      */
   122         int focusTime() const;
   123     TTimeIntervalMinutes FocusTime() const;
   123 
   124 
   124         /**
   125     /**
   125          * Gets the id of the instance currently focused.
   126      * Gets the id of the instance currently focused.
   126          * @return The instance id currently focused. When no instance is focused,
   127      * @return The instance id currently focused. When no instance is focused,
   127          * this will be TCalenInstanceId::NullInstanceIdL()
   128      * this will be TCalenInstanceId::NullInstanceIdL()
   128          */
   129      */
   129         TCalenInstanceId instanceId() const;
   130     TCalenInstanceId InstanceId() const;
   130         
   131     
   131         /**
   132     /**
   132          * Returns start date and time that should be used for creating new instance.
   133      * Sets the start and end time of the instance that has to be created.
   133          * Check isValid() to verify if returnd value is valid.
   134      * @param aStartTime The start time of the instance that has to be created.
   134          * 
   135      * @param aEndTime The end time of the instance that has to be created.
   135          * @return Start date and time for new instance
   136      */
   136          */
   137     void SetStartAndEndTimeForNewInstance( const TTime& aStartTime,
   137         QDateTime startDateAndTimeForNewInstance() const;
   138                                         const TTime& aEndTime );
   138         
   139     
       
   140     /**
       
   141      * Gets the start and end time of the instance that has to be created.
       
   142      * @param aStartTime The start time of the instance that has to be created.
       
   143      * @param aEndTime The end time of the instance that has to be created.
       
   144      */
       
   145     void GetStartAndEndTimeForNewInstance( TTime& aStartTime, TTime& aEndTime );
       
   146 
       
   147     /**
       
   148      * Gets the id of the currently active view.
       
   149      * @return The view id of the currently active view.
       
   150      */
       
   151     TVwsViewId ViewId() const;
       
   152 
   139 public:	// Multiple Context support
   153 public:	// Multiple Context support
   140 		
   154 
   141 	   /**
   155     /**
   142 	    * Set multiple context ids
   156      * Set multiple context ids
   143 	    *
   157      *
   144 	    * @param aMutlipleContextIds
   158      * @param aMutlipleContextIds
   145 	    */	
   159      */	
   146 		 void setMutlipleContextIds(QList<TCalenInstanceId>& mutlipleContextIds);
   160     void SetMutlipleContextIds(RArray<TCalenInstanceId>& aMutlipleContextIds);
   147 		
   161 
   148 	   /**
   162     /**
   149 	    * Remove multiple context id 
   163      * Remove multiple context id 
   150 	    * 
   164      * 
   151 	    * @param aInstanceId Instance Id for which context to be removed
   165      * @param aInstanceId Instance Id for which context to be removed
   152 	    */
   166      */
   153 		 void removeMultipleContextId(TCalenInstanceId instanceId);
   167     void RemoveMultipleContextId(TCalenInstanceId aInstanceId);
   154 		
   168 
   155 	   /**
   169     /**
   156 	    * Resets all the multiple context ids
   170      * Resets all the multiple context ids
   157 	    * 
   171      * 
   158 	    */
   172      */
   159 		 void resetMultipleContextIds(int dbId=0);
   173     void ResetMultipleContextIds(TInt aDbId=0);
   160 		
   174 
   161 	   /**
   175     /**
   162 	    * Getter for multiple context ids
   176      * Getter for multiple context ids
   163 	    *
   177      *
   164 	    * @return RArray<TCalenInstanceId>&
   178      * @return RArray<TCalenInstanceId>&
   165 	    */
   179      */
   166 		 QList<TCalenInstanceId>& getMutlipleContextIds(int dbId=0);
   180     RArray<TCalenInstanceId>& GetMutlipleContextIds(TInt aDbId=0);
   167 		
   181 
   168 	   /**
   182     /**
   169 	    * Returns mutliple context's count
   183      * Returns mutliple context's count
   170 	    *
   184      *
   171 	    * @return 
   185      * @return 
   172 	    */
   186      */
   173 		 int mutlipleContextIdsCount();
   187     TInt MutlipleContextIdsCount();
   174 				
   188 
   175     private:  // Data
   189     /**
   176         MCalenContextChangeObserver* mObserver;
   190      * Sets the user selected landmark
   177         QDateTime mFocusDate;
   191      * @param aLandMark	Landmark object
   178         int mFocusTime;
   192      */
   179         TCalenInstanceId mInstanceId;
   193     void SetLandMark(CPosLandmark* aLandMark);
   180         int mViewId;        
   194 
   181         // Multiple context ids
   195     /**
   182         QList<TCalenInstanceId> mMutlipleContextIds;
   196      * Returns the user selected landmark
   183         
   197      * @return Landmark object
   184         /**
   198      */
   185          * Indicates if default time should be used for new instance creation.
   199     CPosLandmark* GetLandMark();
   186          */
   200 
   187         QDateTime mDateTimeForNewInstance;
   201     /**
       
   202      * Resets the landmark
       
   203      */
       
   204     void ResetLandMark();
       
   205 
       
   206     /**
       
   207      * Allows extending this API without breaking BC.
       
   208      * 
       
   209      * @param aExtensionUid specifies
       
   210      * @return extension of the requested type
       
   211      */
       
   212     TAny* CalenContextExtensionL( TUid aExtensionUid );
       
   213     
       
   214 	/**
       
   215 	* @brief Get calendar filename 
       
   216 	* 
       
   217 	* @return TDesC& reference to calendar filename
       
   218 	*/
       
   219     TDesC& GetCalendarFileNameL() const;
       
   220 
       
   221     /**
       
   222 	* @brief Set the calendar filename
       
   223 	*
       
   224 	* @param aName referance to calendar file name 
       
   225 	*/
       
   226     void SetCalendarFileNameL(const TDesC& aName);
       
   227     
       
   228     /**
       
   229 	* @brief Resets calendar file name in context
       
   230 	*/
       
   231     void ResetCalendarFileName();
       
   232     /**
       
   233     * @brief Set calendar file name of Alarm entry in context
       
   234     */    
       
   235     void SetCalAlarmEntryFileNameL(const TDesC& aName);
       
   236     
       
   237     /**
       
   238     * @brief Get calendar filename 
       
   239     * 
       
   240     * @return HBufC pointer to calendar filename of Alarm entry
       
   241     */
       
   242     HBufC* GetCalAlarmEntryFileNameL() const;
       
   243     
       
   244     /**
       
   245     * @brief Resets Alarm Entry calendar file name in context
       
   246     */ 
       
   247     void ResetCalAlarmEntryFileName();
       
   248     
       
   249     /**
       
   250     * @brief set Alarm Entry LocalUid in context
       
   251     */ 
       
   252     void SetCalAlarmEntryLocalUid(TCalLocalUid aLocalId);
       
   253     
       
   254     /**
       
   255     * @brief Get Alarm Entry LocalUid from context
       
   256     */ 
       
   257     TCalLocalUid CalAlarmLocalUidL() const;
       
   258 
       
   259 private:  // Data
       
   260     MCalenContextChangeObserver* iObserver;
       
   261     TCalTime iFocusDate;
       
   262     TTimeIntervalMinutes iFocusTime;
       
   263     TCalenInstanceId iInstanceId;
       
   264     TVwsViewId iViewId;
       
   265     CPosLandmark* iLandMark;
       
   266     CCalGeoValue* iGeoValue;
       
   267     HBufC* iLocation;
       
   268     // Multiple context ids
       
   269     RArray<TCalenInstanceId> iMutlipleContextIds;
       
   270     HBufC* iCalenFileName;
       
   271     HBufC* iCalAlarmEntryFileName;
       
   272     TCalLocalUid iCalAlarmLocalUid;
       
   273 	
       
   274 	// The new instance's start and end time
       
   275     TTime iNewInstStartTime;
       
   276 	TTime iNewInstEndTime;
   188     };
   277     };
   189 
   278 
   190 #endif // CALENCONTEXTIMPL_H
   279 #endif // CALENCONTEXTIMPL_H
   191 
   280 
   192 // End of file
   281 // End of file