homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsallappsstate.h
changeset 35 f9ce957a272c
child 36 cdae8c6c3876
equal deleted inserted replaced
5:c743ef5928ba 35:f9ce957a272c
       
     1 /*
       
     2  * Copyright (c) 2009 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: Menu All Applications state.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef HSALLAPPSSTATE_H
       
    19 #define HSALLAPPSSTATE_H
       
    20 
       
    21 #include <qstate.h>
       
    22 #include <QModelIndex>
       
    23 
       
    24 #include "hsmenustates_global.h"
       
    25 #include "hsmenuservice.h"
       
    26 
       
    27 HS_STATES_TEST_CLASS(MenuStatesTest)
       
    28 
       
    29 class HbView;
       
    30 class HbAction;
       
    31 class HbMenu;
       
    32 class HbAbstractViewItem;
       
    33 class QPointF;
       
    34 class HsMenuView;
       
    35 class HsMenuItemModel;
       
    36 /**
       
    37  * @ingroup group_hsmenustateplugin
       
    38  * @brief All Applications State.
       
    39  *
       
    40  * Displays all applications present on the device in a sorted list.
       
    41  *
       
    42  * @see StateMachine
       
    43  *
       
    44  * @lib ?library
       
    45  * @since S60 ?S60_version
       
    46  */
       
    47 class HsAllAppsState: public QState
       
    48 {
       
    49     Q_OBJECT
       
    50 
       
    51     HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest)
       
    52 
       
    53 public:
       
    54 
       
    55     /**
       
    56      * Constructor.
       
    57      *
       
    58      * @since S60 ?S60_version.
       
    59      * @param containerView Container view.
       
    60      * @param parent Owner.
       
    61      */
       
    62     HsAllAppsState(HsMenuView &menuView, QState *parent = 0);
       
    63 
       
    64     /**
       
    65      * Destructor.
       
    66      *
       
    67      * @since S60 ?S60_version.
       
    68      */
       
    69     ~HsAllAppsState();
       
    70 
       
    71 public slots:
       
    72     /**
       
    73      * Populates all applications
       
    74      *
       
    75      * @since S60 ?S60_version.
       
    76      */
       
    77     void scrollToBeginning();
       
    78 
       
    79     /**
       
    80      * Sets collections sort order
       
    81      *
       
    82      * @since S60 ?S60_version.
       
    83      * @param sortOrder sort order.
       
    84      */
       
    85     void collectionsSortOrder(HsSortAttribute sortAttribute);
       
    86 
       
    87 private slots:
       
    88 
       
    89     /**
       
    90      * Slot connected to List widget in normal mode.
       
    91      *
       
    92      * @since S60 ?S60_version.
       
    93      * @param index Model index of the activated item.
       
    94      */
       
    95     void listItemActivated(const QModelIndex &index);
       
    96 
       
    97     /**
       
    98      * Slot connected to List widget in add mode.
       
    99      *
       
   100      * @since S60 ?S60_version.
       
   101      * @param index Model index of the activated item.
       
   102      */
       
   103     void addActivated(const QModelIndex &index);
       
   104 
       
   105     /**
       
   106      * Slot connected to List widget in normal mode.
       
   107      * Called when item long pressed.
       
   108      *
       
   109      * @since S60 ?S60_version.
       
   110      * @param item View item.
       
   111      * @param coords Press point coordinates.
       
   112      */
       
   113     void listItemLongPressed(HbAbstractViewItem *item,
       
   114                              const QPointF &coords);
       
   115 
       
   116     /**
       
   117      * Slot connected to List widget in add mode.
       
   118      * Called when item long pressed.
       
   119      *
       
   120      * @since S60 ?S60_version.
       
   121      * @param item View item.
       
   122      * @param coords Press point coordinates.
       
   123      */
       
   124     void addLongPressed(HbAbstractViewItem *item,
       
   125                         const QPointF &coords);
       
   126 
       
   127     /**
       
   128      * Slot called when application is adding to collection.
       
   129      *
       
   130      * @since S60 ?S60_version.
       
   131      */
       
   132     void addToCollection();
       
   133 
       
   134     /**
       
   135      * Menu ascending sort action slot.
       
   136      *
       
   137      * @since S60 ?S60_version.
       
   138      */
       
   139     void ascendingMenuAction();
       
   140 
       
   141     /**
       
   142      * Menu descending sort action slot.
       
   143      *
       
   144      * @since S60 ?S60_version.
       
   145      */
       
   146     void descendingMenuAction();
       
   147 
       
   148     /**
       
   149      * Slot invoked when a state is entered.
       
   150      *
       
   151      * @since S60 ?S60_version.
       
   152      */
       
   153     void stateEntered();
       
   154 
       
   155     /**
       
   156      * Slot invoked when add mode entered.
       
   157      *
       
   158      * @since S60 ?S60_version.
       
   159      */
       
   160     void addModeEntered();
       
   161 
       
   162     /**
       
   163      * Slot invoked when normal mode entered.
       
   164      *
       
   165      * @since S60 ?S60_version.
       
   166      */
       
   167     void normalModeEntered();
       
   168 
       
   169     /**
       
   170      * Slot invoked when a state is exited.
       
   171      *
       
   172      * @since S60 ?S60_version.
       
   173      */
       
   174     void stateExited();
       
   175 
       
   176 private:
       
   177 
       
   178     /**
       
   179      * Constructs contained objects.
       
   180      *
       
   181      * @since S60 ?S60_version.
       
   182      */
       
   183     void construct();
       
   184 
       
   185     /**
       
   186      * Creates and installs menu options for the view
       
   187      *
       
   188      * @since S60 ?S60_version.
       
   189      */
       
   190     void setMenuOptions();
       
   191 
       
   192     void addToHomeScreen(const QModelIndex &index);
       
   193 
       
   194 private:
       
   195 
       
   196     /**
       
   197      * Sort order
       
   198      */
       
   199     HsSortAttribute mSortAttribute;
       
   200 
       
   201     /**
       
   202      * Collections sort order
       
   203      */
       
   204     HsSortAttribute mCollectionsSortAttribute;
       
   205 
       
   206     /**
       
   207      * The View widget.
       
   208      * Own.
       
   209      */
       
   210     HsMenuView &mMenuView;
       
   211 
       
   212     /**
       
   213      * Item Model for the List.
       
   214      * Own.
       
   215      */
       
   216     HsMenuItemModel *mAllAppsModel;
       
   217 
       
   218     QModelIndex mBookmark;
       
   219 
       
   220 };
       
   221 
       
   222 #endif // HSALLAPPSSTATE_H