diff -r 30f14686fb04 -r 2b1b11a301d2 homescreenapp/runtimeplugins/hsdefaultruntimeplugin/src/hsdefaultruntime.cpp --- a/homescreenapp/runtimeplugins/hsdefaultruntimeplugin/src/hsdefaultruntime.cpp Wed Jun 23 18:03:36 2010 +0300 +++ b/homescreenapp/runtimeplugins/hsdefaultruntimeplugin/src/hsdefaultruntime.cpp Tue Jul 06 14:06:53 2010 +0300 @@ -44,6 +44,7 @@ #include "hswidgetpositioningonwidgetadd.h" #include "hsconfiguration.h" #include "hstest_global.h" +#include "hswidgetpositioningonwidgetmove.h" QTM_USE_NAMESPACE #define hbApp qobject_cast(qApp) @@ -82,9 +83,9 @@ HsDefaultRuntime::HsDefaultRuntime(QObject *parent) : QStateMachine(parent), mContentService(0), - mHomeScreenActive(false), - mIdleStateActive(false), - mPublisher(NULL) + mHomeScreenActive(false), + mIdleStateActive(false), + mPublisher(NULL) #ifdef Q_OS_SYMBIAN ,keyCapture() #endif @@ -110,23 +111,26 @@ HsWidgetPositioningOnWidgetAdd::setInstance( new HsAnchorPointInBottomRight); + HsWidgetPositioningOnWidgetMove::setInstance( + new HsSnapToLines); + registerAnimations(); createStatePublisher(); createContentServiceParts(); createStates(); assignServices(); - + // create the instance so that singleton is accessible from elsewhere HsShortcutService::instance(this); - + QCoreApplication::instance()->installEventFilter(this); if (hbApp) { // Qt test framework uses QApplication. - connect(hbApp->activityManager(), SIGNAL(activityRequested(QString)), - this, SLOT(activityRequested(QString))); + connect(hbApp->activityManager(), SIGNAL(activityRequested(QString)), + this, SLOT(activityRequested(QString))); } - HSTEST_FUNC_EXIT("HS::HsDefaultRuntime::HsDefaultRuntime"); + HSTEST_FUNC_EXIT("HS::HsDefaultRuntime::HsDefaultRuntime"); } /*! @@ -135,7 +139,7 @@ HsDefaultRuntime::~HsDefaultRuntime() { HsWidgetPositioningOnOrientationChange::setInstance(0); - delete mPublisher; + delete mPublisher; } /*! @@ -151,34 +155,34 @@ Q_UNUSED(watched); switch (event->type()) { - case QEvent::ApplicationActivate: + case QEvent::ApplicationActivate: qDebug() << "HsDefaultRuntime::eventFilter: QEvent::ApplicationActivate"; #ifdef Q_OS_SYMBIAN - keyCapture.captureKey(applicationKey); + keyCapture.captureKey(applicationKey); #endif mHomeScreenActive = true; updatePSKeys(); break; - case QEvent::ApplicationDeactivate: + case QEvent::ApplicationDeactivate: qDebug() << "HsDefaultRuntime::eventFilter: QEvent::ApplicationDeactivate"; #ifdef Q_OS_SYMBIAN - keyCapture.cancelCaptureKey(applicationKey); + keyCapture.cancelCaptureKey(applicationKey); #endif - mHomeScreenActive = false; + mHomeScreenActive = false; updatePSKeys(); break; default: break; - } + } bool result = QStateMachine::eventFilter(watched, event); // temporary hack as we should not register twice for events - if (event->type() == QEvent::KeyPress ) { + if (event->type() == QEvent::KeyPress ) { QKeyEvent* ke = static_cast(event); // Key_Launch0 should be removed when QT starts to send Key_Menu result = (ke->key() == applicationKey) || ke->key() == Qt::Key_Launch0; - } - return result; + } + return result; } @@ -275,8 +279,14 @@ QState *menuWorkerState = qobject_cast(menuWorkerStateObj); menuWorkerState->setParent(menuParallelState); menuWorkerState->setObjectName(KHsMenuWorkerStateInterface); + connect(appLibraryState, SIGNAL(collectionEntered()), menuWorkerState, SIGNAL(reset())); + connect(appLibraryState, SIGNAL(allAppsStateEntered ()), + menuWorkerState, SIGNAL(reset())); + connect(appLibraryState, SIGNAL(allCollectionsStateEntered ()), + menuWorkerState, SIGNAL(reset())); + //Backup/Restore state QObject *backupRestoreStateObj = manager.loadInterface(KHsBacupRestoreStateInterface); QState *backupRestoreState = qobject_cast(backupRestoreStateObj); @@ -329,7 +339,9 @@ window, QEvent::KeyPress, Qt::Key_Launch0); menuToIdleTransition2->setTargetState(idleState); menuRootState->addTransition(menuToIdleTransition2); - + // add transition to switch to idle + menuRootState->addTransition( this, SIGNAL(event_toIdle()), idleState); + // transitions to child states // opening shortcut to a colleciton QList collectionStates = @@ -421,8 +433,15 @@ */ void HsDefaultRuntime::activityRequested(const QString &name) { - if (name == groupAppLibRecentView()){ - this->postEvent(HsMenuEventFactory::createOpenCollectionEvent(0, - collectionDownloadedTypeName())); + if (name == appLibActivity()) { + this->postEvent( + HsMenuEventFactory::createOpenAppLibraryEvent(NormalHsMenuMode)); + } + else if (name == groupAppLibRecentView()) { + this->postEvent( + HsMenuEventFactory::createOpenCollectionEvent(0, + collectionDownloadedTypeName())); + } else if (name == activityHsIdleView()) { + emit event_toIdle(); } }