26 |
26 |
27 //User inlcudes |
27 //User inlcudes |
28 #include "calendayitem.h" |
28 #include "calendayitem.h" |
29 #include "calendaystatusstrip.h" |
29 #include "calendaystatusstrip.h" |
30 #include "calendaymodel.h" |
30 #include "calendaymodel.h" |
|
31 #include "calendayutils.h" |
|
32 #include "calendaycontainer.h" |
31 |
33 |
32 // ----------------------------------------------------------------------------- |
34 // ----------------------------------------------------------------------------- |
33 // CalenDayItem() |
35 // CalenDayItem() |
34 // Constructor. |
36 // Constructor. |
35 // ----------------------------------------------------------------------------- |
37 // ----------------------------------------------------------------------------- |
36 // |
38 // |
37 CalenDayItem::CalenDayItem(): |
39 CalenDayItem::CalenDayItem(const CalenDayContainer *container): |
38 mUpdated(false), mBg(0), mEventDesc(0), mColorStripe(0), |
40 mContainer(container), mUpdated(false), mBg(0), mEventDesc(0), mColorStripe(0), |
39 mEventDescMinWidth(0.0), mFrameMinWidth(0.0) |
41 mEventDescMinWidth(0.0), mFrameMinWidth(0.0) |
40 { |
42 { |
41 } |
43 } |
42 |
44 |
43 // ----------------------------------------------------------------------------- |
45 // ----------------------------------------------------------------------------- |
44 // CalenBCDayView() |
46 // CalenBCDayView() |
45 // Copy constructor. |
47 // Copy constructor. |
46 // ----------------------------------------------------------------------------- |
48 // ----------------------------------------------------------------------------- |
47 // |
49 // |
48 CalenDayItem::CalenDayItem(const CalenDayItem & source) : |
50 CalenDayItem::CalenDayItem(const CalenDayItem & source) : |
49 HbAbstractViewItem(source), mUpdated(false), mBg(0), mEventDesc(0), |
51 HbAbstractViewItem(source), mContainer(source.container()), mUpdated(false), mBg(0), mEventDesc(0), |
50 mColorStripe(0), mEventDescMinWidth(0.0), mFrameMinWidth(0.0) |
52 mColorStripe(0), mEventDescMinWidth(0.0), mFrameMinWidth(0.0) |
51 { |
53 { |
52 // TODO: "qtg_fr_btn_pressed" need to replaced with qtg_fr_cal_meeting_bg |
54 // TODO: "qtg_fr_btn_pressed" need to replaced with qtg_fr_cal_meeting_bg |
53 // when available |
55 // when available |
54 mBg = new HbFrameItem("qtg_fr_btn_pressed", HbFrameDrawer::NinePieces, this); |
56 mBg = new HbFrameItem("qtg_fr_btn_pressed", HbFrameDrawer::NinePieces, this); |
80 mEventDescMinWidth = mFrameMinWidth + rightMargin;//smallest width for which text can be displayed |
82 mEventDescMinWidth = mFrameMinWidth + rightMargin;//smallest width for which text can be displayed |
81 |
83 |
82 //Minimum width is assured by widgetml and css |
84 //Minimum width is assured by widgetml and css |
83 //additionally called here to prevent minimum size hint caching inside effectiveSizeHint |
85 //additionally called here to prevent minimum size hint caching inside effectiveSizeHint |
84 setMinimumWidth(stripeWidth); |
86 setMinimumWidth(stripeWidth); |
|
87 |
85 } |
88 } |
86 |
89 |
87 // ----------------------------------------------------------------------------- |
90 // ----------------------------------------------------------------------------- |
88 // ~CalenDayItem() |
91 // ~CalenDayItem() |
89 // Destructor. |
92 // Destructor. |
184 { |
187 { |
185 QColor color = HbColorScheme::color("qtc_cal_month_current_day"); |
188 QColor color = HbColorScheme::color("qtc_cal_month_current_day"); |
186 mColorStripe->setColor(color); |
189 mColorStripe->setColor(color); |
187 |
190 |
188 if (!allDayEvent) { |
191 if (!allDayEvent) { |
189 mColorStripe->setStartEndTime(entry.startTime().time(), |
192 |
190 entry.endTime().time()); |
193 QDateTime startTime; |
191 } else { |
194 QDateTime endTime; |
192 // This is workaround for displaying all-day events. |
195 QDateTime currentDateTime; |
193 // Now for MS Outlook compability all-day events' start and end time is |
196 currentDateTime.setDate(container()->date()); |
194 // 00:00:00 and 00:00:00 next day respectively. |
197 |
195 // To draw it correctly we need times like those visible for user in |
198 CalenDayUtils::instance()->getEventValidStartEndTime(startTime, endTime, entry, |
196 // editor: 00:00:00 to 23:59:59 (the same day) |
199 currentDateTime); |
197 mColorStripe->setStartEndTime(entry.startTime().time(), |
200 |
198 entry.endTime().time().addSecs(-1)); |
201 mColorStripe->setStartEndTime(startTime.time(), endTime.time()); |
|
202 } |
|
203 else { |
|
204 // This is workaround for displaying all-day events. |
|
205 // Now for MS Outlook compability all-day events' start and end time is |
|
206 // 00:00:00 and 00:00:00 next day respectively. |
|
207 // To draw it correctly we need times like those visible for user in |
|
208 // editor: 00:00:00 to 23:59:59 (the same day) |
|
209 mColorStripe->setStartEndTime(entry.startTime().time(), entry.endTime().time().addSecs(-1)); |
199 } |
210 } |
200 |
211 |
201 switch (entry.status()) { |
212 switch (entry.status()) { |
202 case AgendaEntry::Confirmed: |
213 case AgendaEntry::Confirmed: |
203 mColorStripe->setDrawingStyle(CalenDayStatusStrip::Filled); |
214 mColorStripe->setDrawingStyle(CalenDayStatusStrip::Filled); |