79 QVariantMap data = menuEvent->data(); |
79 QVariantMap data = menuEvent->data(); |
80 |
80 |
81 const int entryId = data.value(Hs::itemIdKey).toInt(); |
81 const int entryId = data.value(Hs::itemIdKey).toInt(); |
82 QSharedPointer<const CaEntry> entry |
82 QSharedPointer<const CaEntry> entry |
83 = CaService::instance()->getEntry(entryId); |
83 = CaService::instance()->getEntry(entryId); |
|
84 if (!entry) { |
|
85 stateExited(); |
|
86 return; |
|
87 } |
84 const int componentId = entry->attribute( |
88 const int componentId = entry->attribute( |
85 Hs::componentIdAttributeName).toInt(); |
89 Hs::componentIdAttributeName).toInt(); |
86 |
90 |
87 QSharedPointer<CaSoftwareRegistry> scr = CaSoftwareRegistry::create(); |
91 QSharedPointer<CaSoftwareRegistry> scr = CaSoftwareRegistry::create(); |
88 CaSoftwareRegistry::DetailMap detailMap = scr->entryDetails(componentId); |
92 CaSoftwareRegistry::DetailMap detailMap = scr->entryDetails(componentId); |
89 |
93 |
90 QString appType = entry->attribute(Hs::swTypeKey); |
94 QString appType = entry->attribute(Hs::swTypeKey); |
91 |
95 |
92 |
96 |
93 //TODO: Should we display something In that case? |
97 //TODO: Should we display something In that case? |
94 if (detailMap.size() < 1){ |
98 if (detailMap.size() < 1){ |
95 stateExited(); |
99 stateExited(); |
96 return; |
100 return; |
97 } |
101 } |
98 |
102 |
99 HbDocumentLoader loader; |
103 HbDocumentLoader loader; |
100 bool loadStatusOk = false; |
104 bool loadStatusOk = false; |
101 loader.load(HS_DETAILS_DIALOG_LAYOUT, &loadStatusOk); |
105 loader.load(HS_DETAILS_DIALOG_LAYOUT, &loadStatusOk); |
102 Q_ASSERT_X(loadStatusOk, HS_DETAILS_DIALOG_LAYOUT, |
106 Q_ASSERT_X(loadStatusOk, HS_DETAILS_DIALOG_LAYOUT, |
103 "Error while loading docml file."); |
107 "Error while loading docml file."); |
113 |
117 |
114 if (mDialog != NULL) { |
118 if (mDialog != NULL) { |
115 mDialog->setTimeout(HbPopup::NoTimeout); |
119 mDialog->setTimeout(HbPopup::NoTimeout); |
116 mDialog->setAttribute(Qt::WA_DeleteOnClose, true); |
120 mDialog->setAttribute(Qt::WA_DeleteOnClose, true); |
117 mDialog->actions()[0]->setParent(mDialog); |
121 mDialog->actions()[0]->setParent(mDialog); |
118 |
122 |
119 setFieldPresentation(CaSoftwareRegistry::componentNameKey(), |
123 setFieldPresentation(CaSoftwareRegistry::componentNameKey(), |
120 detailMap, loader); |
124 detailMap, loader); |
121 setFieldPresentation(CaSoftwareRegistry::componentVersionKey(), |
125 setFieldPresentation(CaSoftwareRegistry::componentVersionKey(), |
122 detailMap, loader); |
126 detailMap, loader); |
123 setFieldPresentation(CaSoftwareRegistry::componentVendorKey(), |
127 setFieldPresentation(CaSoftwareRegistry::componentVendorKey(), |
133 setFieldPresentation(CaSoftwareRegistry::componentDescriptionKey(), |
137 setFieldPresentation(CaSoftwareRegistry::componentDescriptionKey(), |
134 detailMap, loader); |
138 detailMap, loader); |
135 setFieldPresentation(CaSoftwareRegistry::componentProtectionDomainKey(), |
139 setFieldPresentation(CaSoftwareRegistry::componentProtectionDomainKey(), |
136 detailMap, loader); |
140 detailMap, loader); |
137 } |
141 } |
138 |
142 |
139 QScopedPointer<HsMenuEntryRemovedHandler> entryObserver( |
143 QScopedPointer<HsMenuEntryRemovedHandler> entryObserver( |
140 new HsMenuEntryRemovedHandler(entryId, this, SIGNAL(exit()))); |
144 new HsMenuEntryRemovedHandler(entryId, this, SIGNAL(exit()))); |
141 |
145 |
142 entryObserver.take()->setParent(mDialog); |
146 entryObserver.take()->setParent(mDialog); |
143 |
147 |
144 mDialog->open(this, SLOT(stateExited())); |
148 mDialog->open(this, SLOT(stateExited())); |
145 } else { |
149 } else { |
146 stateExited(); |
150 stateExited(); |
147 } |
151 } |
148 HSMENUTEST_FUNC_EXIT("HsViewAppDetailsState::onEntry"); |
152 HSMENUTEST_FUNC_EXIT("HsViewAppDetailsState::onEntry"); |