homescreenapp/widgetplugins/hsshortcutwidgetplugin/inc/hsshortcutwidget.h
changeset 39 4e8ebe173323
parent 35 f9ce957a272c
child 46 23b5d6a29cce
equal deleted inserted replaced
36:cdae8c6c3876 39:4e8ebe173323
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Shortcut widget
    14 * Description: Home screen shortcut widget.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #ifndef HSSHORTCUTWIDGET_H
    18 #ifndef HSSHORTCUTWIDGET_H
    19 #define HSSHORTCUTWIDGET_H
    19 #define HSSHORTCUTWIDGET_H
    20 
    20 
    21 #include <QVariant>
       
    22 #include <QMap>
       
    23 
       
    24 #include <HbWidget>
    21 #include <HbWidget>
    25 
    22 
    26 #include "hstest_global.h"
       
    27 #include "cadefs.h"
    23 #include "cadefs.h"
    28 
    24 
       
    25 #include "hstest_global.h"
    29 HOMESCREEN_TEST_CLASS(TestShortcutWidget)
    26 HOMESCREEN_TEST_CLASS(TestShortcutWidget)
    30 
    27 
       
    28 class HbFrameItem;    
    31 class HbIconItem;
    29 class HbIconItem;
    32 class HbTextItem;
    30 class HbTextItem;
       
    31 class HbTouchArea;
    33 class CaEntry;
    32 class CaEntry;
    34 
    33 
    35 class HsShortcutWidget : public HbWidget
    34 class HsShortcutWidget : public HbWidget
    36 {
    35 {
    37     Q_OBJECT
    36     Q_OBJECT
    39     
    38     
    40 public:
    39 public:
    41     HsShortcutWidget(QGraphicsItem *parent = 0, Qt::WindowFlags flags = 0);
    40     HsShortcutWidget(QGraphicsItem *parent = 0, Qt::WindowFlags flags = 0);
    42     ~HsShortcutWidget();
    41     ~HsShortcutWidget();
    43 
    42 
       
    43     void setMcsId(int mcsId);
    44     int mcsId() const;
    44     int mcsId() const;
    45     void setMcsId(int mcsId);
    45 
       
    46     bool eventFilter(QObject *watched, QEvent *event);
    46 
    47 
    47 signals:
    48 signals:
    48     void finished();
    49     void finished();
    49 
    50 
    50 public slots:
    51 public slots:
    51     void onEntryChanged(const CaEntry &entry, ChangeType changeType);
       
    52 
       
    53     void onInitialize();
    52     void onInitialize();
    54     void onShow();
    53     void onShow();
    55     void onHide();
    54     void onHide();
    56 
    55 
    57 protected:
    56     void onEntryChanged(const CaEntry &entry, ChangeType changeType);
    58     void mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_UNUSED(event) }
       
    59     void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
       
    60 
    57 
    61 private:
    58 private:
    62     void constructUI();
    59     Q_DISABLE_COPY(HsShortcutWidget)
    63 
    60 
    64     HbIcon fetchIcon(int aShortcutId);
    61     void handleMousePressEvent(QGraphicsSceneMouseEvent *event);
    65     QString fetchText(int aShortcutId);
    62     void handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event);
    66 
    63 
    67     void executeCollectionAction(int shortcutId, const QString& collectionType);
    64     void updatePrimitives();
    68     void createCaNotifier(int aShortcutId);
    65     void createCaNotifier();
       
    66     void updateVisibility();
       
    67 
       
    68 private:
       
    69     HbFrameItem *mBackground;
       
    70     HbIconItem *mIcon;
       
    71     HbTextItem *mText;
       
    72     HbTouchArea *mTouchArea;
    69     
    73     
    70     void hideOrShowWidget(EntryFlags aEntryFlags);
    74     bool mIsPressed;
    71     EntryFlags fetchEntryFlags(int aShortcutId);
       
    72 
       
    73 private:    
       
    74     HbIconItem *mShortcutBackgroundItem;
       
    75     HbIconItem *mShortcutIconItem;
       
    76     HbTextItem *mShortcutTextItem;
       
    77 
    75 
    78     int mMcsId;
    76     int mMcsId;
       
    77     QSharedPointer<CaEntry> mCaEntry;
    79 
    78 
    80     HOMESCREEN_TEST_FRIEND_CLASS(TestShortcutWidget)
    79     HOMESCREEN_TEST_FRIEND_CLASS(TestShortcutWidget)
    81 };
    80 };
    82 
    81 
    83 #endif // HSSHORTCUTWIDGET_H
    82 #endif // HSSHORTCUTWIDGET_H