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