25 #include <hbframeitem.h> |
25 #include <hbframeitem.h> |
26 #include <hbframedrawer.h> |
26 #include <hbframedrawer.h> |
27 #include <hbiconitem.h> |
27 #include <hbiconitem.h> |
28 #include <hbframebackground.h> |
28 #include <hbframebackground.h> |
29 #include <hbcolorscheme.h> |
29 #include <hbcolorscheme.h> |
|
30 #include <hbtheme.h> |
30 |
31 |
31 // User includes |
32 // User includes |
32 #include "calengriditemprototype.h" |
33 #include "calengriditemprototype.h" |
33 #include "calencommon.h" |
34 #include "calencommon.h" |
34 #include "calentodayindicatorlinedrawer.h" |
35 #include "calentodayindicatorlinedrawer.h" |
45 */ |
46 */ |
46 |
47 |
47 /*! |
48 /*! |
48 Constructor. |
49 Constructor. |
49 */ |
50 */ |
50 CalenGridItemPrototype::CalenGridItemPrototype(QColor todayIndColor, QColor activeColor, QColor inActiveColor, |
51 CalenGridItemPrototype::CalenGridItemPrototype(QGraphicsWidget *parent) : |
51 QGraphicsWidget *parent) : |
52 HbGridViewItem(parent), |
52 HbGridViewItem(parent), |
53 mActiveTextColor(HbColorScheme::color("qtc_cal_month_active_dates")), |
53 mTodayUnderLineColor(todayIndColor), |
54 mInActiveTextColor(HbColorScheme::color("qtc_cal_month_notactive_dates")), |
54 mActiveTextColor(activeColor), |
55 mCurrentDateColor(HbColorScheme::color("qtc_cal_month_highlighted_text")), |
55 mInActiveTextColor(inActiveColor), |
56 mEventIndicatorItem(0), |
56 mCurrentDateColor(Qt::black), |
57 mMonthDayInfoItem(0), |
57 mGridBorderColor(Qt::gray), |
58 mFocusIndicatorItem(0), |
58 mEventIndicatorItem(0), |
59 mTodayIndicatorItem(0) |
59 mMonthDayInfoItem(0), |
60 { |
60 mFocusIndicatorItem(0), |
|
61 mTodayIndicatorItem(0) |
|
62 { |
|
63 OstTraceFunctionEntry0( CALENGRIDITEMPROTOTYPE_CALENGRIDITEMPROTOTYPE_ENTRY ); |
61 OstTraceFunctionEntry0( CALENGRIDITEMPROTOTYPE_CALENGRIDITEMPROTOTYPE_ENTRY ); |
64 |
62 |
65 OstTraceFunctionExit0( CALENGRIDITEMPROTOTYPE_CALENGRIDITEMPROTOTYPE_EXIT ); |
63 OstTraceFunctionExit0( CALENGRIDITEMPROTOTYPE_CALENGRIDITEMPROTOTYPE_EXIT ); |
66 } |
64 } |
67 |
65 |
114 OstTraceFunctionEntry0( CALENGRIDITEMPROTOTYPE_CREATEITEM_ENTRY ); |
112 OstTraceFunctionEntry0( CALENGRIDITEMPROTOTYPE_CREATEITEM_ENTRY ); |
115 |
113 |
116 CalenGridItemPrototype* item = new CalenGridItemPrototype(*this); |
114 CalenGridItemPrototype* item = new CalenGridItemPrototype(*this); |
117 item->createPrimitives(); |
115 item->createPrimitives(); |
118 |
116 |
|
117 connect( |
|
118 HbTheme::instance(), SIGNAL(changed()), |
|
119 item, SLOT(handleThemeChange())); |
119 // Set the default frame to NULL so that HbGridView does not add its |
120 // Set the default frame to NULL so that HbGridView does not add its |
120 // default frame for items |
121 // default frame for items |
121 HbFrameBackground frame; |
122 HbFrameBackground frame; |
122 frame.setFrameGraphicsName(QString("")); |
123 frame.setFrameGraphicsName(QString("")); |
123 item->setDefaultFrame(frame); |
124 item->setDefaultFrame(frame); |
182 } |
183 } |
183 |
184 |
184 // Get the text color |
185 // Get the text color |
185 monthTextColorRole = itemList.at(CalendarNamespace::CalendarMonthTextColorRole).value<bool>(); |
186 monthTextColorRole = itemList.at(CalendarNamespace::CalendarMonthTextColorRole).value<bool>(); |
186 if (monthTextColorRole) { |
187 if (monthTextColorRole) { |
187 // Set the active text color |
188 if (monthFocusRole) { |
188 mMonthDayInfoItem->setTextColor(mActiveTextColor); |
189 // Set the Highlighted text color |
|
190 mMonthDayInfoItem->setTextColor(mCurrentDateColor); |
|
191 } else { |
|
192 // Set the active text color |
|
193 mMonthDayInfoItem->setTextColor(mActiveTextColor); |
|
194 } |
189 } else { |
195 } else { |
190 // Set the inactive text color |
196 // Set the inactive text color |
191 mMonthDayInfoItem->setTextColor(mInActiveTextColor); |
197 mMonthDayInfoItem->setTextColor(mInActiveTextColor); |
192 } |
198 } |
193 } |
199 } |
231 |
237 |
232 OstTraceFunctionExit0( CALENGRIDITEMPROTOTYPE_CANSETMODELINDEX_EXIT ); |
238 OstTraceFunctionExit0( CALENGRIDITEMPROTOTYPE_CANSETMODELINDEX_EXIT ); |
233 return true; |
239 return true; |
234 } |
240 } |
235 |
241 |
|
242 /*! |
|
243 Slot to handle the change in theme |
|
244 */ |
|
245 void CalenGridItemPrototype::handleThemeChange() |
|
246 { |
|
247 OstTraceFunctionEntry0( CALENGRIDITEMPROTOTYPE_HANDLETHEMECHANGE_ENTRY ); |
|
248 |
|
249 mActiveTextColor = HbColorScheme::color("qtc_cal_month_active_dates"); |
|
250 mInActiveTextColor = HbColorScheme::color("qtc_cal_month_notactive_dates"); |
|
251 mCurrentDateColor = HbColorScheme::color("qtc_cal_month_highlighted_text"); |
|
252 |
|
253 OstTraceFunctionExit0( CALENGRIDITEMPROTOTYPE_HANDLETHEMECHANGE_EXIT ); |
|
254 |
|
255 } |
236 // End of file --Don't remove this. |
256 // End of file --Don't remove this. |