diff -r 2b1b11a301d2 -r 4b195f3bea29 homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsviewappsettingsstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsviewappsettingsstate.cpp Tue Jul 06 14:06:53 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsviewappsettingsstate.cpp Wed Aug 18 09:40:07 2010 +0300 @@ -14,7 +14,7 @@ * Description: Menu Application Library state. * */ - +#include #include #include #include @@ -26,6 +26,7 @@ #include "hsapp_defs.h" #include "hsmenuevent.h" #include "hsviewappsettingsstate.h" +#include "hsmenuentryremovedhandler.h" #include "caentry.h" #include "canotifier.h" #include "canotifierfilter.h" @@ -64,9 +65,7 @@ QState(parent), mView(0), mPreviousView(0), - mActionConfirm(0), - mNotifier(0) - + mActionConfirm(0) { construct(); } @@ -87,9 +86,6 @@ */ HsViewAppSettingsState::~HsViewAppSettingsState() { - if (mNotifier) { - delete mNotifier; - } } /*! @@ -109,16 +105,20 @@ QSharedPointer entry = CaService::instance()->getEntry(entryId); QString pluginPath; - pluginPath = pluginPath.append("/resource/qt/plugins/appsettings/").append(entry->attribute(appSettingsPlugin())).append(".qtplugin"); + pluginPath = pluginPath.append("/resource/qt/plugins/appsettings/") + .append(entry->attribute(appSettingsPlugin())).append(".qtplugin"); QPluginLoader loader(pluginPath); mView = qobject_cast(loader.instance()); mActionConfirm = new HbAction(Hb::ConfirmNaviAction, mView); - connect(mActionConfirm, SIGNAL(triggered()),SLOT(settingsDone())); + connect(mActionConfirm, SIGNAL(triggered()), SIGNAL(exit())); - if(mView) - { - subscribeForMemoryCardRemove(entryId); + if (mView) { + QScopedPointer entryObserver( + new HsMenuEntryRemovedHandler(entryId, this, SIGNAL(exit()))); + + entryObserver.take()->setParent(mView); + QObject::connect(this, SIGNAL(initialize(QString)), mView, SLOT(initialize(QString))); mView->setParent(this); emit initialize(entry->attribute(applicationUidEntryKey())); @@ -132,7 +132,7 @@ mPreviousView = hbMainWindow->currentView(); hbMainWindow->setCurrentView(mView); hbMainWindow->show(); - } + } HSMENUTEST_FUNC_EXIT("HsViewAppSettingsState::onEntry"); @@ -155,32 +155,6 @@ #endif //COVERAGE_MEASUREMENT -/*! - Invoked when plugin view exits - */ -void HsViewAppSettingsState::settingsDone() -{ - emit exit(); -} - -/*! - Subscribe for memory card remove. - \param entryId: entry id. - \retval void - */ -void HsViewAppSettingsState::subscribeForMemoryCardRemove(int entryId) -{ - CaNotifierFilter filter; - QList entryIds; - entryIds.append(entryId); - filter.setIds(entryIds); - mNotifier = CaService::instance()->createNotifier(filter); - mNotifier->setParent(this); - connect(mNotifier, - SIGNAL(entryChanged(CaEntry,ChangeType)), - SLOT(settingsDone())); -} - void HsViewAppSettingsState::onExit(QEvent *event) { @@ -189,12 +163,7 @@ HbMainWindow *hbMainWindow = mainWindow(); hbMainWindow->setCurrentView(mPreviousView); hbMainWindow->removeView(mView); - disconnect(mNotifier, - SIGNAL(entryChanged(CaEntry,ChangeType)), - this, - SLOT(settingsDone())); - delete mNotifier; - mNotifier = NULL; + delete mActionConfirm; mActionConfirm = NULL;