devicediagnostics/devdiagapp/inc/devdiagplugincontainer.h
changeset 0 3ce708148e4d
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     1 /*
       
     2 * Copyright (c) 2007-2007 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:  Plug-in container. Displayes test plug-ins.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CDEVDIAGPLUGINCONTAINER_H
       
    21 #define CDEVDIAGPLUGINCONTAINER_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <bldvariant.hrh>
       
    25 #include <eiklbo.h>
       
    26 #include <aknlists.h>
       
    27 #include <eikdialg.h>
       
    28 #include <eikmenup.h>
       
    29 #include <e32def.h>
       
    30 #include <aknstaticnotedialog.h>
       
    31 #include <AknProgressDialog.h> 
       
    32 
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CDevDiagPluginView;
       
    36 class CDevDiagEngine;
       
    37 class MDiagPlugin;
       
    38 class CDiagResultsDatabaseItem;
       
    39 class CAknDoubleLargeStyleListBox;
       
    40 
       
    41 // CLASS DECLARATION
       
    42 
       
    43 /**
       
    44 * CDevDiagPluginContainer class
       
    45 * @since S60 5.0
       
    46 * 
       
    47 */
       
    48 class CDevDiagPluginContainer : public CCoeControl,
       
    49                              	public MCoeControlObserver,
       
    50                                 public MEikListBoxObserver                                                  
       
    51     {    
       
    52   
       
    53     // Container results
       
    54     enum TContainerResult
       
    55         {
       
    56         ESuccess = 0,
       
    57         EFailed,           
       
    58         ENotPerformed,       
       
    59         };
       
    60   
       
    61     public: // Constructors and destructor
       
    62     
       
    63         /**
       
    64         * NewL.
       
    65         *
       
    66         * @param aView Plug-in view.
       
    67         * @param aEngine Diagnostics Engine.
       
    68         * @param aRect The area to draw on.
       
    69         */
       
    70         static CDevDiagPluginContainer* NewL( CDevDiagPluginView* aView,
       
    71                                               CDevDiagEngine& aEngine,
       
    72                                                const TRect& aRect );
       
    73 
       
    74 		/**
       
    75         * Destructor.
       
    76         */
       
    77         ~CDevDiagPluginContainer();	
       
    78 	
       
    79     public: // Functions from base classes
       
    80 
       
    81 		/**
       
    82         * From MProgressDialogCallback. Gets called when the
       
    83         * dialog is dismissed/closed.
       
    84         * @param aButtonId Softkey Button Id
       
    85         */
       
    86         void DialogDismissedL( const TInt aButtonId );
       
    87 
       
    88         /**
       
    89         * From CoeControl Responds to size changes. 
       
    90         * Sets the size and position of the contents of this control.
       
    91         * @since Series 60 3.1
       
    92         * @param None.
       
    93         * @return None.
       
    94         */
       
    95         void SizeChanged();
       
    96 
       
    97         /**
       
    98         * From CoeControl Handles the situations where
       
    99         * a resource (e.g. skin or layout) is changed.
       
   100         * @since Series 60 3.1
       
   101         * @param aType Type of resource change.
       
   102         * @return None.
       
   103         */
       
   104         void HandleResourceChange( TInt aType );
       
   105 
       
   106         /**
       
   107         * From CoeControl Gets the number of controls contained 
       
   108         * in a compound control.        
       
   109         * @since Series 60 3.1
       
   110         * @param None.
       
   111         * @return The number of component controls contained by this control.
       
   112         */
       
   113         TInt CountComponentControls() const;
       
   114 
       
   115         /**
       
   116         * From CoeControl Gets the specified component of a compound control.
       
   117         * @since Series 60 3.1
       
   118         * @param aIndex The index of the control to get.
       
   119         * @return Reference to the component control.
       
   120         */
       
   121         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   122 
       
   123         /**
       
   124         * From CoeControl Draws the control.
       
   125         * @since Series 60 3.1
       
   126         * @param aRect The region of the control to be redrawn.
       
   127         * @return None.
       
   128         */
       
   129         void Draw( const TRect& aRect ) const;
       
   130 
       
   131         /**
       
   132         * From CoeControl Handles key events.
       
   133         * @since Series 60 3.1
       
   134         * @param aKeyEvent The key event that occurred.
       
   135         * @param aType The event type.
       
   136         * @return Response to the key event.
       
   137         */
       
   138         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );       
       
   139 
       
   140 		/**
       
   141         * Handle ListBox EventL
       
   142         * @param CEikListBox* aListBox Pointer to used listbox
       
   143 		* @param TListBoxEvent aEventType Event type
       
   144         * @return -
       
   145         */
       
   146 		void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
       
   147 		
       
   148         /**
       
   149         * From MCoeControlObserver Handles an event from an observed control.
       
   150         * @since Series 60 3.1
       
   151         * @param aControl The control that sent the event.
       
   152         * @param aEventType The event type.
       
   153         * @return None.
       
   154         */
       
   155         void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );        
       
   156 
       
   157         /**
       
   158         * From CoeControl Gets the control's help context.
       
   159         * @since Series 60 3.1
       
   160         * @param aContext The control's help context
       
   161         * @return None.
       
   162         */
       
   163         void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   164         /**
       
   165         * Handle Pointer EventL
       
   166         * @since Series 60 3.2
       
   167         * @param  aPointerEvent The event type
       
   168         * @return None.
       
   169         */
       
   170         //void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   171         
       
   172     public: //New functions       
       
   173         
       
   174         /**
       
   175         * Retrieve currently selected plug-in 
       
   176         *
       
   177         * @param aPlugin Selected plug-in.
       
   178         **/
       
   179         void SelectedPlugin( MDiagPlugin*& aPlugin );
       
   180         
       
   181         /**
       
   182         * Display plug-ins and their last results.
       
   183         * Last results are retrieved from the results DB.
       
   184         * Model provides a helper function for that.
       
   185         *
       
   186         * @param aArray plug-in result array.
       
   187         **/
       
   188         void DisplayChildrenWithResultsL(
       
   189                         RPointerArray<CDiagResultsDatabaseItem>& aArray );
       
   190                     
       
   191         /**
       
   192         * Change plug-in's text into "Testing ..."
       
   193         * The container uses the currently selected plug-in.
       
   194         **/                
       
   195         void DisplayStartTestingL();
       
   196         
       
   197         /**
       
   198         * Move "Testing..." to the next plug-in in the listbox.
       
   199         **/
       
   200         void MoveStartTestingDownL();
       
   201         
       
   202         /**
       
   203         * Reset listbox index.
       
   204         **/
       
   205         void ResetL();
       
   206         
       
   207         /**
       
   208         * Loads children of the parent suite.
       
   209         * Container keeps model in memory.
       
   210         * @param aParentSuiteUid UID of the parent.
       
   211         **/
       
   212         void UpdateModelL( TUid aParentSuiteUid );                        
       
   213 
       
   214     protected:
       
   215 
       
   216         /**
       
   217 		* Change of focus
       
   218         * @param -
       
   219 		* @return -
       
   220         */
       
   221         void FocusChanged(TDrawNow aDrawNow);
       
   222 	
       
   223         /**
       
   224         * Appends icons to the contained listbox.
       
   225         * @param None.
       
   226         * @return None.
       
   227         */
       
   228         void AddIconsL();       
       
   229 
       
   230     private:
       
   231 
       
   232         /**
       
   233         * C++ default constructor.
       
   234         */
       
   235         CDevDiagPluginContainer( CDevDiagPluginView* aView, CDevDiagEngine& aEngine );
       
   236 
       
   237         /**
       
   238         * By default Symbian 2nd phase constructor is private.
       
   239         */
       
   240         void ConstructL( const TRect& aRect );
       
   241         
       
   242         /**
       
   243         * Load plug-in's test result text (localised).
       
   244         **/
       
   245         HBufC* GetPluginResultL( TContainerResult aResult ) const;
       
   246         
       
   247         /**
       
   248         * Load plug-in's test result text (localised).
       
   249         **/
       
   250         HBufC* ConvertResultLC( const TDesC& aString, 
       
   251                                TInt& aIconIndex, 
       
   252                                CDiagResultsDatabaseItem* aResult ) const;
       
   253         
       
   254         /**
       
   255         * Displays plug-in's result into the listbox.
       
   256         *
       
   257         * @param aListboxModel Listbox model.
       
   258         * @param aPlugin The plug-in that is displayed.
       
   259         * @param aItem Plug-in's test result.
       
   260         **/
       
   261         void DisplayLastResultL( CDesCArray& aListboxModel,
       
   262                                  MDiagPlugin*& aPlugin,
       
   263                                  CDiagResultsDatabaseItem& aItem ); 
       
   264         
       
   265         /**
       
   266         * Display not performed.
       
   267         *
       
   268         * @param aListboxModel Listbox model.
       
   269         * @param aPlugin The plug-in that is displayed.        
       
   270         **/                         
       
   271         void DisplayNotPerformedL( CDesCArray& aListboxModel, 
       
   272                                   MDiagPlugin*& aPlugin );                                  
       
   273                            
       
   274 	public:  // data
       
   275 	
       
   276 	    // The listbox. Own.
       
   277 		CAknDoubleLargeStyleListBox*   iListBox;
       
   278 	
       
   279 	    // Plug-in view. Not own.
       
   280         CDevDiagPluginView*       iView;
       
   281         
       
   282         // Diagnostics engine
       
   283         CDevDiagEngine&           iEngine;
       
   284                       
       
   285         // Currently displayed plug-ins
       
   286         // Plug-ins are owned by the engine.
       
   287         // Do not call ResetAndDestroy.
       
   288         // This is the model
       
   289         RPointerArray<MDiagPlugin> iChildren;
       
   290         
       
   291         // Is the model updated.
       
   292         TBool iModelUpdated;			
       
   293     };
       
   294 
       
   295 #endif  // CDEVDIAGPLUGINCONTAINER_H
       
   296 
       
   297 // End of File