homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsbaseviewstate.h
author hgs
Wed, 18 Aug 2010 10:33:57 +0300
changeset 81 7dd137878ff8
parent 71 1db7cc813a4e
child 86 e4f038c420f7
permissions -rw-r--r--
201033
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
62
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
 * All rights reserved.
hgs
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
 *
hgs
parents:
diff changeset
     9
 * Initial Contributors:
hgs
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
 *
hgs
parents:
diff changeset
    12
 * Contributors:
hgs
parents:
diff changeset
    13
 *
hgs
parents:
diff changeset
    14
 * Description: Base for menu view states.
hgs
parents:
diff changeset
    15
 *
hgs
parents:
diff changeset
    16
 */
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
#ifndef HSBASEVIEWSTATE_H
hgs
parents:
diff changeset
    19
#define HSBASEVIEWSTATE_H
hgs
parents:
diff changeset
    20
63
hgs
parents: 62
diff changeset
    21
#include <QState>
hgs
parents: 62
diff changeset
    22
#include <QPointer>
hgs
parents: 62
diff changeset
    23
#include <QModelIndex>
62
hgs
parents:
diff changeset
    24
hgs
parents:
diff changeset
    25
#include "hsmenustates_global.h"
hgs
parents:
diff changeset
    26
#include "hsmenuservice.h"
hgs
parents:
diff changeset
    27
#include "hsmenuview.h"
hgs
parents:
diff changeset
    28
69
hgs
parents: 63
diff changeset
    29
63
hgs
parents: 62
diff changeset
    30
class HbMenu;
hgs
parents: 62
diff changeset
    31
class HbAction;
62
hgs
parents:
diff changeset
    32
class HbMessageBox;
63
hgs
parents: 62
diff changeset
    33
class HbAbstractViewItem;
62
hgs
parents:
diff changeset
    34
class CaNotifier;
63
hgs
parents: 62
diff changeset
    35
class HsMenuModeWrapper;
hgs
parents: 62
diff changeset
    36
class HsMainWindow;
71
hgs
parents: 69
diff changeset
    37
class HsAddModeProxyModel;
62
hgs
parents:
diff changeset
    38
hgs
parents:
diff changeset
    39
HS_STATES_TEST_CLASS(MenuStatesTest)
hgs
parents:
diff changeset
    40
hgs
parents:
diff changeset
    41
class HsBaseViewState: public QState
hgs
parents:
diff changeset
    42
{
hgs
parents:
diff changeset
    43
    Q_OBJECT
hgs
parents:
diff changeset
    44
    
hgs
parents:
diff changeset
    45
    HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest)
hgs
parents:
diff changeset
    46
    
hgs
parents:
diff changeset
    47
public:
hgs
parents:
diff changeset
    48
    
63
hgs
parents: 62
diff changeset
    49
    HsBaseViewState(HsMainWindow &mainWindow, QState *parent);
hgs
parents: 62
diff changeset
    50
    HsBaseViewState(HsMainWindow &mainWindow, 
hgs
parents: 62
diff changeset
    51
        HsMenuModeWrapper& menuMode, QState *parent);
62
hgs
parents:
diff changeset
    52
    ~HsBaseViewState();
63
hgs
parents: 62
diff changeset
    53
    void scrollToBeginning();
hgs
parents: 62
diff changeset
    54
62
hgs
parents:
diff changeset
    55
private slots:
hgs
parents:
diff changeset
    56
63
hgs
parents: 62
diff changeset
    57
    virtual void openAppLibrary();
hgs
parents: 62
diff changeset
    58
62
hgs
parents:
diff changeset
    59
protected slots:
hgs
parents:
diff changeset
    60
    
63
hgs
parents: 62
diff changeset
    61
    virtual void stateEntered();
hgs
parents: 62
diff changeset
    62
    virtual void stateExited();
hgs
parents: 62
diff changeset
    63
    virtual void addModeEntered();
71
hgs
parents: 69
diff changeset
    64
    virtual void addModeExited();
63
hgs
parents: 62
diff changeset
    65
    virtual void normalModeEntered();
hgs
parents: 62
diff changeset
    66
    virtual void normalModeExited();
hgs
parents: 62
diff changeset
    67
    virtual void launchItem(const QModelIndex &index);
hgs
parents: 62
diff changeset
    68
    virtual void openCollection(const QModelIndex &index);
hgs
parents: 62
diff changeset
    69
    virtual void showContextMenu(HbAbstractViewItem *item, const QPointF &coords);
hgs
parents: 62
diff changeset
    70
    virtual int checkSoftwareUpdates();
hgs
parents: 62
diff changeset
    71
    virtual bool openTaskSwitcher();
69
hgs
parents: 63
diff changeset
    72
    virtual void closeContextMenu();
81
hgs
parents: 71
diff changeset
    73
    virtual void addToHomeScreen(const int entryId);
hgs
parents: 71
diff changeset
    74
    virtual void contextMenuAction(HbAction *action);
hgs
parents: 71
diff changeset
    75
    virtual void addActivated(const QModelIndex &index);
hgs
parents: 71
diff changeset
    76
    virtual void addLongPressed(HbAbstractViewItem *item,
hgs
parents: 71
diff changeset
    77
                                        const QPointF &coords);
71
hgs
parents: 69
diff changeset
    78
    
62
hgs
parents:
diff changeset
    79
protected:
hgs
parents:
diff changeset
    80
    
69
hgs
parents: 63
diff changeset
    81
    void initialize(HsMenuViewBuilder &menuViewBuilder, HsStateContext stateContext);
62
hgs
parents:
diff changeset
    82
    void createApplicationLaunchFailMessage(int errorCode,int itemId);
63
hgs
parents: 62
diff changeset
    83
    void defineTransitions();
hgs
parents: 62
diff changeset
    84
62
hgs
parents:
diff changeset
    85
private:
71
hgs
parents: 69
diff changeset
    86
63
hgs
parents: 62
diff changeset
    87
    virtual void setContextMenuOptions(HbAbstractViewItem *item, EntryFlags flags) = 0;
hgs
parents: 62
diff changeset
    88
    virtual void setMenuOptions() = 0;
hgs
parents: 62
diff changeset
    89
62
hgs
parents:
diff changeset
    90
private:
hgs
parents:
diff changeset
    91
    
69
hgs
parents: 63
diff changeset
    92
    QPointer<HbMessageBox> mApplicationLaunchFailMessage;
62
hgs
parents:
diff changeset
    93
63
hgs
parents: 62
diff changeset
    94
protected:
71
hgs
parents: 69
diff changeset
    95
    
63
hgs
parents: 62
diff changeset
    96
    HsMenuItemModel *mModel;
hgs
parents: 62
diff changeset
    97
    QPointer<HbMenu> mContextMenu;
hgs
parents: 62
diff changeset
    98
    QModelIndex mContextModelIndex;
hgs
parents: 62
diff changeset
    99
    HbAction *mBackKeyAction;
hgs
parents: 62
diff changeset
   100
    QScopedPointer<HsMenuView> mMenuView;
hgs
parents: 62
diff changeset
   101
    HsMenuModeWrapper *mMenuMode;
hgs
parents: 62
diff changeset
   102
    HsMainWindow &mMainWindow;
71
hgs
parents: 69
diff changeset
   103
    HbMenu *mViewOptions;
62
hgs
parents:
diff changeset
   104
};
hgs
parents:
diff changeset
   105
hgs
parents:
diff changeset
   106
hgs
parents:
diff changeset
   107
#endif // HSBASEVIEWSTATE_H