diff -r 2e2dc3d30ca8 -r 341166945d65 homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsviewappdetailsstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsviewappdetailsstate.cpp Thu Jun 24 13:11:40 2010 +0100 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsviewappdetailsstate.cpp Fri Jun 25 19:19:22 2010 +0300 @@ -31,12 +31,20 @@ #include "hsmenuevent.h" #include "hsmenuitemmodel.h" + +/*! + Constructor. + @param parent Parent state. + */ HsViewAppDetailsState::HsViewAppDetailsState(QState *parent) : QState(parent), mDialog(0), mNotifier(0) { construct(); } +/*! + Destructor + */ HsViewAppDetailsState::~HsViewAppDetailsState() { if (mDialog) { @@ -44,14 +52,23 @@ } } +/*! + Construction + */ void HsViewAppDetailsState::construct() { HSMENUTEST_FUNC_ENTRY("HsViewAppDetailsState::construct"); - setObjectName(this->parent()->objectName() - + "/ViewAppDetailsState"); + + setObjectName("/ViewAppDetailsState"); + if (this->parent()) { + setObjectName(this->parent()->objectName() + objectName()); + } HSMENUTEST_FUNC_EXIT("HsViewAppDetailsState::construct"); } +/*! + Invoked on entering state + */ void HsViewAppDetailsState::onEntry(QEvent *event) { HSMENUTEST_FUNC_ENTRY("HsViewAppDetailsState::onEntry"); @@ -60,50 +77,61 @@ QVariantMap data = menuEvent->data(); const int entryId = data.value(itemIdKey()).toInt(); - QSharedPointer entry = CaService::instance()->getEntry(entryId); - const int componentId = entry->attribute(componentIdAttributeName()).toInt(); + QSharedPointer entry + = CaService::instance()->getEntry(entryId); + const int componentId = entry->attribute( + componentIdAttributeName()).toInt(); QSharedPointer scr = CaSoftwareRegistry::create(); CaSoftwareRegistry::DetailMap detailMap = scr->entryDetails(componentId); HbDocumentLoader loader; bool loadStatusOk = false; - mObjectList = - loader.load(HS_DETAILS_DIALOG_LAYOUT, &loadStatusOk); - Q_ASSERT_X(loadStatusOk, - HS_DETAILS_DIALOG_LAYOUT, + mObjectList = loader.load(HS_DETAILS_DIALOG_LAYOUT, &loadStatusOk); + Q_ASSERT_X(loadStatusOk, HS_DETAILS_DIALOG_LAYOUT, "Error while loading docml file."); - mDialog = qobject_cast(loader.findWidget(HS_DETAILS_DIALOG_NAME)); + mDialog = qobject_cast( + loader.findWidget(HS_DETAILS_DIALOG_NAME)); mDialog->actions()[0]->setParent(mDialog); subscribeForMemoryCardRemove(entryId); - HbLabel* nameLabel = qobject_cast(loader.findWidget(CaSoftwareRegistry::componentNameKey())); - HbLabel* versionLabel = qobject_cast(loader.findWidget(CaSoftwareRegistry::componentVersionKey())); - HbLabel* supplierLabel = qobject_cast(loader.findWidget(CaSoftwareRegistry::componentVendorKey())); - HbLabel* memoryLabel = qobject_cast(loader.findWidget(CaSoftwareRegistry::componentDriveInfoKey())); - HbLabel* sizeLabel = qobject_cast(loader.findWidget(CaSoftwareRegistry::componentSizeKey())); - HbLabel* typeLabel = qobject_cast(loader.findWidget(CaSoftwareRegistry::componentTypeKey())); + HbLabel* nameLabel = qobject_cast( + loader.findWidget(CaSoftwareRegistry::componentNameKey())); + HbLabel* versionLabel = qobject_cast( + loader.findWidget(CaSoftwareRegistry::componentVersionKey())); + HbLabel* supplierLabel = qobject_cast( + loader.findWidget(CaSoftwareRegistry::componentVendorKey())); + HbLabel* memoryLabel = qobject_cast( + loader.findWidget(CaSoftwareRegistry::componentDriveInfoKey())); + HbLabel* sizeLabel = qobject_cast( + loader.findWidget(CaSoftwareRegistry::componentSizeKey())); + HbLabel* typeLabel = qobject_cast( + loader.findWidget(CaSoftwareRegistry::componentTypeKey())); - nameLabel->setPlainText(detailMap[CaSoftwareRegistry::componentNameKey()]); - versionLabel->setPlainText(detailMap[CaSoftwareRegistry::componentVersionKey()]); - supplierLabel->setPlainText(detailMap[CaSoftwareRegistry::componentVendorKey()]); - memoryLabel->setPlainText(detailMap[CaSoftwareRegistry::componentDriveInfoKey()]); - sizeLabel->setPlainText(detailMap[CaSoftwareRegistry::componentSizeKey()]); - typeLabel->setPlainText(detailMap[CaSoftwareRegistry::componentTypeKey()]); + nameLabel->setPlainText( + detailMap[CaSoftwareRegistry::componentNameKey()]); + versionLabel->setPlainText( + detailMap[CaSoftwareRegistry::componentVersionKey()]); + supplierLabel->setPlainText( + detailMap[CaSoftwareRegistry::componentVendorKey()]); + memoryLabel->setPlainText( + detailMap[CaSoftwareRegistry::componentDriveInfoKey()]); + sizeLabel->setPlainText( + detailMap[CaSoftwareRegistry::componentSizeKey()]); + + typeLabel->setPlainText( + detailMap[CaSoftwareRegistry::componentTypeKey()]); if (mDialog != NULL) { mDialog->setTimeout(HbPopup::NoTimeout); mDialog->setAttribute(Qt::WA_DeleteOnClose, true); mDialog->open(this, SLOT(stateExited())); } - HSMENUTEST_FUNC_EXIT("HsViewAppDetailsState::onEntry"); } -#ifdef COVERAGE_MEASUREMENT -#pragma CTC SKIP -#endif //COVERAGE_MEASUREMENT + /*! Slot invoked when a state is exited. */ @@ -115,26 +143,20 @@ HSMENUTEST_FUNC_EXIT("HsViewAppDetailsState::stateExited"); qDebug("HsViewAppDetailsState::stateExited()"); } -#ifdef COVERAGE_MEASUREMENT -#pragma CTC ENDSKIP -#endif //COVERAGE_MEASUREMENT - -#ifdef COVERAGE_MEASUREMENT -#pragma CTC SKIP -#endif //COVERAGE_MEASUREMENT +/*! + Invoked on exiting state + */ void HsViewAppDetailsState::onExit(QEvent *event) { QState::onExit(event); - // Close popups if App key was pressed + // Close popups if App key was pressed or + // memory card removed if (mDialog) { mDialog->close(); } mDialog = NULL; } -#ifdef COVERAGE_MEASUREMENT -#pragma CTC ENDSKIP -#endif //COVERAGE_MEASUREMENT /*! Subscribe for memory card remove. @@ -151,25 +173,5 @@ mNotifier->setParent(this); connect(mNotifier, SIGNAL(entryChanged(CaEntry,ChangeType)), - SLOT(memoryCardRemoved())); + SIGNAL(exit())); } - -#ifdef COVERAGE_MEASUREMENT -#pragma CTC SKIP -#endif //COVERAGE_MEASUREMENT -/*! - Memory card with instaled widget was removed. - \retval void - */ -void HsViewAppDetailsState::memoryCardRemoved() -{ - if (mDialog) { - mDialog->close(); - } - // exit not needed, it is called after dialog closed - -} -#ifdef COVERAGE_MEASUREMENT -#pragma CTC ENDSKIP -#endif //COVERAGE_MEASUREMENT -