homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsbaseviewstate.h
author hgs
Fri, 23 Jul 2010 13:47:57 +0300
changeset 69 87476091b3f5
parent 63 52b0f64eeb51
child 71 1db7cc813a4e
permissions -rw-r--r--
201029
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;
62
hgs
parents:
diff changeset
    37
hgs
parents:
diff changeset
    38
HS_STATES_TEST_CLASS(MenuStatesTest)
hgs
parents:
diff changeset
    39
hgs
parents:
diff changeset
    40
class HsBaseViewState: public QState
hgs
parents:
diff changeset
    41
{
hgs
parents:
diff changeset
    42
    Q_OBJECT
hgs
parents:
diff changeset
    43
    
hgs
parents:
diff changeset
    44
    HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest)
hgs
parents:
diff changeset
    45
    
hgs
parents:
diff changeset
    46
public:
hgs
parents:
diff changeset
    47
    
63
hgs
parents: 62
diff changeset
    48
    HsBaseViewState(HsMainWindow &mainWindow, QState *parent);
hgs
parents: 62
diff changeset
    49
    HsBaseViewState(HsMainWindow &mainWindow, 
hgs
parents: 62
diff changeset
    50
        HsMenuModeWrapper& menuMode, QState *parent);
62
hgs
parents:
diff changeset
    51
    ~HsBaseViewState();
63
hgs
parents: 62
diff changeset
    52
    void scrollToBeginning();
hgs
parents: 62
diff changeset
    53
62
hgs
parents:
diff changeset
    54
private slots:
hgs
parents:
diff changeset
    55
63
hgs
parents: 62
diff changeset
    56
    virtual void openAppLibrary();
hgs
parents: 62
diff changeset
    57
62
hgs
parents:
diff changeset
    58
protected slots:
hgs
parents:
diff changeset
    59
    
63
hgs
parents: 62
diff changeset
    60
    virtual void stateEntered();
hgs
parents: 62
diff changeset
    61
    virtual void stateExited();
hgs
parents: 62
diff changeset
    62
    virtual void addModeEntered();
hgs
parents: 62
diff changeset
    63
    virtual void normalModeEntered();
hgs
parents: 62
diff changeset
    64
    virtual void normalModeExited();
hgs
parents: 62
diff changeset
    65
    virtual void launchItem(const QModelIndex &index);
hgs
parents: 62
diff changeset
    66
    virtual void openCollection(const QModelIndex &index);
hgs
parents: 62
diff changeset
    67
    virtual void showContextMenu(HbAbstractViewItem *item, const QPointF &coords);
hgs
parents: 62
diff changeset
    68
    virtual int checkSoftwareUpdates();
hgs
parents: 62
diff changeset
    69
    virtual bool openTaskSwitcher();
69
hgs
parents: 63
diff changeset
    70
    virtual void closeContextMenu();
62
hgs
parents:
diff changeset
    71
protected:
hgs
parents:
diff changeset
    72
    
69
hgs
parents: 63
diff changeset
    73
    void initialize(HsMenuViewBuilder &menuViewBuilder, HsStateContext stateContext);
62
hgs
parents:
diff changeset
    74
    void createApplicationLaunchFailMessage(int errorCode,int itemId);
63
hgs
parents: 62
diff changeset
    75
    void defineTransitions();
hgs
parents: 62
diff changeset
    76
62
hgs
parents:
diff changeset
    77
private:
63
hgs
parents: 62
diff changeset
    78
    virtual void setContextMenuOptions(HbAbstractViewItem *item, EntryFlags flags) = 0;
hgs
parents: 62
diff changeset
    79
    virtual void setMenuOptions() = 0;
hgs
parents: 62
diff changeset
    80
hgs
parents: 62
diff changeset
    81
62
hgs
parents:
diff changeset
    82
private:
hgs
parents:
diff changeset
    83
    
69
hgs
parents: 63
diff changeset
    84
    QPointer<HbMessageBox> mApplicationLaunchFailMessage;
62
hgs
parents:
diff changeset
    85
63
hgs
parents: 62
diff changeset
    86
protected:
hgs
parents: 62
diff changeset
    87
    HsMenuItemModel *mModel;
hgs
parents: 62
diff changeset
    88
    QPointer<HbMenu> mContextMenu;
hgs
parents: 62
diff changeset
    89
    QModelIndex mContextModelIndex;
hgs
parents: 62
diff changeset
    90
    HbAction *mBackKeyAction;
hgs
parents: 62
diff changeset
    91
    QScopedPointer<HsMenuView> mMenuView;
hgs
parents: 62
diff changeset
    92
    HsMenuModeWrapper *mMenuMode;
hgs
parents: 62
diff changeset
    93
    HsMainWindow &mMainWindow;
62
hgs
parents:
diff changeset
    94
};
hgs
parents:
diff changeset
    95
hgs
parents:
diff changeset
    96
hgs
parents:
diff changeset
    97
#endif // HSBASEVIEWSTATE_H