widgets/widgetinstaller/inc/WidgetUIHandler.h
changeset 0 dd21522fd290
child 10 a359256acfc6
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2006 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 the License "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:  This file contains the header file of the CMidletUI class.
       
    15 *
       
    16 *                This class implements the ECom SWInstUIPluginAPI interface
       
    17 *                for midlet installation.
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 #ifndef WIDGETUIHANDLER_H
       
    24 #define WIDGETUIHANDLER_H
       
    25 
       
    26 //  INCLUDES
       
    27 
       
    28 #include <e32base.h>
       
    29 #include <swi/msisuihandlers.h>
       
    30 #include "CUIDialogs.h"
       
    31 
       
    32 namespace SwiUI
       
    33 {
       
    34 /**
       
    35 * This interface defines an observer for user initiated cancel.
       
    36 *
       
    37 * @since 3.1
       
    38 */
       
    39 class MWidgetUICancelObserver
       
    40     {
       
    41     public:
       
    42 
       
    43         /**
       
    44         * Called when user has cancelled the operation.
       
    45         * @since 3.0
       
    46         */
       
    47         virtual void UserCancelL( TBool aCancelImmediately ) = 0;
       
    48     };
       
    49 
       
    50 /**
       
    51 * This class handles the UI for widget installations.
       
    52 *
       
    53 * @lib WidgetInstallerUI.lib
       
    54 * @since 3.1
       
    55 */
       
    56 class CWidgetUIHandler : public CBase,
       
    57                        public CommonUI::MCUIWaitDialogCallback
       
    58     {
       
    59     public:  // Constructors and destructor
       
    60 
       
    61         /**
       
    62         * Enumeration for install mode.
       
    63         * @since 3.1
       
    64         */
       
    65         enum TInstallMode
       
    66         {
       
    67         EModeInstall,
       
    68         EModeUninstall
       
    69         };
       
    70 
       
    71         /**
       
    72         * Two-phased constructor.
       
    73         * @param aMode - Indicates if this is for install or uninstall
       
    74         * @param aCancelObserver - the object to handle the user cancel event
       
    75         */
       
    76         static CWidgetUIHandler* NewL( TInstallMode aMode, MWidgetUICancelObserver* aCancelObserver );
       
    77 
       
    78         /**
       
    79         * Destructor.
       
    80         */
       
    81         virtual ~CWidgetUIHandler();
       
    82 
       
    83     public:  // From base classes
       
    84 
       
    85         /**
       
    86         * From, MCUIWaitDialogCallback, called when wait/progress dialog is about
       
    87         * to be cancelled.
       
    88         */
       
    89         TBool HandleDialogExitL( TInt aButtonId );
       
    90 
       
    91     public: // new
       
    92 
       
    93         /**
       
    94         * Displays a dialog at the beginning of an installation
       
    95         * @param aWidgetName - display name of the widget
       
    96         * @return Yes if user would want to install, No if user cancels install
       
    97         */
       
    98         TBool DisplayInstallL( const TDesC& aWidgetName );
       
    99 
       
   100         /**
       
   101         * Displays a dialog at the beginning of an update
       
   102         * @param aWidgetName - display name of the widget
       
   103         * @return Yes if user would want to update, No if user cancels update
       
   104         */
       
   105         TBool DisplayOverwriteL( const TDesC& aWidgetName );
       
   106 
       
   107         /**
       
   108         * Displays a dialog asking whether we want to upgrade an
       
   109         * application present on the device.
       
   110         */
       
   111         TBool DisplayUpgradeL( const Swi::CAppInfo& aAppInfo,
       
   112                                const Swi::CAppInfo& aExistingAppInfo );
       
   113 
       
   114         /**
       
   115         * Displays a dialog at the start of the uninstallation with
       
   116         * information about the application to be uninstalled. The user may cancel the
       
   117         * uninstallation at this stage. This dialog must be shown in TrustedUI mode.
       
   118         */
       
   119         TBool DisplayUninstallL( const TDesC& aWidgetName );
       
   120 
       
   121         /**
       
   122         * Prompt user to select a drive to install the widget
       
   123         * @param aDrive - returns user's drive selection
       
   124         * @param aSufficientSpace - return whether user's selected drive is big enough
       
   125         * @return true if user selected a drive, false if user chose cancel.
       
   126         */
       
   127         TBool SelectDriveL( RFs& aFs, TDriveUnit& aDrive,
       
   128                             TBool& aSufficientSpace, TInt aTotalSize );
       
   129 
       
   130         /**
       
   131         * Displays a dialog containing text. This dialog has only a
       
   132         * Continue button if aOption is EInstFileTextOptionContinue, or Yes and No buttons
       
   133         * otherwise.
       
   134         */
       
   135         TBool DisplayTextL( const TDesC& aText );
       
   136 
       
   137         /**
       
   138         * Displays a dialog showing an error message.
       
   139         * @param aErr - an error code
       
   140         */
       
   141         void DisplayErrorL( const TInt aErr );
       
   142 
       
   143         /**
       
   144         * Displays a dialog showing completion message.
       
   145         */
       
   146         void DisplayCompleteL();
       
   147 
       
   148         /**
       
   149         * Displays a dialog showing cancel message.
       
   150         */
       
   151         void DisplayCancelL();
       
   152 
       
   153         /**
       
   154         * Informs user that the applications are in use during an uninstallation.
       
   155         * Return ETrue if the user wishes to continue the removal process and
       
   156         * close the applications anyway.
       
   157         */
       
   158         TBool DisplayApplicationsInUseL( const Swi::CAppInfo& aAppInfo,
       
   159                                          const RPointerArray<TDesC>& aAppNames );
       
   160 
       
   161         /**
       
   162         * Show progress dialog and pass total uncompressed package size.
       
   163         * This method should be called only after SelectDrive is called.
       
   164         * @since 3.1
       
   165         */
       
   166         void DisplayProgressDialogL();
       
   167 
       
   168         /**
       
   169         * Update progress information during installation.
       
   170         * @since 3.1
       
   171         * @param aSize - the increment on progress
       
   172         */
       
   173         void UpdateProgressDialogL( TInt aSize );
       
   174 
       
   175         /**
       
   176         * Close progress dialog
       
   177         */
       
   178         void CloseProgressDialogL() { iCommonDialogs->CloseProgressDialogL(); }
       
   179 
       
   180         /**
       
   181         * Display Finalize dialog
       
   182         */
       
   183         void DisplayFinalizeDialogL();
       
   184 
       
   185         /**
       
   186         * Close the finalize dialog
       
   187         */
       
   188         void CloseFinalizeDialogL() { iCommonDialogs->CloseWaitDialogL(); }
       
   189 
       
   190         /**
       
   191         * Display unintall in progress dialog
       
   192         * @since 5.0
       
   193         */
       
   194         void DisplayUninstallInProgressL();
       
   195 
       
   196         /**
       
   197         * Close the wait dialog
       
   198         * @since 5.0
       
   199         */
       
   200         void CloseUninstallInProgressDialogL() { iCommonDialogs->CloseWaitDialogL(); }
       
   201 
       
   202         /**
       
   203         * Show the untrusted widget dialog
       
   204         * @since 5.0
       
   205         * @return Yes if user would wants to continue with install, 
       
   206         *         No if user cancels install
       
   207         */
       
   208         TBool DisplayUntrustedSecurityDialogL();
       
   209 
       
   210     protected:
       
   211 
       
   212         /**
       
   213         * Constructor.
       
   214         * @param aMode - Indicates if this is for install or uninstall
       
   215         */
       
   216         CWidgetUIHandler( TInstallMode aMode, MWidgetUICancelObserver* aCancelObserver );
       
   217 
       
   218     private:
       
   219 
       
   220         /**
       
   221         * 2nd phase constructor.
       
   222         */
       
   223         void ConstructL();
       
   224 
       
   225 
       
   226     protected:  // Data
       
   227         MWidgetUICancelObserver* iCancelObserver;   // not owned, used for callback
       
   228 
       
   229         CommonUI::CCUIDialogs* iCommonDialogs;      // Owned
       
   230 
       
   231         TInstallMode iMode;     // Indicates whether we have install or uninstall in progress
       
   232 
       
   233         TBool iShowingDialog;   // show dialog or not
       
   234 
       
   235         TBool iShownFinalNote;  // is final note shown or not
       
   236 
       
   237         TInt iUncompressedSize; // uncompressed size of the whole package
       
   238 
       
   239         TInt iInstalledSize;    // total installed size
       
   240 
       
   241         CArrayFixFlat<TInt>* iProgressNumbers; // owned
       
   242     };
       
   243 }
       
   244 
       
   245 #endif