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: Day view control of calendar |
14 * Description: CalenDayItemView implementation |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 //System includes |
18 // System includes |
19 #include <QGesture> |
19 #include <QGesture> |
20 #include <QGraphicsLinearLayout> |
20 #include <QGraphicsLinearLayout> |
21 #include <HbAbstractViewItem> |
21 #include <HbAbstractViewItem> |
22 #include <HbInstance> |
22 #include <HbInstance> |
23 #include <HbAction> |
23 #include <HbAction> |
24 |
24 |
25 //User includes |
25 // User includes |
26 #include "calendayitemview.h" |
26 #include "calendayitemview.h" |
27 #include "calendayutils.h" |
27 #include "calendayutils.h" |
28 #include "calendaycontainer.h" |
28 #include "calendaycontainer.h" |
29 #include "calendayitemview.h" |
29 #include "calendayitemview.h" |
30 #include "calendayinfo.h" |
30 #include "calendayinfo.h" |
170 if (entry.isTimedEntry() && !CalenAgendaUtils::isAlldayEvent(entry)) { |
170 if (entry.isTimedEntry() && !CalenAgendaUtils::isAlldayEvent(entry)) { |
171 apptInfo.iAllDay = false; |
171 apptInfo.iAllDay = false; |
172 mInfo->InsertTimedEvent(apptInfo); |
172 mInfo->InsertTimedEvent(apptInfo); |
173 } |
173 } |
174 else |
174 else |
175 if (CalenAgendaUtils::isAlldayEvent(entry)) //all-day event |
175 if (CalenAgendaUtils::isAlldayEvent(entry)) { //all-day event |
176 { |
|
177 apptInfo.iAllDay = true; |
176 apptInfo.iAllDay = true; |
178 mInfo->InsertAlldayEvent(apptInfo); |
177 mInfo->InsertAlldayEvent(apptInfo); |
179 } |
178 } |
180 } |
179 } |
181 |
180 |
198 |
197 |
199 /*! |
198 /*! |
200 \brief This function is called when a touch press event is received |
199 \brief This function is called when a touch press event is received |
201 within Abstract view item that is representing index. |
200 within Abstract view item that is representing index. |
202 Currently it does nothing. |
201 Currently it does nothing. |
|
202 |
|
203 \param index Index of pressed item |
203 */ |
204 */ |
204 void CalenDayItemView::itemPressed(const QModelIndex &index) |
205 void CalenDayItemView::itemPressed(const QModelIndex &index) |
205 { |
206 { |
206 Q_UNUSED( index ) |
207 Q_UNUSED( index ) |
207 } |
208 } |
208 |
209 |
209 /*! |
210 /*! |
210 \brief This function is called when a touch release event is received |
211 \brief This function is called when a touch release event is received |
211 within Abstract view item that is representing index. |
212 within Abstract view item that is representing index. |
212 Currently it does nothing. |
213 Currently it does nothing. |
|
214 |
|
215 \param index Index of released item |
213 */ |
216 */ |
214 void CalenDayItemView::itemReleased(const QModelIndex &index) |
217 void CalenDayItemView::itemReleased(const QModelIndex &index) |
215 { |
218 { |
216 Q_UNUSED( index ) |
219 Q_UNUSED( index ) |
217 } |
220 } |
218 |
221 |
219 /*! |
222 /*! |
220 \brief This function is called when the item specified by index is activated by the user. |
223 \brief This function is called when the item specified by index is activated by the user. |
221 |
224 |
222 \param position Not used. |
225 \param index Index of activated item |
223 */ |
226 */ |
224 void CalenDayItemView::itemActivated(const QModelIndex &index) |
227 void CalenDayItemView::itemActivated(const QModelIndex &index) |
225 { |
228 { |
226 QItemSelectionModel* selModel(selectionModel()); |
229 QItemSelectionModel* selModel(selectionModel()); |
227 if (index.isValid() && selModel) { |
230 if (index.isValid() && selModel) { |
304 if (this->model()) { |
307 if (this->model()) { |
305 QObject::connect(this->model(), SIGNAL(modelAboutToBeReset()), this, |
308 QObject::connect(this->model(), SIGNAL(modelAboutToBeReset()), this, |
306 SLOT(modelAboutToBeReset())); |
309 SLOT(modelAboutToBeReset())); |
307 QObject::connect(this->model(), SIGNAL(modelReset()), this, |
310 QObject::connect(this->model(), SIGNAL(modelReset()), this, |
308 SLOT(modelReset())); |
311 SLOT(modelReset())); |
309 } |
|
310 if (mContainer) { |
|
311 // Connect with base class to enable handling item press by model index |
|
312 QObject::connect(mContainer, SIGNAL(itemCreated(HbAbstractViewItem *)), |
|
313 this, SLOT(itemCreated(HbAbstractViewItem*))); |
|
314 } |
312 } |
315 QObject::connect(this, SIGNAL(pressed(const QModelIndex&)), this, |
313 QObject::connect(this, SIGNAL(pressed(const QModelIndex&)), this, |
316 SLOT(itemPressed(const QModelIndex&))); |
314 SLOT(itemPressed(const QModelIndex&))); |
317 QObject::connect(this, SIGNAL(released(const QModelIndex&)), this, |
315 QObject::connect(this, SIGNAL(released(const QModelIndex&)), this, |
318 SLOT(itemReleased(const QModelIndex&))); |
316 SLOT(itemReleased(const QModelIndex&))); |