homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hspreviewhswidgetstate.cpp
equal
deleted
inserted
replaced
103 HSMENUTEST_FUNC_ENTRY("HsPreviewHSWidgetState::onEntry"); |
103 HSMENUTEST_FUNC_ENTRY("HsPreviewHSWidgetState::onEntry"); |
104 QState::onEntry(event); |
104 QState::onEntry(event); |
105 HsMenuEvent *menuEvent = static_cast<HsMenuEvent *>(event); |
105 HsMenuEvent *menuEvent = static_cast<HsMenuEvent *>(event); |
106 |
106 |
107 QVariantMap data = menuEvent->data(); |
107 QVariantMap data = menuEvent->data(); |
108 mEntryId = data.value(itemIdKey()).toInt(); |
108 mEntryId = data.value(Hs::itemIdKey).toInt(); |
109 mToken = data.value(HOMESCREENDATA); |
109 mToken = data.value(Hs::homescreenData); |
110 |
110 |
111 |
111 |
112 QSharedPointer<CaEntry> entry = |
112 QSharedPointer<CaEntry> entry = |
113 CaService::instance()->getEntry(mEntryId); |
113 CaService::instance()->getEntry(mEntryId); |
114 mUri = entry->attribute(widgetUriAttributeName()); |
114 mUri = entry->attribute(Hs::widgetUriAttributeName); |
115 mPreviewDialog = buildPreviewDialog(*entry); |
115 mPreviewDialog = buildPreviewDialog(*entry); |
116 mAddToHomescreenAction = mPreviewDialog->actions().value(0); |
116 mAddToHomescreenAction = mPreviewDialog->actions().value(0); |
117 |
117 |
118 if (mPreviewDialog != NULL) { |
118 if (mPreviewDialog != NULL) { |
119 // Launch popup asyncronously |
119 // Launch popup asyncronously |
157 mPreviewDialog = NULL; |
157 mPreviewDialog = NULL; |
158 |
158 |
159 if (finishedAction == mAddToHomescreenAction) { |
159 if (finishedAction == mAddToHomescreenAction) { |
160 |
160 |
161 QVariantHash widgetData; |
161 QVariantHash widgetData; |
162 widgetData[URI] = mUri; |
162 widgetData[Hs::uri] = mUri; |
163 widgetData[HOMESCREENDATA] = mToken; |
163 widgetData[Hs::homescreenData] = mToken; |
164 |
164 |
165 bool success = HsContentService::instance()->createWidget(widgetData); |
165 bool success = HsContentService::instance()->createWidget(widgetData); |
166 |
166 |
167 if (success) { |
167 if (success) { |
168 HbNotificationDialog *notificationDialog = new HbNotificationDialog(); |
168 HbNotificationDialog *notificationDialog = new HbNotificationDialog(); |
205 void HsPreviewHSWidgetState::messageWidgetCorruptedFinished(HbAction* finishedAction) |
205 void HsPreviewHSWidgetState::messageWidgetCorruptedFinished(HbAction* finishedAction) |
206 { |
206 { |
207 mCorruptedMessage = NULL; |
207 mCorruptedMessage = NULL; |
208 |
208 |
209 if (static_cast<QAction*>(finishedAction) == mConfirmRemovalAction) { |
209 if (static_cast<QAction*>(finishedAction) == mConfirmRemovalAction) { |
210 HsMenuService::executeAction(mEntryId, removeActionIdentifier()); |
210 HsMenuService::executeAction(mEntryId, Hs::removeActionIdentifier); |
211 } |
211 } |
212 emit exit(); |
212 emit exit(); |
213 |
213 |
214 mConfirmRemovalAction = NULL; |
214 mConfirmRemovalAction = NULL; |
215 } |
215 } |