# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1276252216 -10800 # Node ID 03646e8da489d883fdcb5d0acc8b159663ba3ba5 # Parent 4785f57bf3d4c842c75f642d6eeca6052b16665b Revision: 201021 Kit: 2010123 diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsapplication/conf/base/confml/homescreendb.confml --- a/homescreenapp/hsapplication/conf/base/confml/homescreendb.confml Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsapplication/conf/base/confml/homescreendb.confml Fri Jun 11 13:30:16 2010 +0300 @@ -3,14 +3,6 @@ - - - - - - - - @@ -73,18 +65,22 @@ + + + + + + + + + + - 8 - 39 - 48 - 8.75 - 8.75 - 1hsclockwidgetplugin 2hsdialerwidgetplugin 3ftuhswidget @@ -163,6 +159,14 @@ 200 200 3 + 8 + 39 + 48 + 8.75 + 8.75 + + 1 + 17.91 diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsapplication/conf/base/implml/homescreendb_templates/create.sql --- a/homescreenapp/hsapplication/conf/base/implml/homescreendb_templates/create.sql Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsapplication/conf/base/implml/homescreendb_templates/create.sql Fri Jun 11 13:30:16 2010 +0300 @@ -2,13 +2,7 @@ CREATE TABLE Scene ( id INTEGER PRIMARY KEY, portraitWallpaper TEXT, - landscapeWallpaper TEXT, - defaultPageId INTEGER, - maximumPageCount INTEGER, - maximumWidgetHeight REAL, - maximumWidgetWidth REAL, - minimumWidgetHeight REAL, - minimumWidgetWidth REAL); + landscapeWallpaper TEXT); DROP TABLE IF EXISTS Pages; CREATE TABLE Pages ( @@ -76,5 +70,13 @@ newPageAddedAnimationDuration INTEGER, widgetDragEffectDuration INTEGER, widgetDropEffectDuration INTEGER, - boundaryFeedbackEffectDistance INTEGER); + boundaryFeedbackEffectDistance INTEGER, + defaultPageId INTEGER, + maximumPageCount INTEGER, + maximumWidgetHeight REAL, + maximumWidgetWidth REAL, + minimumWidgetHeight REAL, + minimumWidgetWidth REAL, + shortcutLabelsVisible INTEGER, + pageChangePanDistance REAL); \ No newline at end of file diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsapplication/conf/base/implml/homescreendb_templates/fill.sql --- a/homescreenapp/hsapplication/conf/base/implml/homescreendb_templates/fill.sql Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsapplication/conf/base/implml/homescreendb_templates/fill.sql Fri Jun 11 13:30:16 2010 +0300 @@ -1,12 +1,6 @@ {%- set portraitWallpaper = feat_tree.HomeScreenDbSettings.portraitWallpaper._value or '' -%} {%- set landscapeWallpaper = feat_tree.HomeScreenDbSettings.landscapeWallpaper._value or '' -%} -{%- set defaultPageId = feat_tree.HomeScreenDbSettings.defaultPageId._value -%} -{%- set maximumPageCount = feat_tree.HomeScreenDbSettings.maximumPageCount._value -%} -{%- set maximumWidgetHeight = feat_tree.HomeScreenDbSettings.maximumWidgetHeight._value -%} -{%- set maximumWidgetWidth = feat_tree.HomeScreenDbSettings.maximumWidgetWidth._value -%} -{%- set minimumWidgetHeight = feat_tree.HomeScreenDbSettings.minimumWidgetHeight._value -%} -{%- set minimumWidgetWidth = feat_tree.HomeScreenDbSettings.minimumWidgetWidth._value -%} -INSERT INTO Scene (portraitWallpaper, landscapeWallpaper, defaultPageId, maximumPageCount, maximumWidgetHeight, maximumWidgetWidth, minimumWidgetHeight, minimumWidgetWidth) VALUES ('{{portraitWallpaper}}', '{{landscapeWallpaper}}', {{defaultPageId}}, {{maximumPageCount}}, {{maximumWidgetHeight}}, {{maximumWidgetWidth}}, {{minimumWidgetHeight}}, {{minimumWidgetWidth}}); +INSERT INTO Scene (portraitWallpaper, landscapeWallpaper) VALUES ('{{portraitWallpaper}}', '{{landscapeWallpaper}}'); {% for index in range(feat_tree.HomeScreenDbSettings.Pages._value|length) -%} {%- set id = feat_tree.HomeScreenDbSettings.Pages.id._value[index] -%} @@ -62,7 +56,15 @@ {%- set widgetDragEffectDuration = feat_tree.HomeScreenDbSettings.GeneralConfiguration.widgetDragEffectDuration._value -%} {%- set widgetDropEffectDuration = feat_tree.HomeScreenDbSettings.GeneralConfiguration.widgetDropEffectDuration._value -%} {%- set boundaryFeedbackEffectDistance = feat_tree.HomeScreenDbSettings.GeneralConfiguration.boundaryFeedbackEffectDistance._value -%} -INSERT INTO GeneralConfiguration (bounceEffect, tapAndHoldDistance, widgetTapAndHoldTimeout, sceneTapAndHoldTimeout, pageChangeZoneWidth, pageIndicatorSpacing, pageChangeAnimationDuration, pageChangeZoneAnimationDuration, pageChangeZoneReverseAnimationDuration, pageRemovedAnimationDuration, newPageAddedAnimationDuration, widgetDragEffectDuration, widgetDropEffectDuration, boundaryFeedbackEffectDistance ) VALUES ({{bounceEffect}}, {{tapAndHoldDistance}}, {{widgetTapAndHoldTimeout}}, {{widgetTapAndHoldTimeout}}, {{pageChangeZoneWidth}}, {{pageIndicatorSpacing}}, {{pageChangeAnimationDuration}}, {{pageChangeZoneAnimationDuration}}, {{pageChangeZoneReverseAnimationDuration}}, {{pageRemovedAnimationDuration}}, {{newPageAddedAnimationDuration}}, {{widgetDragEffectDuration}}, {{widgetDropEffectDuration}}, {{boundaryFeedbackEffectDistance}}); +{%- set defaultPageId = feat_tree.HomeScreenDbSettings.GeneralConfiguration.defaultPageId._value -%} +{%- set maximumPageCount = feat_tree.HomeScreenDbSettings.GeneralConfiguration.maximumPageCount._value -%} +{%- set maximumWidgetHeight = feat_tree.HomeScreenDbSettings.GeneralConfiguration.maximumWidgetHeight._value -%} +{%- set maximumWidgetWidth = feat_tree.HomeScreenDbSettings.GeneralConfiguration.maximumWidgetWidth._value -%} +{%- set minimumWidgetHeight = feat_tree.HomeScreenDbSettings.GeneralConfiguration.minimumWidgetHeight._value -%} +{%- set minimumWidgetWidth = feat_tree.HomeScreenDbSettings.GeneralConfiguration.minimumWidgetWidth._value -%} +{%- set shortcutLabelsVisible = feat_tree.HomeScreenDbSettings.GeneralConfiguration.shortcutLabelsVisible._value -%} +{%- set pageChangePanDistance = feat_tree.HomeScreenDbSettings.GeneralConfiguration.pageChangePanDistance._value -%} +INSERT INTO GeneralConfiguration (bounceEffect, tapAndHoldDistance, widgetTapAndHoldTimeout, sceneTapAndHoldTimeout, pageChangeZoneWidth, pageIndicatorSpacing, pageChangeAnimationDuration, pageChangeZoneAnimationDuration, pageChangeZoneReverseAnimationDuration, pageRemovedAnimationDuration, newPageAddedAnimationDuration, widgetDragEffectDuration, widgetDropEffectDuration, boundaryFeedbackEffectDistance, defaultPageId, maximumPageCount, maximumWidgetHeight, maximumWidgetWidth, minimumWidgetHeight, minimumWidgetWidth, shortcutLabelsVisible, pageChangePanDistance) VALUES ({{bounceEffect}}, {{tapAndHoldDistance}}, {{widgetTapAndHoldTimeout}}, {{widgetTapAndHoldTimeout}}, {{pageChangeZoneWidth}}, {{pageIndicatorSpacing}}, {{pageChangeAnimationDuration}}, {{pageChangeZoneAnimationDuration}}, {{pageChangeZoneReverseAnimationDuration}}, {{pageRemovedAnimationDuration}}, {{newPageAddedAnimationDuration}}, {{widgetDragEffectDuration}}, {{widgetDropEffectDuration}}, {{boundaryFeedbackEffectDistance}}, {{defaultPageId}}, {{maximumPageCount}}, {{maximumWidgetHeight}}, {{maximumWidgetWidth}}, {{minimumWidgetHeight}}, {{minimumWidgetWidth}}, {{shortcutLabelsVisible}}, {{pageChangePanDistance}}); {%- set pageChangeFeedbackType = feat_tree.HomeScreenDbSettings.FeedbackConfiguration.pageChangeFeedbackType._value -%} {%- set widgetPickFeedbackType = feat_tree.HomeScreenDbSettings.FeedbackConfiguration.widgetPickFeedbackType._value -%} diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsapplication/hsapplication_fallbacktheme.qrc --- a/homescreenapp/hsapplication/hsapplication_fallbacktheme.qrc Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsapplication/hsapplication_fallbacktheme.qrc Fri Jun 11 13:30:16 2010 +0300 @@ -1,13 +1,5 @@ - themes/icons/hbdefault/scalable/qtg_mono_applications_all.svg - themes/icons/hbdefault/scalable/qtg_mono_applications_collections.svg - themes/icons/hbdefault/scalable/qtg_mono_search.svg - themes/icons/hbdefault/scalable/qtg_mono_ovistore.svg - themes/icons/hbdefault/scalable/qtg_large_applications_download.svg - themes/icons/hbdefault/scalable/qtg_large_applications_user.svg - themes/icons/hbdefault/scalable/qtg_large_super_new.svg - themes/icons/hbdefault/scalable/qtg_graf_hspage_normal.svg themes/icons/hbdefault/scalable/qtg_graf_hspage_highlight.svg themes/icons/hbdefault/scalable/hs_shortcut_bg.svg diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsapplication/resource_s60/d_landscape.png Binary file homescreenapp/hsapplication/resource_s60/d_landscape.png has changed diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsapplication/resource_s60/d_portrait.png Binary file homescreenapp/hsapplication/resource_s60/d_portrait.png has changed diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsapplication/resource_s60/homescreen.db Binary file homescreenapp/hsapplication/resource_s60/homescreen.db has changed diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsapplication/resource_win/d_landscape.png Binary file homescreenapp/hsapplication/resource_win/d_landscape.png has changed diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsapplication/resource_win/d_portrait.png Binary file homescreenapp/hsapplication/resource_win/d_portrait.png has changed diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsapplication/resource_win/homescreen.db Binary file homescreenapp/hsapplication/resource_win/homescreen.db has changed diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsapplication/themes/icons/hbdefault/scalable/qtg_large_applications_download.svg --- a/homescreenapp/hsapplication/themes/icons/hbdefault/scalable/qtg_large_applications_download.svg Thu May 27 12:46:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsapplication/themes/icons/hbdefault/scalable/qtg_large_applications_user.svg --- a/homescreenapp/hsapplication/themes/icons/hbdefault/scalable/qtg_large_applications_user.svg Thu May 27 12:46:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsapplication/themes/icons/hbdefault/scalable/qtg_large_super_new.svg --- a/homescreenapp/hsapplication/themes/icons/hbdefault/scalable/qtg_large_super_new.svg Thu May 27 12:46:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsapplication/themes/icons/hbdefault/scalable/qtg_mono_applications_all.svg --- a/homescreenapp/hsapplication/themes/icons/hbdefault/scalable/qtg_mono_applications_all.svg Thu May 27 12:46:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ - - - - - - - - - diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsapplication/themes/icons/hbdefault/scalable/qtg_mono_applications_collections.svg --- a/homescreenapp/hsapplication/themes/icons/hbdefault/scalable/qtg_mono_applications_collections.svg Thu May 27 12:46:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ - - - - - - - - - - - diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsapplication/themes/icons/hbdefault/scalable/qtg_mono_ovistore.svg --- a/homescreenapp/hsapplication/themes/icons/hbdefault/scalable/qtg_mono_ovistore.svg Thu May 27 12:46:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ - - - - - - - - - - - diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsapplication/themes/icons/hbdefault/scalable/qtg_mono_search.svg --- a/homescreenapp/hsapplication/themes/icons/hbdefault/scalable/qtg_mono_search.svg Thu May 27 12:46:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - - diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/inc/hsbackuprestoreobserver.h --- a/homescreenapp/hsdomainmodel/inc/hsbackuprestoreobserver.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/inc/hsbackuprestoreobserver.h Fri Jun 11 13:30:16 2010 +0300 @@ -63,7 +63,7 @@ bool mBUROngoing; - static QScopedPointer mInstance; + static HsBackupRestoreObserver *mInstance; #ifdef Q_OS_SYMBIAN friend class HsBackupRestoreObserverPrivate; #endif //Q_OS_SYMBIAN diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/inc/hsconfiguration.h --- a/homescreenapp/hsdomainmodel/inc/hsconfiguration.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/inc/hsconfiguration.h Fri Jun 11 13:30:16 2010 +0300 @@ -20,8 +20,10 @@ #include +#include +#include + #include "hsdomainmodel_global.h" -#include class HsGeneralConfiguration; class HsFeedbackConfiguration; @@ -36,11 +38,11 @@ static void loadConfiguration(); static inline int bounceEffect() { return mBounceEffect; }; - static inline int tapAndHoldDistance() { return mTapAndHoldDistance; }; + static inline qreal tapAndHoldDistance() { return mTapAndHoldDistance; }; static inline int widgetTapAndHoldTimeout() { return mWidgetTapAndHoldTimeout; }; static inline int sceneTapAndHoldTimeout() { return mSceneTapAndHoldTimeout; }; - static inline int pageChangeZoneWidth() { return mPageChangeZoneWidth; }; - static inline int pageIndicatorSpacing() { return mPageIndicatorSpacing; }; + static inline qreal pageChangeZoneWidth() { return mPageChangeZoneWidth; }; + static inline qreal pageIndicatorSpacing() { return mPageIndicatorSpacing; }; static inline int pageChangeAnimationDuration() { return mPageChangeAnimationDuration; }; static inline int pageChangeZoneAnimationDuration() { return mPageChangeZoneAnimationDuration; }; static inline int pageChangeZoneReverseAnimationDuration() { return mPageChangeZoneReverseAnimationDuration; }; @@ -49,6 +51,15 @@ static inline int widgetDragEffectDuration() { return mWidgetDragEffectDuration; }; static inline int widgetDropEffectDuration() { return mWidgetDropEffectDuration; }; static inline int bounceFeedbackEffectDistance() { return mBounceFeedbackEffectDistance; }; + static inline int defaultPageId() { return mDefaultPageId; }; + static inline int maximumPageCount() { return mMaximumPageCount; }; + static inline qreal maximumWidgetHeight() { return mMaximumWidgetHeight; }; + static inline qreal maximumWidgetWidth() { return mMaximumWidgetWidth; }; + static inline qreal minimumWidgetHeight() { return mMinimumWidgetHeight; }; + static inline qreal minimumWidgetWidth() { return mMinimumWidgetWidth; }; + static inline bool shortcutLabelsVisible() { return mShortcutLabelsVisible; }; + static inline qreal pageChangePanDistance() { return mPageChangePanDistance; }; + static inline int pageChangePanDistanceInPixels() { return mPageChangePanDistanceInPixels; }; static inline HbFeedback::InstantEffect pageChangeFeedbackType() { return mPageChangeFeedbackType; }; static inline HbFeedback::InstantEffect widgetPickFeedbackType() { return mWidgetPickFeedbackType; }; @@ -69,11 +80,11 @@ // setters should be removed before code is released to SF static void setBounceEffect(int bounceEffect) { mBounceEffect = bounceEffect; }; - static void setTapAndHoldDistance(int tapAndHoldDistance) { mTapAndHoldDistance = tapAndHoldDistance; }; + static void setTapAndHoldDistance(qreal tapAndHoldDistance) { mTapAndHoldDistance = tapAndHoldDistance; }; static void setWidgetTapAndHoldTimeout(int tapAndHoldTimeout) { mWidgetTapAndHoldTimeout = tapAndHoldTimeout; }; static void setSceneTapAndHoldTimeout(int tapAndHoldTimeout) { mSceneTapAndHoldTimeout = tapAndHoldTimeout; }; - static void setPageChangeZoneWidth(int pageChangeZoneWidth) { mPageChangeZoneWidth = pageChangeZoneWidth; }; - static void setPageIndicatorSpacing(int pageIndicatorSpacing) { mPageIndicatorSpacing = pageIndicatorSpacing; }; + static void setPageChangeZoneWidth(qreal pageChangeZoneWidth) { mPageChangeZoneWidth = pageChangeZoneWidth; }; + static void setPageIndicatorSpacing(qreal pageIndicatorSpacing) { mPageIndicatorSpacing = pageIndicatorSpacing; }; static void setPageChangeAnimationDuration(int pageChangeAnimationDuration) { mPageChangeAnimationDuration = pageChangeAnimationDuration; }; static void setPageChangeZoneAnimationDuration(int pageChangeZoneAnimationDuration) { mPageChangeZoneAnimationDuration = pageChangeZoneAnimationDuration; }; static void setPageChangeZoneReverseAnimationDuration(int pageChangeZoneReverseAnimationDuration) { mPageChangeZoneReverseAnimationDuration = pageChangeZoneReverseAnimationDuration; }; @@ -82,6 +93,15 @@ static void setWidgetDragEffectDuration(int widgetDragEffectDuration) { mWidgetDragEffectDuration = widgetDragEffectDuration; }; static void setWidgetDropEffectDuration(int widgetDropEffectDuration) { mWidgetDropEffectDuration = widgetDropEffectDuration; }; static void setBounceFeedbackEffectDistance(int bounceFeedbackEffectDistance) { mBounceFeedbackEffectDistance = bounceFeedbackEffectDistance; }; + static void setDefaultPageId(int defaultPageId) { mDefaultPageId = defaultPageId; }; + static void setMaximumPageCount(int maximumPageCount) { mMaximumPageCount = maximumPageCount; }; + static void setMaximumWidgetHeight(qreal maximumWidgetHeight) { mMaximumWidgetHeight = maximumWidgetHeight; }; + static void setMaximumWidgetWidth(qreal maximumWidgetWidth) { mMaximumWidgetWidth = maximumWidgetWidth; }; + static void setMinimumWidgetHeight(qreal minimumWidgetHeight) { mMinimumWidgetHeight = minimumWidgetHeight; }; + static void setMinimumWidgetWidth(qreal minimumWidgetWidth) { mMinimumWidgetWidth = minimumWidgetWidth; }; + static void setShortcutLabelsVisible(bool shortcutLabelsVisible) { mShortcutLabelsVisible = shortcutLabelsVisible; }; + static void setPageChangePanDistance(qreal pageChangePanDistance) { mPageChangePanDistance = pageChangePanDistance; + mPageChangePanDistanceInPixels = pageChangePanDistance * HbDeviceProfile::current().unitValue(); }; static void setPageChangeFeedbackType(HbFeedback::InstantEffect pageChangeFeedbackType ) { mPageChangeFeedbackType = pageChangeFeedbackType; }; static void setWidgetPickFeedbackType(HbFeedback::InstantEffect widgetPickFeedbackType ) { mWidgetPickFeedbackType = widgetPickFeedbackType; }; @@ -102,11 +122,11 @@ private: static int mBounceEffect; - static int mTapAndHoldDistance; + static qreal mTapAndHoldDistance; static int mWidgetTapAndHoldTimeout; static int mSceneTapAndHoldTimeout; - static int mPageChangeZoneWidth; - static int mPageIndicatorSpacing; + static qreal mPageChangeZoneWidth; + static qreal mPageIndicatorSpacing; static int mPageChangeAnimationDuration; static int mPageChangeZoneAnimationDuration; static int mPageChangeZoneReverseAnimationDuration; @@ -114,7 +134,16 @@ static int mNewPageAddedAnimationDuration; static int mWidgetDragEffectDuration; static int mWidgetDropEffectDuration; - static int mBounceFeedbackEffectDistance; + static int mBounceFeedbackEffectDistance; + static int mDefaultPageId; + static int mMaximumPageCount; + static qreal mMaximumWidgetHeight; + static qreal mMaximumWidgetWidth; + static qreal mMinimumWidgetHeight; + static qreal mMinimumWidgetWidth; + static bool mShortcutLabelsVisible; + static qreal mPageChangePanDistance; + static int mPageChangePanDistanceInPixels; static HbFeedback::InstantEffect mPageChangeFeedbackType; static HbFeedback::InstantEffect mWidgetPickFeedbackType; diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/inc/hscontentservice.h --- a/homescreenapp/hsdomainmodel/inc/hscontentservice.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/inc/hscontentservice.h Fri Jun 11 13:30:16 2010 +0300 @@ -42,7 +42,7 @@ static HsContentService *instance(); private: - static QScopedPointer mInstance; + static HsContentService *mInstance; Q_DISABLE_COPY(HsContentService) }; diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/inc/hsdatabase.h --- a/homescreenapp/hsdomainmodel/inc/hsdatabase.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/inc/hsdatabase.h Fri Jun 11 13:30:16 2010 +0300 @@ -75,7 +75,7 @@ bool widgetPresentation(HsWidgetPresentationData &data); bool setWidgetPresentation(const HsWidgetPresentationData &data); - bool deleteWidgetPresentation(int widgetId, const QString &key); + bool deleteWidgetPresentation(int widgetId, Qt::Orientation orientation); bool widgetPreferences(int widgetId, QVariantHash &data); bool widgetPreference(int widgetId, const QString &key, QVariant &value); @@ -98,7 +98,7 @@ QString mConnectionName; QString mDatabaseName; - static QScopedPointer mInstance; + static HsDatabase *mInstance; }; #endif // HSDATABASE_H diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/inc/hsdomainmodeldatastructures.h --- a/homescreenapp/hsdomainmodel/inc/hsdomainmodeldatastructures.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/inc/hsdomainmodeldatastructures.h Fri Jun 11 13:30:16 2010 +0300 @@ -21,25 +21,19 @@ #include #include "hsdomainmodel_global.h" #include +#include class HSDOMAINMODEL_EXPORT HsSceneData { public: HsSceneData() - : id(-1), defaultPageId(-1), maximumPageCount(-1), - maximumWidgetHeight(-1.0), maximumWidgetWidth(-1.0), - minimumWidgetHeight(-1.0), minimumWidgetWidth(-1.0) + : id(-1) {} int id; QString portraitWallpaper; QString landscapeWallpaper; - int defaultPageId; - int maximumPageCount; - qreal maximumWidgetHeight; - qreal maximumWidgetWidth; - qreal minimumWidgetHeight; - qreal minimumWidgetWidth; + }; class HSDOMAINMODEL_EXPORT HsPageData @@ -70,7 +64,7 @@ { public: HsWidgetPresentationData() - : x(0), y(0), zValue(0), + : orientation(Qt::Vertical), x(0), y(0), zValue(0), widgetId(-1) {} @@ -80,7 +74,12 @@ y = pos.y(); } - QString key; + QPointF pos() const + { + return QPointF(x, y); + } + + Qt::Orientation orientation; qreal x; qreal y; qreal zValue; @@ -91,11 +90,11 @@ { public: int bounceEffect; // pixels, bounce effect reservation, half in left side and half in right side of wallpaper - int tapAndHoldDistance; // pixels + qreal tapAndHoldDistance; // pixels int widgetTapAndHoldTimeout; // ms, duration of long press before action is triggered on widget int sceneTapAndHoldTimeout; // ms, duration of long press before action is triggered on background - int pageChangeZoneWidth; // pixels - int pageIndicatorSpacing; // pixels + qreal pageChangeZoneWidth; // pixels + qreal pageIndicatorSpacing; // pixels int pageChangeAnimationDuration; // ms, this is how long page change animation takes int pageChangeZoneAnimationDuration; // ms, this is how long crawling is done before page is actually changed int pageChangeZoneReverseAnimationDuration; // ms, animation duration back to starting position when crawling ends before page is changed @@ -105,128 +104,31 @@ int widgetDropEffectDuration; // ms int boundaryFeedbackEffectDistance; // pixels, when widget is moved within n pixels from first page right border or // n pixels from last page's left border, feedback effect is played + int defaultPageId; // id of default page (which cannot be removed) + int maximumPageCount; // maximum number of pages + qreal maximumWidgetHeight; // px + qreal maximumWidgetWidth; // px + qreal minimumWidgetHeight; // px + qreal minimumWidgetWidth; // px + bool shortcutLabelsVisible; // display labels under shortcut widgets + qreal pageChangePanDistance; // un, amount of pan needed to change page }; class HSDOMAINMODEL_EXPORT HsFeedbackConfiguration { public: - HbFeedback::InstantEffect feedbackFromString(QString feedback) + HbFeedback::InstantEffect feedbackFromString(const QString &feedback) { - if (feedback == "Basic") { - return HbFeedback::Basic; - } - else if (feedback == "Sensitive") { - return HbFeedback::Sensitive; - } - else if (feedback == "BasicButton") { - return HbFeedback::BasicButton; - } - else if (feedback == "SensitiveButton") { - return HbFeedback::SensitiveButton; - } - else if (feedback == "BasicKeypad") { - return HbFeedback::BasicKeypad; - } - else if (feedback == "SensitiveKeypad") { - return HbFeedback::SensitiveKeypad; - } - else if (feedback == "BasicSlider") { - return HbFeedback::BasicSlider; - } - else if (feedback == "SensitiveSlider") { - return HbFeedback::SensitiveSlider; - } - else if (feedback == "BasicKeypad") { - return HbFeedback::BasicKeypad; - } - else if (feedback == "BasicSlider") { - return HbFeedback::BasicSlider; - } - else if (feedback == "SensitiveSlider") { - return HbFeedback::SensitiveSlider; - } - else if (feedback == "BasicItem") { - return HbFeedback::BasicItem; - } - else if (feedback == "SensitiveItem") { - return HbFeedback::SensitiveItem; - } - else if (feedback == " ItemScroll") { - return HbFeedback::ItemScroll; - } - else if (feedback == "ItemPick") { - return HbFeedback::ItemPick; - } - else if (feedback == "ItemDrop") { - return HbFeedback::ItemDrop; - } - else if (feedback == "ItemMoveOver") { - return HbFeedback::ItemMoveOver; - } - else if (feedback == "BounceEffect") { - return HbFeedback::BounceEffect; - } - else if (feedback == "Checkbox") { - return HbFeedback::Checkbox; - } - else if (feedback == "MultipleCheckbox") { - return HbFeedback::MultipleCheckbox; - } - else if (feedback == "Editor") { - return HbFeedback::Editor; - } - else if (feedback == "TextSelection") { - return HbFeedback::TextSelection; - } - else if (feedback == "BlankSelection") { - return HbFeedback::BlankSelection; - } - else if (feedback == "LineSelection") { - return HbFeedback::LineSelection; - } - else if (feedback == "EmptyLineSelection") { - return HbFeedback::EmptyLineSelection; - } - else if (feedback == "PopUp") { - return HbFeedback::PopUp; - } - else if (feedback == "PopupOpen") { - return HbFeedback::PopupOpen; - } - else if (feedback == "PopupClose") { - return HbFeedback::PopupClose; - } - else if (feedback == "Flick") { - return HbFeedback::Flick; - } - else if (feedback == "StopFlick") { - return HbFeedback::StopFlick; - } - else if (feedback == "MultitouchActivate") { - return HbFeedback::MultitouchActivate; - } - else if (feedback == "RotateStep") { - return HbFeedback::RotateStep; - } - else if (feedback == "PositiveTacticon") { - return HbFeedback::PositiveTacticon; - } - else if (feedback == "NeutralTacticon") { - return HbFeedback::NeutralTacticon; - } - else if (feedback == "NegativeTacticon") { - return HbFeedback::NegativeTacticon; - } - else if (feedback == "NumberOfInstantFeedbacks") { - return HbFeedback::NumberOfInstantFeedbacks; - } - else if (feedback == "InstantUser") { - return HbFeedback::InstantUser; - } - else if (feedback == "InstantMaxUser") { - return HbFeedback::InstantMaxUser; - } + int index = HbFeedback::staticMetaObject.indexOfEnumerator("InstantEffect"); + QMetaEnum metaEnum = HbFeedback::staticMetaObject.enumerator(index); + + int intFeedback = metaEnum.keysToValue(feedback.toAscii()); + + if (intFeedback < HbFeedback::None || intFeedback > HbFeedback::InstantMaxUser) { return HbFeedback::None; + } + + return static_cast(intFeedback); } public: diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/inc/hsgui.h --- a/homescreenapp/hsdomainmodel/inc/hsgui.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/inc/hsgui.h Fri Jun 11 13:30:16 2010 +0300 @@ -15,8 +15,8 @@ * */ -#ifndef HSVIEW_H -#define HSVIEW_H +#ifndef HSGUI_H +#define HSGUI_H #include @@ -31,17 +31,21 @@ class HSDOMAINMODEL_EXPORT HsGui { public: - HsGui(); - ~HsGui(); static HbView *idleView(); static HbView *takeIdleView(); static void setIdleView(HbView *idleView); - static HbMainWindow *mainWindow(); + + static HbMainWindow *mainWindow(); + +private: + HsGui() {} private: static QPointer mIdleView; - HOMESCREEN_TEST_FRIEND_CLASS(HomeScreenStatePluginTest) + + HOMESCREEN_TEST_FRIEND_CLASS(HomeScreenStatePluginTest) }; Q_DECLARE_METATYPE(HsGui*) -#endif //HSVIEW_H + +#endif // HSGUI_H diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/inc/hspage.h --- a/homescreenapp/hsdomainmodel/inc/hspage.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/inc/hspage.h Fri Jun 11 13:30:16 2010 +0300 @@ -55,6 +55,8 @@ bool isRemovable() const; void setRemovable(bool removable); + bool isActivePage() const; + static HsPage *createInstance(const HsPageData &pageData); public slots: @@ -67,18 +69,25 @@ int pageIndex(); private: + Q_DISABLE_COPY(HsPage) void connectWidget(HsWidgetHost *widget); void disconnectWidget(HsWidgetHost *widget); private slots: - void onWidgetFinished(HsWidgetHost *widget); - void onWidgetResized(HsWidgetHost *widget); + void onWidgetFinished(); + void onWidgetFaulted(); + void onWidgetResized(); + void onWidgetAvailable(); + void onWidgetUnavailable(); + + void onOrientationChanged(Qt::Orientation orientation); private: int mDatabaseId; bool mRemovable; QList mWidgets; QList mNewWidgets; + QList mUnavailableWidgets; HOMESCREEN_TEST_FRIEND_CLASS(TestRuntimeServices) }; diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/inc/hsscene.h --- a/homescreenapp/hsdomainmodel/inc/hsscene.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/inc/hsscene.h Fri Jun 11 13:30:16 2010 +0300 @@ -76,7 +76,7 @@ private: HsScene(QObject *parent = 0); - void calculateWidgetSizeLimitations(HsSceneData &sceneData); + void calculateWidgetSizeLimitations(); Q_DISABLE_COPY(HsScene) private: diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/inc/hsshortcutservice.h --- a/homescreenapp/hsdomainmodel/inc/hsshortcutservice.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/inc/hsshortcutservice.h Fri Jun 11 13:30:16 2010 +0300 @@ -48,7 +48,7 @@ private: QScopedPointer mD; - static QScopedPointer mInstance; + static HsShortcutService *mInstance; HOMESCREEN_TEST_FRIEND_CLASS(TestRuntimeServices) }; diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/inc/hswidgetcomponent.h --- a/homescreenapp/hsdomainmodel/inc/hswidgetcomponent.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/inc/hswidgetcomponent.h Fri Jun 11 13:30:16 2010 +0300 @@ -26,11 +26,6 @@ #include "hstest_global.h" HOMESCREEN_TEST_CLASS(TestRuntimeServices) -#include "cadefs.h" - -class CaEntry; -class HsWidgetComponentDescriptor; - class HSDOMAINMODEL_EXPORT HsWidgetComponent : public QObject { Q_OBJECT diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/inc/hswidgethost.h --- a/homescreenapp/hsdomainmodel/inc/hswidgethost.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/inc/hswidgethost.h Fri Jun 11 13:30:16 2010 +0300 @@ -18,118 +18,125 @@ #ifndef HSWIDGETHOST_H #define HSWIDGETHOST_H -#include +#include #include #include -#include +#include "hsdomainmodel_global.h" +#include "hsdomainmodeldatastructures.h" -#include "hsdomainmodeldatastructures.h" -#include "hsdomainmodel_global.h" #include "hstest_global.h" +HOMESCREEN_TEST_CLASS(TestRuntimeServices) +class QStateMachine; + +class HsWidgetComponent; class HsPage; -HOMESCREEN_TEST_CLASS(TestRuntimeServices) - class HSDOMAINMODEL_EXPORT HsWidgetHost : public HbWidget { Q_OBJECT public: - enum State { - Unloaded, - Loaded, - Initialized, - Visible, - Hidden, - Uninitialized, - Finished, - Faulted, - UninstallingOrUpdating - }; + HsWidgetHost(int databaseId, QGraphicsItem *parent = 0); + ~HsWidgetHost(); -public: - static HsWidgetHost *createInstance(HsWidgetData &widgetData, - const QVariantHash &preferences = QVariantHash()); - - HsWidgetHost(int databaseId, QGraphicsItem *parent = 0); - - ~HsWidgetHost(); - - bool load(); - void unload(); - - bool setPage(HsPage *page); - HsPage *page() const; - - bool isValid() const; + static HsWidgetHost *createInstance( + HsWidgetData &widgetData, + const QVariantHash &preferences = QVariantHash()); int databaseId() const; - State state() const { return mState; } + bool setPage(HsPage *page); + HsPage *page() const; - bool deleteFromDatabase(); + bool isPannable(QGraphicsSceneMouseEvent *event); - bool setWidgetPresentation(); - bool setWidgetPresentationData(HsWidgetPresentationData &presentationData); - bool widgetPresentationData(const QString &key, HsWidgetPresentationData &presentationData); + bool loadPresentation(); + bool loadPresentation(Qt::Orientation orientation); + bool savePresentation(); + bool savePresentation(Qt::Orientation orientation); + bool savePresentation(HsWidgetPresentationData &presentation); + bool getPresentation(HsWidgetPresentationData &presentation); + bool removePresentation(Qt::Orientation orientation); - HsWidgetPresentationData widgetPresentation(Qt::Orientation orientation); - bool loadWidgetPresentation(); - bool deleteWidgetPresentation(Qt::Orientation orientation); - bool isPannable(QGraphicsSceneMouseEvent *event); signals: - void widgetFinished(HsWidgetHost *widget); - void widgetError(HsWidgetHost *widget); - void widgetResized(HsWidgetHost *widget); - + void event_startAndShow(); + void event_startAndHide(); + void event_unload(); + void event_show(); + void event_hide(); + void event_remove(); + void event_close(); + void event_finished(); + void event_faulted(); + + void finished(); + void faulted(); + void resized(); + void available(); + void unavailable(); + public slots: - void initializeWidget(); + void startWidget(bool show = true); void showWidget(); void hideWidget(); - void uninitializeWidget(); void setOnline(bool online = true); + + void remove(); + void close(); void startDragEffect(); void startDropEffect(); - -protected: - void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); - void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - void mousePressEvent(QGraphicsSceneMouseEvent *event); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - bool eventFilter(QObject *obj, QEvent *event); - + +protected: + bool eventFilter(QObject *watched, QEvent *event); + void mousePressEvent(QGraphicsSceneMouseEvent *) {} + private: + Q_DISABLE_COPY(HsWidgetHost) + void setupEffects(); + void setupStates(); + bool setProperty(const char *name, QMetaProperty &property); bool setMethod(const char *signature, QMetaMethod &method); bool hasSignal(const char *signature); + + void setNewSize(const QSizeF &size); + bool setPreferencesToWidget(); - void setNewSize(const QSizeF &newSize); private slots: - void onSetPreferences(const QStringList &names); + void action_connectComponent(); + void action_disconnectComponent(); + void action_load(); + void action_unload(); + void action_initialize(); + void action_uninitialize(); + void action_show(); + void action_hide(); + void action_finished(); + void action_faulted(); + void action_remove(); + void onFinished(); void onError(); - void onAboutToUninstall(); - void onUpdated(); - void onUnavailable(); - void onAvailable(); + void onSetPreferences(const QStringList &names); + private: - Q_DISABLE_COPY(HsWidgetHost) + int mDatabaseId; + QStateMachine *mStateMachine; QGraphicsWidget *mWidget; - HsPage *mPage; + HsPage *mPage; + HsWidgetComponent *mComponent; QMetaMethod mOnInitializeMethod; QMetaMethod mOnShowMethod; QMetaMethod mOnHideMethod; QMetaMethod mOnUninitializeMethod; + QMetaMethod mIsPannableMethod; QMetaProperty mIsOnlineProperty; - QMetaProperty mRootPathProperty; - QMetaMethod mIsPannable; - State mState; - QString mUri; - int mDatabaseId; + QMetaProperty mRootPathProperty; + bool mIsFinishing; HOMESCREEN_TEST_FRIEND_CLASS(TestRuntimeServices) }; diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/src/hsbackuprestoreobserver.cpp --- a/homescreenapp/hsdomainmodel/src/hsbackuprestoreobserver.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/src/hsbackuprestoreobserver.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -48,9 +48,7 @@ Destructor. */ HsBackupRestoreObserverPrivate::~HsBackupRestoreObserverPrivate() -{ - disconnect(sender(), SIGNAL(valueChanged(XQSettingsKey, const QVariant &)), - this, SLOT(handleKeyChange(XQSettingsKey, const QVariant&))); +{ delete mCallBack; delete mActiveBackupClient; } @@ -130,9 +128,9 @@ HsBackupRestoreObserver *HsBackupRestoreObserver::instance() { if (!mInstance) { - mInstance.reset(new HsBackupRestoreObserver); + mInstance = new HsBackupRestoreObserver(); } - return mInstance.data(); + return mInstance; } /*! @@ -195,6 +193,6 @@ /*! Points to the observer instance. */ -QScopedPointer HsBackupRestoreObserver::mInstance(0); +HsBackupRestoreObserver *HsBackupRestoreObserver::mInstance(0); // End of File diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/src/hsconfiguration.cpp --- a/homescreenapp/hsdomainmodel/src/hsconfiguration.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/src/hsconfiguration.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -43,13 +43,21 @@ mWidgetDragEffectDuration = generalConfiguration.widgetDragEffectDuration; mWidgetDropEffectDuration = generalConfiguration.widgetDropEffectDuration; mBounceFeedbackEffectDistance = generalConfiguration.boundaryFeedbackEffectDistance; + mDefaultPageId = generalConfiguration.defaultPageId; + mMaximumPageCount = generalConfiguration.maximumPageCount; + mMaximumWidgetHeight = generalConfiguration.maximumWidgetHeight; + mMaximumWidgetWidth = generalConfiguration.maximumWidgetWidth; + mMinimumWidgetHeight = generalConfiguration.minimumWidgetHeight; + mMinimumWidgetWidth = generalConfiguration.minimumWidgetWidth; + mShortcutLabelsVisible = generalConfiguration.shortcutLabelsVisible; + mPageChangePanDistance = generalConfiguration.pageChangePanDistance; + mPageChangePanDistanceInPixels = mPageChangePanDistance * HbDeviceProfile::current().unitValue(); } else { Q_ASSERT_X(1, "Configuration", "Homescreen configuration could not be loaded from database"); } HsFeedbackConfiguration feedbackConfiguration; if (db->feedbackConfiguration(feedbackConfiguration)) { - mBounceFeedbackEffectDistance = 3; mPageChangeFeedbackType = feedbackConfiguration.pageChangeFeedbackType; mWidgetPickFeedbackType = feedbackConfiguration.widgetPickFeedbackType; mWidgetDropFeedbackType = feedbackConfiguration.widgetDropFeedbackType; @@ -78,11 +86,11 @@ // static member variables initilized here, these values will be used if fetching from database fails int HsConfiguration::mBounceEffect = 20; -int HsConfiguration::mTapAndHoldDistance = 16; +qreal HsConfiguration::mTapAndHoldDistance = 16.0; int HsConfiguration::mWidgetTapAndHoldTimeout = 500; int HsConfiguration::mSceneTapAndHoldTimeout = 500; -int HsConfiguration::mPageChangeZoneWidth = 60; -int HsConfiguration::mPageIndicatorSpacing = 8; +qreal HsConfiguration::mPageChangeZoneWidth = 60.0; +qreal HsConfiguration::mPageIndicatorSpacing = 8.0; int HsConfiguration::mPageChangeAnimationDuration = 200; int HsConfiguration::mPageChangeZoneAnimationDuration = 800; int HsConfiguration::mPageChangeZoneReverseAnimationDuration = 200; @@ -91,6 +99,15 @@ int HsConfiguration::mWidgetDragEffectDuration = 200; int HsConfiguration::mWidgetDropEffectDuration = 200; int HsConfiguration::mBounceFeedbackEffectDistance = 3; +int HsConfiguration::mDefaultPageId = 1; +int HsConfiguration::mMaximumPageCount = 8; +qreal HsConfiguration::mMaximumWidgetHeight = 39; +qreal HsConfiguration::mMaximumWidgetWidth = 48; +qreal HsConfiguration::mMinimumWidgetHeight = 8.75; +qreal HsConfiguration::mMinimumWidgetWidth = 8.75; +bool HsConfiguration::mShortcutLabelsVisible = false; +qreal HsConfiguration::mPageChangePanDistance = 17.91; +int HsConfiguration::mPageChangePanDistanceInPixels = 120; HbFeedback::InstantEffect HsConfiguration::mPageChangeFeedbackType = HbFeedback::None; HbFeedback::InstantEffect HsConfiguration::mWidgetPickFeedbackType = HbFeedback::None; diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/src/hscontentservice.cpp --- a/homescreenapp/hsdomainmodel/src/hscontentservice.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/src/hscontentservice.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -39,8 +39,7 @@ HsWidgetHost *widget = createWidgetForPreview(params); if (!widget) { return false; - } - + } return HsScene::instance()->activePage()->addNewWidget(widget); } @@ -49,20 +48,8 @@ HsWidgetData widgetData; widgetData.uri = params.value("uri").toString(); - - HsWidgetHost *widget = HsWidgetHost::createInstance(widgetData, - params.value("preferences").toHash()); - - if (!widget) { - return NULL; - } - if (!widget->load()) { - widget->deleteFromDatabase(); - delete widget; - return NULL; - } - - return widget; + return HsWidgetHost::createInstance( + widgetData, params.value("preferences").toHash()); } /*! @@ -70,24 +57,22 @@ */ bool HsContentService::addWidget(const QString &uri, const QVariantHash &preferences) { - HsWidgetData widgetData; - widgetData.uri = uri; + HsWidgetData data; + data.uri = uri; - QScopedPointer widget(HsWidgetHost::createInstance(widgetData, preferences)); - if (!widget.data()) { + HsWidgetHost *widget = HsWidgetHost::createInstance(data, preferences); + if (!widget) { return false; } - HsPage *activePage = HsScene::instance()->activePage(); - if (!widget->load() || !activePage->addNewWidget(widget.data())) { - widget->deleteFromDatabase(); + HsPage *page = HsScene::instance()->activePage(); + if (!page->addNewWidget(widget)) { + widget->remove(); return false; } - HsWidgetHost *taken = widget.take(); - taken->initializeWidget(); - taken->showWidget(); - activePage->layoutNewWidgets(); + widget->startWidget(); + page->layoutNewWidgets(); return true; } @@ -97,12 +82,12 @@ HsContentService *HsContentService::instance() { if (!mInstance) { - mInstance.reset(new HsContentService); + mInstance = new HsContentService(); } - return mInstance.data(); + return mInstance; } /*! Points to the content service instance. */ -QScopedPointer HsContentService::mInstance(0); +HsContentService *HsContentService::mInstance(0); diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/src/hsdatabase.cpp --- a/homescreenapp/hsdomainmodel/src/hsdatabase.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/src/hsdatabase.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -185,21 +185,13 @@ QSqlQuery query(QSqlDatabase::database(mConnectionName)); QString statement = - "SELECT id, portraitWallpaper, landscapeWallpaper, defaultPageId, " - "maximumPageCount, maximumWidgetHeight, maximumWidgetWidth, " - "minimumWidgetHeight, minimumWidgetWidth " + "SELECT id, portraitWallpaper, landscapeWallpaper " "FROM Scene"; if (query.prepare(statement) && query.exec() && query.next()) { data.id = query.value(0).toInt(); data.portraitWallpaper = query.value(1).toString(); data.landscapeWallpaper = query.value(2).toString(); - data.defaultPageId = query.value(3).toInt(); - data.maximumPageCount = query.value(4).toInt(); - data.maximumWidgetHeight = query.value(5).toReal(); - data.maximumWidgetWidth = query.value(6).toReal(); - data.minimumWidgetHeight = query.value(7).toReal(); - data.minimumWidgetWidth = query.value(8).toReal(); return true; } @@ -573,6 +565,9 @@ return false; } + QString key = data.orientation == Qt::Vertical ? + QLatin1String("portrait") : QLatin1String("landscape"); + QSqlQuery query(QSqlDatabase::database(mConnectionName)); QString statement = @@ -581,7 +576,7 @@ "WHERE key = ? AND widgetId = ?"; if (query.prepare(statement)) { - query.addBindValue(data.key); + query.addBindValue(key); query.addBindValue(data.widgetId); if (query.exec() && query.next()) { data.x = query.value(0).toReal(); @@ -603,6 +598,9 @@ return false; } + QString key = data.orientation == Qt::Vertical ? + QLatin1String("portrait") : QLatin1String("landscape"); + QSqlQuery query(QSqlDatabase::database(mConnectionName)); QString statement = @@ -611,7 +609,7 @@ "VALUES (?, ?, ?, ?, ?)"; if (query.prepare(statement)) { - query.addBindValue(data.key); + query.addBindValue(key); query.addBindValue(data.x); query.addBindValue(data.y); query.addBindValue(data.zValue); @@ -625,12 +623,15 @@ /*! */ -bool HsDatabase::deleteWidgetPresentation(int widgetId, const QString &key) +bool HsDatabase::deleteWidgetPresentation(int widgetId, Qt::Orientation orientation) { if (!checkConnection()) { return false; } + QString key = orientation == Qt::Vertical ? + QLatin1String("portrait") : QLatin1String("landscape"); + QSqlQuery query(QSqlDatabase::database(mConnectionName)); QString statement = @@ -776,16 +777,19 @@ "pageIndicatorSpacing, pageChangeAnimationDuration, pageChangeZoneAnimationDuration, " "pageChangeZoneReverseAnimationDuration, " "pageRemovedAnimationDuration, newPageAddedAnimationDuration, widgetDragEffectDuration, " - "widgetDropEffectDuration, boundaryFeedbackEffectDistance " + "widgetDropEffectDuration, boundaryFeedbackEffectDistance, " + "defaultPageId, maximumPageCount, maximumWidgetHeight, maximumWidgetWidth, " + "minimumWidgetHeight, minimumWidgetWidth, shortcutLabelsVisible, " + "pageChangePanDistance " "FROM GeneralConfiguration"; if (query.prepare(statement) && query.exec() && query.next()) { data.bounceEffect = query.value(0).toInt(); - data.tapAndHoldDistance = query.value(1).toInt(); + data.tapAndHoldDistance = query.value(1).toReal(); data.widgetTapAndHoldTimeout = query.value(2).toInt(); data.sceneTapAndHoldTimeout = query.value(3).toInt(); - data.pageChangeZoneWidth = query.value(4).toInt(); - data.pageIndicatorSpacing = query.value(5).toInt(); + data.pageChangeZoneWidth = query.value(4).toReal(); + data.pageIndicatorSpacing = query.value(5).toReal(); data.pageChangeAnimationDuration = query.value(6).toInt(); data.pageChangeZoneAnimationDuration = query.value(7).toInt(); data.pageChangeZoneReverseAnimationDuration = query.value(8).toInt(); @@ -794,6 +798,14 @@ data.widgetDragEffectDuration = query.value(11).toInt(); data.widgetDropEffectDuration = query.value(12).toInt(); data.boundaryFeedbackEffectDistance = query.value(13).toInt(); + data.defaultPageId = query.value(14).toInt(); + data.maximumPageCount = query.value(15).toInt(); + data.maximumWidgetHeight = query.value(16).toReal(); + data.maximumWidgetWidth = query.value(17).toReal(); + data.minimumWidgetHeight = query.value(18).toReal(); + data.minimumWidgetWidth = query.value(19).toReal(); + data.shortcutLabelsVisible = query.value(20).toBool(); + data.pageChangePanDistance = query.value(21).toReal(); return true; } @@ -848,10 +860,7 @@ "FROM SnapConfiguration"; if (query.prepare(statement) && query.exec() && query.next()) { - data.snappingEnabled = false; - if (query.value(0).toInt() == 1) { - data.snappingEnabled = true; - } + data.snappingEnabled = query.value(0).toBool(); data.snapForce = query.value(1).toReal(); data.snapGap = query.value(2).toReal(); data.borderGap = query.value(3).toReal(); @@ -867,7 +876,11 @@ */ void HsDatabase::setInstance(HsDatabase *instance) { - mInstance.reset(instance); + if (mInstance != instance) { + HsDatabase *oldInstance = mInstance; + mInstance = instance; + delete oldInstance; + } } /*! @@ -875,7 +888,7 @@ */ HsDatabase *HsDatabase::instance() { - return mInstance.data(); + return mInstance; } /*! @@ -885,7 +898,9 @@ */ HsDatabase *HsDatabase::takeInstance() { - return mInstance.take(); + HsDatabase *instance = mInstance; + mInstance = 0; + return instance; } /*! @@ -900,4 +915,4 @@ /*! Points to the database instance. */ -QScopedPointer HsDatabase::mInstance(0); +HsDatabase *HsDatabase::mInstance(0); diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/src/hsgui.cpp --- a/homescreenapp/hsdomainmodel/src/hsgui.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/src/hsgui.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -17,6 +17,7 @@ #include #include + #include "hsgui.h" /*! @@ -27,25 +28,11 @@ */ /*! - Constructor -*/ -HsGui::HsGui() -{ -} - -/*! - Destructor. -*/ -HsGui::~HsGui() -{ -} - -/*! - Returns idle view. + Returns the idle view. */ HbView *HsGui::idleView() { - return mIdleView.data(); + return mIdleView; } /*! @@ -55,9 +42,9 @@ */ HbView *HsGui::takeIdleView() { - HbView *view = mIdleView; + HbView *idleView = mIdleView; mIdleView = 0; - return view; + return idleView; } /*! @@ -67,14 +54,13 @@ void HsGui::setIdleView(HbView *idleView) { if (mIdleView != idleView) { - HbView *oldView = mIdleView; + delete mIdleView; mIdleView = idleView; - delete oldView; } } /*! - Return main window. + Returns the main window. */ HbMainWindow *HsGui::mainWindow() { @@ -82,6 +68,6 @@ } /*! - Points to the view instance. + Points to the idle view instance. */ QPointer HsGui::mIdleView(0); diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/src/hspage.cpp --- a/homescreenapp/hsdomainmodel/src/hspage.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/src/hspage.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -27,6 +27,7 @@ #include "hswidgethost.h" #include "hswallpaper.h" #include "hswidgetpositioningonwidgetadd.h" +#include "hswidgetpositioningonorientationchange.h" /*! @@ -92,22 +93,18 @@ } foreach (HsWidgetData data, datas) { - QScopedPointer widget(new HsWidgetHost(data.id)); - if(!widget->load() || !widget->isValid()) { - continue; - } - connectWidget(widget.data()); + HsWidgetHost *widget = new HsWidgetHost(data.id); + mWidgets.append(widget); + connectWidget(widget); widget->setPage(this); - widget->initializeWidget(); - if (widget->state() != HsWidgetHost::Initialized) { - continue; - } - widget->showWidget(); - mWidgets.append(widget.data()); widget->setParentItem(this); - widget.take(); // now this page owns widget + widget->startWidget(); } + connect(HsScene::mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + SLOT(onOrientationChanged(Qt::Orientation))); + return true; } @@ -163,16 +160,13 @@ return true; } - // Set presentation. - QString key = HsScene::orientation() == Qt::Horizontal ? - "landscape" : "portrait"; - HsWidgetPresentationData presentation; - if (!widgetHost->widgetPresentationData(key, presentation)) { - presentation.key = key; + presentation.orientation = HsScene::orientation(); + if (!widgetHost->getPresentation(presentation)) { + presentation.orientation = HsScene::orientation(); presentation.setPos(QPointF()); presentation.zValue = 0; - widgetHost->setWidgetPresentationData(presentation); + widgetHost->savePresentation(presentation); } widgetHost->hide(); @@ -215,9 +209,10 @@ for (int i = 0; i < mNewWidgets.count(); ++i) { widget = mNewWidgets.at(i); widget->setGeometry(calculatedRects.at(i)); - widget->setWidgetPresentation(); + widget->savePresentation(); widget->setPage(this); widget->setParentItem(this); + widget->showWidget(); widget->show(); } mWidgets << mNewWidgets; @@ -227,19 +222,22 @@ bool HsPage::deleteFromDatabase() { - HsDatabase *db = HsDatabase::instance(); - foreach (HsWidgetHost *widget, mWidgets) { - if (!widget->deleteFromDatabase()) { - return false; - } + widget->remove(); + } + mWidgets.clear(); + + foreach (HsWidgetHost *widget, mNewWidgets) { + widget->remove(); } + mNewWidgets.clear(); - if (!db->deletePage(mDatabaseId)) { - return false; + foreach (HsWidgetHost *widget, mUnavailableWidgets) { + widget->remove(); } + mUnavailableWidgets.clear(); - return true; + return HsDatabase::instance()->deletePage(mDatabaseId); } QList HsPage::widgets() const @@ -264,6 +262,11 @@ mRemovable = removable; } +bool HsPage::isActivePage() const +{ + return this == HsScene::instance()->activePage(); +} + HsPage *HsPage::createInstance(const HsPageData &pageData) { HsDatabase *db = HsDatabase::instance(); @@ -336,14 +339,14 @@ foreach (HsWidgetHost *widget, sortedWidgets) { widget->setZValue(z++); - widget->setWidgetPresentation(); + widget->savePresentation(); } } if (!mNewWidgets.isEmpty()) { foreach (HsWidgetHost *widget, mNewWidgets) { widget->setZValue(z++); - widget->setWidgetPresentation(); + widget->savePresentation(); } } } @@ -355,10 +358,11 @@ void HsPage::connectWidget(HsWidgetHost *widget) { - connect(widget, SIGNAL(widgetFinished(HsWidgetHost*)), - SLOT(onWidgetFinished(HsWidgetHost*))); - connect(widget, SIGNAL(widgetResized(HsWidgetHost*)), - SLOT(onWidgetResized(HsWidgetHost*))); + connect(widget, SIGNAL(finished()), SLOT(onWidgetFinished())); + connect(widget, SIGNAL(faulted()), SLOT(onWidgetFaulted())); + connect(widget, SIGNAL(resized()), SLOT(onWidgetResized())); + connect(widget, SIGNAL(available()), SLOT(onWidgetAvailable())); + connect(widget, SIGNAL(unavailable()), SLOT(onWidgetUnavailable())); } void HsPage::disconnectWidget(HsWidgetHost *widget) @@ -366,9 +370,10 @@ widget->disconnect(this); } -void HsPage::onWidgetFinished(HsWidgetHost *widget) +void HsPage::onWidgetFinished() { - Q_ASSERT(widget); + HsWidgetHost *widget = qobject_cast(sender()); + // It can be in new widget list if we haven't layouted it yet // or layouted new widget and widget list if (!mNewWidgets.removeOne(widget)) { @@ -376,16 +381,21 @@ } disconnectWidget(widget); - widget->uninitializeWidget(); - widget->deleteFromDatabase(); - widget->deleteLater(); + widget->remove(); +} + +void HsPage::onWidgetFaulted() +{ + onWidgetFinished(); } /*! Calculates new widget position on page when widget size changes */ -void HsPage::onWidgetResized(HsWidgetHost *widget) +void HsPage::onWidgetResized() { + HsWidgetHost *widget = qobject_cast(sender()); + QRectF widgetRect = widget->geometry(); QRectF pageRect = HsScene::mainWindow()->layoutRect(); @@ -401,3 +411,59 @@ widget->setPos(widgetX, widgetY); } +void HsPage::onWidgetAvailable() +{ + HsWidgetHost *widget = qobject_cast(sender()); + + mUnavailableWidgets.removeOne(widget); + mWidgets.append(widget); + + widget->setParentItem(this); + widget->startWidget(isActivePage()); + widget->show(); +} + +void HsPage::onWidgetUnavailable() +{ + HsWidgetHost *widget = qobject_cast(sender()); + + if (mWidgets.contains(widget)) { + mWidgets.removeOne(widget); + } else if (mNewWidgets.contains(widget)) { + mNewWidgets.removeOne(widget); + } else { + return; + } + + mUnavailableWidgets.append(widget); + + widget->hide(); + widget->setParentItem(0); +} + +void HsPage::onOrientationChanged(Qt::Orientation orientation) +{ + QRectF rect = HsScene::mainWindow()->layoutRect(); + + HsWidgetPositioningOnOrientationChange *converter = + HsWidgetPositioningOnOrientationChange::instance(); + + qreal chrome = 64; + QRectF from(0, chrome, rect.height(), rect.width() - chrome); + QRectF to(0, chrome, rect.width(), rect.height() - chrome); + + HsWidgetPresentationData presentation; + presentation.orientation = orientation; + + foreach (HsWidgetHost *widget, mWidgets) { + if (!widget->getPresentation(presentation)) { + QList geometries = converter->convert( + from, QList() << widget->geometry(), to); + widget->setGeometry(geometries.first()); + widget->savePresentation(); + } else { + widget->setPos(presentation.pos()); + widget->setZValue(presentation.zValue); + } + } +} diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/src/hsscene.cpp --- a/homescreenapp/hsdomainmodel/src/hsscene.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/src/hsscene.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -27,6 +27,7 @@ #include "hswidgethost.h" #include "hsdatabase.h" #include "hswallpaper.h" +#include "hsconfiguration.h" /*! Destructor. @@ -57,9 +58,9 @@ return false; } - mMaximumPageCount = sceneData.maximumPageCount; + mMaximumPageCount = HsConfiguration::maximumPageCount(); - calculateWidgetSizeLimitations(sceneData); + calculateWidgetSizeLimitations(); if (sceneData.portraitWallpaper.isEmpty()) { mWallpaper->setImagesById(); @@ -83,7 +84,7 @@ delete page; continue; } - if (pageData.id == sceneData.defaultPageId) { + if (pageData.id == HsConfiguration::defaultPageId()) { mActivePage = page; mActivePage->setRemovable(false); } @@ -97,19 +98,17 @@ /*! Calculate maximum and minimum widget sizes */ -void HsScene::calculateWidgetSizeLimitations(HsSceneData &sceneData) +void HsScene::calculateWidgetSizeLimitations() { // 1un = 6.7px = 2mm - mMaximumWidgetSizeInUnits = QSizeF(sceneData.maximumWidgetWidth, - sceneData.maximumWidgetHeight); - mMinimumWidgetSizeInUnits = QSizeF(sceneData.minimumWidgetWidth, - sceneData.minimumWidgetHeight); + mMaximumWidgetSizeInUnits = QSizeF(HsConfiguration::maximumWidgetWidth(), + HsConfiguration::maximumWidgetHeight()); + mMinimumWidgetSizeInUnits = QSizeF(HsConfiguration::minimumWidgetWidth(), + HsConfiguration::minimumWidgetHeight()); HbDeviceProfile profile; qreal unitToPixelFactor = profile.unitValue(); - mMaximumWidgetSizeInPixels = QSizeF(sceneData.maximumWidgetWidth * unitToPixelFactor, - sceneData.maximumWidgetHeight * unitToPixelFactor); - mMinimumWidgetSizeInPixels = QSizeF(sceneData.minimumWidgetWidth * unitToPixelFactor, - sceneData.minimumWidgetHeight * unitToPixelFactor); + mMaximumWidgetSizeInPixels = unitToPixelFactor * mMaximumWidgetSizeInUnits; + mMinimumWidgetSizeInPixels = unitToPixelFactor * mMinimumWidgetSizeInUnits; } /*! @@ -149,6 +148,8 @@ return false; } + int addPosition = data.indexPosition; + db->transaction(); for (int i = data.indexPosition; i < mPages.count(); ++i) { @@ -162,7 +163,7 @@ db->commit(); - mPages.insert(data.indexPosition, page); + mPages.insert(addPosition, page); return true; } diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/src/hsshortcutservice.cpp --- a/homescreenapp/hsdomainmodel/src/hsshortcutservice.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/src/hsshortcutservice.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -68,9 +68,9 @@ HsShortcutService *HsShortcutService::instance(QStateMachine *stateMachine) { if (!mInstance && stateMachine) { - mInstance.reset(new HsShortcutService(stateMachine)); + mInstance = new HsShortcutService(stateMachine); } - return mInstance.data(); + return mInstance; } HsShortcutService::~HsShortcutService() @@ -94,4 +94,4 @@ mD.reset(new HsShortcutServicePrivate(stateMachine)); } -QScopedPointer HsShortcutService::mInstance(0); +HsShortcutService *HsShortcutService::mInstance(0); diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/src/hswidgetcomponent.cpp --- a/homescreenapp/hsdomainmodel/src/hswidgetcomponent.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/src/hswidgetcomponent.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -19,8 +19,6 @@ #include #include "hswidgetcomponent.h" -#include "hswidgetcomponentdescriptor.h" -#include "hswidgetcomponentregistry.h" #include "hsapp_defs.h" #include "caservice.h" #include "caquery.h" @@ -171,9 +169,3 @@ emit available(); } } - - - - - - diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/src/hswidgetcomponentdescriptor.cpp --- a/homescreenapp/hsdomainmodel/src/hswidgetcomponentdescriptor.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/src/hswidgetcomponentdescriptor.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -23,6 +23,10 @@ \class HsWidgetComponentDescriptor \ingroup group_hsdomainmodel \brief Homescreen widget component descriptor class. + + Homescreen widget component descriptor class hosts meta data of + widget component. Meta data is delivered in manifest file. + \see page_widgetsispackage */ diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/src/hswidgetcomponentregistry.cpp --- a/homescreenapp/hsdomainmodel/src/hswidgetcomponentregistry.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/src/hswidgetcomponentregistry.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -37,6 +37,15 @@ \class HsWidgetComponentRegistry \ingroup group_hsdomainmodel \brief Homescreen widget component registry. + + Homescreen widget component registry keeps track of packages from which is(are) + created widget(s) to homescreen page(s). Registry updates its content + when the installation package is uninstalled/updated or installation location is( or is not) + available (media attached/detached). Registry takes care of package registration/unregistration + to Qt service framework. + + Events for all above cases are get from Content Storage. Component registry listens + changes of Content Storages' entries (CaEntry) via its service class (CaService). */ HsWidgetComponentRegistry *HsWidgetComponentRegistry::mInstance = 0; @@ -64,6 +73,7 @@ /*! Returns component object of the given \a uri. + Uri is defined in widget manifest file. \see page_widgetsispackage */ HsWidgetComponent *HsWidgetComponentRegistry::component(const QString &uri) { @@ -77,15 +87,15 @@ } /*! - Requests widget component to emit 'aboutToInstall' signal to free widget resources when uninstalling the widget. + Requests widget component to emit 'aboutToUninstall' signal to free widget resources when + uninstalling the widget's installation package. */ void HsWidgetComponentRegistry::uninstallComponent(const HsWidgetComponentDescriptor &componentDescriptor) { HsWidgetComponent *component = mRegistry.value(componentDescriptor.uri); if (component) { component->emitAboutToUninstall(); - } - + } } /*! @@ -119,7 +129,6 @@ if (component) { component->emitAvailable(); } - } /*! @@ -139,7 +148,7 @@ mServiceManager.removeService(uri); QCoreApplication::removeLibraryPath(rootPath); if (component) { - // for now support versions without uinstaller + // for now support versions without uninstaller component->emitAboutToUninstall(); component->emitUninstalled(); mRegistry.take(uri)->deleteLater(); @@ -203,4 +212,3 @@ default: break; } } - diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsdomainmodel/src/hswidgethost.cpp --- a/homescreenapp/hsdomainmodel/src/hswidgethost.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsdomainmodel/src/hswidgethost.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -15,190 +15,90 @@ * */ -#include +#include +#include +#include +#include #include #include #include #include #include +#include +#include #include #include #include -#include #include -#include "hswidgethost.h" #include "hsdatabase.h" #include "hsdomainmodeldatastructures.h" +#include "hsscene.h" #include "hspage.h" -#include "hsapp_defs.h" -#include "hsscene.h" +#include "hswidgethost.h" #include "hswidgetcomponentregistry.h" #include "hswidgetcomponent.h" +#include "hsconfiguration.h" + +// Helper macros for connecting state entry and exit actions. +#define ENTRY_ACTION(state, action) \ + connect(state, SIGNAL(entered()), SLOT(action())); +#define EXIT_ACTION(state, action) \ + connect(state, SIGNAL(exited()), SLOT(action())); QTM_USE_NAMESPACE -/*! - \class HsWidgetHost - \ingroup group_hsutils - \brief Homescreen widget runner. - Is responsible of running a homescreen widget. Each - homescreen widget has its own host. -*/ - -HsWidgetHost* HsWidgetHost::createInstance(HsWidgetData &widgetData, - const QVariantHash &preferences) +HsWidgetHost::HsWidgetHost(int databaseId, QGraphicsItem *parent) + : HbWidget(parent), + mDatabaseId(databaseId), + mStateMachine(0), + mWidget(0), + mPage(0), + mComponent(0), + mIsFinishing(false) { - HsDatabase* db = HsDatabase::instance(); - Q_ASSERT(db); - - if (db->insertWidget(widgetData)) { - db->setWidgetPreferences(widgetData.id, preferences); - return new HsWidgetHost(widgetData.id); - } + setFlag(QGraphicsItem::ItemClipsChildrenToShape); + setFlag(QGraphicsItem::ItemHasNoContents); - return 0; -} -/*! - Construct a widget host for the given \a databaseId. - \a parent becomes the parent item for the host. -*/ -HsWidgetHost::HsWidgetHost(int databaseId, QGraphicsItem *parent) - : HbWidget(parent), - mWidget(0), - mPage(0), - mState(Unloaded), - mDatabaseId(databaseId) -{ - setFlags(QGraphicsItem::ItemClipsChildrenToShape); - - HsDatabase *db = HsDatabase::instance(); + grabGesture(Qt::TapGesture); + grabGesture(Qt::TapAndHoldGesture); + grabGesture(Qt::PanGesture); + grabGesture(Qt::PinchGesture); + grabGesture(Qt::SwipeGesture); + grabGesture(Qt::CustomGesture); - // Find the widget data. - HsWidgetData data; - data.id = mDatabaseId; - if (!db->widget(data)) { - return; - } - - mUri = data.uri; - - // bind host to component - HsWidgetComponent *component = HsWidgetComponentRegistry::instance()->component(mUri); - connect(component, SIGNAL(uninstalled()), SLOT(onFinished())); - connect(component, SIGNAL(aboutToUninstall()), SLOT(onAboutToUninstall())); - connect(component, SIGNAL(updated()), SLOT(onUpdated())); - connect(component, SIGNAL(unavailable()), SLOT(onUnavailable())); - connect(component, SIGNAL(available()), SLOT(onAvailable())); - - /* TODO: Uncomment after the Qt bug has been fixed. - QGraphicsDropShadowEffect *effect = - new QGraphicsDropShadowEffect(this); - effect->setColor(QColor(0, 0, 0, 150)); - effect->setBlurRadius(5); - effect->setOffset(3); - setGraphicsEffect(effect); - */ + setupEffects(); + setupStates(); } -/*! - Destructor. -*/ HsWidgetHost::~HsWidgetHost() { } -/*! - Load hosted widget from plugin and validate it. - Returns true if widget construction is successfull. -*/ -bool HsWidgetHost::load() +HsWidgetHost *HsWidgetHost::createInstance(HsWidgetData &widgetData, + const QVariantHash &preferences) { - if (mState != Unloaded) { - return false; - } - if (mWidget) { - return false; - } - - - // Create the hosted widget. - QServiceManager manager; - QServiceFilter filter("com.nokia.symbian.IHomeScreenWidget"); - filter.setServiceName(mUri); - QList interfaces = manager.findInterfaces(filter); - if (interfaces.isEmpty()) { - return false; - } - - QObject *widgetObject = manager.loadInterface(interfaces.first()); - mWidget = qobject_cast(widgetObject); - - if (!mWidget || - !setMethod("onShow()", mOnShowMethod) || - !setMethod("onHide()", mOnHideMethod)) { - mWidget = 0; - delete widgetObject; - return false; - } + HsDatabase *db = HsDatabase::instance(); - setProperty("isOnline", mIsOnlineProperty); - setProperty("rootPath", mRootPathProperty); - - setMethod("isPannable(QGraphicsSceneMouseEvent*)", mIsPannable); - setMethod("onInitialize()", mOnInitializeMethod); - setMethod("onUninitialize()", mOnUninitializeMethod); - - if (hasSignal("setPreferences(const QStringList&)")) { - connect(mWidget, SIGNAL(setPreferences(QStringList)), - SLOT(onSetPreferences(QStringList))); - } - if (hasSignal("finished()")) { - connect(mWidget, SIGNAL(finished()), - SLOT(onFinished())); + if (db->insertWidget(widgetData)) { + db->setWidgetPreferences(widgetData.id, preferences); + return new HsWidgetHost(widgetData.id); + } else { + return 0; } - if (hasSignal("error()")) { - connect(mWidget, SIGNAL(error()), - SLOT(onError())); - } - - mWidget->installEventFilter(this); - - loadWidgetPresentation(); - - HsScene *scene = HsScene::instance(); - setMaximumSize(scene->maximumWidgetSizeInPixels()); - setMinimumSize(scene->minimumWidgetSizeInPixels()); - - mWidget->setParentItem(this); - - setNewSize(mWidget->size()); - mState = Loaded; - - return true; } -void HsWidgetHost::unload() +int HsWidgetHost::databaseId() const { - if (mState != Uninitialized) { - return; - } - if (mWidget) { - mWidget->setParentItem(0); - } - delete mWidget; - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); - mWidget = 0; - mState = Unloaded; + return mDatabaseId; } bool HsWidgetHost::setPage(HsPage *page) { - HsDatabase* db = HsDatabase::instance(); - Q_ASSERT(db); - + HsDatabase *db = HsDatabase::instance(); + HsWidgetData data; data.id = mDatabaseId; if (db->widget(data)) { @@ -217,266 +117,129 @@ mPage = page; return true; } - + HsPage *HsWidgetHost::page() const { return mPage; } -/*! - Returns true if this host has a valid widget set. - Otherwise, return false. -*/ -bool HsWidgetHost::isValid() const -{ - return mWidget; -} - -/*! - Returns database id -*/ -int HsWidgetHost::databaseId() const -{ - return mDatabaseId; -} - -/*! - Returns true if this the database operation succeeds, - false otherwise -*/ -bool HsWidgetHost::deleteFromDatabase() +bool HsWidgetHost::isPannable(QGraphicsSceneMouseEvent *event) { - HsDatabase *db = HsDatabase::instance(); - - if (!db->deleteWidget(mDatabaseId)) { - return false; - } - - mDatabaseId = -1; - return true; -} - -/*! - Set widget presentation by using current values. - Return true if successfull. -*/ -bool HsWidgetHost::setWidgetPresentation() -{ - HsDatabase *db = HsDatabase::instance(); - Q_ASSERT(db); - - QString key = HsScene::orientation() == Qt::Vertical ? - "portrait" : "landscape"; - - HsWidgetPresentationData data; - data.key = key; - data.setPos(pos()); - data.zValue = zValue(); - data.widgetId = databaseId(); - - return db->setWidgetPresentation(data); + bool result = false; + mIsPannableMethod.invoke(mWidget, Q_RETURN_ARG(bool, result), Q_ARG(QGraphicsSceneMouseEvent *,event)); + return result; } -/*! - Set widget presentation data. Return true if successfull. -*/ -bool HsWidgetHost::setWidgetPresentationData(HsWidgetPresentationData &presentationData) +bool HsWidgetHost::loadPresentation() { - HsDatabase *db = HsDatabase::instance(); - Q_ASSERT(db); - - presentationData.widgetId = mDatabaseId; - return db->setWidgetPresentation(presentationData); -} - -/*! - Get widget presentation data matching given \a key. - Data is returned on given empty \a presentationData. Return true if successfull -*/ -bool HsWidgetHost::widgetPresentationData(const QString &key, - HsWidgetPresentationData &presentationData) -{ - HsDatabase *db = HsDatabase::instance(); - Q_ASSERT(db); - - presentationData.key = key; - presentationData.widgetId = mDatabaseId; - return db->widgetPresentation(presentationData); + return loadPresentation(HsScene::orientation()); } -/*! - Return HsWidgetPresentationData for given \a orientation -*/ -HsWidgetPresentationData HsWidgetHost::widgetPresentation(Qt::Orientation orientation) +bool HsWidgetHost::loadPresentation(Qt::Orientation orientation) { HsDatabase *db = HsDatabase::instance(); - Q_ASSERT(db); - - QString key = orientation == Qt::Vertical ? - "portrait" : "landscape"; - + HsWidgetPresentationData data; - data.key = key; - data.widgetId = mDatabaseId; - if (db->widgetPresentation(data)) { - return data; - } else { - return HsWidgetPresentationData(); - } -} - -/*! - Load HsWidgetPresentationData for current orientation -*/ -bool HsWidgetHost::loadWidgetPresentation() -{ - HsDatabase *db = HsDatabase::instance(); - - QString key = HsScene::orientation() == Qt::Vertical ? - "portrait" : "landscape"; - - HsWidgetPresentationData data; - data.key = key; + data.orientation = orientation; data.widgetId = mDatabaseId; if (!db->widgetPresentation(data)) { return false; } - setPos(data.x, data.y); setZValue(data.zValue); - return true; } -/*! - Delete HsWidgetPresentationData for given \a orientation. - Return true if successfull. -*/ -bool HsWidgetHost::deleteWidgetPresentation(Qt::Orientation orientation) +bool HsWidgetHost::savePresentation() +{ + return savePresentation(HsScene::orientation()); +} + +bool HsWidgetHost::savePresentation(Qt::Orientation orientation) +{ + HsDatabase *db = HsDatabase::instance(); + + HsWidgetPresentationData data; + data.orientation = orientation; + data.setPos(pos()); + data.zValue = zValue(); + data.widgetId = mDatabaseId; + return db->setWidgetPresentation(data); +} + +bool HsWidgetHost::savePresentation(HsWidgetPresentationData &presentation) +{ + HsDatabase *db = HsDatabase::instance(); + + presentation.widgetId = mDatabaseId; + return db->setWidgetPresentation(presentation); +} + +bool HsWidgetHost::getPresentation(HsWidgetPresentationData &presentation) { HsDatabase *db = HsDatabase::instance(); - Q_ASSERT(db); - - QString key = orientation == Qt::Vertical ? - "portrait" : "landscape"; + + presentation.widgetId = mDatabaseId; + return db->widgetPresentation(presentation); +} - return db->deleteWidgetPresentation(mDatabaseId, key); -} -/*! - Check wheter widget uses pan gestures - Return true if successfull. -*/ -bool HsWidgetHost::isPannable(QGraphicsSceneMouseEvent *event) +bool HsWidgetHost::removePresentation(Qt::Orientation orientation) { - bool ret(false); - mIsPannable.invoke(mWidget,Q_RETURN_ARG(bool,ret),Q_ARG(QGraphicsSceneMouseEvent *,event)); - return ret; + HsDatabase *db = HsDatabase::instance(); + return db->deleteWidgetPresentation(mDatabaseId, orientation); } -/*! - \fn void HsWidgetHost::widgetFinished() - This signal is emitted after the contained widget - reported is completion. -*/ - -/*! - \fn void HsWidgetHost::widgetError() - This signal is emitted after the contained widget - reported an error. -*/ -/*! - \fn void HsWidgetHost::widgetResized() - This signal is emitted after the contained widget - sends a resize event. -*/ -/*! - \fn void HsWidgetHost::mousePressEventIgnored() - This signal is emitted if managed widget ignores mouse press event - -*/ +void HsWidgetHost::startWidget(bool show) +{ + if (!mStateMachine->isRunning()) { + mStateMachine->start(); + // This is needed because QStateMachine::start() starts + // the state machine asynchronously via the eventloop. + // Here we want the machine to start synchronously. + QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); + } -/*! - Calls the widget's onInitialize() slot if the - widget defines it. -*/ -void HsWidgetHost::initializeWidget() -{ - if (mState != Loaded) { - return; - } - HsWidgetComponent *component = HsWidgetComponentRegistry::instance()->component(mUri); - Q_ASSERT(component); - mRootPathProperty.write(mWidget, component->rootPath()); - setPreferencesToWidget(); - setOnline(HsScene::instance()->isOnline()); - mOnInitializeMethod.invoke(mWidget); - - if (mState != Finished && - mState != Faulted) { - mState = Initialized; + if (show) { + emit event_startAndShow(); + } else { + emit event_startAndHide(); } } - -/*! - Calls the widget's onShow() slot if the - widget defines it. -*/ + void HsWidgetHost::showWidget() { - if (mState != Initialized && - mState != Hidden ) { - return; - } - - mOnShowMethod.invoke(mWidget); - - mState = Visible; + emit event_show(); } - -/*! - Calls the widget's onHide() slot if the - widget defines it. -*/ + void HsWidgetHost::hideWidget() { - if (mState != Initialized && - mState != Visible) { - return; - } - - mOnHideMethod.invoke(mWidget); - - mState = Hidden; + emit event_hide(); } -/*! - Calls the widget's onUninitialize() slot if the - widget defines it. -*/ -void HsWidgetHost::uninitializeWidget() -{ - if (mState != Visible && - mState != Hidden) { - return; - } - - mOnUninitializeMethod.invoke(mWidget); - - mState = Uninitialized; -} - -/*! - Calls the widget's widgetOnlineState property if the - widget defines it. -*/ void HsWidgetHost::setOnline(bool online) { mIsOnlineProperty.write(mWidget, online); } -/*! - Starts the widget drag animation. -*/ +void HsWidgetHost::remove() +{ + if (mStateMachine->isRunning()) { + emit event_remove(); + } else { + action_remove(); + deleteLater(); + } +} + +void HsWidgetHost::close() +{ + if (mStateMachine->isRunning()) { + emit event_close(); + } else { + deleteLater(); + } +} + void HsWidgetHost::startDragEffect() { /* TODO: Uncomment after the Qt bug has been fixed. @@ -490,7 +253,7 @@ QParallelAnimationGroup *animationGroup = new QParallelAnimationGroup(); QPropertyAnimation *animation = new QPropertyAnimation(this, "scale"); - animation->setDuration(200); + animation->setDuration(HsConfiguration::widgetDragEffectDuration()); animation->setEndValue(1.1); animationGroup->addAnimation(animation); @@ -504,9 +267,6 @@ animationGroup->start(QAbstractAnimation::DeleteWhenStopped); } -/*! - Starts the widget drop animation. -*/ void HsWidgetHost::startDropEffect() { /* TODO: Uncomment after the Qt bug has been fixed. @@ -518,7 +278,7 @@ QParallelAnimationGroup *animationGroup = new QParallelAnimationGroup; QPropertyAnimation *animation = new QPropertyAnimation(this, "scale"); - animation->setDuration(200); + animation->setDuration(HsConfiguration::widgetDropEffectDuration()); animation->setEndValue(1); animationGroup->addAnimation(animation); @@ -531,56 +291,122 @@ animationGroup->start(QAbstractAnimation::DeleteWhenStopped); } -/*! - Overwritten to stop event propogation -*/ -void HsWidgetHost::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) -{ - Q_UNUSED(event) -} -/*! - Overwritten to stop event propogation -*/ -void HsWidgetHost::mouseMoveEvent(QGraphicsSceneMouseEvent *event) -{ - Q_UNUSED(event) -} -/*! - Overwritten to stop event propogation -*/ -void HsWidgetHost::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - Q_UNUSED(event) - -} -/*! - Overwritten to stop event propogation -*/ -void HsWidgetHost::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { - Q_UNUSED(event) -} -/*! - Filters resize events from widgets and resizes inside max/min size boundaries if needed. -*/ -bool HsWidgetHost::eventFilter(QObject *obj, QEvent *event) + +bool HsWidgetHost::eventFilter(QObject *watched, QEvent *event) { if (event->type() == QEvent::GraphicsSceneResize ) { - QGraphicsSceneResizeEvent *resizeEvent = static_cast(event); + QGraphicsSceneResizeEvent *resizeEvent = + static_cast(event); setNewSize(resizeEvent->newSize()); - emit widgetResized(this); - return true; - } else { - // standard event processing - return HbWidget::eventFilter(obj, event); + emit resized(); } + return HbWidget::eventFilter(watched, event); +} + +void HsWidgetHost::setupEffects() +{ + /* TODO: Uncomment after the Qt bug has been fixed. + QGraphicsDropShadowEffect *effect = + new QGraphicsDropShadowEffect(this); + effect->setColor(QColor(0, 0, 0, 150)); + effect->setBlurRadius(5); + effect->setOffset(3); + setGraphicsEffect(effect); + */ } -/*! - Checks if a property with the given \a name - in the contained widget. If the property exists the \a - metaProperty is made to reference to it. Returns true if - the property was found. Otherwise, returns false. -*/ +void HsWidgetHost::setupStates() +{ + // State machine + + mStateMachine = new QStateMachine(this); + mStateMachine->setAnimated(false); + + // States + + QState *state_component = new QState; + QState *state_unloaded = new QState(state_component); + QState *state_running = new QState(state_component); + QState *state_show = new QState(state_running); + QState *state_hide = new QState(state_running); + QState *state_finished = new QState; + QState *state_faulted = new QState; + QState *state_remove = new QState; + QFinalState *state_final = new QFinalState; + + mStateMachine->addState(state_component); + mStateMachine->addState(state_finished); + mStateMachine->addState(state_faulted); + mStateMachine->addState(state_remove); + mStateMachine->addState(state_final); + + mStateMachine->setInitialState(state_component); + state_component->setInitialState(state_unloaded); + state_running->setInitialState(state_hide); + + // Transitions + + state_component->addTransition( + this, SIGNAL(event_close()), state_final); + state_component->addTransition( + this, SIGNAL(event_remove()), state_remove); + state_component->addTransition( + this, SIGNAL(event_finished()), state_finished); + state_component->addTransition( + this, SIGNAL(event_faulted()), state_faulted); + + state_unloaded->addTransition( + this, SIGNAL(event_startAndShow()), state_show); + state_unloaded->addTransition( + this, SIGNAL(event_startAndHide()), state_hide); + + state_running->addTransition( + this, SIGNAL(event_unload()), state_unloaded); + + state_show->addTransition( + this, SIGNAL(event_hide()), state_hide); + + state_hide->addTransition( + this, SIGNAL(event_show()), state_show); + + state_finished->addTransition( + this, SIGNAL(event_remove()), state_remove); + state_finished->addTransition( + this, SIGNAL(event_close()), state_final); + + state_faulted->addTransition( + this, SIGNAL(event_remove()), state_remove); + state_faulted->addTransition( + this, SIGNAL(event_close()), state_final); + + state_remove->addTransition(state_final); + + // Actions + + ENTRY_ACTION(state_component, action_connectComponent) + EXIT_ACTION(state_component, action_disconnectComponent) + + ENTRY_ACTION(state_running, action_load) + ENTRY_ACTION(state_running, action_initialize) + EXIT_ACTION(state_running, action_uninitialize) + EXIT_ACTION(state_running, action_unload) + + ENTRY_ACTION(state_show, action_show) + + ENTRY_ACTION(state_hide, action_hide) + + ENTRY_ACTION(state_finished, action_finished) + + ENTRY_ACTION(state_faulted, action_faulted) + + ENTRY_ACTION(state_remove, action_remove) + + // Delete on finish. + + connect(mStateMachine, SIGNAL(finished()), SLOT(deleteLater()), + Qt::QueuedConnection); +} + bool HsWidgetHost::setProperty(const char *name, QMetaProperty &property) { const QMetaObject *object = mWidget->metaObject(); @@ -589,12 +415,6 @@ return index >= 0; } -/*! - Checks if a slot with the given \a signature exists - in the contained widget. If the slot exists the \a - method is made to reference to it. Returns true if - the slot was found. Otherwise, returns false. -*/ bool HsWidgetHost::setMethod(const char *signature, QMetaMethod &method) { const QMetaObject *object = mWidget->metaObject(); @@ -604,11 +424,6 @@ return index >= 0; } -/*! - Returns true if a signal with the given \a signature - exists in the contained widget. Otherwise, returns - false. -*/ bool HsWidgetHost::hasSignal(const char *signature) { const QMetaObject *object = mWidget->metaObject(); @@ -616,22 +431,24 @@ QMetaObject::normalizedSignature(signature)); return index >= 0; } -/*! - Returns true if fetching widget preferences from db and setting those - to widget is successfull -*/ + +void HsWidgetHost::setNewSize(const QSizeF &size) +{ + resize(size); + setPreferredSize(size); +} + bool HsWidgetHost::setPreferencesToWidget() { HsDatabase *db = HsDatabase::instance(); - Q_ASSERT(db); - + QVariantHash preferences; if (!db->widgetPreferences(mDatabaseId, preferences)) { return false; } QStringList names = preferences.keys(); - foreach(QString name, names) { + foreach (QString name, names) { mWidget->setProperty(name.toLatin1(), preferences.value(name)); } @@ -639,23 +456,159 @@ return true; } -/*! - Resizes and sets preferred size for widget layouts -*/ -void HsWidgetHost::setNewSize(const QSizeF &newSize) +void HsWidgetHost::action_connectComponent() { - resize(newSize); - setPreferredSize(newSize); + HsDatabase *db = HsDatabase::instance(); + + HsWidgetData data; + data.id = mDatabaseId; + if (!db->widget(data)) { + emit event_faulted(); + return; + } + + mComponent = HsWidgetComponentRegistry::instance()->component(data.uri); + + connect(mComponent, SIGNAL(aboutToUninstall()), SIGNAL(event_unload())); + connect(mComponent, SIGNAL(uninstalled()), SIGNAL(event_finished())); + connect(mComponent, SIGNAL(unavailable()), SIGNAL(event_unload())); + connect(mComponent, SIGNAL(unavailable()), SIGNAL(unavailable())); + connect(mComponent, SIGNAL(available()), SIGNAL(available())); + connect(mComponent, SIGNAL(updated()), SIGNAL(available())); +} + +void HsWidgetHost::action_disconnectComponent() +{ + mComponent->disconnect(this); } -/*! - This slot is connected to the contained widget's - setPreferences() signal, if it was defined for - the widget. The widget emits the signal for persisting - its preferences named with \a names. The given - preferences are read, validated, and written to - the database. -*/ +void HsWidgetHost::action_load() +{ + QServiceManager manager; + QServiceFilter filter("com.nokia.symbian.IHomeScreenWidget"); + filter.setServiceName(mComponent->uri()); + QList interfaces = manager.findInterfaces(filter); + if (interfaces.isEmpty()) { + emit event_faulted(); + return; + } + + QObject *widgetObject = manager.loadInterface(interfaces.first()); + mWidget = qobject_cast(widgetObject); + + if (!mWidget || + !setMethod("onShow()", mOnShowMethod) || + !setMethod("onHide()", mOnHideMethod)) { + mWidget = 0; + delete widgetObject; + emit event_faulted(); + return; + } + + setMethod("onInitialize()", mOnInitializeMethod); + setMethod("onUninitialize()", mOnUninitializeMethod); + setMethod("isPannable(QGraphicsSceneMouseEvent*)", mIsPannableMethod); + + setProperty("isOnline", mIsOnlineProperty); + setProperty("rootPath", mRootPathProperty); + + if (hasSignal("setPreferences(const QStringList&)")) { + connect(mWidget, SIGNAL(setPreferences(QStringList)), + SLOT(onSetPreferences(QStringList))); + } + if (hasSignal("finished()")) { + connect(mWidget, SIGNAL(finished()), + SLOT(onFinished())); + } + if (hasSignal("error()")) { + connect(mWidget, SIGNAL(error()), + SLOT(onError())); + } + + mWidget->installEventFilter(this); + + HsScene *scene = HsScene::instance(); + setMaximumSize(scene->maximumWidgetSizeInPixels()); + setMinimumSize(scene->minimumWidgetSizeInPixels()); + + loadPresentation(); + + mWidget->setParentItem(this); + + setNewSize(mWidget->size()); +} + +void HsWidgetHost::action_unload() +{ + delete mWidget; + mWidget = 0; + + mOnInitializeMethod = QMetaMethod(); + mOnShowMethod = QMetaMethod(); + mOnHideMethod = QMetaMethod(); + mOnUninitializeMethod = QMetaMethod(); + mIsPannableMethod = QMetaMethod(); + mIsOnlineProperty = QMetaProperty(); + mRootPathProperty = QMetaProperty(); +} + +void HsWidgetHost::action_initialize() +{ + mRootPathProperty.write(mWidget, mComponent->rootPath()); + setPreferencesToWidget(); + setOnline(HsScene::instance()->isOnline()); + mOnInitializeMethod.invoke(mWidget); +} + +void HsWidgetHost::action_uninitialize() +{ + mOnUninitializeMethod.invoke(mWidget); +} + +void HsWidgetHost::action_show() +{ + if (!mIsFinishing) { + mOnShowMethod.invoke(mWidget); + } +} + +void HsWidgetHost::action_hide() +{ + if (!mIsFinishing) { + mOnHideMethod.invoke(mWidget); + } +} + +void HsWidgetHost::action_finished() +{ + emit finished(); +} + +void HsWidgetHost::action_faulted() +{ + emit faulted(); +} + +void HsWidgetHost::action_remove() +{ + HsDatabase *db = HsDatabase::instance(); + + db->deleteWidget(mDatabaseId); + mDatabaseId = -1; +} + +void HsWidgetHost::onFinished() +{ + mIsFinishing = true; + emit event_finished(); +} + +void HsWidgetHost::onError() +{ + mIsFinishing = true; + emit event_faulted(); +} + void HsWidgetHost::onSetPreferences(const QStringList &names) { if (names.isEmpty()) { @@ -669,85 +622,8 @@ preferences.insert(name, value); } - HsDatabase *db = HsDatabase::instance(); - Q_ASSERT(db); - + HsDatabase *db = HsDatabase::instance(); if (!db->setWidgetPreferences(mDatabaseId, preferences)) { onError(); } } - -/*! - This slot reacts to the widgets finished() signal, if - it was defined for the widget. The widget emits the signal - when it has finished its execution and is ready for - removal from the homescreen. -*/ -void HsWidgetHost::onFinished() -{ - mState = Finished; - emit widgetFinished(this); -} - -/*! - This slot reacts to the widgets error() signal, if it was - defined for the widget. The widget emits the signal in - failure cases. -*/ -void HsWidgetHost::onError() -{ - mState = Faulted; - emit widgetError(this); -} -/*! - This slot is called when component is about to uninstall or - update. Widget need to release all handles to resources installing - to succeed. -*/ -void HsWidgetHost::onAboutToUninstall() -{ - uninitializeWidget(); - unload(); -} - -void HsWidgetHost::onUpdated() -{ - if(mState != Unloaded) { - return; - } - load(); - initializeWidget(); - if (HsScene::instance()->activePage() == mPage) { - showWidget(); - } else { - hideWidget(); - } - -} -void HsWidgetHost::onUnavailable() -{ - if (mState != Visible && mState != Hidden) { - return; - } - uninitializeWidget(); - unload(); -} - -void HsWidgetHost::onAvailable() -{ - if (mState != Unloaded) { - return; - } - load(); - initializeWidget(); - if (HsScene::instance()->activePage() == mPage) { - showWidget(); - } else { - hideWidget(); - } -} - - - - - diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsutils/inc/hsmenuevent.h --- a/homescreenapp/hsutils/inc/hsmenuevent.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsutils/inc/hsmenuevent.h Fri Jun 11 13:30:16 2010 +0300 @@ -40,6 +40,7 @@ CollectionDeleted, AddAppsToCollection, RemoveAppFromCollection, + UninstallApplication, OpenApplicationLibrary, OpenInstalledView, OpenHomeScreen, diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsutils/inc/hsmenueventfactory.h --- a/homescreenapp/hsutils/inc/hsmenueventfactory.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsutils/inc/hsmenueventfactory.h Fri Jun 11 13:30:16 2010 +0300 @@ -70,6 +70,8 @@ static QEvent *createRemoveAppFromCollectionEvent(int aItemId, int aCollectionId); + static QEvent *createUninstallApplicationEvent(int aItemId); + static QEvent *createArrangeCollectionEvent(int aTopItemId); static QEvent *createPreviewHSWidgetEvent( diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/hsutils/src/hsmenueventfactory.cpp --- a/homescreenapp/hsutils/src/hsmenueventfactory.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/hsutils/src/hsmenueventfactory.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -207,6 +207,20 @@ } /*! + Creates an HsMenuEvent::UninstallApplication event. + + \param aItemId Item id of the application to be removed from a collection. + \param aCollectionId Item id of the collection the application is to be removed from. + \return UninstallApplication event. + */ +QEvent *HsMenuEventFactory::createUninstallApplicationEvent(int aItemId) +{ + QVariantMap params; + params.insert(itemIdKey(), aItemId); + return new HsMenuEvent(HsMenuEvent::UninstallApplication, params); +} + +/*! Creates an HsMenuEvent::ArrangeCollection event. \param aTopItemId Item id to be scrolled. diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/inc/hsapp_defs.inl --- a/homescreenapp/inc/hsapp_defs.inl Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/inc/hsapp_defs.inl Fri Jun 11 13:30:16 2010 +0300 @@ -212,7 +212,7 @@ */ inline const QString newIconId() { - static const QString name("qtg_large_super_new"); + static const QString name("qtg_small_new_event"); return name; } diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/sis/homescreenapp_ut_hs.pkg --- a/homescreenapp/sis/homescreenapp_ut_hs.pkg Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/sis/homescreenapp_ut_hs.pkg Fri Jun 11 13:30:16 2010 +0300 @@ -33,62 +33,59 @@ "/epoc32/release/armv5/urel/t_hsapplicationexe.exe" - "c:/sys/bin/t_hsapplicationexe.exe" "/epoc32/data/z/private/10003a3f/import/apps/t_hsapplicationexe_reg.rsc" - "c:/private/10003a3f/import/apps/t_hsapplicationexe_reg.rsc" "/epoc32/data/z/resource/apps/t_hsapplicationexe.rsc" - "c:/resource/apps/t_hsapplicationexe.rsc" -"/epoc32/release/armv5/urel/mockruntimeplugin.dll" - "c:/sys/bin/mockruntimeplugin.dll" +"/epoc32/release/armv5/urel/mockruntimeplugin.dll" - "c:/sys/bin/mockruntimeplugin.dll" "/epoc32/data/z/private/20022f5f/hsresources/plugins/runtimeplugins/mockruntimeplugin.qtplugin" - "c:/private/20022f5f/hsresources/plugins/runtimeplugins/mockruntimeplugin.qtplugin" -"/epoc32/data/z/private/20022f5f/hsresources/plugins/runtimeplugins/mockruntimeplugin.xml" - "c:/private/20022f5f/hsresources/plugins/runtimeplugins/mockruntimeplugin.xml" +"/epoc32/data/z/private/20022f5f/hsresources/plugins/runtimeplugins/mockruntimeplugin.xml" - "c:/private/20022f5f/hsresources/plugins/runtimeplugins/mockruntimeplugin.xml" ;--------------- hsutils --------------- "/epoc32/release/armv5/urel/t_hsutils.exe" - "c:/sys/bin/t_hsutils.exe" "/epoc32/data/z/private/10003a3f/import/apps/t_hsutils_reg.rsc" - "c:/private/10003a3f/import/apps/t_hsutils_reg.rsc" "/epoc32/data/z/resource/apps/t_hsutils.rsc" - "c:/resource/apps/t_hsutils.rsc" -"../hsutils/tsrc/t_hsutils/nokia.png" - "C:/hsresources/testresources/nokia.png" -"../hsutils/tsrc/t_hsutils/large.jpg" - "C:/hsresources/testresources/large.jpg" +"../hsutils/tsrc/t_hsutils/nokia.png" - "c:/hsresources/testresources/nokia.png" +"../hsutils/tsrc/t_hsutils/large.jpg" - "c:/hsresources/testresources/large.jpg" ;--------------- hsdomainmodel --------------- - "/epoc32/release/armv5/urel/t_hsdomainmodel.exe" - "c:/sys/bin/t_hsdomainmodel.exe" "/epoc32/data/z/private/10003a3f/import/apps/t_hsdomainmodel_reg.rsc" - "c:/private/10003a3f/import/apps/t_hsdomainmodel_reg.rsc" "/epoc32/data/z/resource/apps/t_hsdomainmodel.rsc" - "c:/resource/apps/t_hsdomainmodel.rsc" -"../hsdomainmodel/tsrc/t_hsdomainmodel/hsdomainmodeltest.db" - "c:/private/20022F59/hsdomainmodeltest.db" -"../hsdomainmodel/tsrc/t_hsdomainmodel/d_landscape.png" - "c:/private/20022F59/d_landscape.png" -"../hsdomainmodel/tsrc/t_hsdomainmodel/d_portrait.png" - "c:/private/20022F59/d_portrait.png" +"../hsdomainmodel/tsrc/t_hsdomainmodel/hsdomainmodeltest.db" - "c:/private/20022F59/hsdomainmodeltest.db" +"../hsdomainmodel/tsrc/t_hsdomainmodel/d_landscape.png" - "c:/private/20022F59/d_landscape.png" +"../hsdomainmodel/tsrc/t_hsdomainmodel/d_portrait.png" - "c:/private/20022F59/d_portrait.png" -"/epoc32/release/armv5/urel/mockwidgetplugin.dll" - "c:/sys/bin/mockwidgetplugin.dll" -"/epoc32/data/z/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugin.qtplugin" - "c:/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugin.qtplugin" -"/epoc32/data/z/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugin.xml" - "c:/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugin.xml" -"/epoc32/data/z/resource/qt/translations/mockwidgetplugin.qm" - "c:/resource/qt/translations/mockwidgetplugin.qm" +"/epoc32/release/armv5/urel/mockwidgetplugin.dll" - "c:/sys/bin/mockwidgetplugin.dll" +"/epoc32/data/z/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugin.qtplugin" - "c:/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugin.qtplugin" +"/epoc32/data/z/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugin.xml" - "c:/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugin.xml" +"/epoc32/data/z/resource/qt/translations/mockwidgetplugin.qm" - "c:/resource/qt/translations/mockwidgetplugin.qm" -"/epoc32/release/armv5/urel/mockwidgetplugintoosmall.dll" - "c:/sys/bin/mockwidgetplugintoosmall.dll" -"/epoc32/data/z/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugintoosmall.qtplugin" - "c:/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugintoosmall.qtplugin" -"/epoc32/data/z/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugintoosmall.xml" - "c:/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugintoosmall.xml" +"/epoc32/release/armv5/urel/mockwidgetplugintoosmall.dll" - "c:/sys/bin/mockwidgetplugintoosmall.dll" +"/epoc32/data/z/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugintoosmall.qtplugin" - "c:/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugintoosmall.qtplugin" +"/epoc32/data/z/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugintoosmall.xml" - "c:/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugintoosmall.xml" -"/epoc32/release/armv5/urel/mockwidgetplugintoobig.dll" - "c:/sys/bin/mockwidgetplugintoobig.dll" +"/epoc32/release/armv5/urel/mockwidgetplugintoobig.dll" - "c:/sys/bin/mockwidgetplugintoobig.dll" "/epoc32/data/z/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugintoobig.qtplugin" - "c:/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugintoobig.qtplugin" -"/epoc32/data/z/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugintoobig.xml" - "c:/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugintoobig.xml" +"/epoc32/data/z/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugintoobig.xml" - "c:/private/20022F59/hsresources/plugins/widgetplugins/mockwidgetplugintoobig.xml" ;--------------- runtimeplugins --------------- ;hsdefaultruntimeplugin -"/epoc32/release/armv5/urel/t_hsdefaultruntimeplugin.exe" - "c:/sys/bin/t_hsdefaultruntimeplugin.exe" -"/epoc32/data/z/private/10003a3f/import/apps/t_hsdefaultruntimeplugin_reg.rsc" - "c:/private/10003a3f/import/apps/t_hsdefaultruntimeplugin_reg.rsc" -"/epoc32/data/z/resource/apps/t_hsdefaultruntimeplugin.rsc" - "c:/resource/apps/t_hsdefaultruntimeplugin.rsc" -"/epoc32/release/armv5/urel/mockstateplugins.dll" - "c:/sys/bin/mockstateplugins.dll" -"/epoc32/data/z/private/20022f63/hsresources/plugins/stateplugins/mockstateplugins.qtplugin" - "c:/private/20022f63/hsresources/plugins/stateplugins/mockstateplugins.qtplugin" -"/epoc32/data/z/private/20022f63/hsresources/plugins/stateplugins/mockstateplugins.xml" - "c:/private/20022f63/hsresources/plugins/stateplugins/mockstateplugins.xml" +"/epoc32/release/armv5/urel/t_hsdefaultruntimeplugin.exe" - "c:/sys/bin/t_hsdefaultruntimeplugin.exe" +"/epoc32/data/z/private/10003a3f/import/apps/t_hsdefaultruntimeplugin_reg.rsc" - "c:/private/10003a3f/import/apps/t_hsdefaultruntimeplugin_reg.rsc" +"/epoc32/data/z/resource/apps/t_hsdefaultruntimeplugin.rsc" - "c:/resource/apps/t_hsdefaultruntimeplugin.rsc" +"/epoc32/release/armv5/urel/mockstateplugins.dll" - "c:/sys/bin/mockstateplugins.dll" +"/epoc32/data/z/private/20022f63/hsresources/plugins/stateplugins/mockstateplugins.qtplugin" - "c:/private/20022f63/hsresources/plugins/stateplugins/mockstateplugins.qtplugin" +"/epoc32/data/z/private/20022f63/hsresources/plugins/stateplugins/mockstateplugins.xml" - "c:/private/20022f63/hsresources/plugins/stateplugins/mockstateplugins.xml" ;--------------- serviceproviders --------------- ;--------------- stateplugins --------------- - ;hshomescreenstateplugin "/epoc32/release/armv5/urel/t_hshomescreenstateplugin.exe" - "c:/sys/bin/t_hshomescreenstateplugin.exe" "/epoc32/data/z/private/10003a3f/import/apps/t_hshomescreenstateplugin_reg.rsc" - "c:/private/10003a3f/import/apps/t_hshomescreenstateplugin_reg.rsc" "/epoc32/data/z/resource/apps/t_hshomescreenstateplugin.rsc" - "c:/resource/apps/t_hshomescreenstateplugin.rsc" ;--------------- widgetplugins --------------- - ;hsshortcutwidgetlugin ;t_hsshortcutwidget: "/epoc32/release/armv5/urel/t_hsshortcutwidget.exe" - "c:/sys/bin/t_hsshortcutwidget.exe" @@ -100,3 +97,21 @@ "/epoc32/release/armv5/urel/t_hsclockwidgetplugin.exe" - "c:/sys/bin/t_hsclockwidgetplugin.exe" "/epoc32/data/z/private/10003a3f/import/apps/t_hsclockwidgetplugin_reg.rsc" - "c:/private/10003a3f/import/apps/t_hsclockwidgetprovider_reg.rsc" "/epoc32/data/z/resource/apps/t_hsclockwidgetplugin.rsc" - "c:/resource/apps/t_hsclockwidgetprovider.rsc" + +;--------------- hshomescreenclientplugin ----------------------- +;hshomescreenclientplugin +;"/epoc32/release/armv5/urel/t_hshomescreenclientplugin.exe" - "c:/sys/bin/t_hshomescreenclientplugin.exe" +;"/epoc32/data/z/private/10003a3f/import/apps/t_hshomescreenclientplugin_reg.rsc" - "c:/private/10003a3f/import/apps/t_hshomescreenclientplugin_reg.rsc" +;"/epoc32/data/z/resource/apps/t_hshomescreenclientplugin.rsc" - "c:/resource/apps/t_hshomescreenclientplugin.rsc" + +;--------------- hswidgetuninstaller ----------------------- +;hswidgetuninstaller +"/epoc32/release/armv5/urel/t_hswidgetuninstaller.exe" - "c:/sys/bin/t_hswidgetuninstaller.exe" +"/epoc32/data/z/private/10003a3f/import/apps/t_hswidgetuninstaller_reg.rsc" - "c:/private/10003a3f/import/apps/t_hswidgetuninstaller_reg.rsc" +"/epoc32/data/z/resource/apps/t_hswidgetuninstaller.rsc" - "c:/resource/apps/t_hswidgetuninstaller.rsc" +"../hswidgetuninstaller/tsrc/t_hswidgetuninstaller/empty.manifest" - "c:/private/20022F42/empty.manifest" +"../hswidgetuninstaller/tsrc/t_hswidgetuninstaller/fail_new.manifest" - "c:/private/20022F42/fail_new.manifest" +"../hswidgetuninstaller/tsrc/t_hswidgetuninstaller/ok_new.manifest" - "c:/private/20022F42/ok_new.manifest" +"../hswidgetuninstaller/tsrc/t_hswidgetuninstaller/ok_old.manifest" - "c:/private/20022F42/ok_old.manifest" +"../hswidgetuninstaller/tsrc/t_hswidgetuninstaller/version10.manifest" - "c:/private/20022F42/version10.manifest" +"../hswidgetuninstaller/tsrc/t_hswidgetuninstaller/version12.manifest" - "c:/private/20022F42/version12.manifest" \ No newline at end of file diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsapplibrarystateplugin/conf/hsapplibrary.confml Binary file homescreenapp/stateplugins/hsapplibrarystateplugin/conf/hsapplibrary.confml has changed diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsapplibrarystateplugin/conf/hsapplibrary_20022F97.crml Binary file homescreenapp/stateplugins/hsapplibrarystateplugin/conf/hsapplibrary_20022F97.crml has changed diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hscollectionstate.h --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hscollectionstate.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hscollectionstate.h Fri Jun 11 13:30:16 2010 +0300 @@ -69,6 +69,9 @@ void latestOnTopMenuAction(); void oldestOnTopMenuAction(); void contextMenuAction(HbAction *action); + void handleEmptyChange(bool empty); + void lockSearchButton(bool lock); + private: void construct(); void constructMenu(bool isDynamic); diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsinstalledappsstate.h --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsinstalledappsstate.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsinstalledappsstate.h Fri Jun 11 13:30:16 2010 +0300 @@ -66,6 +66,8 @@ void stateExited(); + void setEmptyLabelVisibility(bool visibility); + void contextMenuAction(HbAction *action); private: diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuview.h --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuview.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuview.h Fri Jun 11 13:30:16 2010 +0300 @@ -51,10 +51,13 @@ ~HsMenuView(); void setSearchPanelVisible(bool visible); + void setContext(HsViewContext viewContext, + HsOperationalContext context); HbView *view() const; HbListView *listView() const; + HbPushButton *collectionButton() const; void activate(); void inactivate(); @@ -77,6 +80,8 @@ void showSearchPanel(); void hideSearchPanel(); + void disableSearch(bool disable); + private slots: void scrollToRow(int row, @@ -120,6 +125,8 @@ HbSearchPanel *mSearchPanel; HbStaticVkbHost* mVkbHost; + HbPushButton *mCollectionButton; + HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest) }; diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuviewbuilder.h --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuviewbuilder.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuviewbuilder.h Fri Jun 11 13:30:16 2010 +0300 @@ -24,6 +24,7 @@ #include #include #include +#include "hsmenustates_global.h" class QActionGroup; class HbAction; @@ -35,6 +36,7 @@ class HbView; class HbWidget; class HbToolBarExtension; +class HbPushButton; enum HsViewContext { HsAllAppsContext, @@ -45,9 +47,12 @@ enum HsOperationalContext { HsItemViewContext, - HsSearchContext + HsSearchContext, + HsButtonContext, + HsEmptyLabelContext }; +HS_STATES_TEST_CLASS(MenuStatesTest) class HsMenuViewBuilder { @@ -73,6 +78,7 @@ // optional widgets accessors HbGroupBox *currentViewLabel() const; HbSearchPanel *currentSearchPanel() const; + HbPushButton *collectionButton() const; void setViewContext(HsViewContext viewContext); @@ -99,13 +105,13 @@ QSet mLoadedObjects; const QString DOCUMENT_FILE_NAME; - const QString COMMON_SECTION_NAME; const QString ALL_APPS_ACTION_NAME; const QString ALL_COLLECTIONS_ACTION_NAME; const QString SEARCH_ACTION_NAME; const QString OVI_STORE_ACTION_NAME; const QString OPERATOR_ACTION_NAME; const QString SEARCH_PANEL_NAME; + const QString BUTTON_NAME; const QString TOOL_BAR_NAME; QActionGroup *mToolBarActionGroup; @@ -115,6 +121,8 @@ HsViewContext mViewContext; HsOperationalContext mOperationalContext; + + HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest) }; #endif // HSMENUVIEWBUILDER_H diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsapplibrarystateplugin/resource/applibrary.docml --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/resource/applibrary.docml Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/resource/applibrary.docml Fri Jun 11 13:30:16 2010 +0300 @@ -1,71 +1,56 @@ - - -
- + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - + - + + +
- - + + - + - @@ -90,8 +75,8 @@ - - + + @@ -113,8 +98,8 @@ - - + + @@ -151,8 +136,8 @@ - - + + @@ -176,13 +161,13 @@ - + - - + + @@ -198,6 +183,11 @@ + + + + + @@ -216,6 +206,7 @@ + @@ -226,8 +217,8 @@ - - + + @@ -235,6 +226,11 @@ + + + + + @@ -246,16 +242,69 @@
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ - - + + @@ -271,6 +320,16 @@ + + + + + + + + + + @@ -287,18 +346,19 @@ + + - - - + + @@ -306,6 +366,15 @@ + + + + + + + + + @@ -317,16 +386,147 @@
- - +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + - + + + + + + + + + + + + + + + + + + + + + + + + diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsallappsstate.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsallappsstate.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsallappsstate.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -355,6 +355,8 @@ // check conditions and hide irrelevant menu items QSharedPointer entry = mAllAppsModel->entry(item->modelIndex()); + EntryFlags flags = item->modelIndex().data( + CaItemModel::FlagsRole).value (); if (!(entry->attribute(appSettingsPlugin()).isEmpty())) { appSettingsAction = mContextMenu->addAction(hbTrId( @@ -362,14 +364,11 @@ appSettingsAction->setData(AppSettingContextAction); } if (!(entry->attribute(componentIdAttributeName()).isEmpty()) && - entry->entryTypeName() == applicationTypeName() ) { + (flags & RemovableEntryFlag) ) { appDetailsAction = mContextMenu->addAction(hbTrId( "txt_common_menu_details")); appDetailsAction->setData(AppDetailsContextAction); - } - - EntryFlags flags = item->modelIndex().data( - CaItemModel::FlagsRole).value (); + } if (!(flags & RemovableEntryFlag)) { uninstallAction->setVisible(false); @@ -406,7 +405,9 @@ mSortAttribute, mCollectionsSortAttribute, itemId)); break; case UninstallContextAction: - HsMenuService::executeAction(itemId, removeActionIdentifier()); + machine()->postEvent( + HsMenuEventFactory::createUninstallApplicationEvent( + itemId)); break; case AppSettingContextAction: machine()->postEvent( diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsallcollectionsstate.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsallcollectionsstate.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsallcollectionsstate.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -349,9 +349,6 @@ { HSMENUTEST_FUNC_ENTRY("HsAllCollectionsState::listItemLongPressed"); - - const int itemId = item->modelIndex().data(CaItemModel::IdRole).toInt(); - mContextMenu = new HbMenu; // create context menu diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsapplibrarystateplugin/src/hscollectionstate.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hscollectionstate.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hscollectionstate.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -140,17 +141,16 @@ void HsCollectionState::construct() { HSMENUTEST_FUNC_ENTRY("HsCollectionState::construct"); + const QString parentName = parent() != 0 ? parent()->objectName() : QString(""); setObjectName(parentName + "/collectionstate"); - connect(this, SIGNAL(entered()),SLOT(stateEntered())); connect(this, SIGNAL(exited()),SLOT(stateExited())); makeConnect(); - mMenuView.view()-> - setNavigationAction(mSecondarySoftkeyAction); + mMenuView.view()->setNavigationAction(mSecondarySoftkeyAction); HSMENUTEST_FUNC_EXIT("HsCollectionState::construct"); } @@ -207,7 +207,27 @@ mCollectionId, mSortAttribute, mCollectionType); } + EntryFlags flags = + mCollectionModel->root().data(CaItemModel::FlagsRole).value< + EntryFlags> (); + + if (mCollectionModel->rowCount() == 0){ + if (flags & RemovableEntryFlag){ + mMenuView.setContext(HsCollectionContext,HsButtonContext); + } else { + mMenuView.setContext(HsCollectionContext,HsEmptyLabelContext); + } + mMenuView.disableSearch(true); + } else { + mMenuView.setContext(HsCollectionContext,HsItemViewContext); + mMenuView.disableSearch(false); + } + connect(mCollectionModel, SIGNAL(modelReset()), SLOT(updateLabel())); + connect(mCollectionModel, SIGNAL(empty(bool)),this, + SLOT(handleEmptyChange(bool))); + connect(mCollectionModel, SIGNAL(empty(bool)),this, + SLOT(lockSearchButton(bool))); mMenuView.setModel(mCollectionModel); @@ -223,10 +243,6 @@ this, SLOT(openTaskSwitcher())); - EntryFlags flags = - mCollectionModel->root().data(CaItemModel::FlagsRole).value< - EntryFlags> (); - if (flags & RemovableEntryFlag) { mOptions->addAction(hbTrId("txt_applib_opt_add_content"), this, SLOT(addAppsAction())); @@ -280,8 +296,15 @@ { HSMENUTEST_FUNC_ENTRY("HsCollectionState::stateExited"); + mMenuView.inactivate(); mMenuView.setSearchPanelVisible(false); - mMenuView.inactivate(); + mMenuView.disableSearch(false); + disconnect(mCollectionModel, SIGNAL(empty(bool)),this, + SLOT(handleEmptyChange(bool))); + + disconnect(mCollectionModel, SIGNAL(empty(bool)),this, + SLOT(lockSearchButton(bool))); + disconnect(mCollectionModel, SIGNAL(modelReset()), this, SLOT(updateLabel())); delete mCollectionModel; @@ -308,6 +331,9 @@ connect(&mMenuView, SIGNAL(longPressed(HbAbstractViewItem *, QPointF)), SLOT(listItemLongPressed(HbAbstractViewItem *, QPointF))); + connect(mMenuView.collectionButton(), + SIGNAL(released()), this, SLOT(addAppsAction())); + } /*! @@ -315,6 +341,9 @@ */ void HsCollectionState::makeDisconnect() { + disconnect(mMenuView.collectionButton(), + SIGNAL(pressed()), this, SLOT(addAppsAction())); + disconnect(mSecondarySoftkeyAction, SIGNAL(triggered()), this, SLOT(backSteppingAction())); @@ -416,7 +445,7 @@ } if (!(entry->attribute(componentIdAttributeName()).isEmpty()) && - entry->entryTypeName() == applicationTypeName() ) { + (flags & RemovableEntryFlag) ) { appDetailsAction = mContextMenu->addAction(hbTrId( "txt_common_menu_details")); appDetailsAction->setData(AppDetailsContextAction); @@ -450,7 +479,9 @@ mCollectionId, itemId, mCollectionsSortAttribute)); break; case UninstallContextAction: - HsMenuService::executeAction(itemId, removeActionIdentifier()); + machine()->postEvent( + HsMenuEventFactory::createUninstallApplicationEvent( + itemId)); break; case RemoveFromCollectionContextAction: machine()->postEvent( @@ -473,6 +504,36 @@ } /*! + Handles button visibility + */ +void HsCollectionState::handleEmptyChange(bool empty) +{ + EntryFlags flags = + mCollectionModel->root().data(CaItemModel::FlagsRole).value< + EntryFlags> (); + + if (empty){ + if (flags & RemovableEntryFlag){ + mMenuView.setContext(HsCollectionContext,HsButtonContext); + } else { + mMenuView.setContext(HsCollectionContext,HsEmptyLabelContext); + } + } else { + mMenuView.setContext(HsCollectionContext,HsItemViewContext); + } +} + + +/*! + Handles lock serch button + */ +void HsCollectionState::lockSearchButton(bool lock) +{ + mMenuView.disableSearch(lock); +} + + +/*! Menu add applications action slot */ void HsCollectionState::addAppsAction() diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsinstalledappsstate.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsinstalledappsstate.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsinstalledappsstate.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -158,6 +158,10 @@ mMenuView.setModel(mInstalledAppsModel); } + if (mInstalledAppsModel->rowCount() == 0){ + mMenuView.setContext(HsInstalledAppsContext,HsEmptyLabelContext); + } + mMenuView.listView()->scrollTo( mInstalledAppsModel->index(0)); @@ -168,6 +172,9 @@ SIGNAL(longPressed(HbAbstractViewItem *, QPointF)), SLOT(listItemLongPressed(HbAbstractViewItem *, QPointF))); + connect(mInstalledAppsModel, SIGNAL(empty(bool)),this, + SLOT(setEmptyLabelVisibility(bool))); + mMenuView.viewLabel()->setHeading( hbTrId("txt_applib_subtitle_installed")); @@ -181,6 +188,9 @@ { HSMENUTEST_FUNC_ENTRY("HsInstalledAppsState::stateExited"); + disconnect(mInstalledAppsModel, SIGNAL(empty(bool)),this, + SLOT(setEmptyLabelVisibility(bool))); + mMenuView.setSearchPanelVisible(false); mMenuView.inactivate(); @@ -192,6 +202,18 @@ } /*! + Handles button visibility + */ +void HsInstalledAppsState::setEmptyLabelVisibility(bool visibility) +{ + if(visibility){ + mMenuView.setContext(HsInstalledAppsContext,HsEmptyLabelContext); + } else { + mMenuView.setContext(HsInstalledAppsContext,HsItemViewContext); + } +} + +/*! Open task switcher. \retval true if operation is successful. */ @@ -233,7 +255,19 @@ HbAction *uninstallAction = mContextMenu->addAction( hbTrId("txt_common_menu_delete")); + HbAction *appDetailsAction(NULL); uninstallAction->setData(UninstallContextAction); + + QSharedPointer entry = mInstalledAppsModel->entry(item->modelIndex()); + EntryFlags flags = item->modelIndex().data( + CaItemModel::FlagsRole).value (); + + if (!(entry->attribute(componentIdAttributeName()).isEmpty()) && + (flags & RemovableEntryFlag) ) { + appDetailsAction = mContextMenu->addAction(hbTrId( + "txt_common_menu_details")); + appDetailsAction->setData(AppDetailsContextAction); + } mContextModelIndex = item->modelIndex(); mContextMenu->setPreferredPos(coords); @@ -251,13 +285,25 @@ Handles context menu actions */ void HsInstalledAppsState::contextMenuAction(HbAction *action) -{ - HsContextAction command = static_cast(action->data().toInt()); - if (command == UninstallContextAction) { - const int itemId = mContextModelIndex.data( - CaItemModel::IdRole).toInt(); - HsMenuService::executeAction(itemId, removeActionIdentifier()); - } +{ + HsContextAction command = + static_cast(action->data().toInt()); + + const int itemId = mContextModelIndex.data(CaItemModel::IdRole).toInt(); + + switch (command) { + case UninstallContextAction: + machine()->postEvent( + HsMenuEventFactory::createUninstallApplicationEvent( + itemId)); + break; + case AppDetailsContextAction: + machine()->postEvent( + HsMenuEventFactory::createAppDetailsViewEvent(itemId)); + break; + default: + break; + } mMenuView.setSearchPanelVisible(false); } diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuview.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuview.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuview.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -74,6 +75,8 @@ mListView = mBuilder.currentListView(); mViewLabel= mBuilder.currentViewLabel(); + mCollectionButton = mBuilder.collectionButton(); + mProxyModel->setFilterRole(CaItemModel::TextRole); mProxyModel->setFilterKeyColumn(1); mProxyModel->setSortRole(CaItemModel::TextRole); @@ -186,6 +189,20 @@ } /*! + Makes the UI to show or hide view add collection button + \param visibility When true button will be shown, + otherwise it will be hidden. + */ +void HsMenuView::setContext(HsViewContext viewContext, + HsOperationalContext context) +{ + mBuilder.setViewContext(viewContext); + mBuilder.setOperationalContext(context); + mBuilder.build(); +} + + +/*! \return View widget of the menu view. */ HbView *HsMenuView::view() const @@ -202,6 +219,14 @@ } /*! +\return Collection button + */ +HbPushButton *HsMenuView::collectionButton() const +{ + return mCollectionButton; +} + +/*! Makes search panel visible. Equivalent to \a setSearchPanelVisible(true) */ @@ -232,6 +257,15 @@ #endif //COVERAGE_MEASUREMENT /*! + Disable or enable search action button. + \param disable If true action is disabled. + */ +void HsMenuView::disableSearch(bool disable) +{ + mBuilder.searchAction()->setDisabled(disable); +} + +/*! Scrolls item view to requested row. \param row The row which is to get at the position pointed by \a hint. \param hint Position in the view the row should be scrolled to. @@ -336,6 +370,8 @@ HSMENUTEST_FUNC_ENTRY("hsmenuview::findItem"); if ("" != criteriaStr) { + mProxyModel->invalidate(); + mProxyModel->setSourceModel(mListView->model()); mProxyModel->setFilterRegExp(QRegExp(criteriaStr, Qt::CaseInsensitive, QRegExp::FixedString)); mSearchListView->scrollTo(mProxyModel->index(0,0), diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuviewbuilder.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuviewbuilder.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuviewbuilder.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -83,7 +84,6 @@ if (view != NULL && mViewContext != HsInstalledAppsContext) { view->setToolBar(mToolBar); } - return view; } @@ -95,9 +95,11 @@ */ HbListView *HsMenuViewBuilder::currentListView() const { - const QString LIST_VIEW_NAME = mViewContextToStringMap[mViewContext] - + mOperationalContextToStringMap[mOperationalContext] - + "ListView"; + QString LIST_VIEW_NAME = mViewContextToStringMap[mViewContext]; + if (mOperationalContext == HsSearchContext) { + LIST_VIEW_NAME.append(mOperationalContextToStringMap[mOperationalContext]); + } + LIST_VIEW_NAME.append("ListView"); return qobject_cast( mDocumentLoader.findWidget(LIST_VIEW_NAME)); @@ -131,6 +133,17 @@ } /*! + \return pointer to a button + The pointer is valid until the HsMenuViewBuilder instance is destroyed. + Memory ownership is not changed. + */ +HbPushButton *HsMenuViewBuilder::collectionButton() const +{ + return qobject_cast(mDocumentLoader.findWidget( + BUTTON_NAME)); +} + +/*! \return pointer to All Applications Action. Guaranteed to be not NULL. The pointer is valid until the HsMenuViewBuilder instance is destroyed. Memory ownership is not changed. @@ -230,13 +243,13 @@ */ HsMenuViewBuilder::HsMenuViewBuilder(): DOCUMENT_FILE_NAME(":/xml/applibrary.docml"), - COMMON_SECTION_NAME("commonDefinitions"), ALL_APPS_ACTION_NAME("allAppsAction"), ALL_COLLECTIONS_ACTION_NAME("allCollectionsAction"), SEARCH_ACTION_NAME("searchAction"), OVI_STORE_ACTION_NAME("oviStoreAction"), OPERATOR_ACTION_NAME("operatorAction"), SEARCH_PANEL_NAME("searchPanel"), + BUTTON_NAME("collectionButton"), TOOL_BAR_NAME("toolBar"), mToolBar(new HbToolBar), mToolBarExtension(new HbToolBarExtension), @@ -246,7 +259,7 @@ init(); // parse common section and the one specified by view options - const bool result = parseSection(COMMON_SECTION_NAME); + const bool result = parseSection(); Q_ASSERT_X(result, "HsMenuViewBuilder::HsMenuViewBuilder()", @@ -284,12 +297,10 @@ HSMENUTEST_FUNC_ENTRY("HsMenuViewBuilder::parseSection"); bool loadStatusOk = false; - const QObjectList loadedObjects = mDocumentLoader.load(DOCUMENT_FILE_NAME, sectionName, - &loadStatusOk); - + &loadStatusOk); mLoadedObjects |= loadedObjects.toSet(); Q_ASSERT_X(loadStatusOk, @@ -342,6 +353,9 @@ mViewContextToStringMap[HsCollectionContext] = "collection"; mOperationalContextToStringMap[HsItemViewContext] = ""; mOperationalContextToStringMap[HsSearchContext] = "Search"; + mOperationalContextToStringMap[HsButtonContext] = "Button"; + mOperationalContextToStringMap[HsEmptyLabelContext] = "EmptyLabel"; + } /*! @@ -360,7 +374,6 @@ void HsMenuViewBuilder::setOperationalContext( HsOperationalContext operationalContext) { - mOperationalContext = operationalContext; } diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hshomescreenstateplugin/inc/hsidlestate.h --- a/homescreenapp/stateplugins/hshomescreenstateplugin/inc/hsidlestate.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hshomescreenstateplugin/inc/hsidlestate.h Fri Jun 11 13:30:16 2010 +0300 @@ -136,7 +136,6 @@ void moveScene_onMouseReleased( QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered); - void onOrientationChanged(Qt::Orientation orientation); void widgetInteraction_onTapAndHoldTimeout(); void sceneInteraction_onTapAndHoldTimeout(); void onTitleChanged(QString title); @@ -144,7 +143,7 @@ bool openTaskSwitcher(); void zoneAnimationFinished(); void onSceneMenuTriggered(HbAction *action); - void onRemovePageMessageBoxClosed(HbAction *action); + void onRemovePageConfirmationOk(); void onSceneMenuAboutToClose(); private: @@ -152,8 +151,6 @@ HsIdleWidget *mUiWidget; QTimer mTimer; - qreal mTapAndHoldDistance; - qreal mPageChangeZoneWidth; QPointF mTouchScenePos; HsTitleResolver *mTitleResolver; diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hshomescreenstateplugin/inc/hsloadscenestate.h --- a/homescreenapp/stateplugins/hshomescreenstateplugin/inc/hsloadscenestate.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hshomescreenstateplugin/inc/hsloadscenestate.h Fri Jun 11 13:30:16 2010 +0300 @@ -19,6 +19,11 @@ #define HSLOADSCENESTATE_H #include +#ifdef Q_OS_SYMBIAN +#include + +class XQSettingsManager; +#endif class HsLoadSceneState : public QState { @@ -27,7 +32,10 @@ public: HsLoadSceneState(QState *parent = 0); ~HsLoadSceneState(); - +#ifdef Q_OS_SYMBIAN +public slots: + void handleKeyChange(XQSettingsKey key, const QVariant &value); +#endif signals: void event_history(); @@ -36,6 +44,12 @@ private: Q_DISABLE_COPY(HsLoadSceneState) + void showUi(); + +#ifdef Q_OS_SYMBIAN + XQPublishAndSubscribeSettingsKey mStartupKey; + XQSettingsManager *mSettingsMgr; +#endif }; #endif // HSLOADSCENESTATE_H diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hshomescreenstateplugin/src/hsidlestate.cpp --- a/homescreenapp/stateplugins/hshomescreenstateplugin/src/hsidlestate.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hshomescreenstateplugin/src/hsidlestate.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -46,7 +46,6 @@ #include "hsselectbackgroundstate.h" #include "hstrashbinwidget.h" #include "hspageindicator.h" -#include "hswidgetpositioningonorientationchange.h" #include "hsmenueventfactory.h" #include "hshomescreenstatecommon.h" #include "hstitleresolver.h" @@ -137,8 +136,6 @@ ,mSettingsMgr(0) #endif { - mTapAndHoldDistance = HsConfiguration::tapAndHoldDistance(); - mPageChangeZoneWidth = HsConfiguration::pageChangeZoneWidth(); setupStates(); mTimer.setSingleShot(true); mTitleResolver = new HsTitleResolver(this); @@ -479,7 +476,7 @@ */ bool HsIdleState::isInLeftPageChangeZone() { - return mTouchScenePos.x() < mPageChangeZoneWidth; + return mTouchScenePos.x() < HsConfiguration::pageChangeZoneWidth(); } /*! @@ -489,7 +486,7 @@ bool HsIdleState::isInRightPageChangeZone() { qreal pageWidth = HsScene::mainWindow()->layoutRect().width(); - return mTouchScenePos.x() > pageWidth - mPageChangeZoneWidth; + return mTouchScenePos.x() > pageWidth - HsConfiguration::pageChangeZoneWidth();; } /*! @@ -634,9 +631,7 @@ mNavigationAction->setIcon(HbIcon(gApplicationLibraryIconName)); connect(mNavigationAction, SIGNAL(triggered()), SIGNAL(event_applicationLibrary())); idleView->setNavigationAction(mNavigationAction); - - // TODO: Workaround to Qt/Hb layouting bugs. - QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); + HsGui::setIdleView(idleView); if (mPageChangeAnimation) { @@ -702,8 +697,7 @@ } foreach (HsWidgetHost *widget, widgets) { - widget->initializeWidget(); - widget->showWidget(); + widget->startWidget(); } page->layoutNewWidgets(); @@ -728,7 +722,7 @@ { connect(HsScene::mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), - SLOT(onOrientationChanged(Qt::Orientation))); + SLOT(action_idle_showActivePage())); } /*! @@ -785,7 +779,7 @@ { disconnect(HsScene::mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), - this, SLOT(onOrientationChanged(Qt::Orientation))); + this, SLOT(action_idle_showActivePage())); } /*! @@ -986,18 +980,16 @@ if (mUiWidget->trashBin()->isUnderMouse()) { HbInstantFeedback::play(HsConfiguration::widgetDropToTrashbinFeedbackType()); widget->page()->removeWidget(widget); - widget->uninitializeWidget(); - widget->deleteFromDatabase(); - widget->deleteLater(); + widget->remove(); scene->setActiveWidget(0); } else { if (widget->page() != page) { widget->page()->removeWidget(widget); page->addExistingWidget(widget); if (HsScene::orientation() == Qt::Horizontal) { - widget->deleteWidgetPresentation(Qt::Vertical); + widget->removePresentation(Qt::Vertical); } else { - widget->deleteWidgetPresentation(Qt::Horizontal); + widget->removePresentation(Qt::Horizontal); } } @@ -1012,7 +1004,7 @@ } widget->setPos(widgetX, widgetY); - widget->setWidgetPresentation(); + widget->savePresentation(); page->updateZValues(); } mAllowZoneAnimation = true; @@ -1061,9 +1053,9 @@ int pageIndex = HsScene::instance()->activePageIndex(); - if (mDeltaX < -pageSize.width() / 3) { + if (mDeltaX < -HsConfiguration::pageChangePanDistanceInPixels()) { pageIndex = qMin(pageIndex + 1, pages.count() - 1); - } else if (pageSize.width() / 3 < mDeltaX) { + } else if (HsConfiguration::pageChangePanDistanceInPixels() < mDeltaX) { pageIndex = qMax(pageIndex - 1, 0); } @@ -1116,7 +1108,7 @@ void HsIdleState::action_addPage_addPage() { HsScene *scene = HsScene::instance(); - int pageIndex = scene->pages().count(); + int pageIndex = scene->activePageIndex() + 1; addPageToScene(pageIndex); scene->setActivePageIndex(pageIndex); startPageChangeAnimation(pageIndex, HsConfiguration::newPageAddedAnimationDuration()); @@ -1136,16 +1128,18 @@ #ifndef HOMESCREEN_TEST //We don't want to test message box. //Confirm removal of page having content HbMessageBox *box = new HbMessageBox(HbMessageBox::MessageTypeQuestion); + box->setAttribute(Qt::WA_DeleteOnClose); box->setHeadingWidget(new HbLabel (hbTrId(hsLocTextId_Title_RemovePage))); box->setText(hbTrId(hsLocTextId_Confirmation_RemovePage)); - box->setPrimaryAction(new HbAction(hbTrId(hsLocTextId_ConfirmationButton_Ok))); - box->setSecondaryAction(new HbAction(hbTrId(hsLocTextId_ConfirmationButton_Cancel))); - box->setAttribute(Qt::WA_DeleteOnClose); + + QAction *buttonOk = box->actions().at(0); + //We are keen only from OK button. Cancel is not connected to any slot. + connect(buttonOk, SIGNAL(triggered()), SLOT(onRemovePageConfirmationOk())); HsScene::mainWindow()->setInteractive(true); - box->open(this,SLOT(onRemovePageMessageBoxClosed(HbAction*))); + box->open(); #endif //HOMESCREEN_TEST } else { //Empty page can be removed without confirmation @@ -1217,7 +1211,7 @@ QPointF point = event->scenePos() - event->buttonDownScenePos(Qt::LeftButton); - if (mTapAndHoldDistance < point.manhattanLength()) { + if (HsConfiguration::tapAndHoldDistance() < point.manhattanLength()) { // Threshold area for tap exceeded. This is pan or swipe mTimer.stop(); if (HsScene::instance()->activeWidget()->isPannable(event)) { @@ -1278,7 +1272,7 @@ QPointF point = event->scenePos() - event->buttonDownScenePos(Qt::LeftButton); - if (mTapAndHoldDistance < point.manhattanLength()) { + if (HsConfiguration::tapAndHoldDistance() < point.manhattanLength()) { mTimer.stop(); mUiWidget->clearDelayedPress(); emit event_moveScene(); @@ -1328,37 +1322,32 @@ QPointF delta(event->scenePos() - event->lastScenePos()); widgetRect.moveTopLeft(widgetRect.topLeft() + delta); - //Widget can be moved over the pages left border if not in the first page. - //In the first page widget cannot cross the page's left border at all. + //Widget can be moved over the pages left border qreal lowerBoundX = -widgetRect.width(); HsPage *page = scene->activePage(); - if (page == scene->pages().first()) { - lowerBoundX = 0; - } + QRectF pageRect = HsGui::idleView()->rect(); + //Widget can be moved over the pages right border + qreal upperBoundX = pageRect.width(); - //Widget can be moved over the pages right border if not in the last page when maximum amount - //of pages exist. Widget cannot cross the lastest page's right border at all. - QRectF pageRect = HsGui::idleView()->rect(); - qreal upperBoundX = pageRect.width() + widgetRect.width(); - if (page == scene->pages().last() && scene->pages().count() == scene->maximumPageCount()) { - upperBoundX = pageRect.width() - widgetRect.width(); - } + //Notice that chrome height is 64 pixels + qreal lowerBoundY = qreal(64) - widgetRect.height(); + //Widget can be moved over the pages down border + qreal upperBoundY = pageRect.height(); - //Widget cannot cross over top or bottom edges of the page. + qreal widgetX = qBound(lowerBoundX, widgetRect.x(), upperBoundX); + qreal widgetY = qBound(lowerBoundY, widgetRect.y(), upperBoundY); /* if using ItemClipsChildrenToShape-flag in widgethost then setPos does not update position here, however setGeometry does it, QT bug? */ - qreal widgetX = qBound(lowerBoundX, widgetRect.x(), upperBoundX); - qreal widgetY = qBound(qreal(64), widgetRect.y(), pageRect.height() - widgetRect.height()); widget->setGeometry(widgetX, widgetY, widgetRect.width(), widgetRect.height()); int bounceFeedbackEffectDistance = HsConfiguration::bounceFeedbackEffectDistance(); //Handle effects: //User is indicated by a tactile feedback if he/she is trying to move //widget over the first or the last page. - if( (page == scene->pages().first() && widgetRect.x() < bounceFeedbackEffectDistance ) || + if( (page == scene->pages().first() && mTouchScenePos.x() < bounceFeedbackEffectDistance ) || (page == scene->pages().last() && scene->pages().count() == scene->maximumPageCount() - && widgetRect.x()+ widgetRect.width() > pageRect.width() - bounceFeedbackEffectDistance)) { + && mTouchScenePos.x() > pageRect.width() - bounceFeedbackEffectDistance)) { HbInstantFeedback::play(HsConfiguration::widgetMoveBlockedFeedbackType()); // TODO: use code below when Orbit has updated ContinuousFeedback API //if (!mContinuousFeedback->isPlaying()) { @@ -1437,56 +1426,6 @@ } /*! - Handles orientation change events. \a orientation is the - new orientation. -*/ -void HsIdleState::onOrientationChanged(Qt::Orientation orientation) -{ - QList pages = HsScene::instance()->pages(); - QList widgets; - HsWidgetHost *widget = 0; - - QRectF pageRect = HsScene::mainWindow()->layoutRect(); - - // TODO: Temporary workaround for the Orbit bug. - if (orientation == Qt::Horizontal) { - pageRect = QRectF(0, 0, 640, 360); - } else { - pageRect = QRectF(0, 0, 360, 640); - } - // End of the workaround. - - const int chromeHeight = 64; // TODO: get this somewhere - - for (int i = 0; i < pages.count(); ++i) { - widgets = pages[i]->widgets(); - for (int j = 0; j < widgets.count(); ++j) { - widget = widgets[j]; - HsWidgetPresentationData presentation = widget->widgetPresentation(orientation); - if (presentation.widgetId < 0) { - QList geometries = - HsWidgetPositioningOnOrientationChange::instance()->convert( - QRectF(0, chromeHeight, - pageRect.height(), - pageRect.width() - chromeHeight), - QList() << widget->geometry(), - QRectF(0, chromeHeight, - pageRect.width(), - pageRect.height() - chromeHeight)); - widget->setGeometry(geometries.first()); - widget->setWidgetPresentation(); - } else { - widget->setPos(presentation.x, presentation.y); - widget->setZValue(presentation.zValue); - } - } - } - // TODO: Workaround to Qt/Hb layouting bugs. - QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); - action_idle_showActivePage(); -} - -/*! Handles tap-and-hold events for the widgetInteraction state. */ void HsIdleState::widgetInteraction_onTapAndHoldTimeout() @@ -1594,13 +1533,9 @@ /*! Handles the close of remove page confirmation dialog for page having content. */ -void HsIdleState::onRemovePageMessageBoxClosed(HbAction *action) +void HsIdleState::onRemovePageConfirmationOk() { - HbMessageBox *dlg = static_cast(sender()); - if(action == dlg->primaryAction()) { - //Page removal accepted - removeActivePage(); - } + removeActivePage(); } /*! @@ -1621,9 +1556,3 @@ emit event_waitInput(); } } - -// Undefine the helper macros. -#undef ENTRY_ACTION -#undef EXIT_ACTION -#undef CONNECT_MOUSE_EVENT_HANDLER -#undef DISCONNECT_MOUSE_EVENT_HANDLER diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hshomescreenstateplugin/src/hsidlewidget.cpp --- a/homescreenapp/stateplugins/hshomescreenstateplugin/src/hsidlewidget.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hshomescreenstateplugin/src/hsidlewidget.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -109,10 +109,17 @@ void HsIdleWidget::setGeometry(const QRectF &rect) { int n = HsScene::instance()->pages().count(); - mControlLayer->resize(rect.size()); - mPageLayer->resize(n * rect.width(), rect.height()); - mSceneLayer->resize(2 * rect.width() + HsConfiguration::bounceEffect(), rect.height()); - HbWidget::setGeometry(rect); + QRectF layoutRect(HsScene::instance()->mainWindow()->layoutRect()); + if (layoutRect == rect || (layoutRect.height() == rect.width() && layoutRect.width() == rect.height())) { + mControlLayer->resize(rect.size()); + mPageLayer->resize(n * rect.width(), rect.height()); + mSceneLayer->resize(2 * rect.width() + HsConfiguration::bounceEffect(), rect.height()); + HbWidget::setGeometry(rect); + } else { + QRectF sceneRect = mapToScene(rect).boundingRect(); + sceneRect.setTop(-sceneRect.top()); + HbWidget::setGeometry(sceneRect); + } } /*! @@ -257,6 +264,7 @@ { mTrashBin->hide(); mTrashBin->deactivate(); + mPageIndicator->setSpacing(HsConfiguration::pageIndicatorSpacing()); // for usability optimization widget, can be removed later on mPageIndicator->setVisible(1 < mPageIndicator->itemCount()); } diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hshomescreenstateplugin/src/hsloadscenestate.cpp --- 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 +#ifdef Q_OS_SYMBIAN +#include +#include +#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(); } diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsaddappstocollectionstate.h --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsaddappstocollectionstate.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsaddappstocollectionstate.h Fri Jun 11 13:30:16 2010 +0300 @@ -134,12 +134,8 @@ HsCollectionNameDialog *mEditorDialog; - bool mEditorFinishedEntered; - HsCollectionsListDialog *mListDialog; - bool mListFinishedEntered; - }; #endif /* ADDAPPSTOCOLLECTIONSTATE_H */ diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsaddtohomescreenstate.h --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsaddtohomescreenstate.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsaddtohomescreenstate.h Fri Jun 11 13:30:16 2010 +0300 @@ -27,9 +27,9 @@ HS_STATES_TEST_CLASS(MenuStatesTest) class HbAction; +class HbMessageBox; class CaEntry; -class HbMessageBox; - +class CaNotifier; class HsAddToHomeScreenState: public HsMenuBaseState { @@ -50,6 +50,8 @@ void cleanUp(); void messageWidgetCorruptedFinished(HbAction* finishedAction); + + void memoryCardRemoved(); signals: @@ -67,6 +69,7 @@ void logActionResult(QString operationName, int entryId, bool operationSucceded); + void subscribeForMemoryCardRemove(); private: @@ -78,7 +81,10 @@ HbMessageBox *mCorruptedMessage; HbAction *mConfirmAction; + HsMenuMode mMenuMode; + + CaNotifier *mNotifier; }; diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsarrangestate.h --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsarrangestate.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsarrangestate.h Fri Jun 11 13:30:16 2010 +0300 @@ -84,9 +84,6 @@ QList mArrangedCollIdList; QObjectList mObjectList; - - bool mFinishedEntered; - }; diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hscollectionnamestate.h --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hscollectionnamestate.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hscollectionnamestate.h Fri Jun 11 13:30:16 2010 +0300 @@ -71,7 +71,6 @@ HsCollectionNameDialog *mCollectionNameDialog; - bool mFinishedEntered; }; #endif /* COLLECTIONANAMESTATE_H */ diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hspreviewhswidgetstate.h --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hspreviewhswidgetstate.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hspreviewhswidgetstate.h Fri Jun 11 13:30:16 2010 +0300 @@ -53,8 +53,6 @@ void cleanUp(); - void memoryCardRemoved(); - signals: void exit(); @@ -79,7 +77,7 @@ int mEntryId; HbMessageBox *mCorruptedMessage; - + }; diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsuninstallitemstate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsuninstallitemstate.h Fri Jun 11 13:30:16 2010 +0300 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef HSUNINSTALLITEMSTATE_H +#define HSUNINSTALLITEMSTATE_H + +#include + +#include "hsmenustates_global.h" +HS_STATES_TEST_CLASS(MenuStatesTest) + +class HbAction; +class HbMessageBox; +class HsShortcutService; +class HsMenuService; + +class HsUninstallItemState: public QState +{ + Q_OBJECT + + HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest) + +public: + + HsUninstallItemState(QState *parent = 0); + + virtual ~HsUninstallItemState(); + +protected: + + void onEntry(QEvent *event); + +private slots: + + void uninstallMessageFinished(HbAction* finishedAction); + + void cleanUp(); + +signals: + + void exit(); + +private: + + void construct(); + + HsShortcutService *shortcutService() const; + +private: + + int mItemId; + + HbMessageBox *mUninstallMessage; // deletes itself automatically on close + + HbAction *mConfirmAction; // child for mConfirmMessage + +}; + +#endif //HSUNINSTALLITEMSTATE_H diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsmenuworkerstateplugin/resource/hsappchecklist.docml --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/resource/hsappchecklist.docml Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/resource/hsappchecklist.docml Fri Jun 11 13:30:16 2010 +0300 @@ -2,6 +2,9 @@ + + + diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsaddappstocollectionstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsaddappstocollectionstate.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsaddappstocollectionstate.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -180,8 +180,7 @@ mNewCollectionState(0), mAppsCheckListState(0), mActionType( NoActionType), mApplicationsSortAttribute(NoHsSortAttribute), mCollectionsSortAttribute(NoHsSortAttribute), mAppsCheckList(0), - mEditorDialog(0), mEditorFinishedEntered(false), mListDialog(0), - mListFinishedEntered(false) + mEditorDialog(0), mListDialog(0) { construct(); } @@ -376,11 +375,15 @@ mAppsCheckList = NULL; if (mEditorDialog) { + disconnect(mEditorDialog, SIGNAL(finished(HbAction*)), + this, SLOT(editorDialogFinished(HbAction*))); mEditorDialog->close(); mEditorDialog = NULL; } if (mListDialog) { + disconnect(mListDialog, SIGNAL(finished(HbAction*)), + this, SLOT(listDialogFinished(HbAction*))); mListDialog->close(); mListDialog = NULL; } @@ -399,7 +402,6 @@ { qDebug("HsAddAppsToCollectionState::newCollection"); HSMENUTEST_FUNC_ENTRY("HsAddAppsToCollectionState::newCollection"); - mEditorFinishedEntered = false; mEditorDialog = new HsCollectionNameDialog(); mEditorDialog->open(this, SLOT(editorDialogFinished(HbAction*))); @@ -415,31 +417,23 @@ // void HsAddAppsToCollectionState::editorDialogFinished(HbAction* finishedAction) { - if (!mEditorFinishedEntered) { - mEditorFinishedEntered = true; - - if (finishedAction == mEditorDialog->actions().value(0)) { - QString newName(mEditorDialog->newName(mEditorDialog->value().toString(), true)); - if (mActionType == ViaAllViewOptionMenuType) { - qDebug("HsAddAppsToCollectionState::newCollection() " - "- emit collectionNameSelectedCl(newName)"); - emit transitToAppsCheckListState(newName); - } else { - qDebug("HsAddAppsToCollectionState::newCollection() " - "- emit collectionNameSelected(newName)"); - emit transitToSaveState(newName); - } + if (finishedAction == mEditorDialog->actions().value(0)) { + QString newName(mEditorDialog->newName(mEditorDialog->value().toString(), true)); + if (mActionType == ViaAllViewOptionMenuType) { + qDebug("HsAddAppsToCollectionState::newCollection() " + "- emit collectionNameSelectedCl(newName)"); + emit transitToAppsCheckListState(newName); } else { - qDebug( - "HsAddAppsToCollectionState::newCollection() - emit cancel()"); - emit transitToFinalState(); + qDebug("HsAddAppsToCollectionState::newCollection() " + "- emit collectionNameSelected(newName)"); + emit transitToSaveState(newName); } - mEditorDialog = NULL; // set to null since this will be deleted after close - } else { - // (work-around if more then one action is selected in HbDialog) - qWarning("Another signal finished was emited."); + qDebug( + "HsAddAppsToCollectionState::newCollection() - emit cancel()"); + emit transitToFinalState(); } + mEditorDialog = NULL; // set to null since this will be deleted after close } /*! @@ -452,7 +446,6 @@ { qDebug("HsAddAppsToCollectionState::selectCollection()"); HSMENUTEST_FUNC_ENTRY("HsAddAppsToCollectionState::selectCollection"); - mListFinishedEntered = false; mListDialog = new HsCollectionsListDialog(mCollectionsSortAttribute, mCollectionId); mListDialog->open(this, SLOT(listDialogFinished(HbAction*))); @@ -469,34 +462,25 @@ // void HsAddAppsToCollectionState::listDialogFinished(HbAction* finishedAction) { - if (!mListFinishedEntered) { - mListFinishedEntered = true; - - if (finishedAction != mListDialog->actions().value(0)) { - int itemId = mListDialog->getItemId(); - if (itemId) { - if (mActionType == ViaAllViewOptionMenuType) { - qDebug("emit collectionSelectedCl(%d)", itemId); - emit transitToAppsCheckListState(itemId); - } else { - qDebug("emit collectionSelected(%d)", itemId); - emit transitToSaveState(itemId); - } + if (finishedAction != mListDialog->actions().value(0)) { + int itemId = mListDialog->getItemId(); + if (itemId) { + if (mActionType == ViaAllViewOptionMenuType) { + qDebug("emit collectionSelectedCl(%d)", itemId); + emit transitToAppsCheckListState(itemId); } else { - qDebug("emit createNewCollection()"); - emit transitToNewCollectionState(); + qDebug("emit collectionSelected(%d)", itemId); + emit transitToSaveState(itemId); } } else { - qDebug("emit cancel()"); - emit transitToFinalState(); + qDebug("emit createNewCollection()"); + emit transitToNewCollectionState(); } - - mListDialog = NULL; // set to null since this will be deleted after close - } else { - // (work-around if more then one action is selected in HbDialog) - qWarning("Another signal finished was emited."); + qDebug("emit cancel()"); + emit transitToFinalState(); } + mListDialog = NULL; // set to null since this will be deleted after close } /*! diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsaddtohomescreenstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsaddtohomescreenstate.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsaddtohomescreenstate.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -27,6 +27,8 @@ #include "hsaddtohomescreenstate.h" #include "hsmenuevent.h" +#include "canotifier.h" +#include "canotifierfilter.h" #include "caservice.h" #include "caquery.h" #include "hsmenuservice.h" @@ -54,7 +56,8 @@ HsAddToHomeScreenState::HsAddToHomeScreenState(QState *parent) : HsMenuBaseState(ADD_TO_HOMESCREEN_STATE, parent), mCorruptedMessage(NULL), mConfirmAction(NULL), - mMenuMode(NormalHsMenuMode) + mMenuMode(NormalHsMenuMode), + mNotifier(0) { requestServices(QList () << SHORTCUT_SERVICE_KEY << CONTENT_SERVICE_KEY); @@ -105,6 +108,7 @@ if (success && (mMenuMode == NormalHsMenuMode)) { HbNotificationDialog *notificationDialog = new HbNotificationDialog(); notificationDialog->setAttribute(Qt::WA_DeleteOnClose); + notificationDialog->setSequentialShow(false); notificationDialog->setTitle(hbTrId( "txt_applib_dpophead_added_to_homescreen") ); notificationDialog->show(); @@ -130,6 +134,7 @@ params[URI] = uri; bool success = contentService.createWidget(params); if (!success) { + subscribeForMemoryCardRemove(); showMessageWidgetCorrupted(); } else { emit exit(); @@ -154,6 +159,7 @@ void HsAddToHomeScreenState::showMessageWidgetCorrupted() { HSMENUTEST_FUNC_ENTRY("HsCollectionState::showMessageWidgetCorrupted"); + mCorruptedMessage = new HbMessageBox(HbMessageBox::MessageTypeQuestion); mCorruptedMessage->setAttribute(Qt::WA_DeleteOnClose); @@ -184,20 +190,13 @@ void HsAddToHomeScreenState::messageWidgetCorruptedFinished (HbAction* finishedAction) { - if (mCorruptedMessage) { - if (finishedAction == mConfirmAction) { - HsMenuService::executeAction(mEntryId, removeActionIdentifier()); - } - mCorruptedMessage = NULL; - emit exit(); - if (mMenuMode == AddHsMenuMode) { - machine()->postEvent( - HsMenuEventFactory::createOpenHomeScreenEvent()); - } - - } else { - // (work-around for crash if more then one action is selected in HbDialog) - qWarning("Another signal finished was emited."); + if (finishedAction == mConfirmAction) { + HsMenuService::executeAction(mEntryId, removeActionIdentifier()); + } + emit exit(); + if (mMenuMode == AddHsMenuMode) { + machine()->postEvent( + HsMenuEventFactory::createOpenHomeScreenEvent()); } } @@ -210,9 +209,18 @@ { // Close popups if App key was pressed if (mCorruptedMessage) { + disconnect(mCorruptedMessage, SIGNAL(finished(HbAction*)), + this, SLOT(messageWidgetCorruptedFinished(HbAction*))); mCorruptedMessage->close(); mCorruptedMessage = NULL; } + + disconnect(mNotifier, + SIGNAL(entryChanged(CaEntry,ChangeType)), + this, SLOT(memoryCardRemoved())); + + delete mNotifier; + mNotifier = NULL; } @@ -305,3 +313,33 @@ qWarning() << message; } } + +/*! + Subscribe for memory card remove. + \retval void + */ +void HsAddToHomeScreenState::subscribeForMemoryCardRemove() +{ + CaNotifierFilter filter; + QList entryIds; + entryIds.append(mEntryId); + filter.setIds(entryIds); + mNotifier = CaService::instance()->createNotifier(filter); + mNotifier->setParent(this); + connect(mNotifier, + SIGNAL(entryChanged(CaEntry,ChangeType)), + SLOT(memoryCardRemoved())); +} + +/*! + Memory card with instaled widget was removed. + \retval void + */ +void HsAddToHomeScreenState::memoryCardRemoved() +{ + if (mCorruptedMessage) { + mCorruptedMessage->close(); + mCorruptedMessage = NULL; + } + // exit not needed, it is called after dialog closed +} diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsarrangestate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsarrangestate.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsarrangestate.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -78,7 +78,7 @@ */ HsArrangeState::HsArrangeState(QState *parent) : QState(parent), mDialog(0), mEntriesList(0), - mItemModel(0), mFinishedEntered(false) + mItemModel(0) { construct(); } @@ -193,21 +193,13 @@ */ void HsArrangeState::arrangeDialogFinished(HbAction* finishedAction) { - if (!mFinishedEntered) { - mFinishedEntered = true; - - mEntriesList->setArrangeMode(false); - if (finishedAction == mDialog->actions().value(0)) { - save(*mEntriesList); - } - emit exit(); - } else { - // (work-around for crash if more then one action is selected in HbDialog) - qWarning("Another signal finished was emited."); + mEntriesList->setArrangeMode(false); + if (finishedAction == mDialog->actions().value(0)) { + save(*mEntriesList); } + emit exit(); } - /*! Slot invoked when a state is exited. */ @@ -215,9 +207,10 @@ { HSMENUTEST_FUNC_ENTRY("HsArrangeState::stateExited"); if (mDialog) { + disconnect(mDialog, SIGNAL(finished(HbAction*)), this, SLOT(arrangeDialogFinished(HbAction*))); mDialog->close(); + mDialog = NULL; } - mDialog = NULL; mObjectList.clear(); // mDialog as parent for all confml items @@ -228,8 +221,6 @@ mArrangedCollIdList.clear(); mCollIdList.clear(); - mFinishedEntered = false; - HSMENUTEST_FUNC_EXIT("HsArrangeState::stateExited"); qDebug("HsArrangeState::stateExited()"); } diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hscollectionnamestate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hscollectionnamestate.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hscollectionnamestate.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -55,7 +55,7 @@ */ HsCollectionNameState::HsCollectionNameState(QState *parent) : QState(parent), - mItemId(0), mCollectionNameDialog(NULL), mFinishedEntered(false) + mItemId(0), mCollectionNameDialog(NULL) { construct(); } @@ -76,7 +76,6 @@ { setObjectName(this->parent()->objectName() + "/collectionnamestate"); connect(this, SIGNAL(exited()), SLOT(cleanUp())); - } /*! @@ -93,7 +92,6 @@ QState::onEntry(event); mItemId = 0; - mFinishedEntered = false; if (event->type() == HsMenuEvent::eventType()) { HsMenuEvent *menuEvent = static_cast(event); QVariantMap data = menuEvent->data(); @@ -115,24 +113,18 @@ // void HsCollectionNameState::dialogFinished(HbAction* finishedAction) { - if (!mFinishedEntered) { - mFinishedEntered = true; - if (finishedAction == mCollectionNameDialog->actions().value(0)) { - QString newName(mCollectionNameDialog->newName(mCollectionNameDialog->value().toString(), true)); - if (mItemId) { - if (newName != HsMenuService::getName(mItemId)) { - HsMenuService::renameCollection(mItemId, newName); - } - } else { - HsMenuService::createCollection(newName); + if (finishedAction == mCollectionNameDialog->actions().value(0)) { + QString newName(mCollectionNameDialog->newName(mCollectionNameDialog->value().toString(), true)); + if (mItemId) { + if (newName != HsMenuService::getName(mItemId)) { + HsMenuService::renameCollection(mItemId, newName); } + } else { + HsMenuService::createCollection(newName); } - mCollectionNameDialog = NULL; //set to NULL since this will be deleted atfer close - emit exit(); - } else { - // (work-around if more then one action is selected in HbDialog) - qWarning("Another signal finished was emited."); } + mCollectionNameDialog = NULL; //set to NULL since this will be deleted atfer close + emit exit(); } // --------------------------------------------------------------------------- @@ -141,6 +133,7 @@ void HsCollectionNameState::cleanUp() { if (mCollectionNameDialog) { + disconnect(mCollectionNameDialog, SIGNAL(finished(HbAction*)), this, SLOT(dialogFinished(HbAction*))); mCollectionNameDialog->close(); mCollectionNameDialog = NULL; } diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hscollectionslistdialog.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hscollectionslistdialog.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hscollectionslistdialog.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -62,7 +62,10 @@ int collectionId) : HbSelectionDialog(), mItemId(0) { - setPrimaryAction(NULL); + clearActions(); + HbAction *cancelAction = new HbAction(hbTrId("txt_common_button_cancel"), this); + addAction(cancelAction); + setHeadingWidget(new HbLabel(hbTrId("txt_applib_title_add_to"))); // it must be single selection, although it shows checkboxes - // it is Orbit defect and will be fixed in next release @@ -109,8 +112,6 @@ HbDialog::closeEvent(event); // emits finished(HbAction*) } - - /*! Creates standard item model. \param sortOrder sort order. diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsdeletecollectionitemstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsdeletecollectionitemstate.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsdeletecollectionitemstate.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -66,9 +66,6 @@ Sets entry event. \param event entry event. */ -#ifdef COVERAGE_MEASUREMENT -#pragma CTC SKIP -#endif //COVERAGE_MEASUREMENT void HsDeleteCollectionItemState::onEntry(QEvent *event) { HSMENUTEST_FUNC_ENTRY("HsDeleteCollectionItemState::onEntry"); @@ -102,26 +99,18 @@ HSMENUTEST_FUNC_EXIT("HsDeleteCollectionItemState::onEntry"); } -#ifdef COVERAGE_MEASUREMENT -#pragma CTC ENDSKIP -#endif //COVERAGE_MEASUREMENT -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// +/*! + Action after closed confirmation dialog. + \param finishedAction chosen action. + \retval void + */ void HsDeleteCollectionItemState::deleteMessageFinished(HbAction* finishedAction) { - if (mItemId !=0 ) { // (work-around for crash if more then one action is selected in HbDialog) - - if (finishedAction == mConfirmAction) { - HsMenuService::removeApplicationFromCollection(mItemId, mCollectionId); - } - mItemId = 0; - emit exit(); - } else { - // (work-around for crash if more then one action is selected in HbDialog) - qWarning("Another signal finished was emited."); + if (finishedAction == mConfirmAction) { + HsMenuService::removeApplicationFromCollection(mItemId, mCollectionId); } + emit exit(); } /*! @@ -132,11 +121,12 @@ { // Close messagebox if App key was pressed if (mDeleteMessage) { + disconnect(mDeleteMessage, SIGNAL(finished(HbAction*)), this, SLOT(deleteMessageFinished(HbAction*))); mDeleteMessage->close(); + mDeleteMessage = NULL; } - - mDeleteMessage = NULL; - mConfirmAction= NULL; + + mConfirmAction = NULL; mItemId = 0; mCollectionId = 0; } diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsdeletecollectionstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsdeletecollectionstate.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsdeletecollectionstate.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -126,19 +126,12 @@ // void HsDeleteCollectionState::deleteMessageFinished(HbAction* finishedAction) { - if (mItemId !=0 ) { // (work-around for crash if more then one action is selected in HbDialog) - - if (finishedAction == mConfirmAction) { - HsMenuService::removeCollection(mItemId); - machine()->postEvent( - HsMenuEventFactory::createCollectionDeletedEvent()); - } - mItemId = 0; - emit exit(); - } else { - // (work-around for crash if more then one action is selected in HbDialog) - qWarning("Another signal finished was emited."); + if (finishedAction == mConfirmAction) { + HsMenuService::removeCollection(mItemId); + machine()->postEvent( + HsMenuEventFactory::createCollectionDeletedEvent()); } + emit exit(); } /*! @@ -149,10 +142,11 @@ { // Close messagebox if App key was pressed if (mDeleteMessage) { + disconnect(mDeleteMessage, SIGNAL(finished(HbAction*)), this, SLOT(deleteMessageFinished(HbAction*))); mDeleteMessage->close(); + mDeleteMessage = NULL; } - mDeleteMessage = NULL; - mConfirmAction= NULL; + mConfirmAction = NULL; mItemId = 0; } diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsmenuworkerstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsmenuworkerstate.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsmenuworkerstate.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -21,6 +21,7 @@ #include "hsaddappstocollectionstate.h" #include "hsdeletecollectionstate.h" #include "hsdeletecollectionitemstate.h" +#include "hsuninstallitemstate.h" #include "hsmenuworkerstate.h" #include "hscollectionnamestate.h" #include "hsarrangestate.h" @@ -75,6 +76,8 @@ HsMenuEvent::DeleteCollection); createChildState ( HsMenuEvent::RemoveAppFromCollection); + createChildState ( + HsMenuEvent::UninstallApplication); createChildState (HsMenuEvent::ArrangeCollection); // create a new child state based on the template diff -r 4785f57bf3d4 -r 03646e8da489 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 - 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(); } diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsuninstallitemstate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsuninstallitemstate.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Menu delete collection item state + * + */ + +#include +#include +#include +#include + +#include "hsuninstallitemstate.h" +#include "hsmenuevent.h" + +/*! + \class HsUninstallItemState + \ingroup group_hsworkerstateplugin + \brief Uninstall Item State. + Deletes app from collection. + */ + +/*! + Constructor. + \param parent Owner. + */ +HsUninstallItemState::HsUninstallItemState(QState *parent) : + QState(parent), + mItemId(0), + mUninstallMessage(NULL), + mConfirmAction(NULL) +{ + construct(); +} + +/*! + Destructor. + */ +HsUninstallItemState::~HsUninstallItemState() +{ + cleanUp(); // in case of throw +} + +/*! + Constructs contained objects. + */ +void HsUninstallItemState::construct() +{ + setObjectName(this->parent()->objectName() + + "/UninstallItemState"); + setProperty(HS_SERVICES_REGISTRATION_KEY, QList () + << SHORTCUT_SERVICE_KEY); + connect(this, SIGNAL(exited()), SLOT(cleanUp())); +} + +/*! + Sets entry event. + \param event entry event. + */ +void HsUninstallItemState::onEntry(QEvent *event) +{ + HSMENUTEST_FUNC_ENTRY("HsUninstallItemState::onEntry"); + QState::onEntry(event); + qDebug("HsUninstallItemState::onEntry()"); + HsMenuEvent *menuEvent = static_cast(event); + QVariantMap data = menuEvent->data(); + + mItemId = data.value(itemIdKey()).toInt(); + + QString message; + if (shortcutService()->isItemShortcutWidget(mItemId)) { + message.append( + hbTrId("txt_applib_dialog_uninstalls_1_and_deletes_all_sh").arg( + HsMenuService::getName(mItemId))); + } else { + message.append( + hbTrId("txt_applib_dialog_1_will_be_removed_from_phone_c").arg( + HsMenuService::getName(mItemId))); + } + + // create and show message box + mUninstallMessage = new HbMessageBox(HbMessageBox::MessageTypeQuestion); + mUninstallMessage->setAttribute(Qt::WA_DeleteOnClose); + + mUninstallMessage->setText(message); + + mUninstallMessage->clearActions(); + mConfirmAction = new HbAction(hbTrId("txt_common_button_ok"), mUninstallMessage); + mUninstallMessage->addAction(mConfirmAction); + + HbAction *secondaryAction = new HbAction(hbTrId("txt_common_button_cancel"), mUninstallMessage); + mUninstallMessage->addAction(secondaryAction); + + mUninstallMessage->open(this, SLOT(uninstallMessageFinished(HbAction*))); + + HSMENUTEST_FUNC_EXIT("HsUninstallItemState::onEntry"); +} + +/*! + Action after closed confirmation dialog. + \param finishedAction chosen action. + \retval void + */ +void HsUninstallItemState::uninstallMessageFinished(HbAction* finishedAction) +{ + if (finishedAction == mConfirmAction) { + HsMenuService::executeAction(mItemId, removeActionIdentifier()); + } + emit exit(); +} + +/*! + Convenience method returning the shortcut service. + \since S60 ?S60_version. + \return Shortcut Service. + */ +HsShortcutService *HsUninstallItemState::shortcutService() const +{ + return property(SHORTCUT_SERVICE_KEY).value (); +} + +/*! + Slot launched after state has exited and in destructor. + \retval void + */ +void HsUninstallItemState::cleanUp() +{ + // Close messagebox if App key was pressed + if (mUninstallMessage) { + disconnect(mUninstallMessage, SIGNAL(finished(HbAction*)), this, SLOT(uninstallMessageFinished(HbAction*))); + mUninstallMessage->close(); + mUninstallMessage = NULL; + } + + mConfirmAction = NULL; + mItemId = 0; +} diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsviewappdetailsstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsviewappdetailsstate.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsviewappdetailsstate.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -89,14 +89,7 @@ nameLabel->setPlainText(detailMap[CaSoftwareRegistry::componentNameKey()]); versionLabel->setPlainText(detailMap[CaSoftwareRegistry::componentVersionKey()]); supplierLabel->setPlainText(detailMap[CaSoftwareRegistry::componentVendorKey()]); - if(detailMap[CaSoftwareRegistry::componentDriveInfoKey()] == "C:") - memoryLabel->setPlainText(QString("%1 txt_applib_dialog_1_device_memory").arg(detailMap[CaSoftwareRegistry::componentDriveInfoKey()])); - else if (detailMap[CaSoftwareRegistry::componentDriveInfoKey()] == "E:") - memoryLabel->setPlainText(QString("%1 txt_applib_dialog_1_mass_storage").arg(detailMap[CaSoftwareRegistry::componentDriveInfoKey()])); - else if (detailMap[CaSoftwareRegistry::componentDriveInfoKey()] == "F:") - memoryLabel->setPlainText(QString("%1 txt_applib_dialog_1_memory_card").arg(detailMap[CaSoftwareRegistry::componentDriveInfoKey()])); - else - memoryLabel->setPlainText(detailMap[CaSoftwareRegistry::componentDriveInfoKey()]); + memoryLabel->setPlainText(detailMap[CaSoftwareRegistry::componentDriveInfoKey()]); sizeLabel->setPlainText(detailMap[CaSoftwareRegistry::componentSizeKey()]); typeLabel->setPlainText(detailMap[CaSoftwareRegistry::componentTypeKey()]); diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/widgetplugins/hsshortcutwidgetplugin/inc/hsshortcutwidget.h --- a/homescreenapp/widgetplugins/hsshortcutwidgetplugin/inc/hsshortcutwidget.h Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/widgetplugins/hsshortcutwidgetplugin/inc/hsshortcutwidget.h Fri Jun 11 13:30:16 2010 +0300 @@ -37,6 +37,8 @@ Q_PROPERTY(int caEntryId READ caEntryId WRITE setCaEntryId) Q_PROPERTY(QString uid READ uid WRITE setUid) + Q_PROPERTY(QString text READ text WRITE setText ) + public: HsShortcutWidget(QGraphicsItem *parent = 0, Qt::WindowFlags flags = 0); ~HsShortcutWidget(); @@ -46,6 +48,9 @@ void setUid(const QString &uid); QString uid() const; + QString text() const; + void setText(const QString& textItem); + bool eventFilter(QObject *watched, QEvent *event); signals: diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/widgetplugins/hsshortcutwidgetplugin/resource/hsshortcutwidget.css --- a/homescreenapp/widgetplugins/hsshortcutwidgetplugin/resource/hsshortcutwidget.css Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/widgetplugins/hsshortcutwidgetplugin/resource/hsshortcutwidget.css Fri Jun 11 13:30:16 2010 +0300 @@ -1,30 +1,30 @@ HsShortcutWidget { + layout: icon_shortcut; +} + +HsShortcutWidget[text] { layout: icon_text_shortcut; } -HsShortcutWidget[icon][text] { - layout: icon_text_shortcut; -} - -HsShortcutWidget[icon][!text] { +HsShortcutWidget[!text] { layout: icon_shortcut; } HsShortcutWidget::background { border-width: 0.0un; fixed-width: 12un; - fixed-height: expr(12.5un + var(hb-param-text-height-tiny)); + fixed-height: 12un; zvalue: 0; } -HsShortcutWidget[icon][text]::background { +HsShortcutWidget[text]::background { border-width: 0.0un; fixed-width: 12un; fixed-height: expr(12.5un + var(hb-param-text-height-tiny)); zvalue: 0; } -HsShortcutWidget[icon][!text]::background { +HsShortcutWidget[!text]::background { border-width: 0.0un; fixed-width: 12un; fixed-height: 12un; diff -r 4785f57bf3d4 -r 03646e8da489 homescreenapp/widgetplugins/hsshortcutwidgetplugin/src/hsshortcutwidget.cpp --- a/homescreenapp/widgetplugins/hsshortcutwidgetplugin/src/hsshortcutwidget.cpp Thu May 27 12:46:08 2010 +0300 +++ b/homescreenapp/widgetplugins/hsshortcutwidgetplugin/src/hsshortcutwidget.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -98,6 +98,28 @@ } /*! + Returns the text property. This property is needed by css selector. +*/ +QString HsShortcutWidget::text() const +{ + if ( mText ) { + return mText->text(); + } else { + return QString(); + } +} + +/*! + Sets the text property. This property is needed by css selector. +*/ +void HsShortcutWidget::setText(const QString& textItem) +{ + if ( mText ) { + mText->setText(textItem); + } +} + +/*! Filters touch area events. */ bool HsShortcutWidget::eventFilter(QObject *watched, QEvent *event) @@ -239,11 +261,10 @@ } // Text - if (!mText) { + if ( HsConfiguration::shortcutLabelsVisible() && !mText ) { mText = new HbTextItem(this); HbStyle::setItemName(mText, QLatin1String("text")); - } - + } // Touch Area if (!mTouchArea) { mTouchArea = new HbTouchArea(this); @@ -261,7 +282,9 @@ mCaEntryFlags = caEntry.flags(); mCaEntryTypeName = caEntry.entryTypeName(); mIcon->setIcon(caEntry.makeIcon()); - mText->setText(caEntry.text()); + if (mText) { + mText->setText(caEntry.text()); + } } /*! @@ -320,3 +343,5 @@ emit finished(); } } + + diff -r 4785f57bf3d4 -r 03646e8da489 taskswitcherapp/rom/tsapplication_core.iby --- a/taskswitcherapp/rom/tsapplication_core.iby Thu May 27 12:46:08 2010 +0300 +++ b/taskswitcherapp/rom/tsapplication_core.iby Fri Jun 11 13:30:16 2010 +0300 @@ -17,8 +17,6 @@ #ifndef __TSAPP_CORE_IBY__ #define __TSAPP_CORE_IBY__ -data=\epoc32\data\z\resource\qt\crml\tsexternalactivation.qcrml resource\qt\crml\tsexternalactivation.qcrml - file=ABI_DIR\BUILD_DIR\tsdevicedialogplugin.dll SHARED_LIB_DIR\tsdevicedialogplugin.dll data=\epoc32\data\z\resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin diff -r 4785f57bf3d4 -r 03646e8da489 taskswitcherapp/taskswitcherapp.pro --- a/taskswitcherapp/taskswitcherapp.pro Thu May 27 12:46:08 2010 +0300 +++ b/taskswitcherapp/taskswitcherapp.pro Fri Jun 11 13:30:16 2010 +0300 @@ -16,14 +16,14 @@ TEMPLATE = subdirs -SUBDIRS += tsdevicedialogplugin - coverage { SUBDIRS += ../../homescreensrv/activityfw SUBDIRS += ../../homescreensrv/hsappkeyhandler SUBDIRS += ../../homescreensrv/tstaskmonitor } +SUBDIRS += tsdevicedialogplugin + tests { SUBDIRS += internal/tstestrunner SUBDIRS += tsdevicedialogplugin/tsrc @@ -33,7 +33,10 @@ SUBDIRS += ../../homescreensrv/activityfw/activityserviceplugin/s60/tsrc SUBDIRS += ../../homescreensrv/tstaskmonitor/client/tsrc SUBDIRS += ../../homescreensrv/tstaskmonitor/server/tsrc + SUBDIRS += ../../homescreensrv/tstaskmonitor/screenshotplugin/tsrc SUBDIRS += ../../homescreensrv/activityfw/tsutils/tsrc + SUBDIRS += ../../homescreensrv/tstaskmonitor/utils/tsrc + SUBDIRS += ../../homescreensrv/tstaskmonitor/backstepping/tsrc } symbian:include(rom.pri) diff -r 4785f57bf3d4 -r 03646e8da489 taskswitcherapp/tsdevicedialogplugin/src/tsdevicedialogplugin.cpp --- a/taskswitcherapp/tsdevicedialogplugin/src/tsdevicedialogplugin.cpp Thu May 27 12:46:08 2010 +0300 +++ b/taskswitcherapp/tsdevicedialogplugin/src/tsdevicedialogplugin.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -154,4 +154,12 @@ return mError; } +#ifdef COVERAGE_MEASUREMENT +#pragma CTC SKIP +#endif //COVERAGE_MEASUREMENT + Q_EXPORT_PLUGIN2(tsdevicedialogplugin, TsDeviceDialogPlugin) + +#ifdef COVERAGE_MEASUREMENT +#pragma CTC ENDSKIP +#endif //COVERAGE_MEASUREMENT diff -r 4785f57bf3d4 -r 03646e8da489 taskswitcherapp/tsdevicedialogplugin/src/tsentrymodelitem.cpp --- a/taskswitcherapp/tsdevicedialogplugin/src/tsentrymodelitem.cpp Thu May 27 12:46:08 2010 +0300 +++ b/taskswitcherapp/tsdevicedialogplugin/src/tsentrymodelitem.cpp Fri Jun 11 13:30:16 2010 +0300 @@ -56,7 +56,9 @@ return QVariant(mEntry->name()); case Qt::DecorationRole: { - QPixmap icon = mEntry->icon(); + QPixmap icon = mEntry->screenshot().isNull() ? + mEntry->icon() : + mEntry->screenshot(); if (icon.isNull()) { return HbIcon("qtg_large_application"); } else {