diff -r 4e8ebe173323 -r 23b5d6a29cce homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsviewappsettingsstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsviewappsettingsstate.cpp Mon May 03 12:24:59 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsviewappsettingsstate.cpp Fri May 14 15:43:04 2010 +0300 @@ -33,12 +33,29 @@ #include "hsmenuservice.h" /*! - \class HsCollectionNameDialog + \class HsViewAppSettingsState \ingroup HsViewAppSettingsState \brief State for showing Application Settings HbView from provided plugin */ /*! + \var HsViewAppSettingsState::mView + View. + Owned. + */ + +/*! + \var HsViewAppSettingsState::mPreviousView + Previous view. + Not owned. + */ + +/*! + \var HsViewAppSettingsState::mActionConfirm + Confirm action. Owned. + */ + +/*! Constructor \param parent: parent state \retval void @@ -54,9 +71,9 @@ construct(); } -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// +/*! + Constructs contained objects. + */ void HsViewAppSettingsState::construct() { setObjectName(this->parent()->objectName() @@ -89,17 +106,6 @@ const int entryId = data.value(itemIdKey()).toInt(); QSharedPointer entry = CaService::instance()->getEntry(entryId); - if(mView) - { - - delete mActionConfirm; - mActionConfirm = NULL; - - delete mView; - mView = NULL; - - } - QString pluginPath(entry->attribute(appSettingsPlugin())); QPluginLoader loader(pluginPath); mView = qobject_cast(loader.instance()); @@ -133,6 +139,10 @@ #ifdef COVERAGE_MEASUREMENT #pragma CTC SKIP #endif //COVERAGE_MEASUREMENT +/*! + Returns pointer to tha main window. + \return Pointer to the main window. + */ HbMainWindow *HsViewAppSettingsState::mainWindow() const { return HbInstance::instance()->allMainWindows().value(0); @@ -145,16 +155,12 @@ #ifdef COVERAGE_MEASUREMENT #pragma CTC SKIP #endif //COVERAGE_MEASUREMENT +/*! + Invoked when plugin view exits + */ void HsViewAppSettingsState::settingsDone() { - // Remove mView from main window and restore previous view. - HbMainWindow *hbMainWindow = mainWindow(); - hbMainWindow->setCurrentView(mPreviousView); - hbMainWindow->removeView(mView); - delete mActionConfirm; - mActionConfirm = NULL; - delete mView; - mView = NULL; + emit exit(); } #ifdef COVERAGE_MEASUREMENT #pragma CTC ENDSKIP @@ -178,3 +184,23 @@ SLOT(settingsDone())); } +void HsViewAppSettingsState::onExit(QEvent *event) +{ + + QState::onExit(event); + // Remove mView from main window and restore previous view. + 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; + delete mView; + mView = NULL; +}