appinstall_plat/sifui_api/inc/sifui.h
changeset 25 98b66e4fb0be
child 29 26b6f0522fd8
equal deleted inserted replaced
24:84a16765cd86 25:98b66e4fb0be
       
     1 /*
       
     2 * Copyright (c) 2010 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:  CSifUi API can be used to implement UI dialogs for
       
    15 *               SIF (Software Install Framework) plugins.
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_SIFUI_H
       
    20 #define C_SIFUI_H
       
    21 
       
    22 #include <e32base.h>                            // CActive
       
    23 #include <hb/hbcore/hbsymbiandevicedialog.h>    // MHbDeviceDialogObserver
       
    24 
       
    25 
       
    26 
       
    27 /******************************************************************
       
    28  *                                                                *
       
    29  *   WARNING - WORK-IN-PROGRESS - THIS API CHANGES ALL THE TIME   *
       
    30  *                                                                *
       
    31  ******************************************************************/
       
    32 
       
    33 
       
    34 
       
    35 class MSifUiCertificateDetailsProvider;
       
    36 class MSifUiDrmDetailsProvider;
       
    37 class CHbDeviceDialog;
       
    38 class CHbSymbianVariantMap;
       
    39 class CActiveSchedulerWait;
       
    40 class CApaMaskedBitmap;
       
    41 
       
    42 namespace Swi {
       
    43     class CAppInfo;
       
    44     class CCertificateInfo;
       
    45 }
       
    46 
       
    47 /**
       
    48  * CSifUi provides UI dialogs for SW installation. UI dialogs are
       
    49  * global and they can be used in a non-UI code (like in SIF plugins).
       
    50  * SW install device dialog plugin implements the UI dialogs.
       
    51  *
       
    52  * @lib SifUi.lib
       
    53  * @since 10.1
       
    54  */
       
    55 class CSifUi : public CActive, public MHbDeviceDialogObserver
       
    56     {
       
    57     public:     // constructor and destructor
       
    58         /**
       
    59          * Creates new CSifUi object and pushes it into cleanup stack.
       
    60          * @returns CSifUi* -- new CSifUi object
       
    61          */
       
    62         IMPORT_C static CSifUi* NewLC();
       
    63 
       
    64         /**
       
    65          * Creates new CSifUi object.
       
    66          * @returns CSifUi* -- new CSifUi object
       
    67          */
       
    68         IMPORT_C static CSifUi* NewL();
       
    69 
       
    70         /**
       
    71          * Destructor.
       
    72          */
       
    73         CSifUi::~CSifUi();
       
    74 
       
    75     public:     // new functions
       
    76         /**
       
    77          * Defines installation or uninstallation mode.
       
    78          */
       
    79         enum TMode {
       
    80             EUnspecified = 0,
       
    81             EInstalling = 1,
       
    82             EUninstalling = 2
       
    83         };
       
    84 
       
    85         /**
       
    86          * Defines installing or uninstalling mode. Selected mode defines
       
    87          * the dialog titles and buttons.
       
    88          * @param aMode - installing or uninstalling mode
       
    89          */
       
    90         IMPORT_C void SetMode( TMode aMode );
       
    91 
       
    92         /**
       
    93          * Returns the currently selected mode.
       
    94          * @return TMode - installing or uninstalling mode
       
    95          */
       
    96         IMPORT_C TMode Mode();
       
    97 
       
    98         /**
       
    99          * Displays main installation/uninstallation confirmation query and waits
       
   100          * for user response. Returns ETrue if user accepted the query. Confirmation
       
   101          * dialog is left on the screen. Subsequent ShowProgressL() call replaces it's
       
   102          * content with main progress note, and ShowFailedL() or ShowCompleteL() calls
       
   103          * replace it's content with the error or complete dialogs.
       
   104          * @param aAppInfo - application information (name, version, and vendor)
       
   105          * @param aAppSize - application size in bytes (not displayed if zero)
       
   106          * @param aAppIcon - application icon, default icon is displayed if NULL
       
   107          * @param aCertificates - certificate details
       
   108          * @return TBools - ETrue if user accepted the query, EFalse otherwise
       
   109          */
       
   110         IMPORT_C TBool ShowConfirmationL( const Swi::CAppInfo& aAppInfo,
       
   111                 TInt aAppSize, const CApaMaskedBitmap* aAppIcon,
       
   112                 const RPointerArray<Swi::CCertificateInfo>& aCertificates );
       
   113 
       
   114         /**
       
   115          * Displays main installation/uninstallation progress note. If progress note
       
   116          * or main confirmation query is already displayed, then updates the dialog
       
   117          * content. Use IncreaseProgressBarValueL() to increase the progress bar value.
       
   118          * Dialog remains still on the screen after progress bar shows full 100% value.
       
   119          * Use ShowFailedL() or ShowCompleteL() to replace the dialog content with the
       
   120          * final error or complete note.
       
   121          * @param aAppInfo - application information (name, version, and vendor)
       
   122          * @param aAppSize - application size in bytes (not displayed if zero)
       
   123          * @param aProgressBarFinalValue - final value of the progress bar
       
   124          */
       
   125         IMPORT_C void ShowProgressL( const Swi::CAppInfo& aAppInfo,
       
   126                 TInt aAppSize, TInt aProgressBarFinalValue );
       
   127 
       
   128         /**
       
   129          * Updates the progress bar value displayed in progress note. Initially progress bar
       
   130          * shows 0%. Each aIncrement increases the value displayed in progress bar. When all
       
   131          * increments reach the final value defined in ShowProgressNoteL() method, then the
       
   132          * progress bar shows full 100%.
       
   133          * @param aIncrement - progress bar value increment
       
   134          */
       
   135         IMPORT_C void IncreaseProgressBarValueL( TInt aIncrement );
       
   136 
       
   137         /**
       
   138          * Displays main installation/uninstallation complete note. Installation complete
       
   139          * note contains button to launch application libaray.
       
   140          */
       
   141         IMPORT_C void ShowCompleteL();
       
   142 
       
   143         /**
       
   144          * Displays main installation/uninstallation error note. Installation error note
       
   145          * contains button to see detailed error message.
       
   146          * @param aErrorCode - error code
       
   147          */
       
   148         IMPORT_C void ShowFailedL( TInt aErrorCode );
       
   149 
       
   150     protected:  // from CActive
       
   151         void DoCancel();
       
   152         void RunL();
       
   153 
       
   154     private:    // from MHbDeviceDialogObserver
       
   155         void DataReceived( CHbSymbianVariantMap& aData );
       
   156         void DeviceDialogClosed( TInt aCompletionCode );
       
   157 
       
   158     private:    // new functions
       
   159         CSifUi();
       
   160         void ConstructL();
       
   161         void ClearParamsL();
       
   162         void ChangeNoteTypeL( TInt aType );
       
   163         void AddParamL( const TDesC& aKey, TInt aValue );
       
   164         void AddParamL( const TDesC& aKey, const TDesC& aValue );
       
   165         void AddParamsAppInfoAndSizeL( const Swi::CAppInfo& aAppInfo, TInt aAppSize );
       
   166         void AddParamsIconL( const CApaMaskedBitmap* aIcon );
       
   167         void AddParamsCertificatesL( const RPointerArray<Swi::CCertificateInfo>& aCertificates );
       
   168         void DisplayDeviceDialogL();
       
   169         TInt WaitForResponse();
       
   170         void ResponseReceived( TInt aCompletionCode );
       
   171 
       
   172     private:    // data
       
   173         TMode iMode;
       
   174         CHbDeviceDialog* iDeviceDialog;
       
   175         CHbSymbianVariantMap* iVariantMap;
       
   176         CActiveSchedulerWait* iWait;
       
   177         TBool iIsDisplayingDialog;
       
   178         TInt iCompletionCode;
       
   179         TInt iReturnValue;
       
   180         CApaMaskedBitmap* iBitmap;
       
   181     };
       
   182 
       
   183 
       
   184 #endif  // C_SIFUI_H
       
   185