appinstall_plat/sifui_api/inc/sifui.h
changeset 29 26b6f0522fd8
parent 25 98b66e4fb0be
child 37 6e7b00453237
equal deleted inserted replaced
25:98b66e4fb0be 29:26b6f0522fd8
    14 * Description:  CSifUi API can be used to implement UI dialogs for
    14 * Description:  CSifUi API can be used to implement UI dialogs for
    15 *               SIF (Software Install Framework) plugins.
    15 *               SIF (Software Install Framework) plugins.
    16 */
    16 */
    17 
    17 
    18 
    18 
       
    19 /********************************************************
       
    20  *                                                      *
       
    21  *   WARNING - WORK-IN-PROGRESS - THIS API MAY CHANGE   *
       
    22  *                                                      *
       
    23  ********************************************************/
       
    24 
    19 #ifndef C_SIFUI_H
    25 #ifndef C_SIFUI_H
    20 #define C_SIFUI_H
    26 #define C_SIFUI_H
    21 
    27 
    22 #include <e32base.h>                            // CActive
    28 #include <e32base.h>                            // CBase
    23 #include <hb/hbcore/hbsymbiandevicedialog.h>    // MHbDeviceDialogObserver
       
    24 
    29 
    25 
    30 class CSifUiPrivate;
    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;
    31 class CApaMaskedBitmap;
    41 
       
    42 namespace Swi {
    32 namespace Swi {
    43     class CAppInfo;
    33     class CAppInfo;
    44     class CCertificateInfo;
    34     class CCertificateInfo;
    45 }
    35 }
    46 
    36 
       
    37 
    47 /**
    38 /**
    48  * CSifUi provides UI dialogs for SW installation. UI dialogs are
    39  * 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).
    40  * global and they can be used in a non-UI code (like SIF plugins).
    50  * SW install device dialog plugin implements the UI dialogs.
    41  * SW install device dialog plugin implements the UI dialogs.
    51  *
    42  *
    52  * @lib SifUi.lib
    43  * @lib sifui.lib
    53  * @since 10.1
    44  * @since 10.1
    54  */
    45  */
    55 class CSifUi : public CActive, public MHbDeviceDialogObserver
    46 class CSifUi : public CBase
    56     {
    47     {
    57     public:     // constructor and destructor
    48     public:     // constructor and destructor
    58         /**
    49         /**
    59          * Creates new CSifUi object and pushes it into cleanup stack.
    50          * Creates new CSifUi object and pushes it into cleanup stack.
    60          * @returns CSifUi* -- new CSifUi object
    51          * @returns CSifUi* -- new CSifUi object
    72          */
    63          */
    73         CSifUi::~CSifUi();
    64         CSifUi::~CSifUi();
    74 
    65 
    75     public:     // new functions
    66     public:     // new functions
    76         /**
    67         /**
    77          * Defines installation or uninstallation mode.
    68          * Displays main installation confirmation query and waits for user response.
    78          */
    69          * Returns ETrue if user accepted the query. The next ShowProgressL() call
    79         enum TMode {
    70          * changes the dialog to installation progress note. And finally, ShowFailedL()
    80             EUnspecified = 0,
    71          * or ShowCompleteL() changes the dialog to the final error or complete note.
    81             EInstalling = 1,
    72          * If the installation confirmation query should contain memory selection option,
    82             EUninstalling = 2
    73          * then set the selectable drives with SetMemorySelectionL() first. User selected
    83         };
    74          * drive can be retrieved with SelectedDrive().
    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)
    75          * @param aAppInfo - application information (name, version, and vendor)
   105          * @param aAppSize - application size in bytes (not displayed if zero)
    76          * @param aAppSize - application size in bytes, not displayed if zero
   106          * @param aAppIcon - application icon, default icon is displayed if NULL
    77          * @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
    78          * @return TBools - ETrue if user accepted the query, EFalse otherwise
   109          */
    79          */
   110         IMPORT_C TBool ShowConfirmationL( const Swi::CAppInfo& aAppInfo,
    80         IMPORT_C TBool ShowConfirmationL( const Swi::CAppInfo& aAppInfo,
   111                 TInt aAppSize, const CApaMaskedBitmap* aAppIcon,
    81                 TInt aAppSize = 0, const CApaMaskedBitmap* aAppIcon = NULL );
       
    82 
       
    83         /**
       
    84          * Defines memory selection alternatives for the main installation
       
    85          * confirmation query displayed with ShowConfirmationL() function.
       
    86          * @param aDriveNumbers - options for memory selection
       
    87          */
       
    88         IMPORT_C void SetMemorySelectionL( const RArray<TInt>& aDriveNumbers );
       
    89 
       
    90         /**
       
    91          * Gets the selected drive where new component should be installed.
       
    92          * Use RFs::DriveToChar() to convert the drive number to drive letter.
       
    93          * @param aDriveNumber - selected drive number
       
    94          * @return TInt - KErrNone if successful, otherwise Symbian error code
       
    95          */
       
    96         IMPORT_C TInt SelectedDrive( TInt& aDriveNumber );
       
    97 
       
    98         /**
       
    99          * Defines certificate details for the main installation confirmation
       
   100          * query displayed with ShowConfirmationL() function.
       
   101          * @param aCertificates - certificate details
       
   102          */
       
   103         IMPORT_C void SetCertificateInfoL(
   112                 const RPointerArray<Swi::CCertificateInfo>& aCertificates );
   104                 const RPointerArray<Swi::CCertificateInfo>& aCertificates );
   113 
   105 
   114         /**
   106         /**
   115          * Displays main installation/uninstallation progress note. If progress note
   107          * Displays main installation progress note. If the progress note or main
   116          * or main confirmation query is already displayed, then updates the dialog
   108          * confirmation query is already displayed, then updates the dialog content.
   117          * content. Use IncreaseProgressBarValueL() to increase the progress bar value.
   109          * Use IncreaseProgressBarValueL() to increase the progress bar value.
   118          * Dialog remains still on the screen after progress bar shows full 100% value.
   110          * Dialog remains on the screen after progress bar shows full 100% value.
   119          * Use ShowFailedL() or ShowCompleteL() to replace the dialog content with the
   111          * Use ShowFailedL() or ShowCompleteL() to replace the dialog content
   120          * final error or complete note.
   112          * with the final error or complete note.
   121          * @param aAppInfo - application information (name, version, and vendor)
   113          * @param aAppInfo - application information (name, version, and vendor)
   122          * @param aAppSize - application size in bytes (not displayed if zero)
   114          * @param aAppSize - application size in bytes (not displayed if zero)
   123          * @param aProgressBarFinalValue - final value of the progress bar
   115          * @param aProgressBarFinalValue - final value of the progress bar
   124          */
   116          */
   125         IMPORT_C void ShowProgressL( const Swi::CAppInfo& aAppInfo,
   117         IMPORT_C void ShowProgressL( const Swi::CAppInfo& aAppInfo,
   133          * @param aIncrement - progress bar value increment
   125          * @param aIncrement - progress bar value increment
   134          */
   126          */
   135         IMPORT_C void IncreaseProgressBarValueL( TInt aIncrement );
   127         IMPORT_C void IncreaseProgressBarValueL( TInt aIncrement );
   136 
   128 
   137         /**
   129         /**
   138          * Displays main installation/uninstallation complete note. Installation complete
   130          * Displays main installation complete note. Installation complete note contains
   139          * note contains button to launch application libaray.
   131          * button to launch the application libaray to show the recently installed apps.
   140          */
   132          */
   141         IMPORT_C void ShowCompleteL();
   133         IMPORT_C void ShowCompleteL();
   142 
   134 
   143         /**
   135         /**
   144          * Displays main installation/uninstallation error note. Installation error note
   136          * Displays main installation error note. Installation error note contains button
   145          * contains button to see detailed error message.
   137          * to see detailed error message when available.
   146          * @param aErrorCode - error code
   138          * @param aErrorCode - error code
       
   139          * @param aErrorMessage - localized error message to be displayed
       
   140          * @param aErrorDetails - localized error message details (if any)
   147          */
   141          */
       
   142         IMPORT_C void ShowFailedL( TInt aErrorCode, const TDesC& aErrorMessage,
       
   143             const TDesC& aErrorDetails = KNullDesC );
       
   144 
       
   145 
       
   146 
       
   147         /** DEPRECATED -- DO NOT USE -- WILL BE REMOVED */
       
   148         enum TMode {
       
   149             EUnspecified = 0,
       
   150             EInstalling = 1,
       
   151             EUninstalling = 2
       
   152         };
       
   153         IMPORT_C void SetMode( TMode aMode );
       
   154         IMPORT_C TMode Mode();
   148         IMPORT_C void ShowFailedL( TInt aErrorCode );
   155         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 
   156 
   158     private:    // new functions
   157     private:    // new functions
   159         CSifUi();
   158         CSifUi();
   160         void ConstructL();
   159         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 
   160 
   172     private:    // data
   161     private:    // data
   173         TMode iMode;
   162         CSifUiPrivate* iPrivate;
   174         CHbDeviceDialog* iDeviceDialog;
       
   175         CHbSymbianVariantMap* iVariantMap;
       
   176         CActiveSchedulerWait* iWait;
       
   177         TBool iIsDisplayingDialog;
       
   178         TInt iCompletionCode;
       
   179         TInt iReturnValue;
       
   180         CApaMaskedBitmap* iBitmap;
       
   181     };
   163     };
   182 
   164 
   183 
   165 
   184 #endif  // C_SIFUI_H
   166 #endif  // C_SIFUI_H
   185 
   167