appinstall_plat/sifui_api/inc/sifui.h
branchRCL_3
changeset 66 8b7f4e561641
parent 65 7333d7932ef7
child 70 e8965914fac7
equal deleted inserted replaced
65:7333d7932ef7 66:8b7f4e561641
     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 /**************************************************************
       
    20  *                                                            *
       
    21  *   WARNING - WORK-IN-PROGRESS - THIS API MAY STILL CHANGE   *
       
    22  *                                                            *
       
    23  **************************************************************/
       
    24 
       
    25 #ifndef C_SIFUI_H
       
    26 #define C_SIFUI_H
       
    27 
       
    28 #include <e32base.h>                            // CBase
       
    29 #include <bamdesca.h>                           // MDesCArray
       
    30 
       
    31 class CSifUiPrivate;
       
    32 class CApaMaskedBitmap;
       
    33 class CSifUiCertificateInfo;
       
    34 class CSifUiAppInfo;
       
    35 class CSifUiErrorInfo;
       
    36 
       
    37 namespace Swi {
       
    38     class CAppInfo;
       
    39     class CCertificateInfo;
       
    40 }
       
    41 
       
    42 
       
    43 /**
       
    44  * CSifUi provides UI dialogs for SW installation. UI dialogs are
       
    45  * global and they can be used in a non-UI code (like SIF plugins).
       
    46  * SW install device dialog plugin implements the UI dialogs.
       
    47  *
       
    48  * @lib sifui.lib
       
    49  * @since 10.1
       
    50  */
       
    51 class CSifUi : public CBase
       
    52     {
       
    53     public:     // constructor and destructor
       
    54         /**
       
    55          * Creates new CSifUi object and pushes it into cleanup stack.
       
    56          * @returns CSifUi* -- new CSifUi object
       
    57          */
       
    58         IMPORT_C static CSifUi* NewLC();
       
    59 
       
    60         /**
       
    61          * Creates new CSifUi object.
       
    62          * @returns CSifUi* -- new CSifUi object
       
    63          */
       
    64         IMPORT_C static CSifUi* NewL();
       
    65 
       
    66         /**
       
    67          * Destructor.
       
    68          */
       
    69         ~CSifUi();
       
    70 
       
    71     public:     // new functions
       
    72 
       
    73         //=================================================
       
    74         // Preparing note method
       
    75         //=================================================
       
    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.
       
   114          * If the installation confirmation query should contain memory selection option,
       
   115          * then set the selectable drives with SetMemorySelectionL() first. User selected
       
   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.
       
   119          * @param aAppInfo - application information (name, size, version, vendor, icon)
       
   120          * @return TBools - ETrue if the user accepted the query, EFalse otherwise
       
   121          */
       
   122         IMPORT_C TBool ShowConfirmationL( const CSifUiAppInfo& aAppInfo );
       
   123 
       
   124         /**
       
   125          * Gets the selected drive where new component should be installed.
       
   126          * Use RFs::DriveToChar() to convert the drive number to drive letter.
       
   127          * @param aDriveNumber - selected drive number
       
   128          * @return TInt - KErrNone if successful, otherwise Symbian error code
       
   129          */
       
   130         IMPORT_C TInt SelectedDrive( TInt& aDriveNumber );
       
   131 
       
   132 
       
   133         //=================================================
       
   134         // Progress note methods
       
   135         //=================================================
       
   136 
       
   137         /**
       
   138          * Installing phases in progress notes. Indicated in progress note title text.
       
   139          */
       
   140         enum TInstallingPhase {
       
   141             EInstalling,
       
   142             EDownloading,
       
   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.
       
   151          * Dialog remains on the screen after progress bar shows full 100% value.
       
   152          * Use ShowCompleteL() or ShowFailedL() methods to show the result.
       
   153          * @param aAppInfo - application information (name, size, version, vendor, icon)
       
   154          * @param aProgressBarFinalValue - final value of the progress bar
       
   155          * @param aPhase - defines new title text for the progress note dialog
       
   156          */
       
   157         IMPORT_C void ShowProgressL( const CSifUiAppInfo& aAppInfo, TInt aProgressBarFinalValue,
       
   158                 TInstallingPhase aPhase = EInstalling );
       
   159 
       
   160         /**
       
   161          * Updates the progress bar value displayed in progress note. Initially progress bar
       
   162          * shows 0%. Each aIncrement increases the value displayed in progress bar. When all
       
   163          * increments reach the final value defined in ShowProgressNoteL() method, then the
       
   164          * progress bar shows full 100%. Caller should check using IsCancelled() method if
       
   165          * the user has cancelled the progress note before updating the progress bar value.
       
   166          * @param aIncrement - progress bar value increment
       
   167          */
       
   168         IMPORT_C void IncreaseProgressBarValueL( TInt aIncrement );
       
   169 
       
   170         /**
       
   171          * Returns ETrue if the user has cancelled the progress dialog.
       
   172          * @return TBool - ETrue if the progress dialog has been cancelled
       
   173          */
       
   174         IMPORT_C TBool IsCancelled();
       
   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 
       
   207         /**
       
   208          * Toolbar buttons in progress and complete notes that can be disabled/hidden.
       
   209          */
       
   210         enum TOptionalButton
       
   211             {
       
   212             EHideProgressButton,        // "Hide" button in progress note
       
   213             ECancelProgressButton,      // "Cancel" button in progress note
       
   214             EShowInAppLibButton,        // "Show" button in complete note
       
   215             EErrorDetailsButton         // "Details" button in error note
       
   216             };
       
   217 
       
   218         /**
       
   219          * Hides or shows optional toolbar buttons from installation progress note
       
   220          * or installation complete note. All optional buttos are visible by default.
       
   221          * Buttons visibility becomes effective in the next ShowProgressL(),
       
   222          * ShowCompleteL(), or IncreseProgressBarValueL() method calls.
       
   223          * @param aButton - button which visibility is changed
       
   224          * @param aIsVisible - EFalse if button needs to be hidden
       
   225          */
       
   226         IMPORT_C void SetButtonVisible( TOptionalButton aButton, TBool aIsVisible );
       
   227 
       
   228 
       
   229         //=================================================
       
   230         // Other query dialogs
       
   231         //=================================================
       
   232 
       
   233         /**
       
   234          * Displays dialog requesting capabilities for the application being installed
       
   235          * and waits for user response. Returns ETrue if the user granted the capabilities.
       
   236          * Other dialogs (like progress note) are not affected.
       
   237          * @param aCapabilities - requested user capabilities
       
   238          * @return TBool - ETrue if the user granted the capabilities, EFalse otherwise
       
   239          */
       
   240         IMPORT_C TBool ShowGrantCapabilitiesL( const TCapabilitySet& aCapabilities );
       
   241 
       
   242         /**
       
   243          * Displays pop-up language selection dialog with radio-buttons, and
       
   244          * waits for user response. Other displayed installation dialogs (like
       
   245          * progress note) are not affected. Returns integer that is the index
       
   246          * of the selected language in given langauge array, or error code.
       
   247          * Return value is KErrCancel if the user cancelled the query.
       
   248          * @param aLanguages - array of selectable languages
       
   249          * @return The selected item index to aLangauges array, or error code.
       
   250          */
       
   251         IMPORT_C TInt ShowSelectLanguageL( const RArray<TLanguage>& aLanguages );
       
   252 
       
   253         /**
       
   254          * Displays multi-selection pop-up dialog with checkboxes, and waits
       
   255          * for user response. Other displayed installation dialogs (like progress
       
   256          * note) are not affected. Returns ETrue if the user made the selection,
       
   257          * EFalse if the user cancelled the query. Selected indices are returned
       
   258          * in aSelectedIndexes array.
       
   259          * @param aSelectableItems - array of selectable items displayed
       
   260          * @param aSelectedIndexes - returns the selected item indices
       
   261          * @return TBool - ETrue if the user accepted the query, EFalse otherwise
       
   262          */
       
   263         IMPORT_C TBool ShowSelectOptionsL( const MDesCArray& aSelectableItems,
       
   264                 RArray<TInt>& aSelectedIndexes );
       
   265 
       
   266 
       
   267         //=================================================
       
   268         // DEPRECATED METHODS
       
   269         //=================================================
       
   270 
       
   271         // DEPRECATED, WILL BE REMOVED, DO NOT USE
       
   272         IMPORT_C void ShowFailedL( TInt aErrorCode, const TDesC& aErrorMessage,
       
   273             const TDesC& aErrorDetails = KNullDesC );
       
   274         IMPORT_C TBool ShowSingleSelectionL( const TDesC& aTitle,
       
   275             const MDesCArray& aSelectableItems, TInt& aSelectedIndex );
       
   276         IMPORT_C TBool ShowMultiSelectionL( const TDesC& aTitle,
       
   277             const MDesCArray& aSelectableItems, RArray<TInt>& aSelectedIndexes );
       
   278 
       
   279 
       
   280     private:    // new functions
       
   281         CSifUi();
       
   282         void ConstructL();
       
   283 
       
   284     private:    // data
       
   285         CSifUiPrivate* iPrivate;
       
   286     };
       
   287 
       
   288 
       
   289 #endif  // C_SIFUI_H
       
   290