appinstall_plat/sifui_api/inc/sifui.h
changeset 60 245df5276b97
parent 42 d17dc5398051
child 67 3a625661d1ce
equal deleted inserted replaced
53:ae54820ef82c 60:245df5276b97
    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 /********************************************************
    19 /**************************************************************
    20  *                                                      *
    20  *                                                            *
    21  *   WARNING - WORK-IN-PROGRESS - THIS API MAY CHANGE   *
    21  *   WARNING - WORK-IN-PROGRESS - THIS API MAY STILL CHANGE   *
    22  *                                                      *
    22  *                                                            *
    23  ********************************************************/
    23  **************************************************************/
    24 
    24 
    25 #ifndef C_SIFUI_H
    25 #ifndef C_SIFUI_H
    26 #define C_SIFUI_H
    26 #define C_SIFUI_H
    27 
    27 
    28 #include <e32base.h>                            // CBase
    28 #include <e32base.h>                            // CBase
       
    29 #include <bamdesca.h>                           // MDesCArray
    29 
    30 
    30 class CSifUiPrivate;
    31 class CSifUiPrivate;
    31 class CApaMaskedBitmap;
    32 class CApaMaskedBitmap;
    32 class CSifUiCertificateInfo;
    33 class CSifUiCertificateInfo;
    33 class CSifUiAppInfo;
    34 class CSifUiAppInfo;
       
    35 class CSifUiErrorInfo;
    34 
    36 
    35 namespace Swi {
    37 namespace Swi {
    36     class CAppInfo;
    38     class CAppInfo;
    37     class CCertificateInfo;
    39     class CCertificateInfo;
    38 }
    40 }
    65          * Destructor.
    67          * Destructor.
    66          */
    68          */
    67         ~CSifUi();
    69         ~CSifUi();
    68 
    70 
    69     public:     // new functions
    71     public:     // new functions
    70         /**
    72 
    71          * Displays main installation confirmation query and waits for user response.
    73         //=================================================
    72          * Returns ETrue if user accepted the query. The next ShowProgressL() call
    74         // Preparing note method
    73          * changes the dialog to installation progress note. And finally, ShowFailedL()
    75         //=================================================
    74          * or ShowCompleteL() changes the dialog to the final error or complete note.
    76 
       
    77         /**
       
    78          * Displays installation dialog with "Preparing" text and indefinite progress bar.
       
    79          * No buttons are available. Use ShowConfirmationL() method to update the dialog
       
    80          * content to the installation confirmation query.
       
    81          */
       
    82         IMPORT_C void ShowPreparingL();
       
    83 
       
    84 
       
    85         //=================================================
       
    86         // Install confirmation query methods
       
    87         //=================================================
       
    88 
       
    89         /**
       
    90          * Defines memory selection alternatives for the ShowConfirmationL() installation
       
    91          * confirmation query. Use SelectedDrive() method to get the selected drive number
       
    92          * after ShowConfirmationL() call.
       
    93          * @param aDriveNumbers - options for memory selection
       
    94          */
       
    95         IMPORT_C void SetMemorySelectionL( const RArray<TInt>& aDriveNumbers );
       
    96 
       
    97         /**
       
    98          * Defines certificate details for the ShowConfirmationL() installation
       
    99          * confirmation query. If certificates are not set, then application is
       
   100          * untrusted.
       
   101          * @param aCertificates - certificate details
       
   102          */
       
   103         IMPORT_C void SetCertificateInfoL(
       
   104                 const RPointerArray<CSifUiCertificateInfo>& aCertificates );
       
   105 
       
   106         /**
       
   107          * Displays installation confirmation query and waits for user response.
       
   108          * Returns ETrue if the user accepted the query. The next ShowProgressL() call
       
   109          * changes the dialog content to installation progress note. And finally,
       
   110          * ShowCompleteL() or ShowFailedL() call changes the dialog content to the
       
   111          * complete or error note.
       
   112          * If preparing installation note needs to be displayed before confirmation query,
       
   113          * then call ShowPreparingL() before any other functions.
    75          * If the installation confirmation query should contain memory selection option,
   114          * If the installation confirmation query should contain memory selection option,
    76          * then set the selectable drives with SetMemorySelectionL() first. User selected
   115          * then set the selectable drives with SetMemorySelectionL() first. User selected
    77          * drive can be retrieved with SelectedDrive().
   116          * drive can be retrieved with SelectedDrive() after ShowConfirmationL() returns.
       
   117          * If the installation confirmation query should contain certificate details, then
       
   118          * set the certificate details using SetCertificateInfoL() first.
    78          * @param aAppInfo - application information (name, size, version, vendor, icon)
   119          * @param aAppInfo - application information (name, size, version, vendor, icon)
    79          * @return TBools - ETrue if user accepted the query, EFalse otherwise
   120          * @return TBools - ETrue if the user accepted the query, EFalse otherwise
    80          */
   121          */
    81         IMPORT_C TBool ShowConfirmationL( const CSifUiAppInfo& aAppInfo );
   122         IMPORT_C TBool ShowConfirmationL( const CSifUiAppInfo& aAppInfo );
    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 
   123 
    90         /**
   124         /**
    91          * Gets the selected drive where new component should be installed.
   125          * Gets the selected drive where new component should be installed.
    92          * Use RFs::DriveToChar() to convert the drive number to drive letter.
   126          * Use RFs::DriveToChar() to convert the drive number to drive letter.
    93          * @param aDriveNumber - selected drive number
   127          * @param aDriveNumber - selected drive number
    94          * @return TInt - KErrNone if successful, otherwise Symbian error code
   128          * @return TInt - KErrNone if successful, otherwise Symbian error code
    95          */
   129          */
    96         IMPORT_C TInt SelectedDrive( TInt& aDriveNumber );
   130         IMPORT_C TInt SelectedDrive( TInt& aDriveNumber );
    97 
   131 
    98         /**
   132 
    99          * Defines certificate details for the main installation confirmation
   133         //=================================================
   100          * query displayed with ShowConfirmationL() function.
   134         // Progress note methods
   101          * @param aCertificates - certificate details
   135         //=================================================
   102          */
   136 
   103         IMPORT_C void SetCertificateInfoL(
   137         /**
   104                 const RPointerArray<CSifUiCertificateInfo>& aCertificates );
   138          * Installing phases in progress notes. Indicated in progress note title text.
   105 
   139          */
   106         /**
   140         enum TInstallingPhase {
   107          * Displays main installation progress note. If the progress note or main
   141             EInstalling,
   108          * confirmation query is already displayed, then updates the dialog content.
   142             EDownloading,
   109          * Use IncreaseProgressBarValueL() to increase the progress bar value.
   143             ECheckingCerts
       
   144         };
       
   145 
       
   146         /**
       
   147          * Displays installation progress note. Changes confirmation query content
       
   148          * to progress note. If the progress note is already displayed, then updates
       
   149          * the dialog content. Use IncreaseProgressBarValueL() method to increase the
       
   150          * progress bar value.
   110          * Dialog remains on the screen after progress bar shows full 100% value.
   151          * Dialog remains on the screen after progress bar shows full 100% value.
   111          * Use ShowFailedL() or ShowCompleteL() to replace the dialog content
   152          * Use ShowCompleteL() or ShowFailedL() methods to show the result.
   112          * with the final error or complete note.
       
   113          * @param aAppInfo - application information (name, size, version, vendor, icon)
   153          * @param aAppInfo - application information (name, size, version, vendor, icon)
   114          * @param aProgressBarFinalValue - final value of the progress bar
   154          * @param aProgressBarFinalValue - final value of the progress bar
   115          */
   155          * @param aPhase - defines new title text for the progress note dialog
   116         IMPORT_C void ShowProgressL( const CSifUiAppInfo& aAppInfo, TInt aProgressBarFinalValue );
   156          */
       
   157         IMPORT_C void ShowProgressL( const CSifUiAppInfo& aAppInfo, TInt aProgressBarFinalValue,
       
   158                 TInstallingPhase aPhase = EInstalling );
   117 
   159 
   118         /**
   160         /**
   119          * Updates the progress bar value displayed in progress note. Initially progress bar
   161          * Updates the progress bar value displayed in progress note. Initially progress bar
   120          * shows 0%. Each aIncrement increases the value displayed in progress bar. When all
   162          * shows 0%. Each aIncrement increases the value displayed in progress bar. When all
   121          * increments reach the final value defined in ShowProgressNoteL() method, then the
   163          * increments reach the final value defined in ShowProgressNoteL() method, then the
   129          * Returns ETrue if the user has cancelled the progress dialog.
   171          * Returns ETrue if the user has cancelled the progress dialog.
   130          * @return TBool - ETrue if the progress dialog has been cancelled
   172          * @return TBool - ETrue if the progress dialog has been cancelled
   131          */
   173          */
   132         IMPORT_C TBool IsCancelled();
   174         IMPORT_C TBool IsCancelled();
   133 
   175 
       
   176 
       
   177         //=================================================
       
   178         // Final complete and error notes
       
   179         //=================================================
       
   180 
       
   181         /**
       
   182          * Displays installation complete note and waits for the user to close it.
       
   183          * Installation complete note contains "Show" button to show installed
       
   184          * applications in application library. Use SetButtonVisible() method to
       
   185          * hide the "Show" button when necessary.
       
   186          */
       
   187         IMPORT_C void ShowCompleteL();
       
   188 
       
   189         /**
       
   190          * Displays installation error note and waits for user to close it.
       
   191          * Installation error note contains "Details" button to show the detailed
       
   192          * error message (when available). Also SetButtonVisible() method can be
       
   193          * used to hide the "Details" button if necessary.
       
   194          * @param aErrorCategory - error category
       
   195          * @param aErrorMessage - localized error message to be displayed
       
   196          * @param aErrorDetails - localized error message details (if any)
       
   197          * @param aErrorCode - error code
       
   198          * @param aErrorCode - error code
       
   199          */
       
   200         IMPORT_C void ShowFailedL( const CSifUiErrorInfo& aErrorInfo );
       
   201 
       
   202 
       
   203         //=================================================
       
   204         // Buttons in progress/complete/error notes
       
   205         //=================================================
       
   206 
   134         /**
   207         /**
   135          * Toolbar buttons in progress and complete notes that can be disabled/hidden.
   208          * Toolbar buttons in progress and complete notes that can be disabled/hidden.
   136          */
   209          */
   137         enum TOptionalButton
   210         enum TOptionalButton
   138             {
   211             {
   139             EHideProgressButton,
   212             EHideProgressButton,        // "Hide" button in progress note
   140             ECancelProgressButton,
   213             ECancelProgressButton,      // "Cancel" button in progress note
   141             EShowInAppLibButton,
   214             EShowInAppLibButton,        // "Show" button in complete note
   142             EErrorDetailsButton
   215             EErrorDetailsButton         // "Details" button in error note
   143             };
   216             };
   144 
   217 
   145         /**
   218         /**
   146          * Hides or shows optional toolbar buttons from installation progress note
   219          * Hides or shows optional toolbar buttons from installation progress note
   147          * or installation complete note. All optional buttos are visible by default.
   220          * or installation complete note. All optional buttos are visible by default.
   150          * @param aButton - button which visibility is changed
   223          * @param aButton - button which visibility is changed
   151          * @param aIsVisible - EFalse if button needs to be hidden
   224          * @param aIsVisible - EFalse if button needs to be hidden
   152          */
   225          */
   153         IMPORT_C void SetButtonVisible( TOptionalButton aButton, TBool aIsVisible );
   226         IMPORT_C void SetButtonVisible( TOptionalButton aButton, TBool aIsVisible );
   154 
   227 
   155         /**
   228 
   156          * Displays main installation complete note. Installation complete note contains
   229         //=================================================
   157          * button to launch the application libaray to show the recently installed apps.
   230         // Other query dialogs
   158          */
   231         //=================================================
   159         IMPORT_C void ShowCompleteL();
   232 
   160 
   233         /**
   161         /**
   234          * Displays dialog requesting capabilities for the application being installed
   162          * Displays main installation error note. Installation error note contains button
   235          * and waits for user response. Returns ETrue if the user granted the capabilities.
   163          * to see detailed error message when available.
   236          * Other dialogs (like progress note) are not affected.
   164          * @param aErrorCode - error code
   237          * @param aCapabilities - requested user capabilities
   165          * @param aErrorMessage - localized error message to be displayed
   238          * @return TBool - ETrue if the user granted the capabilities, EFalse otherwise
   166          * @param aErrorDetails - localized error message details (if any)
   239          */
   167          */
   240         IMPORT_C TBool ShowGrantCapabilitiesL( const TCapabilitySet& aCapabilities );
       
   241 
       
   242         /**
       
   243          * Displays a selection dialog with radio-buttons in a pop-up window,
       
   244          * and waits for user response. Other displayed installation dialogs
       
   245          * (like progress note) are not affected. Returns boolean that indicates
       
   246          * if the user cancelled the query. Selected item index is returned in
       
   247          * aSelectedIndex parameter (KErrNotFound if cancelled).
       
   248          * @param aTitle - selection dialog title
       
   249          * @param aSelectableItems - array of selectable items
       
   250          * @param aSelectedIndex - returns selected item index
       
   251          * @return TBool - ETrue if the user accepted the query, EFalse otherwise
       
   252          */
       
   253         IMPORT_C TBool ShowSingleSelectionL( const TDesC& aTitle,
       
   254             const MDesCArray& aSelectableItems, TInt& aSelectedIndex );
       
   255 
       
   256         /**
       
   257          * Displays a multi-selection dialog with checkboxes in a pop-up window,
       
   258          * and waits for user response. Other displayed installation dialogs
       
   259          * (like progress note) are not affected. Returns user selected indices,
       
   260          * in aSelectedIndexes array (empty if cancelled).
       
   261          * @param aTitle - multi-selection dialog title
       
   262          * @param aSelectableItems - array of selectable items
       
   263          * @param aSelectedIndexes - returns the selected item indices
       
   264          * @return TBool - ETrue if the user accepted the query, EFalse otherwise
       
   265          */
       
   266         IMPORT_C TBool ShowMultiSelectionL( const TDesC& aTitle,
       
   267             const MDesCArray& aSelectableItems, RArray<TInt>& aSelectedIndexes );
       
   268 
       
   269 
       
   270         //=================================================
       
   271         // DEPRECATED METHODS
       
   272         //=================================================
       
   273 
       
   274         // DEPRECATED, WILL BE REMOVED, DO NOT USE
   168         IMPORT_C void ShowFailedL( TInt aErrorCode, const TDesC& aErrorMessage,
   275         IMPORT_C void ShowFailedL( TInt aErrorCode, const TDesC& aErrorMessage,
   169             const TDesC& aErrorDetails = KNullDesC );
   276             const TDesC& aErrorDetails = KNullDesC );
       
   277 
   170 
   278 
   171     private:    // new functions
   279     private:    // new functions
   172         CSifUi();
   280         CSifUi();
   173         void ConstructL();
   281         void ConstructL();
   174 
   282