calendarui/views/dayview/inc/calendaymodelmanager.h
changeset 45 b6db4fd4947b
child 57 bb2d3e476f29
equal deleted inserted replaced
23:fd30d51f876b 45:b6db4fd4947b
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Model manager holds models for three day views
       
    15 *
       
    16 */
       
    17 #ifndef CALENDAYMODELMANAGER_H
       
    18 #define CALENDAYMODELMANAGER_H
       
    19 
       
    20 #include <QObject>
       
    21 #include <QMap>
       
    22 #include <QDateTime>
       
    23 
       
    24 #include "calendaycommonheaders.h"
       
    25 
       
    26 class QAbstractItemModel;
       
    27 class MCalenServices; 
       
    28 class CalenDayModel;
       
    29 
       
    30 class CalenDayModelManager : public QObject
       
    31 {
       
    32     Q_OBJECT
       
    33 
       
    34 public:
       
    35     enum ModelDay {
       
    36 		PreviousDay = 0,
       
    37 		CurrentDay = 1,
       
    38 		NextDay = 2,
       
    39 		NumberOfDays
       
    40     };
       
    41 
       
    42 public:
       
    43     CalenDayModelManager(MCalenServices &services, bool emptyModels,
       
    44 								QObject *parent = 0);
       
    45     ~CalenDayModelManager();
       
    46 
       
    47     QAbstractItemModel &getModel(CalenDayModelManager::ModelDay day);
       
    48     
       
    49     void refreshAllModels();
       
    50     void refreshSingleModel(CalenDayModelManager::ModelDay day);
       
    51     MCalenServices &getServices() {
       
    52         return mServices;
       
    53     }
       
    54     
       
    55 public slots:
       
    56 	void viewsScrollingFinished(CalenScrollDirection scrollTo);
       
    57 
       
    58 private:
       
    59 	void createAllModels();
       
    60 	void moveBackward();
       
    61 	void moveForeward();
       
    62 
       
    63 private:
       
    64     QMap<ModelDay, CalenDayModel*> mModels;
       
    65     MCalenServices &mServices;
       
    66     QDateTime mCurrentDayTime;
       
    67 };
       
    68 
       
    69 #endif//CALENDAYMODELMANAGER_H