41 CalenDayModel(const QDateTime &date, MCalenServices &services, |
41 CalenDayModel(const QDateTime &date, MCalenServices &services, |
42 QObject *parent = 0) |
42 QObject *parent = 0) |
43 { |
43 { |
44 Q_UNUSED(date) |
44 Q_UNUSED(date) |
45 Q_UNUSED(parent) |
45 Q_UNUSED(parent) |
46 Q_UNUSED(date) |
46 Q_UNUSED(services) |
47 }; |
47 }; |
|
48 |
|
49 void Reset() |
|
50 { |
|
51 mEntryList.clear(); |
|
52 } |
|
53 |
|
54 bool insertRows(int num, int row, const QModelIndex &aparent) |
|
55 { |
|
56 Q_UNUSED(row); |
|
57 Q_UNUSED(aparent); |
|
58 AgendaEntry entry; |
|
59 if ( !num ) { |
|
60 entry.setType( AgendaEntry::TypeAppoinment ); //or reminder |
|
61 // non all day event |
|
62 entry.setStartAndEndTime( QDateTime(QDate(2010,07,12),QTime(0,0)), |
|
63 QDateTime(QDate(2010,07,12),QTime(1,0)) ); |
|
64 } |
|
65 else { |
|
66 entry.setType( AgendaEntry::TypeEvent ); |
|
67 // all day event |
|
68 entry.setStartAndEndTime( QDateTime(QDate(2010,07,12),QTime(0,0)), |
|
69 QDateTime(QDate(2010,07,13),QTime(0,0)) ); |
|
70 } |
|
71 mEntryList.append(QVariant::fromValue(entry)); |
|
72 return true; |
|
73 } |
48 |
74 |
49 // from QAbstractListModel |
75 // from QAbstractListModel |
50 int rowCount(const QModelIndex &parent = QModelIndex()) const |
76 int rowCount(const QModelIndex &parent = QModelIndex()) const |
51 { |
77 { |
52 return 0; |
78 Q_UNUSED(parent) |
|
79 return mEntryList.count(); |
53 } |
80 } |
54 QVariant data(const QModelIndex &index, int role) const |
81 |
|
82 QVariant data(const QModelIndex &index, int role) const |
55 { |
83 { |
56 Q_UNUSED(index) |
84 if ( role == CalenDayEntry ) { |
57 Q_UNUSED(role) |
85 return mEntryList.at(index.row()); |
|
86 } |
58 return QVariant(); |
87 return QVariant(); |
59 } |
88 } |
60 |
89 |
61 void refreshModel(const QDateTime &date) |
90 void refreshModel(const QDateTime &date) |
62 { |
91 { |
63 Q_UNUSED(date) |
92 Q_UNUSED(date) |
64 }; |
93 }; |
65 |
94 |
66 QDateTime modelDate() const |
95 QDateTime modelDate() const |
67 {return QDateTime();} |
96 {return QDateTime();} |
68 |
97 |
|
98 QVariantList mEntryList; |
69 }; |
99 }; |
70 |
100 |
71 #endif //CALENDAYMODEL_H |
101 #endif //CALENDAYMODEL_H |
72 |
102 |