homescreenapp/widgetplugins/hsshortcutwidgetplugin/inc/hsshortcutwidget.h
changeset 35 f9ce957a272c
child 39 4e8ebe173323
equal deleted inserted replaced
5:c743ef5928ba 35:f9ce957a272c
       
     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:  Shortcut widget
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef HSSHORTCUTWIDGET_H
       
    19 #define HSSHORTCUTWIDGET_H
       
    20 
       
    21 #include <QVariant>
       
    22 #include <QMap>
       
    23 
       
    24 #include <HbWidget>
       
    25 
       
    26 #include "hstest_global.h"
       
    27 #include "cadefs.h"
       
    28 
       
    29 HOMESCREEN_TEST_CLASS(TestShortcutWidget)
       
    30 
       
    31 class HbIconItem;
       
    32 class HbTextItem;
       
    33 class CaEntry;
       
    34 
       
    35 class HsShortcutWidget : public HbWidget
       
    36 {
       
    37     Q_OBJECT
       
    38     Q_PROPERTY(int mcsId READ mcsId WRITE setMcsId)
       
    39     
       
    40 public:
       
    41     HsShortcutWidget(QGraphicsItem *parent = 0, Qt::WindowFlags flags = 0);
       
    42     ~HsShortcutWidget();
       
    43 
       
    44     int mcsId() const;
       
    45     void setMcsId(int mcsId);
       
    46 
       
    47 signals:
       
    48     void finished();
       
    49 
       
    50 public slots:
       
    51     void onEntryChanged(const CaEntry &entry, ChangeType changeType);
       
    52 
       
    53     void onInitialize();
       
    54     void onShow();
       
    55     void onHide();
       
    56 
       
    57 protected:
       
    58     void mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_UNUSED(event) }
       
    59     void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
       
    60 
       
    61 private:
       
    62     void constructUI();
       
    63 
       
    64     HbIcon fetchIcon(int aShortcutId);
       
    65     QString fetchText(int aShortcutId);
       
    66 
       
    67     void executeCollectionAction(int shortcutId, const QString& collectionType);
       
    68     void createCaNotifier(int aShortcutId);
       
    69     
       
    70     void hideOrShowWidget(EntryFlags aEntryFlags);
       
    71     EntryFlags fetchEntryFlags(int aShortcutId);
       
    72 
       
    73 private:    
       
    74     HbIconItem *mShortcutBackgroundItem;
       
    75     HbIconItem *mShortcutIconItem;
       
    76     HbTextItem *mShortcutTextItem;
       
    77 
       
    78     int mMcsId;
       
    79 
       
    80     HOMESCREEN_TEST_FRIEND_CLASS(TestShortcutWidget)
       
    81 };
       
    82 
       
    83 #endif // HSSHORTCUTWIDGET_H