24 |
24 |
25 #include "hsdomainmodel_global.h" |
25 #include "hsdomainmodel_global.h" |
26 #include "hsapp_defs.h" |
26 #include "hsapp_defs.h" |
27 #include "hsmenuevent.h" |
27 #include "hsmenuevent.h" |
28 #include "hsviewappsettingsstate.h" |
28 #include "hsviewappsettingsstate.h" |
|
29 #include "hsmenuentryremovedhandler.h" |
29 #include "caentry.h" |
30 #include "caentry.h" |
30 #include "canotifier.h" |
31 #include "canotifier.h" |
31 #include "canotifierfilter.h" |
32 #include "canotifierfilter.h" |
32 |
33 |
33 #include "hsmenuservice.h" |
34 #include "hsmenuservice.h" |
107 |
103 |
108 const int entryId = data.value(itemIdKey()).toInt(); |
104 const int entryId = data.value(itemIdKey()).toInt(); |
109 QSharedPointer<const CaEntry> entry = CaService::instance()->getEntry(entryId); |
105 QSharedPointer<const CaEntry> entry = CaService::instance()->getEntry(entryId); |
110 |
106 |
111 QString pluginPath; |
107 QString pluginPath; |
112 pluginPath = pluginPath.append("/resource/qt/plugins/appsettings/").append(entry->attribute(appSettingsPlugin())).append(".qtplugin"); |
108 pluginPath = pluginPath.append("/resource/qt/plugins/appsettings/") |
|
109 .append(entry->attribute(appSettingsPlugin())).append(".qtplugin"); |
113 QPluginLoader loader(pluginPath); |
110 QPluginLoader loader(pluginPath); |
114 mView = qobject_cast<HbView *>(loader.instance()); |
111 mView = qobject_cast<HbView *>(loader.instance()); |
115 |
112 |
116 mActionConfirm = new HbAction(Hb::ConfirmNaviAction, mView); |
113 mActionConfirm = new HbAction(Hb::ConfirmNaviAction, mView); |
117 connect(mActionConfirm, SIGNAL(triggered()),SLOT(settingsDone())); |
114 connect(mActionConfirm, SIGNAL(triggered()), SIGNAL(exit())); |
118 |
115 |
119 if (mView) { |
116 if (mView) { |
120 subscribeForMemoryCardRemove(entryId); |
117 QScopedPointer<HsMenuEntryRemovedHandler> entryObserver( |
|
118 new HsMenuEntryRemovedHandler(entryId, this, SIGNAL(exit()))); |
|
119 |
|
120 entryObserver.take()->setParent(mView); |
|
121 |
121 QObject::connect(this, SIGNAL(initialize(QString)), mView, SLOT(initialize(QString))); |
122 QObject::connect(this, SIGNAL(initialize(QString)), mView, SLOT(initialize(QString))); |
122 mView->setParent(this); |
123 mView->setParent(this); |
123 emit initialize(entry->attribute(applicationUidEntryKey())); |
124 emit initialize(entry->attribute(applicationUidEntryKey())); |
124 // Add View to main window |
125 // Add View to main window |
125 HbMainWindow *hbMainWindow = mainWindow(); |
126 HbMainWindow *hbMainWindow = mainWindow(); |
152 #ifdef COVERAGE_MEASUREMENT |
153 #ifdef COVERAGE_MEASUREMENT |
153 #pragma CTC ENDSKIP |
154 #pragma CTC ENDSKIP |
154 #endif //COVERAGE_MEASUREMENT |
155 #endif //COVERAGE_MEASUREMENT |
155 |
156 |
156 |
157 |
157 /*! |
|
158 Invoked when plugin view exits |
|
159 */ |
|
160 void HsViewAppSettingsState::settingsDone() |
|
161 { |
|
162 emit exit(); |
|
163 } |
|
164 |
|
165 /*! |
|
166 Subscribe for memory card remove. |
|
167 \param entryId: entry id. |
|
168 \retval void |
|
169 */ |
|
170 void HsViewAppSettingsState::subscribeForMemoryCardRemove(int entryId) |
|
171 { |
|
172 CaNotifierFilter filter; |
|
173 QList<int> entryIds; |
|
174 entryIds.append(entryId); |
|
175 filter.setIds(entryIds); |
|
176 mNotifier = CaService::instance()->createNotifier(filter); |
|
177 mNotifier->setParent(this); |
|
178 connect(mNotifier, |
|
179 SIGNAL(entryChanged(CaEntry,ChangeType)), |
|
180 SLOT(settingsDone())); |
|
181 } |
|
182 |
|
183 void HsViewAppSettingsState::onExit(QEvent *event) |
158 void HsViewAppSettingsState::onExit(QEvent *event) |
184 { |
159 { |
185 |
160 |
186 QState::onExit(event); |
161 QState::onExit(event); |
187 // Remove mView from main window and restore previous view. |
162 // Remove mView from main window and restore previous view. |
188 HbMainWindow *hbMainWindow = mainWindow(); |
163 HbMainWindow *hbMainWindow = mainWindow(); |
189 hbMainWindow->setCurrentView(mPreviousView); |
164 hbMainWindow->setCurrentView(mPreviousView); |
190 hbMainWindow->removeView(mView); |
165 hbMainWindow->removeView(mView); |
191 disconnect(mNotifier, |
166 |
192 SIGNAL(entryChanged(CaEntry,ChangeType)), |
|
193 this, |
|
194 SLOT(settingsDone())); |
|
195 delete mNotifier; |
|
196 mNotifier = NULL; |
|
197 |
167 |
198 delete mActionConfirm; |
168 delete mActionConfirm; |
199 mActionConfirm = NULL; |
169 mActionConfirm = NULL; |
200 delete mView; |
170 delete mView; |
201 mView = NULL; |
171 mView = NULL; |