calendarui/views/inc/calendayview.h
changeset 18 c198609911f9
parent 0 f979ecb2b13e
child 23 fd30d51f876b
equal deleted inserted replaced
0:f979ecb2b13e 18:c198609911f9
     1 /*
     1 /*
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     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:   Declares view class of View architecture for Day view.
    14 * Description: Class declaration for the day/agenda view
    15  *
    15 *
    16 */
    16 */
    17 
       
    18 
       
    19 
    17 
    20 #ifndef CALENDAYVIEW_H
    18 #ifndef CALENDAYVIEW_H
    21 #define CALENDAYVIEW_H
    19 #define CALENDAYVIEW_H
    22 
    20 
    23 //  INCLUDES
    21 // System includes
       
    22 #include <QDateTime>
       
    23 
       
    24 // User includes
    24 #include "calennativeview.h"
    25 #include "calennativeview.h"
    25 
    26 
    26 // FORWARD DECLARATIONS
    27 // Forward declarations
    27 class CAknNavigationDecorator;
    28 class QGraphicsSceneMouseEvent;
       
    29 class CalenDayViewWidget;
       
    30 class CalenDocLoader;
    28 
    31 
    29 //  CLASS DEFINITIONS
    32 #ifdef  CALENVIEWS_DLL
       
    33 #define CALENDAYVIEW_EXPORT Q_DECL_EXPORT
       
    34 #else
       
    35 #define CALENDAYVIEW_EXPORT Q_DECL_IMPORT
       
    36 #endif
    30 
    37 
    31 /**
    38 /**
    32  *  Declares view for Day view
    39  * @class CalenDayView
       
    40  * @brief Class declaration for the day/agenda view
       
    41  * which shows the list of events &/ to-do's (if any)
       
    42  * for any given day in the calendar. User can do other
       
    43  * basic operations like creating, viewing or deleting
       
    44  * an event
    33  */
    45  */
    34 NONSHARABLE_CLASS( CCalenDayView ) : public CCalenNativeView
    46 class CalenDayView : public CalenNativeView
    35     {
    47     {
    36 public: // Constructors and destructor
    48     Q_OBJECT
       
    49 
       
    50 public:
    37     /**
    51     /**
    38      * Two-phased constructor.
    52      * @brief Constructor
       
    53      * @param services A reference to the MCalenServices object
    39      */
    54      */
    40     IMPORT_C static CCalenDayView* NewL( MCalenServices& aServices );
    55     CALENDAYVIEW_EXPORT CalenDayView(MCalenServices &services);
    41 
       
    42     /**
       
    43      * Destructor.
       
    44      */
       
    45     virtual ~CCalenDayView();
       
    46 
       
    47 public:  // New function
       
    48     /**
       
    49      * Set a date text to StatusPane
       
    50      * @param aTime Set a time
       
    51      */
       
    52     void SetStatusPaneFromActiveContextL();
       
    53 
       
    54     /**
       
    55      * Update CBA buttons depending on if we have items or not in view
       
    56      * Callend from Day Container as well as DoActivateViewImpl.
       
    57      * 
       
    58      */
       
    59     void UpdateCbaL();
       
    60 
       
    61 public:  // From CCalenView
       
    62     virtual TNextPopulationStep ActiveStepL();
       
    63     virtual void CancelPopulation();
       
    64     virtual TCyclePosition CyclePosition() const;
       
    65     virtual const TDesC& LocalisedViewNameL( CCalenView::TViewName aViewName );
       
    66     virtual CGulIcon* CCalenDayView::ViewIconL() const;
       
    67 
       
    68 protected:  // From CCalenNativeView
       
    69     /**
       
    70      * Clears view specific data
       
    71      */
       
    72     virtual void ClearViewSpecificDataL();
       
    73     
    56     
    74     /**
    57     /**
    75      * Update date form context when entry is saved
    58      * @brief Default C++ constructor
    76      */
    59      */
    77     void UpdateDateFromContextL();
    60     CALENDAYVIEW_EXPORT virtual ~CalenDayView();
       
    61     
       
    62     /**
       
    63      * @brief Initializes the view after its creation
       
    64      * Must be called only after the view and its children are constructed
       
    65      * @param docLoader Pointer to the document loader object which has
       
    66      * loaded this view from the .docml file
       
    67      */
       
    68     CALENDAYVIEW_EXPORT void setupView(CalenDocLoader *docLoader);
       
    69     
       
    70     /**
       
    71      * @brief Activates the current view. Sets this view as the current
       
    72      * view of the application's main window. Must be called only after
       
    73      * the view has been constructed and initialized
       
    74      */
       
    75     CALENDAYVIEW_EXPORT virtual void doPopulation();
       
    76     
       
    77     /**
       
    78      * @brief Callback function for any notifications that has been
       
    79      * subscribed by this view
       
    80      * @param notification The event for which notification is being sent
       
    81      */
       
    82     CALENDAYVIEW_EXPORT void HandleNotification(const TCalenNotification notification);
       
    83     
       
    84     /**
       
    85      * @brief Getter function for the document loader. Called from the content
       
    86      * widget in order get its children
       
    87      */
       
    88     CALENDAYVIEW_EXPORT CalenDocLoader* docLoader();
    78 
    89 
    79 private: // Constructors
    90     
    80     /**
    91     /**
    81      * C++ constructor.
    92      * @brief Called from the content widget to indicate if the day
       
    93      * has any events or not
       
    94      * @param yes true if day has events, false otherwise
    82      */
    95      */
    83     CCalenDayView( MCalenServices& aServices );
    96     void hasEvents(bool yes);
       
    97     
       
    98 protected:
       
    99     
       
   100     // TODO: Remove these after gestures are available
       
   101     void mousePressEvent(QGraphicsSceneMouseEvent *event);
       
   102     void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
       
   103     bool eventFilter(QObject *source, QEvent *event);
    84 
   104 
    85 private:
   105 private:
    86     /**
       
    87      * By default Symbian OS constructor is private.
       
    88      */
       
    89     void ConstructL();
       
    90 
       
    91     /**
       
    92      * From CCalenView Second phase DoActivateL
       
    93      */
       
    94     void DoActivateImplL(	const TVwsViewId& aPrevViewId,
       
    95                             TUid aCustomMessageId,
       
    96                             const TDesC8& aCustomMessage );
       
    97 
       
    98     /**
       
    99      * From CCalenView Second phase DoDeactivate
       
   100      */
       
   101     void DoDeactivateImpl();
       
   102 
       
   103     /**
       
   104      * From CCalenView. Called when locale was changed and
       
   105      *                 time was crossed over
       
   106      */
       
   107     void OnLocaleChangedL(TInt aReason);
       
   108 
       
   109     /**
       
   110      * From CCalenView Creates container control for DayView
       
   111      */
       
   112     CCalenContainer* CreateContainerImplL();
       
   113 
       
   114     /**
       
   115      * From CCalenView Redraw status pane when Form is closed
       
   116      */
       
   117     void RedrawStatusPaneL();
       
   118     
   106     
   119     /**
   107     /**
   120      * From CCalenView. Normal command handling method.
   108      * @brief Connects to all the toolbar and menu actions associated
   121      * needed for MSK.
   109      * with this view
   122      */
   110      */
   123     void HandleCommandL(TInt aCommand);
   111 	void setupActions();
   124     
       
   125     TUid Id() const;
       
   126 	
   112 	
   127 	/**
   113 	/**
   128      * Enable the copy functionality for the entries 
   114 	 * @brief Callback function for listening to locale changes like
   129 	  *.to single aur multiple calendars.    
   115 	 * time format, date format etc
   130      */
   116 	 */
   131     
   117 	void onLocaleChanged(int reason);
   132     void CopyToCalendarsL();
   118 	
   133     
   119 private slots:
   134 private:  // From MEikMenuObserver
   120 	
   135     /**
   121     /**
   136      * From MEikMenuObserver Changes MenuPane dynamically
   122 	 * @brief Slot which is called whenever the orientation of the device changes
   137      */
   123 	 * @param orientation The current device orientation
   138     void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
   124 	 */
       
   125 	void orientationChanged(Qt::Orientation orientation);
       
   126 	
       
   127 	/**
       
   128 	 * @brief Slot which launches back the month view
       
   129 	 */
       
   130 	void launchMonthView();
   139 
   131 
   140 private: 
   132 private:
       
   133 	
       
   134 	/**
       
   135 	 * @var mDate
       
   136 	 * @brief The date for which this view is being shown
       
   137 	 */
       
   138 	QDateTime mDate;
       
   139 	
       
   140 	/**
       
   141 	 * @var mSoftKeyAction
       
   142 	 * TODO: This may not be required going ahead
       
   143 	 */
       
   144 	HbAction *mSoftKeyAction;
       
   145 	
       
   146 	/**
       
   147 	 * @var mDayViewWidget
       
   148 	 * @brief The pointer to the content widget of this view
       
   149 	 */
       
   150 	CalenDayViewWidget *mDayViewWidget;
       
   151 	
       
   152 	/**
       
   153 	 * @var mDocLoader
       
   154 	 * @brief Pointer to the document loader which has loaded
       
   155 	 * this view
       
   156 	 */
       
   157 	CalenDocLoader *mDocLoader;
       
   158 	
       
   159 	/**
       
   160 	 * @var mGoToTodayAction
       
   161 	 * Action which provides "Go to today" functionality
       
   162 	 */
       
   163 	HbAction *mGoToTodayAction;
       
   164 	
       
   165 	/**
       
   166 	 * @var mDeleteAction
       
   167 	 * Action which provides "Delete" functionality
       
   168 	 */
       
   169 	HbAction *mDeleteAction;
       
   170 	   
       
   171     // TODO: Remove these after gestures are available
       
   172     QPointF mTapPoint;
       
   173     bool mActionTaken;
   141 
   174 
   142     /**
   175 };
   143      * Returns ETrue if the vsd is null.
       
   144      */
       
   145     TBool IsViewSpecificDataNullL();
       
   146     
       
   147 private:   // Data
       
   148 
   176 
   149     TBool iShowBackButtonOnCba; // BACK cba button test variable
   177 #endif /* CALENDAYVIEW_H */
   150     TVwsViewId iPreviousViewId;   // view id that the day view is switched from
       
   151 
   178 
   152 private: 
   179 // End of file	--Don't remove this.
   153     enum TPopulationStep
       
   154         {
       
   155         ENothingDone,        
       
   156         ERequestedInstanceView,
       
   157         ECreateSlotTableNext,
       
   158         ESizedChanged,
       
   159         ECreateListBoxDataNext,
       
   160         EPopulationDone
       
   161         };
       
   162     TPopulationStep iPopulationStep;
       
   163 
       
   164     // View specific data, day container gets references to all of these.
       
   165     TTime iDate;                    // Date of current focus.
       
   166     TInt iHighlightedRowNumber;     // The row number highlighted.
       
   167     TInt iFirstEntryOnScreenIndex;  // The offset of the topmost item on screen to the first entry.
       
   168     TInt iEventViewCommandHandled;
       
   169     };
       
   170 
       
   171 #endif  // CALENDAYVIEW_H
       
   172 
       
   173 // End of File