iaupdate/IAD/ui/inc/iaupdatemainview.h
branchRCL_3
changeset 26 8b7f4e561641
parent 25 7333d7932ef7
equal deleted inserted replaced
25:7333d7932ef7 26:8b7f4e561641
     1 /*
     1 /*
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:   This file contains the header file of the IAUpdateMainView
    14 * Description:   This file contains the header file of the CIAUpdateMainView class 
    15 *                class 
       
    16 *
    15 *
    17 */
    16 */
    18 
    17 
    19 #ifndef IAUPDATEMAINVIEW_H_
    18 
    20 #define IAUPDATEMAINVIEW_H_
    19 
    21 
    20 #ifndef IAUPDATEMAINVIEW_H
    22 #include <hbview.h>
    21 #define IAUPDATEMAINVIEW_H
    23 #include <QItemSelection> 
    22 
    24 
    23 // INCLUDES
    25 #include "iaupdatenode.h"
    24 #include <aknview.h> 
    26 #include "iaupdatefwnode.h"
    25 #include <akntoolbarobserver.h> 
    27 #include "iaupdatebasenode.h"
    26 #include "iaupdatecontainerobserver.h"
    28 
    27 
    29 
    28 // FORWARD DECLARATIONS
    30 class HbListWidget;
    29 class CAknNavigationControlContainer;
    31 class HbAction;
    30 class CAknNavigationDecorator;
    32 class HbAbstractViewItem;
    31 class CAknToolbar;
    33 class HbGroupBox;
    32 class CIAUpdateMainContainer;
    34 class HbDataForm;
    33 class CIAUpdateFWUpdateHandler;
    35 class IAUpdateEngine;
    34 
    36 class IAUpdateDialogUtil;
    35 class MIAUpdateAnyNode;
    37 class TIAUpdateVersion;
    36 class MIAUpdateNode;
    38 class HbTranslator;
    37 class MIAUpdateFwNode;
    39 
    38 
    40 
    39 // CLASS DECLARATION
    41 class IAUpdateMainView : public HbView
    40 /**
    42 {
    41 * This class represents the main view of IAUpdate
    43     Q_OBJECT 
    42 *
    44     
    43 */
       
    44 class CIAUpdateMainView : public CAknView, 
       
    45                           public MAknToolbarObserver, 
       
    46                           public MIAUpdateContainerObserver
       
    47     {
    45 public:
    48 public:
    46     IAUpdateMainView(IAUpdateEngine *engine);
    49     /**
    47     virtual ~IAUpdateMainView();
    50     * Symbian two phased constructor.
       
    51     * @return Instance of the created server object.
       
    52     */
       
    53     static CIAUpdateMainView* NewL(const TRect& aRect );
       
    54 
       
    55     /**
       
    56     * Symbian two phased constructor.
       
    57     * @return Instance of the created server object.
       
    58     */
       
    59     static CIAUpdateMainView* NewLC(const TRect& aRect );
       
    60 
       
    61     /**
       
    62     * Destructor
       
    63     */
       
    64     ~CIAUpdateMainView();
       
    65     
       
    66     /**
       
    67     * Refresh the list
       
    68     * @param aNodes  Array of nodes 
       
    69     * @param aError  Error code
       
    70     */    
       
    71     void RefreshL( const RPointerArray<MIAUpdateNode>& aNodes,
       
    72                    const RPointerArray<MIAUpdateFwNode>& aFwNodes,
       
    73                    TInt aError );       
       
    74             
       
    75     /**
       
    76     * Returns node that's highlighted in a list
       
    77     * @return Current (highlighted) node
       
    78     */     
       
    79     MIAUpdateAnyNode* GetCurrentNode();
       
    80     
       
    81     /**
       
    82     * Returns node that's selected (marked) in a list
       
    83     * Can be used only when it's known that only one node is selected (marked)
       
    84     * @return selected (marked) node
       
    85     */  
       
    86     MIAUpdateAnyNode* GetSelectedNode();
       
    87     
       
    88     
       
    89 private:  // from CAknView
       
    90     
       
    91     /**
       
    92     * Returns views id, intended for overriding by sub classes.
       
    93     * @return id for this view.
       
    94     */
       
    95     TUid Id() const;
       
    96     
       
    97     /** 
       
    98     * Command handling function intended for overriding by sub classes. 
       
    99     * Default implementation is empty.  
       
   100     * @param aCommand ID of the command to respond to. 
       
   101     */
       
   102     void HandleCommandL( TInt aCommand );
       
   103     
       
   104     /**
       
   105     * Dynamic menu initiation
       
   106     * Called by framework before menu is shown.
       
   107     * @param aResourceId Menu resource id.
       
   108 	* @param aMenuPane Pointer to the menu.
       
   109     */ 
       
   110     void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   111 
       
   112 
       
   113     /** 
       
   114     * Handles a view activation and passes the message of type 
       
   115     * @c aCustomMessageId. This function is intended for overriding by 
       
   116     * sub classes. This function is called by @c AknViewActivatedL().
       
   117     * Views should not launch waiting or modal notes or dialogs in
       
   118     * @c DoActivateL.
       
   119     * @param aPrevViewId Specifies the view previously active.
       
   120     * @param aCustomMessageId Specifies the message type.
       
   121     * @param aCustomMessage The activation message.
       
   122     */
       
   123     void  DoActivateL ( const TVwsViewId& aPrevViewId, 
       
   124                         TUid aCustomMessageId, 
       
   125                         const TDesC8& aCustomMessage );
       
   126 
       
   127     /** 
       
   128     * View deactivation function intended for overriding by sub classes. 
       
   129     * This function is called by @c AknViewDeactivated().
       
   130     */
       
   131     void DoDeactivate();
       
   132  
       
   133 private: // from MAknToolbarObserver 
       
   134     
       
   135     /**
       
   136     * Should be used to set the properties of some toolbar components 
       
   137     * before it is drawn.
       
   138     * @param aResourceId The resource ID for particular toolbar
       
   139     * @param aToolbar The toolbar object pointer
       
   140     */
       
   141     void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolbar );
       
   142             
       
   143     /**
       
   144     * Handles toolbar events for a certain toolbar item.
       
   145     * @param aCommand The command ID of some toolbar item.
       
   146     */
       
   147     void OfferToolbarEventL( TInt aCommand );
       
   148     
       
   149 private: // from MIAUpdateContainerObserver   
       
   150  
       
   151     /**
       
   152     * Mark list item
       
   153     * @param aMark True if marking, False if unmarking
       
   154     * @param aIndex  Index of the item
       
   155     * @return False value if marking/unmarking cancelled when dependencies/dependants not found
       
   156     */ 
       
   157     TBool MarkListItemL( TBool aMark, TInt aIndex );
       
   158   
       
   159     /**
       
   160     * Set text label to middle soft key
       
   161     * @param aVisible   True value when MSK text is visible
       
   162     * @param aSelected  True value when list item is selected( marked)
       
   163     */
       
   164     void SetMiddleSKTextL( TBool aVisible, TBool aSelected );
       
   165     
       
   166 private: // constructors
       
   167      
       
   168     /** 
       
   169     * Constuctor 
       
   170     * @param aRect Rectangular of the view
       
   171     */
       
   172     void ConstructL(const TRect& aRect);
       
   173 
       
   174     /** 
       
   175     * C++ constuctor 
       
   176     */
       
   177     CIAUpdateMainView();
       
   178 
       
   179 private: // new methods    
       
   180     /**
       
   181     * Get selected (marked) nodes in the list
       
   182     * @param aSelectedNodes Array of nodes 
       
   183     */  
       
   184     void GetSelectedNodesL( RPointerArray<MIAUpdateAnyNode>& aSelectedNodes ) const;
       
   185     
       
   186     /**
       
   187       * Get mandatory nodes in the list
       
   188       * @param aMandNodes Array of nodes 
       
   189       */  
       
   190     void GetMandatoryNodesL( RPointerArray<MIAUpdateAnyNode>& aMandNodes ) const;  
       
   191     /**
       
   192     * Pass selected indices to the container 
       
   193     */ 
       
   194     void SetSelectedIndicesL(); 
       
   195     
       
   196     /**
       
   197     * Get index of a node 
       
   198     *
       
   199     * @param aNode Node
       
   200     * @return Index of the node
       
   201     */  
       
   202     TInt NodeIndex( const MIAUpdateAnyNode& aNode ) const; 
       
   203     
       
   204     /**
       
   205     * Updates the status pane text
       
   206     */ 
       
   207     void UpdateStatusPaneL();
       
   208     
       
   209     /**
       
   210     * Updates selection information in navi pane 
       
   211     */ 
       
   212     void UpdateSelectionInfoInNaviPaneL();
       
   213     
       
   214     /**
       
   215     * Removes selection info in  navi pane
       
   216     */                                      
       
   217     void RemoveSelectionInfoInNaviPane();
       
   218     
       
   219     /**
       
   220     * Shows dependencies found dialog
       
   221     *
       
   222     * @param aText Text shown in a dialog
       
   223     * @return True value if marking/unmarking accepted 
       
   224     */ 
       
   225     TBool ShowDependenciesFoundDialogL( TDesC& aText ) const;
       
   226     
       
   227     /**
       
   228     * Count of selected (marked) items 
       
   229     *
       
   230     * @return Count of selected items 
       
   231     */                     
       
   232     TInt CountOfSelectedItems() const;
       
   233     
       
   234     void ShowUpdateCannotOmitDialogL() const;
       
   235     
       
   236 private: // Data
       
   237 
       
   238     CAknNavigationControlContainer* iNaviPane; //not owned
       
   239     
       
   240     CAknNavigationDecorator* iDecorator;
    48         
   241         
    49     void refresh(const RPointerArray<MIAUpdateNode> &nodes,
   242     CIAUpdateMainContainer* iContainer;
    50                  const RPointerArray<MIAUpdateFwNode> &fwNodes,
   243     
    51                  int error);
   244     RPointerArray<MIAUpdateAnyNode> iAllNodes;
    52 signals:
   245     
    53     void toSettingView();
   246     TBool iShowStatusDialogAgain;
    54     
   247     
    55 public slots:
   248     TInt iRefreshError;
    56     void handleStartUpdate();
   249     
    57  
   250     TInt iLastCommandId;
    58     void handleSettings();
   251     
    59  
   252     CIAUpdateFWUpdateHandler* iFwUpdateHandler;
    60     void handleDisclaimer();
   253     
    61     
   254     TBool iIsDMSupported;
    62     void handleDetails(HbAbstractViewItem *, const QPointF &);
   255     
    63     
   256     };
    64     void handleFotaDetails(HbAbstractViewItem *, const QPointF &); 
   257 
    65     
   258 
    66     void handleSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
   259 #endif // IAUPDATEMAINVIEW_H
    67     
   260 
    68     void handleFwSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
   261 // End of File
    69     
       
    70     void dialogFinished(HbAction* action);
       
    71     
       
    72 private:
       
    73     
       
    74     bool fotaSelected() const;
       
    75     void markListItem(bool mark, int index);
       
    76     void markFotaItem(bool mark);
       
    77     bool getMandatoryNodes(RPointerArray<MIAUpdateNode> &mandNodes) const;
       
    78     void showUpdateCannotOmitDialog(); 
       
    79     void showDependenciesFoundDialog(QString &text);
       
    80     void updateSelectionsToNodeArray(MIAUpdateNode &node, bool mark);
       
    81     void updateSelectionsToList();
       
    82     MIAUpdateNode* getApplicationNode(int index) const;
       
    83     void showDetails(MIAUpdateAnyNode& node);
       
    84     void constructDetailsText(MIAUpdateAnyNode &node, QString &text);
       
    85     void versionText(const TIAUpdateVersion &version, QString &versionText);
       
    86     void fileSizeText(int fileSize, QString &text);
       
    87     void setImportance(MIAUpdateAnyNode *node, QString &importanceDescription);
       
    88     void removeCurrentContentLayout();
       
    89     void refreshFirmwareUpdates(const RPointerArray<MIAUpdateFwNode> &fwNodes);
       
    90     void refreshFotaUpdate(MIAUpdateFwNode& fwNode);
       
    91     void refreshNsuUpdate();
       
    92     void refreshApplicationUpdates(const RPointerArray<MIAUpdateNode> &nodes);
       
    93     void updateSelectionInfoInDock();
       
    94     
       
    95 private:
       
    96     enum DialogState
       
    97         {
       
    98         NoDialog,
       
    99         Dependencies,
       
   100         CannotOmit,
       
   101         Details
       
   102         };
       
   103      
       
   104     IAUpdateEngine *mEngine;
       
   105     IAUpdateDialogUtil *mDialogUtil;
       
   106     HbWidget *mContent;
       
   107     HbListWidget *mListView;
       
   108     HbListWidget *mFwListView;
       
   109     HbGroupBox *mApplicationUpdatesGroupBox;
       
   110     HbGroupBox *mFwNSUGroupBox;
       
   111     HbDataForm *mContentDataForm;
       
   112     HbGroupBox *mSelections;
       
   113     RPointerArray<MIAUpdateNode> mNodes;
       
   114     RPointerArray<MIAUpdateFwNode> mFwNodes;
       
   115     DialogState mDialogState; 
       
   116     HbAction *mPrimaryAction;
       
   117     MIAUpdateNode *mNode; 
       
   118     bool mMark;
       
   119     bool mSelectionUpdate;
       
   120     bool mSelectionConnect;
       
   121     HbTranslator *mTranslator;
       
   122 
       
   123 };
       
   124 
       
   125 #endif /* IAUPDATEMAINVIEW_H_ */