29 |
29 |
30 #include "hsviewappdetailsstate.h" |
30 #include "hsviewappdetailsstate.h" |
31 #include "hsmenuevent.h" |
31 #include "hsmenuevent.h" |
32 #include "hsmenuitemmodel.h" |
32 #include "hsmenuitemmodel.h" |
33 |
33 |
|
34 |
|
35 /*! |
|
36 Constructor. |
|
37 @param parent Parent state. |
|
38 */ |
34 HsViewAppDetailsState::HsViewAppDetailsState(QState *parent) : |
39 HsViewAppDetailsState::HsViewAppDetailsState(QState *parent) : |
35 QState(parent), mDialog(0), mNotifier(0) |
40 QState(parent), mDialog(0), mNotifier(0) |
36 { |
41 { |
37 construct(); |
42 construct(); |
38 } |
43 } |
39 |
44 |
|
45 /*! |
|
46 Destructor |
|
47 */ |
40 HsViewAppDetailsState::~HsViewAppDetailsState() |
48 HsViewAppDetailsState::~HsViewAppDetailsState() |
41 { |
49 { |
42 if (mDialog) { |
50 if (mDialog) { |
43 delete mDialog; |
51 delete mDialog; |
44 } |
52 } |
45 } |
53 } |
46 |
54 |
|
55 /*! |
|
56 Construction |
|
57 */ |
47 void HsViewAppDetailsState::construct() |
58 void HsViewAppDetailsState::construct() |
48 { |
59 { |
49 HSMENUTEST_FUNC_ENTRY("HsViewAppDetailsState::construct"); |
60 HSMENUTEST_FUNC_ENTRY("HsViewAppDetailsState::construct"); |
50 setObjectName(this->parent()->objectName() |
61 |
51 + "/ViewAppDetailsState"); |
62 setObjectName("/ViewAppDetailsState"); |
|
63 if (this->parent()) { |
|
64 setObjectName(this->parent()->objectName() + objectName()); |
|
65 } |
52 HSMENUTEST_FUNC_EXIT("HsViewAppDetailsState::construct"); |
66 HSMENUTEST_FUNC_EXIT("HsViewAppDetailsState::construct"); |
53 } |
67 } |
54 |
68 |
|
69 /*! |
|
70 Invoked on entering state |
|
71 */ |
55 void HsViewAppDetailsState::onEntry(QEvent *event) |
72 void HsViewAppDetailsState::onEntry(QEvent *event) |
56 { |
73 { |
57 HSMENUTEST_FUNC_ENTRY("HsViewAppDetailsState::onEntry"); |
74 HSMENUTEST_FUNC_ENTRY("HsViewAppDetailsState::onEntry"); |
58 QState::onEntry(event); |
75 QState::onEntry(event); |
59 HsMenuEvent *menuEvent = static_cast<HsMenuEvent *>(event); |
76 HsMenuEvent *menuEvent = static_cast<HsMenuEvent *>(event); |
60 QVariantMap data = menuEvent->data(); |
77 QVariantMap data = menuEvent->data(); |
61 |
78 |
62 const int entryId = data.value(itemIdKey()).toInt(); |
79 const int entryId = data.value(itemIdKey()).toInt(); |
63 QSharedPointer<const CaEntry> entry = CaService::instance()->getEntry(entryId); |
80 QSharedPointer<const CaEntry> entry |
64 const int componentId = entry->attribute(componentIdAttributeName()).toInt(); |
81 = CaService::instance()->getEntry(entryId); |
|
82 const int componentId = entry->attribute( |
|
83 componentIdAttributeName()).toInt(); |
65 |
84 |
66 QSharedPointer<CaSoftwareRegistry> scr = CaSoftwareRegistry::create(); |
85 QSharedPointer<CaSoftwareRegistry> scr = CaSoftwareRegistry::create(); |
67 CaSoftwareRegistry::DetailMap detailMap = scr->entryDetails(componentId); |
86 CaSoftwareRegistry::DetailMap detailMap = scr->entryDetails(componentId); |
68 |
87 |
69 HbDocumentLoader loader; |
88 HbDocumentLoader loader; |
70 bool loadStatusOk = false; |
89 bool loadStatusOk = false; |
71 mObjectList = |
90 mObjectList = loader.load(HS_DETAILS_DIALOG_LAYOUT, &loadStatusOk); |
72 loader.load(HS_DETAILS_DIALOG_LAYOUT, &loadStatusOk); |
91 Q_ASSERT_X(loadStatusOk, HS_DETAILS_DIALOG_LAYOUT, |
73 Q_ASSERT_X(loadStatusOk, |
|
74 HS_DETAILS_DIALOG_LAYOUT, |
|
75 "Error while loading docml file."); |
92 "Error while loading docml file."); |
76 |
93 |
77 mDialog = qobject_cast<HbDialog*>(loader.findWidget(HS_DETAILS_DIALOG_NAME)); |
94 mDialog = qobject_cast<HbDialog*>( |
|
95 loader.findWidget(HS_DETAILS_DIALOG_NAME)); |
78 mDialog->actions()[0]->setParent(mDialog); |
96 mDialog->actions()[0]->setParent(mDialog); |
79 |
97 |
80 subscribeForMemoryCardRemove(entryId); |
98 subscribeForMemoryCardRemove(entryId); |
81 |
99 |
82 HbLabel* nameLabel = qobject_cast<HbLabel*>(loader.findWidget(CaSoftwareRegistry::componentNameKey())); |
100 HbLabel* nameLabel = qobject_cast<HbLabel*>( |
83 HbLabel* versionLabel = qobject_cast<HbLabel*>(loader.findWidget(CaSoftwareRegistry::componentVersionKey())); |
101 loader.findWidget(CaSoftwareRegistry::componentNameKey())); |
84 HbLabel* supplierLabel = qobject_cast<HbLabel*>(loader.findWidget(CaSoftwareRegistry::componentVendorKey())); |
102 HbLabel* versionLabel = qobject_cast<HbLabel*>( |
85 HbLabel* memoryLabel = qobject_cast<HbLabel*>(loader.findWidget(CaSoftwareRegistry::componentDriveInfoKey())); |
103 loader.findWidget(CaSoftwareRegistry::componentVersionKey())); |
86 HbLabel* sizeLabel = qobject_cast<HbLabel*>(loader.findWidget(CaSoftwareRegistry::componentSizeKey())); |
104 HbLabel* supplierLabel = qobject_cast<HbLabel*>( |
87 HbLabel* typeLabel = qobject_cast<HbLabel*>(loader.findWidget(CaSoftwareRegistry::componentTypeKey())); |
105 loader.findWidget(CaSoftwareRegistry::componentVendorKey())); |
|
106 HbLabel* memoryLabel = qobject_cast<HbLabel*>( |
|
107 loader.findWidget(CaSoftwareRegistry::componentDriveInfoKey())); |
|
108 HbLabel* sizeLabel = qobject_cast<HbLabel*>( |
|
109 loader.findWidget(CaSoftwareRegistry::componentSizeKey())); |
|
110 HbLabel* typeLabel = qobject_cast<HbLabel*>( |
|
111 loader.findWidget(CaSoftwareRegistry::componentTypeKey())); |
88 |
112 |
89 nameLabel->setPlainText(detailMap[CaSoftwareRegistry::componentNameKey()]); |
113 nameLabel->setPlainText( |
90 versionLabel->setPlainText(detailMap[CaSoftwareRegistry::componentVersionKey()]); |
114 detailMap[CaSoftwareRegistry::componentNameKey()]); |
91 supplierLabel->setPlainText(detailMap[CaSoftwareRegistry::componentVendorKey()]); |
115 versionLabel->setPlainText( |
92 memoryLabel->setPlainText(detailMap[CaSoftwareRegistry::componentDriveInfoKey()]); |
116 detailMap[CaSoftwareRegistry::componentVersionKey()]); |
93 sizeLabel->setPlainText(detailMap[CaSoftwareRegistry::componentSizeKey()]); |
117 supplierLabel->setPlainText( |
94 typeLabel->setPlainText(detailMap[CaSoftwareRegistry::componentTypeKey()]); |
118 detailMap[CaSoftwareRegistry::componentVendorKey()]); |
|
119 memoryLabel->setPlainText( |
|
120 detailMap[CaSoftwareRegistry::componentDriveInfoKey()]); |
|
121 sizeLabel->setPlainText( |
|
122 detailMap[CaSoftwareRegistry::componentSizeKey()]); |
|
123 |
|
124 typeLabel->setPlainText( |
|
125 detailMap[CaSoftwareRegistry::componentTypeKey()]); |
95 |
126 |
96 if (mDialog != NULL) { |
127 if (mDialog != NULL) { |
97 mDialog->setTimeout(HbPopup::NoTimeout); |
128 mDialog->setTimeout(HbPopup::NoTimeout); |
98 mDialog->setAttribute(Qt::WA_DeleteOnClose, true); |
129 mDialog->setAttribute(Qt::WA_DeleteOnClose, true); |
99 mDialog->open(this, SLOT(stateExited())); |
130 mDialog->open(this, SLOT(stateExited())); |
100 } |
131 } |
101 |
|
102 HSMENUTEST_FUNC_EXIT("HsViewAppDetailsState::onEntry"); |
132 HSMENUTEST_FUNC_EXIT("HsViewAppDetailsState::onEntry"); |
103 } |
133 } |
104 #ifdef COVERAGE_MEASUREMENT |
134 |
105 #pragma CTC SKIP |
|
106 #endif //COVERAGE_MEASUREMENT |
|
107 /*! |
135 /*! |
108 Slot invoked when a state is exited. |
136 Slot invoked when a state is exited. |
109 */ |
137 */ |
110 void HsViewAppDetailsState::stateExited() |
138 void HsViewAppDetailsState::stateExited() |
111 { |
139 { |