calendarui/views/dayview/inc/calendaymodel.h
changeset 50 579cc610882e
equal deleted inserted replaced
49:5de72ea7a065 50:579cc610882e
       
     1 /*
       
     2 * Copyright (c) 2010 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: Single day item view model
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CALENDAYMODEL_H
       
    19 #define CALENDAYMODEL_H
       
    20 
       
    21 //System includes
       
    22 #include <QAbstractItemModel>
       
    23 #include <QVariant>
       
    24 #include <QDateTime>
       
    25 
       
    26 #include <agendaentry.h>
       
    27 
       
    28 //User includes
       
    29 
       
    30 //Forward declarations
       
    31 class MCalenServices;
       
    32 
       
    33 //Constantss
       
    34 const int CalenDayEntry = Qt::UserRole + 1; 
       
    35 
       
    36 Q_DECLARE_METATYPE(AgendaEntry)
       
    37 
       
    38 class CalenDayModel : public QAbstractListModel
       
    39 {
       
    40     Q_OBJECT
       
    41 public:
       
    42 	CalenDayModel(const QDateTime &date, MCalenServices &services,
       
    43 						QObject *parent = 0);
       
    44 	
       
    45     // from QAbstractListModel
       
    46 	int rowCount(const QModelIndex &parent = QModelIndex()) const;
       
    47     QVariant data(const QModelIndex &index, int role) const;
       
    48     
       
    49 	void refreshModel(const QDateTime &date);
       
    50 	
       
    51 	QDateTime modelDate() const;
       
    52 	
       
    53 	
       
    54 private:
       
    55     void loadAndStoreInstances(const QDateTime& date);
       
    56     
       
    57 private:
       
    58     MCalenServices &mServices;
       
    59     QVariantList mEntryList;
       
    60     QDateTime mDateTime;
       
    61 };
       
    62 
       
    63 #endif //CALENDAYMODEL_H
       
    64