homescreenapp/widgetplugins/hsshortcutwidgetplugin/inc/hsshortcutwidget.h
branchRCL_3
changeset 82 5f0182e07bfb
equal deleted inserted replaced
79:f00a6757af32 82:5f0182e07bfb
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Home screen shortcut widget.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef HSSHORTCUTWIDGET_H
       
    19 #define HSSHORTCUTWIDGET_H
       
    20 
       
    21 #include <HbWidget>
       
    22 
       
    23 #include "cadefs.h"
       
    24 
       
    25 #include "hstest_global.h"
       
    26 HOMESCREEN_TEST_CLASS(TestShortcutWidget)
       
    27 
       
    28 class HbFrameItem;    
       
    29 class HbIconItem;
       
    30 class HbTextItem;
       
    31 class QGestureEvent;
       
    32 class CaEntry;
       
    33 
       
    34 class HsShortcutWidget : public HbWidget
       
    35 {
       
    36     Q_OBJECT
       
    37     Q_PROPERTY(int caEntryId READ caEntryId WRITE setCaEntryId)
       
    38     Q_PROPERTY(QString uid READ uid WRITE setUid)
       
    39     
       
    40     Q_PROPERTY(QString text READ text WRITE setText )
       
    41     
       
    42 public:
       
    43     HsShortcutWidget(QGraphicsItem *parent = 0, Qt::WindowFlags flags = 0);
       
    44     ~HsShortcutWidget();
       
    45 
       
    46     void setCaEntryId(int caEntryId);
       
    47     int caEntryId() const;
       
    48     void setUid(const QString &uid);
       
    49     QString uid() const;
       
    50 
       
    51     QString text() const;
       
    52     void setText(const QString& textItem);
       
    53 
       
    54 signals:
       
    55     void finished();
       
    56     void setPreferences(const QStringList &names);
       
    57 
       
    58 public slots:
       
    59     void onInitialize();
       
    60     void onShow();
       
    61     void onHide();
       
    62 
       
    63 protected:
       
    64     void gestureEvent(QGestureEvent *event);
       
    65 
       
    66 private:
       
    67     Q_DISABLE_COPY(HsShortcutWidget)
       
    68     
       
    69     void launch();
       
    70             
       
    71     void createPrimitives();
       
    72     void updateContent(const CaEntry &caEntry);
       
    73     void updateVisibility();
       
    74 
       
    75     void setBackgroundToNormal();
       
    76     void setBackgroundToPressed();
       
    77 
       
    78     void createCaNotifier();
       
    79 
       
    80 private slots:
       
    81     void onEntryChanged(const CaEntry &caEntry, ChangeType changeType);
       
    82 
       
    83 private:
       
    84     HbFrameItem *mBackground;
       
    85     HbIconItem *mIcon;
       
    86     HbTextItem *mText;
       
    87         
       
    88     int mCaEntryId;
       
    89     QString mUid;
       
    90     EntryRole mCaEntryRole;
       
    91     EntryFlags mCaEntryFlags;
       
    92     QString mCaEntryTypeName;
       
    93     HOMESCREEN_TEST_FRIEND_CLASS(TestShortcutWidget)
       
    94 };
       
    95 
       
    96 #endif // HSSHORTCUTWIDGET_H