29 \class TsTasksGridItem |
29 \class TsTasksGridItem |
30 \ingroup group_tsdevicedialogplugin |
30 \ingroup group_tsdevicedialogplugin |
31 \brief Item that should be presented in grid. |
31 \brief Item that should be presented in grid. |
32 */ |
32 */ |
33 |
33 |
34 TsTasksGridItem::TsTasksGridItem() |
34 TsTasksGridItem::TsTasksGridItem() |
35 : |
35 : |
36 HbAbstractViewItem(), |
36 HbAbstractViewItem(), |
37 mScreenshotLabel(0), |
37 mScreenshotLabel(0), |
38 mApplicationNameLabel(0), |
38 mApplicationNameLabel(0), |
39 mDeleteButton(0), |
39 mDeleteButton(0), |
40 mActiveLabelFrame(0), |
40 mActiveLabelFrame(0), |
41 mActiveLabel(0) |
41 mActiveLabel(0) |
42 { |
42 { |
43 // Register the custom docml and css to provide our own style to the list items |
43 // Register the custom docml and css to provide our own style to the list items |
44 bool widgetmlLoaded = |
44 bool widgetmlLoaded = |
45 HbStyleLoader::registerFilePath(":/resource/tstasksgriditem.widgetml"); |
45 HbStyleLoader::registerFilePath(":/resource/tstasksgriditem.widgetml"); |
46 Q_ASSERT(widgetmlLoaded); |
46 Q_ASSERT(widgetmlLoaded); |
47 bool cssLoaded = |
47 bool cssLoaded = |
48 HbStyleLoader::registerFilePath(":/resource/tstasksgriditem.css"); |
48 HbStyleLoader::registerFilePath(":/resource/tstasksgriditem.css"); |
49 Q_ASSERT(cssLoaded); |
49 Q_ASSERT(cssLoaded); |
50 } |
50 } |
51 |
51 |
52 TsTasksGridItem::TsTasksGridItem(const TsTasksGridItem &item) : HbAbstractViewItem(item) |
52 TsTasksGridItem::TsTasksGridItem(const TsTasksGridItem &item) : HbAbstractViewItem(item) |
53 { |
53 { |
54 mScreenshotLabel = new HbIconItem(this); |
54 mScreenshotLabel = new HbIconItem(this); |
55 mApplicationNameLabel = new HbTextItem(this); |
55 mApplicationNameLabel = new HbTextItem(this); |
56 mDeleteButton = new HbPushButton(this); |
56 mDeleteButton = new HbPushButton(this); |
57 HbFrameItem *screenshotFrame = new HbFrameItem(this); |
57 HbFrameItem *screenshotFrame = new HbFrameItem(this); |
58 screenshotFrame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
58 screenshotFrame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
59 screenshotFrame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans"); |
59 screenshotFrame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans"); |
60 |
60 |
61 HbFrameItem *applicationLabelFrame = new HbFrameItem(this); |
61 HbFrameItem *applicationLabelFrame = new HbFrameItem(this); |
62 applicationLabelFrame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
62 applicationLabelFrame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
94 |
94 |
95 void TsTasksGridItem::updateChildItems() |
95 void TsTasksGridItem::updateChildItems() |
96 { |
96 { |
97 mScreenshotLabel->setIcon(modelIndex().data(Qt::DecorationRole).value<HbIcon>()); |
97 mScreenshotLabel->setIcon(modelIndex().data(Qt::DecorationRole).value<HbIcon>()); |
98 mApplicationNameLabel->setText(modelIndex().data(Qt::DisplayRole).toString()); |
98 mApplicationNameLabel->setText(modelIndex().data(Qt::DisplayRole).toString()); |
99 |
99 |
100 QVariant closableData(modelIndex().data(TsDataRoles::Closable)); |
100 QVariant closableData(modelIndex().data(TsDataRoles::Closable)); |
101 const bool isClosable(closableData.isValid() && closableData.toBool()); |
101 const bool isClosable(closableData.isValid() && closableData.toBool()); |
102 if (isClosable) { |
102 if (isClosable) { |
103 mDeleteButton->show(); |
103 mDeleteButton->show(); |
104 } else { |
104 } else { |
105 mDeleteButton->hide(); |
105 mDeleteButton->hide(); |
106 } |
106 } |
107 |
107 |
108 QVariant activeData(modelIndex().data(TsDataRoles::Active)); |
108 QVariant activeData(modelIndex().data(TsDataRoles::Active)); |
109 const bool isActive(activeData.isValid() && activeData.toBool()); |
109 const bool isActive(activeData.isValid() && activeData.toBool()); |
110 if (isActive) { |
110 if (isActive) { |
111 mActiveLabel->show(); |
111 mActiveLabel->show(); |
112 mActiveLabelFrame->show(); |
112 mActiveLabelFrame->show(); |