30 #include <hbcolorscheme.h> |
30 #include <hbcolorscheme.h> |
31 |
31 |
32 // User includes |
32 // User includes |
33 #include "calengriditemprototype.h" |
33 #include "calengriditemprototype.h" |
34 #include "calencommon.h" |
34 #include "calencommon.h" |
|
35 #include "calentodayindicatorlinedrawer.h" |
35 |
36 |
36 /*! |
37 /*! |
37 \class CalenGridItemPrototype |
38 \class CalenGridItemPrototype |
38 |
39 |
39 Prototype class for HbGridView. |
40 Prototype class for HbGridView. |
69 mMonthDayInfoItem->setElideMode(Qt::ElideNone); |
70 mMonthDayInfoItem->setElideMode(Qt::ElideNone); |
70 } |
71 } |
71 |
72 |
72 if (!mFocusIndicatorItem) { |
73 if (!mFocusIndicatorItem) { |
73 mFocusIndicatorItem = new HbFrameItem(this); |
74 mFocusIndicatorItem = new HbFrameItem(this); |
74 mFocusIndicatorItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
75 mFocusIndicatorItem->frameDrawer().setFrameType( |
|
76 HbFrameDrawer::NinePieces); |
75 mFocusIndicatorItem->setZValue(-1); |
77 mFocusIndicatorItem->setZValue(-1); |
76 HbStyle::setItemName(mFocusIndicatorItem, QLatin1String("focusIconItem")); |
78 HbStyle::setItemName( |
|
79 mFocusIndicatorItem, QLatin1String("focusIconItem")); |
77 } |
80 } |
78 |
81 |
79 if (!mEventIndicatorItem) { |
82 if (!mEventIndicatorItem) { |
80 mEventIndicatorItem = new HbIconItem(this); |
83 mEventIndicatorItem = new HbIconItem(this); |
81 HbStyle::setItemName(mEventIndicatorItem, QLatin1String("eventIconItem")); |
84 HbStyle::setItemName( |
82 } |
85 mEventIndicatorItem, QLatin1String("eventIconItem")); |
|
86 } |
|
87 |
|
88 if (!mTodayIndicatorItem) { |
|
89 mTodayIndicatorItem = new CalenTodayIndicatorLineDrawer(this); |
|
90 HbStyle::setItemName( |
|
91 mTodayIndicatorItem, QLatin1String("todayIndicatorItem")); |
|
92 } |
|
93 |
83 } |
94 } |
84 |
95 |
85 /*! |
96 /*! |
86 From HbAbstractViewItem. |
97 From HbAbstractViewItem. |
87 |
98 |
134 } else { |
145 } else { |
135 mFocusIndicatorItem->frameDrawer().setFrameGraphicsName(QString("")); |
146 mFocusIndicatorItem->frameDrawer().setFrameGraphicsName(QString("")); |
136 } |
147 } |
137 |
148 |
138 // Get the today indicator role |
149 // Get the today indicator role |
139 underlineEnabled = itemList.at(CalendarNamespace::CalendarMonthUnderlineRole).value<bool>(); |
150 underlineEnabled = itemList.at( |
140 drawUnderline(underlineEnabled); |
151 CalendarNamespace::CalendarMonthUnderlineRole). |
|
152 value<bool>(); |
|
153 if(underlineEnabled) { |
|
154 mTodayIndicatorItem->show(); |
|
155 } else { |
|
156 mTodayIndicatorItem->hide(); |
|
157 } |
141 |
158 |
142 // Get the event indicator data |
159 // Get the event indicator data |
143 monthEventRole = itemList.at(CalendarNamespace::CalendarMonthEventRole).value<bool>(); |
160 monthEventRole = itemList.at(CalendarNamespace::CalendarMonthEventRole).value<bool>(); |
144 if (monthEventRole) { |
161 if (monthEventRole) { |
145 // Set the event indicator |
162 // Set the event indicator |
164 // base class implementation |
181 // base class implementation |
165 HbGridViewItem::updateChildItems(); |
182 HbGridViewItem::updateChildItems(); |
166 } |
183 } |
167 |
184 |
168 /*! |
185 /*! |
169 Function to create the underline icon item |
|
170 */ |
|
171 void CalenGridItemPrototype::drawUnderline(bool underlineEnabled) |
|
172 { |
|
173 if (underlineEnabled) { |
|
174 if (!mTodayIndicatorItem) { |
|
175 mTodayIndicatorItem = new HbIconItem(this); |
|
176 HbStyle::setItemName(mTodayIndicatorItem, |
|
177 QLatin1String("todayIndicatorItem")); |
|
178 if (mTodayUnderLineColor.isValid()) { |
|
179 mTodayIndicatorItem->setColor(mTodayUnderLineColor); |
|
180 } |
|
181 } |
|
182 } else { |
|
183 if (mTodayIndicatorItem) { |
|
184 delete mTodayIndicatorItem; |
|
185 mTodayIndicatorItem = NULL; |
|
186 } |
|
187 } |
|
188 } |
|
189 |
|
190 |
|
191 /*! |
|
192 Function overwritten to avoid default behavior |
186 Function overwritten to avoid default behavior |
193 */ |
187 */ |
194 void CalenGridItemPrototype::pressStateChanged(bool pressed,bool animate) |
188 void CalenGridItemPrototype::pressStateChanged(bool pressed,bool animate) |
195 { |
189 { |
196 Q_UNUSED(pressed) |
190 Q_UNUSED(pressed) |