idlehomescreen/widgetmanager/inc/wmplugin.h
branchRCL_3
changeset 83 5456b4e8b3a8
child 93 b01126ce0bec
equal deleted inserted replaced
82:5f0182e07bfb 83:5456b4e8b3a8
       
     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:
       
    15 * widget manager plugin declaration
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef __WMPLUGIN_
       
    20 #define __WMPLUGIN_
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <vwsdef.h>
       
    25 
       
    26 #include <hscontentcontrolui.h>
       
    27 #include <hscontentcontroller.h>
       
    28 #include <hscontentinfo.h>
       
    29 
       
    30 class CAknViewAppUi;
       
    31 class CWmResourceLoader;
       
    32 class CWmMainContainer;
       
    33 class CWmEffectManager;
       
    34 class CWmWidgetData;
       
    35 class CWmInstaller;
       
    36 
       
    37 /**
       
    38  * CWmPlugin 
       
    39  */
       
    40 NONSHARABLE_CLASS( CWmPlugin ) : public CHsContentControlUi
       
    41     {
       
    42 public:
       
    43 
       
    44     /**
       
    45      * Two-phased constructor.
       
    46      */
       
    47     static CWmPlugin* NewL();
       
    48     
       
    49     /** Destructor */
       
    50     ~CWmPlugin();
       
    51 
       
    52 public: // From MHsContentControlUi
       
    53 
       
    54     /** 
       
    55      * shows the widget manager UI 
       
    56      * 
       
    57      * @see MHsContentControlUi::Activate
       
    58      */
       
    59     void Activate();
       
    60 
       
    61     /** 
       
    62      * notification for widget manager UI that its
       
    63      * deactivated and plugin is about to be destroyed.
       
    64      * 
       
    65      * @see MHsContentControlUi::DeActivate
       
    66      */
       
    67     void DeActivate();
       
    68 
       
    69     /** 
       
    70      * returns array of AknViews which were added to
       
    71      * AknViewAppUi by this plugin. 
       
    72      * 
       
    73      * @see MHsContentControlUi::Views
       
    74      */
       
    75     void Views( RPointerArray<CAknView>& aViews );
       
    76 
       
    77     /** 
       
    78      * Notifies widget list changes 
       
    79      * 
       
    80      * @see MHsContentControlUi::NotifyWidgetListChanged
       
    81      */
       
    82     void NotifyWidgetListChanged();
       
    83         
       
    84 public: // plugin services
       
    85 
       
    86     /** 
       
    87      * whether widget manager UI is showing 
       
    88      * 
       
    89      * @return return ETrue if wm UI is showed 
       
    90      */
       
    91     TBool IsActive();
       
    92 
       
    93     /** 
       
    94      * hides widget manager UI 
       
    95      */
       
    96     void CloseView();
       
    97 
       
    98     /** 
       
    99      * main view activated. Sets the previous view ID and main container 
       
   100      *
       
   101      * @param aPreviousViewId
       
   102      * @param aWmMainContainer 
       
   103      */
       
   104     void MainViewActivated( 
       
   105             const TVwsViewId& aPreviousViewId,
       
   106             CWmMainContainer* aWmMainContainer );
       
   107 
       
   108     /** 
       
   109      * main view was deactivated 
       
   110      */
       
   111     void MainViewDeactivated();
       
   112 
       
   113     /** Postponed command to execute when widgetmanager has deactivated */
       
   114     enum TCommand
       
   115         {
       
   116         /** no command */
       
   117         ENone,
       
   118         /** add content to home screen */
       
   119         EAddToHomescreen
       
   120         };
       
   121     
       
   122     /**
       
   123      * Sets a postponed command. The postponed command will be executed after
       
   124      * widget manager has been deactivated.
       
   125      * 
       
   126      * @param aCommand the command to be executed
       
   127      * @param aContent content parameter related to the command
       
   128      */
       
   129     void SetPostponedCommandL(
       
   130             TCommand aCommand, CHsContentInfo& aContent );
       
   131     
       
   132     /** 
       
   133      * the CAknViewAppUi reference
       
   134      * 
       
   135      * @return returns CAknViewAppUi 
       
   136      */
       
   137     CAknViewAppUi& ViewAppUi();
       
   138 
       
   139     /** 
       
   140      * the resource loader 
       
   141      * 
       
   142      * @return returns CWmResourceLoader
       
   143      */
       
   144     CWmResourceLoader& ResourceLoader();
       
   145     
       
   146     /** 
       
   147      * the content controller ref
       
   148      * 
       
   149      * @return returns MHsContentController
       
   150      */
       
   151     MHsContentController& ContentController();
       
   152 
       
   153     /**
       
   154      * the shared file server reference
       
   155      */
       
   156     RFs& FileServer();
       
   157     
       
   158     /** prestored action to be executed. */
       
   159     void DoExecuteCommand();
       
   160     
       
   161     /** callback function for launcher */
       
   162     static TInt ExecuteCommand( TAny* aSelf );
       
   163     
       
   164     /**
       
   165      * reference to iWmInstaller
       
   166      */
       
   167     CWmInstaller& WmInstaller();
       
   168     
       
   169     /**
       
   170      * Get widget by Uid. Used for getting widget details 
       
   171      * when error has occured during uninstallation.
       
   172      * @param aUid Uid of widget
       
   173      */
       
   174     CWmWidgetData* GetUninstalledWidgetByUid( TUid aUid );
       
   175 
       
   176 private:
       
   177     /** constructor */
       
   178     CWmPlugin();
       
   179     /** 2nd phase constructor */
       
   180     void ConstructL();
       
   181     
       
   182     /**
       
   183      * Sets forwarding numeric keys to phone.
       
   184      * 
       
   185      * @param aEnabled ETrue if numeric keys are forwarded to phone
       
   186      */
       
   187     void ForwardNumericKeysToPhone( TBool aEnabled );
       
   188     
       
   189     /** 
       
   190      * Shows error note.
       
   191      * 
       
   192      * @parama aError Error to be shown.
       
   193      */
       
   194     void ShowErrorNoteL( TInt aError );
       
   195 
       
   196 private: // data members
       
   197 
       
   198     /**
       
   199      * the host application view app UI (not owned)
       
   200      */
       
   201     CAknViewAppUi*  iViewAppUi;
       
   202 
       
   203     /**
       
   204      * main container (not owned)
       
   205      */
       
   206     CWmMainContainer*  iWmMainContainer;
       
   207 
       
   208     /**
       
   209      * resource loader
       
   210      */
       
   211     CWmResourceLoader* iResourceLoader;
       
   212 
       
   213     /**
       
   214      * previous view ID (shown when main view closed)
       
   215      */
       
   216     TVwsViewId iPreviousViewUid;
       
   217 	
       
   218     /**
       
   219      * Takes care of fancy UI effects
       
   220      */    
       
   221     CWmEffectManager* iEffectManager;
       
   222     
       
   223     /**
       
   224      * The file server session
       
   225      */
       
   226     RFs* iFs;
       
   227 
       
   228     /**
       
   229      * command to be executed when widgetmanager has
       
   230      * been deactivated
       
   231      */
       
   232     TCommand iPostponedCommand;
       
   233     
       
   234     /**
       
   235      * content info as parameter to iPostponedCommand
       
   236      */
       
   237     CHsContentInfo* iPostponedContent;
       
   238     
       
   239     /*
       
   240      * Handles installation
       
   241      */
       
   242     CWmInstaller* iWmInstaller;
       
   243     
       
   244     /**
       
   245      * Used for adding widgets to homescreen.
       
   246      */
       
   247     CPeriodic* iLauncher;
       
   248     
       
   249     /**
       
   250      * Counter for execute command delay.
       
   251      */
       
   252     TInt iExecutionCount;
       
   253     
       
   254 #ifdef _WM_UNIT_TEST
       
   255     friend class CWmUnitTest;
       
   256 #endif
       
   257     };
       
   258 
       
   259 #endif // __WMPLUGIN_
       
   260