--- a/homescreenapp/stateplugins/hshomescreenstateplugin/src/hsloadscenestate.cpp Thu May 27 12:46:08 2010 +0300
+++ b/homescreenapp/stateplugins/hshomescreenstateplugin/src/hsloadscenestate.cpp Fri Jun 11 13:30:16 2010 +0300
@@ -16,6 +16,10 @@
*/
#include <HbMainWindow>
+#ifdef Q_OS_SYMBIAN
+#include <XQSettingsManager>
+#include <startupdomainpskeys.h>
+#endif
#include "hsloadscenestate.h"
#include "hsscene.h"
@@ -32,8 +36,17 @@
*/
HsLoadSceneState::HsLoadSceneState(QState *parent)
: QState(parent)
+#ifdef Q_OS_SYMBIAN
+ ,mStartupKey(KPSUidStartup.iUid, KPSStartupUiPhase),
+ mSettingsMgr(0)
+#endif
{
connect(this, SIGNAL(entered()), SLOT(action_loadScene()));
+#ifdef Q_OS_SYMBIAN
+
+ mSettingsMgr = new XQSettingsManager(this);
+
+#endif //Q_OS_SYMBIAN
}
/*!
@@ -55,6 +68,63 @@
void HsLoadSceneState::action_loadScene()
{
HsScene::instance()->load();
+
+#ifdef Q_OS_SYMBIAN
+
+ int startupPhase = mSettingsMgr->readItemValue(mStartupKey).toInt();
+ qDebug() << "HsLoadSceneState::action_loadScene boot phase " << startupPhase;
+
+ if (EStartupUiPhaseAllDone != startupPhase) {
+ qDebug() << "HsLoadSceneState::HsLoadSceneState, starting to listen key";
+
+ connect(mSettingsMgr,SIGNAL(valueChanged(XQSettingsKey, const QVariant &)), this,
+ SLOT(handleKeyChange(XQSettingsKey, const QVariant &)));
+
+ mSettingsMgr->startMonitoring(mStartupKey);
+ } else {
+ // We're already at the phase in boot where we can draw ourself to the foreground.
+ showUi();
+ delete mSettingsMgr;
+ mSettingsMgr = 0;
+ }
+
+#else
+
+ showUi();
+
+#endif
+}
+#ifdef Q_OS_SYMBIAN
+/*!
+ \fn HsLoadSceneState::handleKeyChange()
+
+ Handles the key change. Activates hs ui when appropriate.
+*/
+
+void HsLoadSceneState::handleKeyChange(XQSettingsKey key, const QVariant &value)
+{
+ qDebug() << "HsLoadSceneState::handleKeyChange key " << key.key()
+ << "value " << value.toInt();
+
+ if (key.key() == KPSStartupUiPhase && value.toInt() == EStartupUiPhaseAllDone) {
+ showUi();
+ mSettingsMgr->stopMonitoring(mStartupKey);
+ mSettingsMgr->deleteLater();
+ mSettingsMgr = 0;
+ }
+}
+#endif
+/*!
+ \fn HsLoadSceneState::showUi()
+
+ Makes the main window visible, signals transition to idle state and
+ brings the hs app to the foreground.
+*/
+
+void HsLoadSceneState::showUi()
+{
+ qDebug() << "HsLoadSceneState::showUi";
+ HsScene::mainWindow()->raise();
HsScene::mainWindow()->show();
emit event_history();
}