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