homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hspreviewhswidgetstate.cpp
--- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hspreviewhswidgetstate.cpp Thu May 27 12:46:08 2010 +0300
+++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hspreviewhswidgetstate.cpp Fri Jun 11 13:30:16 2010 +0300
@@ -41,11 +41,9 @@
#include "canotifier.h"
#include "canotifierfilter.h"
#include "caservice.h"
-
#include "hsdomainmodel_global.h"
#include <hscontentservice.h>
-
const char HS_PREVIEW_HS_WIDGET_STATE[] = "HsPreviewHSWidgetState";
/*!
@@ -147,13 +145,13 @@
mScrollArea->setContentWidget(mWidget); // ownership transferred
subscribeForMemoryCardRemove();
- mWidget->initializeWidget();
- mWidget->showWidget();
+ mWidget->startWidget();
// Launch popup asyncronously
mPopupDialog->open(this, SLOT(previewDialogFinished(HbAction*)));
}
} else {
+ subscribeForMemoryCardRemove();
showMessageWidgetCorrupted();
}
@@ -169,73 +167,54 @@
*/
void HsPreviewHSWidgetState::cleanUp()
{
- // Close popups if App key was pressed
+ // Close popups if App key was pressed or memory card removed
if (mPopupDialog) {
+ disconnect(mPopupDialog, SIGNAL(finished(HbAction*)), this, SLOT(previewDialogFinished(HbAction*)));
mPopupDialog->close();
+ mPopupDialog = NULL;
}
if (mCorruptedMessage) {
+ disconnect(mCorruptedMessage, SIGNAL(finished(HbAction*)), this, SLOT(messageWidgetCorruptedFinished(HbAction*)));
mCorruptedMessage->close();
+ mCorruptedMessage = NULL;
}
- mPopupDialog = NULL;
mScrollArea = NULL;
mWidget = NULL;
- mCorruptedMessage = NULL;
disconnect(mNotifier,
SIGNAL(entryChanged(CaEntry,ChangeType)),
- this, SLOT(memoryCardRemoved()));
+ this, SIGNAL(exit()));
delete mNotifier;
mNotifier = NULL;
}
/*!
- Memory card with instaled widget was removed.
- \retval void
- */
-void HsPreviewHSWidgetState::memoryCardRemoved()
-{
- if (mPopupDialog) {
- mPopupDialog->close();
- }
- // exit not needed, it is called after dialog closed
-
-}
-
-/*!
Slot launched on dismissing the preview dialog
\retval void
*/
void HsPreviewHSWidgetState::previewDialogFinished(HbAction* finishedAction)
{
- if (mPopupDialog != NULL) {
- // (work-around for crash if more then one action is selected in HbDialog)
- if (finishedAction == mPopupDialog->actions().value(0)) {
- mWidget->hideWidget();
+ if (finishedAction == mPopupDialog->actions().value(0)) {
+ mWidget->hideWidget();
+ mScrollArea->takeContentWidget();
+ HsScene::instance()->activePage()->addNewWidget(
+ mWidget); // ownership transferred
+ HbNotificationDialog *notificationDialog = new HbNotificationDialog();
+ notificationDialog->setAttribute(Qt::WA_DeleteOnClose);
+ notificationDialog->setTitle(hbTrId(
+ "txt_applib_dpophead_added_to_homescreen") );
+ notificationDialog->show();
+ } else {
mScrollArea->takeContentWidget();
- HsScene::instance()->activePage()->addNewWidget(
- mWidget); // ownership transferred
- HbNotificationDialog *notificationDialog = new HbNotificationDialog();
- notificationDialog->setAttribute(Qt::WA_DeleteOnClose);
- notificationDialog->setTitle(hbTrId(
- "txt_applib_dpophead_added_to_homescreen") );
- notificationDialog->show();
- } else {
- mWidget->uninitializeWidget();
- mWidget->deleteFromDatabase();
- }
- mPopupDialog = NULL;
- emit exit();
- } else {
- // (work-around for crash if more then one action is selected in HbDialog)
- qWarning("Another signal finished was emited.");
+ mWidget->remove();
+ mWidget = NULL;
}
+ emit exit();
}
-
-
/*!
Subscribe for memory card remove.
\retval void
@@ -250,10 +229,9 @@
mNotifier->setParent(this);
connect(mNotifier,
SIGNAL(entryChanged(CaEntry,ChangeType)),
- SLOT(memoryCardRemoved()));
+ SIGNAL(exit()));
}
-
/*!
Shows message about corrupted widget library. Deletes widget eventually
\retval void
@@ -271,9 +249,9 @@
QString message(hbTrId("txt_applib_dialog_file_corrupted_unable_to_use_wi"));
mCorruptedMessage->setText(message);
- mCorruptedMessage->clearActions();
+ mCorruptedMessage->clearActions();
HbAction *primaryAction = new HbAction(hbTrId("txt_common_button_ok"), mCorruptedMessage);
- mCorruptedMessage->addAction(primaryAction);
+ mCorruptedMessage->addAction(primaryAction);
HbAction *secondaryAction = new HbAction(hbTrId("txt_common_button_cancel"), mCorruptedMessage);
mCorruptedMessage->addAction(secondaryAction);
@@ -291,14 +269,8 @@
*/
void HsPreviewHSWidgetState::messageWidgetCorruptedFinished(HbAction* finishedAction)
{
- if (mCorruptedMessage) {
- if (finishedAction == mCorruptedMessage->actions().value(0)) {
- HsMenuService::executeAction(mEntryId, removeActionIdentifier());
- }
- mCorruptedMessage = NULL;
- emit exit();
- } else {
- // (work-around for crash if more then one action is selected in HbDialog)
- qWarning("Another signal finished was emited.");
+ if (finishedAction == mCorruptedMessage->actions().value(0)) {
+ HsMenuService::executeAction(mEntryId, removeActionIdentifier());
}
+ emit exit();
}