|
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 #include <QAbstractListModel> |
|
26 class QAbstractItemModel; |
|
27 class MCalenServices; |
|
28 class CalenDayModel; |
|
29 |
|
30 /*! |
|
31 Test class TestAbstractListModel |
|
32 */ |
|
33 class TestAbstractListModel : public QAbstractListModel |
|
34 { |
|
35 Q_OBJECT |
|
36 |
|
37 public: |
|
38 TestAbstractListModel() : QAbstractListModel() { |
|
39 } |
|
40 |
|
41 ~TestAbstractListModel() { |
|
42 } |
|
43 |
|
44 int rowCount(const QModelIndex &parent) const { |
|
45 Q_UNUSED(parent); |
|
46 return 0; |
|
47 } |
|
48 |
|
49 QVariant data(const QModelIndex &index, int role) const { |
|
50 Q_UNUSED(index); |
|
51 Q_UNUSED(role); |
|
52 return QVariant(0); |
|
53 } |
|
54 }; |
|
55 |
|
56 class CalenDayModelManager : public QObject |
|
57 { |
|
58 Q_OBJECT |
|
59 |
|
60 public: |
|
61 enum ModelDay |
|
62 { |
|
63 PreviousDay = 0, CurrentDay = 1, NextDay = 2, NumberOfDays |
|
64 }; |
|
65 |
|
66 public: |
|
67 CalenDayModelManager(MCalenServices &services, bool emptyModels, QObject *parent = 0) : |
|
68 mServices(services) |
|
69 { |
|
70 Q_UNUSED(emptyModels); |
|
71 Q_UNUSED(parent); |
|
72 } |
|
73 ~CalenDayModelManager() |
|
74 { |
|
75 } |
|
76 |
|
77 QAbstractItemModel &getModel(CalenDayModelManager::ModelDay day) |
|
78 { |
|
79 Q_UNUSED(day); |
|
80 model = new TestAbstractListModel(); |
|
81 return *model; |
|
82 } |
|
83 |
|
84 void refreshAllModels() |
|
85 { |
|
86 } |
|
87 void refreshSingleModel(CalenDayModelManager::ModelDay day) |
|
88 { |
|
89 Q_UNUSED(day); |
|
90 } |
|
91 MCalenServices &getServices() |
|
92 { |
|
93 return mServices; |
|
94 } |
|
95 |
|
96 public slots: |
|
97 void viewsScrollingFinished(CalenScrollDirection scrollTo) |
|
98 { |
|
99 Q_UNUSED(scrollTo); |
|
100 } |
|
101 |
|
102 private: |
|
103 void createAllModels() |
|
104 { |
|
105 } |
|
106 void moveBackward() |
|
107 { |
|
108 } |
|
109 void moveForeward() |
|
110 { |
|
111 } |
|
112 |
|
113 private: |
|
114 QMap<ModelDay, CalenDayModel*> mModels; |
|
115 MCalenServices &mServices; |
|
116 QDateTime mCurrentDayTime; |
|
117 TestAbstractListModel* model; |
|
118 }; |
|
119 |
|
120 #endif//CALENDAYMODELMANAGER_H |