calendarui/views/inc/calenmonthview.h
changeset 18 c198609911f9
parent 0 f979ecb2b13e
child 23 fd30d51f876b
equal deleted inserted replaced
0:f979ecb2b13e 18:c198609911f9
     1 /*
     1 /*
     2 * Copyright (c) 2007-2008 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:   For month view of calendar application.
    14 * Description:  CalenMonthView class definition.
    15  *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 #ifndef CALENMONTHVIEW_H  
    19 
       
    20 #ifndef CALENMONTHVIEW_H
       
    21 #define CALENMONTHVIEW_H
    19 #define CALENMONTHVIEW_H
    22 
    20 
    23 //  INCLUDES
    21 // System includes
       
    22 #include <QGraphicsLinearLayout>
       
    23 #include <qdatetime.h>
       
    24 #include <hblabel.h>
       
    25 #include <hbextendedlocale.h>
       
    26 
       
    27 // User includes
    24 #include "calennativeview.h"
    28 #include "calennativeview.h"
    25 
    29 
    26 // FORWARD DECLARATIONS
    30 // Forward declarations
    27 class CCalenMonthContainer;
    31 class QStandardItemModel;
    28 class CAknNavigationDecorator;
    32 class HbAction;
       
    33 class HbGridView;
       
    34 class HbExtendedLocale;
       
    35 class XQSettingsManager;
       
    36 class XQSettingsKey;
       
    37 class AgendaUtil;
       
    38 class AgendaEntry;
       
    39 class MCalenContext;
       
    40 class CalenMonthData;
       
    41 class MCalenServices;
       
    42 class CalenPreviewPane;
       
    43 class CalenDocLoader;
       
    44 class CalenThickLinesDrawer;
       
    45 class CalenMonthGrid;
    29 
    46 
    30 //  CLASS DEFINITIONS
    47 // Constants
    31 /**
    48 const int KCalenDaysInWeek = 7;
    32  *  For Month View of calendar application
    49 const int KNumOfVisibleRows = 6;
    33  */
       
    34 NONSHARABLE_CLASS( CCalenMonthView ) : public CCalenNativeView
       
    35     {
       
    36     public:
       
    37         /**
       
    38          * Two-phased constructor.
       
    39          */
       
    40         IMPORT_C static CCalenMonthView* NewL( MCalenServices& aServices );
       
    41 
    50 
    42         /**
    51 #ifdef  CALENVIEWS_DLL
    43          * Destructor.
    52 #define CALENMONTHVIEW_EXPORT Q_DECL_EXPORT
    44          */
    53 #else
    45         virtual ~CCalenMonthView();
    54 #define CALENMONTHVIEW_EXPORT Q_DECL_IMPORT
       
    55 #endif
    46 
    56 
    47     public:    // New function
    57 class CALENMONTHVIEW_EXPORT CalenMonthView : public CalenNativeView
    48         void SetStatusPaneFromActiveContextL();
    58 {
    49 
    59 	Q_OBJECT
    50     private:    // New function
    60 	
    51         /**
    61 public:
    52          * C++ constructor.
    62 	CalenMonthView( MCalenServices &services );
    53          */
    63 	virtual ~CalenMonthView();
    54         CCalenMonthView( MCalenServices& aServices );
    64 	
    55 
    65 public:  // From CCalenView
    56         /**
    66 	virtual void doPopulation();
    57          * By default Symbian OS constructor is private.
    67 	void setupView(CalenDocLoader *docLoader);
    58          */
    68 	void handleGridItemActivated();
    59         void ConstructL();
    69 	void handleGridItemLongPressed(int index, QPointF &coords);
    60 
    70 	void setContextForActiveDay(int index);
    61     public:  // From CCalenView
    71 	QDateTime getCurrentDay();
    62         virtual TNextPopulationStep ActiveStepL();
    72 	QDateTime getActiveDay();
    63         virtual void CancelPopulation();
    73 	int rowsInPrevMonth();
    64         virtual TCyclePosition CyclePosition() const;
    74 	int rowsInFutMonth();
    65         virtual const TDesC& LocalisedViewNameL( CCalenView::TViewName aViewName );
    75 	int getCurrGridIndex();
    66         virtual CGulIcon* CCalenMonthView::ViewIconL() const;
    76 	void setCurrGridIndex(int index);
    67 
    77 	void populatePrevMonth();
    68     protected:   // From CCalenNativeView
    78 	void populateNextMonth();
    69         /**
    79 	void onLocaleChanged(int reason);
    70          * Clears view specific data
    80 	QList<CalenMonthData> monthDataList();
    71          */
    81 	void updateModelWithPrevMonth();
    72         virtual void ClearViewSpecificDataL();
    82 	void updateModelWithFutureMonth();
    73     
    83 	void populatePreviewPane(QDateTime &dateTime);
    74         /**
    84 	void handlePreviewPaneGesture(bool rightGesture);
    75          *  Updates preview pane/preview popup
    85 	
    76          */
    86 private:
    77         void UpdatePreviewPaneL();
    87 	void createGrid();
    78 
    88 	void populateWithInstanceView();
    79         /**
    89 	void completePopulation();
    80          * Hides preview pane/preview popup
    90 	void prepareForPopulation();
    81          */
    91 	QDateTime dateFromContext( const MCalenContext &context );
    82         void HidePreviewPane();
    92 	void setActiveDay(QDateTime day);
    83         
    93 	void setDate();
    84     private:    // From CCalenView
    94 	void getInstanceList(QList<AgendaEntry> &list,
    85         /**
    95 						QDateTime rangeStart, QDateTime rangeEnd);
    86          * From CCalenView CCalenView::DoActivateL() calls DoActivateImplL()
    96 	void handleChangeOrientation();
    87          */
    97 	void setDateToLabel();
    88         void DoActivateImplL(	const TVwsViewId& aPrevViewId,
    98 	void updateWeekNumGridModel();
    89                                 TUid aCustomMessageId,
    99 	void addWeekNumbers();
    90                                 const TDesC8& aCustomMessage );
   100 	void removeWeekNumbers();
    91 
   101 	void addBackgroundFrame();
    92         /**
   102 	
    93          * From CCalenView
   103 	
    94          * CCalenView::DoDeactivateL() calls DoDeactivateImplL()
   104 private slots:
    95          */
   105 	void createEditor();
    96         void DoDeactivateImpl();
   106 	void goToToday();
    97 
   107 	void updateMonthDataArrayWithActiveDates();
    98         /**
   108 	void handleLeftEffectCompleted(const HbEffect::EffectStatus &status);
    99          * From CCalenView Creates CCalenContainer
   109 	void handleRightEffectCompleted(const HbEffect::EffectStatus &status);
   100          */
   110 	
   101         CCalenContainer* CreateContainerImplL();
   111 public slots:
   102 
   112 	void launchDayView();
   103         /**
   113 	void changeOrientation(Qt::Orientation orientation);
   104          * From CCalenView Called when cross over midinight or locale change.
   114 	
   105          */
   115 private:
   106         void OnLocaleChangedL(TInt aReason);
   116 	bool mIsFirstTimeLoad;
   107 
   117 	CalenDocLoader *mDocLoader;
   108         /**
   118 	CalenThickLinesDrawer *mDayNameWidget;
   109          * From CCalenView Redraw status pane when Form is closed
   119 	CalenMonthGrid *mMonthGrid;
   110          */
   120 	HbWidget* mPrevPaneParent;
   111         void RedrawStatusPaneL();
   121 	HbWidget* mCurrPaneParent;
   112 
   122 	HbWidget* mNextPaneParent;
   113         /**
   123 	CalenPreviewPane* mCurrPreviewPane;
   114          * From CCalenView. Normal command handling method.
   124 	CalenPreviewPane* mPrevPreviewPane;
   115          * needed for MSK.
   125 	CalenPreviewPane* mNextPreviewPane;
   116          */
   126 	CalenThickLinesDrawer *mWeekNumberWidget;
   117         void HandleCommandL(TInt aCommand);
   127 	HbWidget *mMonthGridPlusWeekNumWidget;
   118 
   128 	HbExtendedLocale mLocale;
   119     private:
   129 	int mIndexToBeScrolled;
   120         // From CAknView
   130 	QDateTime mActiveMonth;
   121         TUid Id() const;
   131 	int mNumOfRowsInPrevMonth;
   122 
   132 	int mNumOfRowsInFutureMonth;
   123         /**
   133 	HbLabel *mFirstDayLabel;
   124          * Returns ETrue if the vsd is null.
   134 	HbLabel *mSecondDayLabel;
   125          */
   135 	HbLabel *mThirdDayLabel;
   126         TBool IsViewSpecificDataNullL();
   136 	HbLabel *mFourthDayLabel;
   127         
   137 	HbLabel *mFifthDayLabel;
   128     private:    // From MEikMenuObserver
   138 	HbLabel *mSixthDayLabel;
   129         /**
   139 	HbLabel *mSeventhDayLabel;
   130          * From MEikMenuObserver Changes MenuPane dynamically
   140 	HbLabel *mFirstWeekLabel;
   131          */
   141 	HbLabel *mSecondWeekLabel;
   132         void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
   142 	HbLabel *mThirdWeekLabel;
   133 
   143 	HbLabel *mFourthWeekLabel;
   134     private:    // Data
   144 	HbLabel *mFifthWeekLabel;
   135 
   145 	HbLabel *mSixthWeekLabel;
   136         enum TPopulationStep
   146 	QList<CalenMonthData> mMonthDataArray;
   137             {
   147 	QDateTime mDate;
   138             ENothingDone,
   148 	QDateTime mCurrentDay;
   139             ESizeChanged,
   149 	QDateTime mFirstDayOfGrid;
   140             ERequestedInstanceView,
   150 	QDateTime mLastDayOfGrid;
   141             ESetIndicatorNext,
   151 	int mTotalNumOfGridItems;
   142             ESetFocusNext,
   152 	QList<int> mWeekNumbers;
   143             EPopulationDone
   153 	HbLabel *mTitleLabel;
   144             };
   154 	Qt::Orientation mOrientation;
   145         TPopulationStep iPopulationStep;
   155 	XQSettingsManager *mSettingsManager;
   146     // view specific data
   156 	XQSettingsKey *mWeekNumberCenrepKey;
   147         TTime iDate;
   157 	uint mIsWeekNumbersShown;
   148     };
   158 	AgendaUtil *mAgendaUtil;
       
   159 	bool mIsPrevPaneGesture;
       
   160 	HbAction *mGoToTodayAction;
       
   161 };
   149 
   162 
   150 #endif //CALENMONTHVIEW_H
   163 #endif //CALENMONTHVIEW_H
   151 
   164 
   152 
   165 // End of file  --Don't remove this.
   153 // End of File