securitydialogs/SecUi/Inc/SecQueryUi.h
branchRCL_3
changeset 22 03674e5abf46
parent 21 09b1ac925e3f
child 23 94da73d93b58
equal deleted inserted replaced
21:09b1ac925e3f 22:03674e5abf46
     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:  CSecQueryUi API can be used to implement UI dialogs for
       
    15 *               SecUi plugins.
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_SECQUERYUI_H
       
    20 #define C_SECQUERYUI_H
       
    21 
       
    22 #include <e32base.h>                            // CActive
       
    23 #include <hb/hbcore/hbdevicedialogsymbian.h>    // MHbDeviceDialogObserver
       
    24 #include <etelmm.h>
       
    25 #include <e32property.h>
       
    26 
       
    27 #define ESecUiTypeMask  0x0FFFFFF
       
    28 #define ESecUiBasicTypeMask    0x00F0000
       
    29 
       
    30 #define ESecUiCancelSupported  0x1000000
       
    31 #define ESecUiCancelNotSupported  0x0000000
       
    32 
       
    33 #define ESecUiEmergencySupported  0x2000000
       
    34 #define ESecUiEmergencyNotSupported  0x0000000
       
    35 
       
    36 #define ESecUiAlphaSupported  0x4000000
       
    37 #define ESecUiAlphaNotSupported  0x0000000
       
    38 
       
    39 #define ESecUiSecretSupported  0x8000000
       
    40 #define ESecUiSecretNotSupported  0x0000000
       
    41 
       
    42 #define ESecUiBasicTypeCheck   0x0010000
       
    43 #define ESecUiBasicTypeMultiCheck   0x0020000
       
    44 
       
    45 class MSecQueryUiCertificateDetailsProvider;
       
    46 class MSecQueryUiDrmDetailsProvider;
       
    47 class CHbDeviceDialogSymbian;
       
    48 class CHbSymbianVariantMap;
       
    49 class CActiveSchedulerWait;
       
    50 class CApaMaskedBitmap;
       
    51 
       
    52 typedef TBuf<80> TSecUiPassword;
       
    53 
       
    54 enum R_SECUI_ERROR_CODES
       
    55 	{
       
    56 	R_CODE_ERROR=0x58ED0100,
       
    57 	R_SEC_BLOCKED,
       
    58 	R_CONFIRMATION_NOTE,
       
    59 	R_PIN_CODE_CHANGED_NOTE,
       
    60 	R_PIN2_CODE_CHANGED_NOTE,
       
    61 	R_PIN2_REJECTED,
       
    62 	R_UPIN_CODE_CHANGED_NOTE,
       
    63 	R_SIM_NOT_ALLOWED,
       
    64 	R_SIM_ALLREADY_OFF,
       
    65 	R_SIM_OFF,
       
    66 	R_SIM_ALLREADY_ON,
       
    67 	R_OPERATION_NOT_ALLOWED,
       
    68 	R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE,
       
    69 	R_PIN_NOT_ALLOWED,
       
    70 	R_REMOTELOCK_INVALID_CODE,
       
    71 	R_SIM_ON,
       
    72 	R_INSERT_SIM,
       
    73 	R_CODES_DONT_MATCH,
       
    74 	R_PIN_BLOCKED_NOTE,
       
    75 	R_UPIN_NOT_ALLOWED,
       
    76 	R_SECURITY_CODE_CHANGED_NOTE,
       
    77 	R_SECUI_ERROR_CODE_LAST
       
    78 	};
       
    79 
       
    80 /**
       
    81  * CSecQueryUi provides UI dialogs for SW installation. UI dialogs are
       
    82  * global and they can be used in a non-UI code (like in SIF plugins).
       
    83  * SW install device dialog plugin implements the UI dialogs.
       
    84  *
       
    85  * @lib SecQueryUi.lib
       
    86  * @since 10.1
       
    87  */
       
    88 typedef TBuf<80> TSecUiPassword;
       
    89 
       
    90 class CSecQueryUi : public CActive, public MHbDeviceDialogObserver
       
    91     {
       
    92     public:  // constructor and destructor
       
    93         /**
       
    94          * Creates new CSecQueryUi object and pushes it into cleanup stack.
       
    95          * @returns CSecQueryUi* -- new CSecQueryUi object
       
    96          */
       
    97         IMPORT_C static CSecQueryUi* NewLC();
       
    98 
       
    99         /**
       
   100          * Creates new CSecQueryUi object.
       
   101          * @returns CSecQueryUi* -- new CSecQueryUi object
       
   102          */
       
   103         IMPORT_C static CSecQueryUi* NewL();
       
   104 
       
   105         /**
       
   106          * Destructor.
       
   107          */
       
   108         CSecQueryUi::~CSecQueryUi();
       
   109 
       
   110     public:  // new functions
       
   111         /**
       
   112          * Displays install confirmation query synchronously. Synchronous function
       
   113          * returns after the user has accepted or cancelled the query.
       
   114          * @param aAppDetails - other application details (like supplier)
       
   115          * @return TBool - ETrue if user accepted the query, EFalse otherwise
       
   116          */
       
   117         IMPORT_C TBool InstallConfirmationQueryL( TInt aType, RMobilePhone::TMobilePassword& password );
       
   118         IMPORT_C TInt  SecQueryDialog(const TDesC& aCaption, TDes& aDataText, TInt aMinLength,TInt aMaxLength,TInt aMode);
       
   119         /*
       
   120         IMPORT_C TBool InstallConfirmationQueryL( const TDesC& aAppName,
       
   121                 const TDesC& aIconFile, const TDesC& aAppVersion, TInt aAppSize,
       
   122                 const TDesC& aAppDetails );
       
   123         */
       
   124 
       
   125         /**
       
   126          * Displays information note. If the information note is already displayed, then
       
   127          * only the dialog text is updated. Information note is closed automatically after
       
   128          * pre-defined time (e.g. after 1.5 seconds). User can also press any key to close
       
   129          * the note faster.
       
   130          * @param aText - info text to be displayed
       
   131          */
       
   132         IMPORT_C void DisplayInformationNoteL( const TDesC& aText );
       
   133 
       
   134         /**
       
   135          * Displays warning note. If the warning note is already displayed, then only the note
       
   136          * text is updated. Warning note is closed automatically after pre-defined time (e.g.
       
   137          * after three seconds). User can also press any key to close the note faster.
       
   138          * @param aText - error text to be displayed
       
   139          */
       
   140         IMPORT_C void DisplayWarningNoteL( const TDesC& aText );
       
   141 
       
   142         /**
       
   143          * Displays error note. If the error note is already displayed, then only the dialog
       
   144          * text is updated. Error note is closed automatically after pre-defined time (e.g.
       
   145          * after three seconds). User can also press any key to close the note faster.
       
   146          * @param aText - error text to be displayed
       
   147          */
       
   148         IMPORT_C void DisplayErrorNoteL( const TDesC& aText );
       
   149 
       
   150         /**
       
   151          * Displays permanent note. If the permanent note is already displayed, then only the
       
   152          * dialog text is updated. User cannot cancel or close permanent notes. Permanent note
       
   153          * is displayed until ClosePermanentNote() is called. Delayed notes are displayed after
       
   154          * pre-defined delay time, and they may be closed before they appear on the screen.
       
   155          * @param aText - text to be displayed
       
   156          * @param aIsDelayed - ETrue if delayed dialog should be used
       
   157          */
       
   158         IMPORT_C void DisplayPermanentNoteL( const TDesC& aText );
       
   159 
       
   160         /**
       
   161          * Closes the permanent note.
       
   162          */
       
   163         IMPORT_C void ClosePermanentNote();
       
   164 
       
   165         /**
       
   166          * Displays progress note using aFinalValue. Use UpdateProgressNoteValueL() to
       
   167          * update the progress bar. If the progress note is already active, then only
       
   168          * the note text and final value are updated.
       
   169          * @param aText - text displayed in progress note
       
   170          * @param aFinalValue - final value of the progress bar
       
   171          */
       
   172         IMPORT_C void DisplayProgressNoteL( const TDesC& aText, TInt aFinalValue );
       
   173 
       
   174         /**
       
   175          * Updates the progress bar in progress note. Progress bar shows 0% when
       
   176          * aNewValue is zero (or less than zero), and full 100% when aNewValue is
       
   177          * equal (or more than) the final value set with SetProgressNoteFinalValueL().
       
   178          * @param aNewValue - new value for the progress bar
       
   179          */
       
   180         IMPORT_C void UpdateProgressNoteValueL( TInt aNewValue );
       
   181 
       
   182         /**
       
   183          * Closes the progress note. TRequestStatus set in DisplayProgressNoteL() is
       
   184          * completed with KErrNone. Note that it is completed with KErrCancel if user
       
   185          * cancels the note, or with error code if some error happens.
       
   186          */
       
   187         IMPORT_C void CloseProgressNoteL();
       
   188 
       
   189         /**
       
   190          * Displays wait note. If the wait note is already displayed, then only the note
       
   191          * text is updated. Wait note is like progress note, except that it is not known
       
   192          * how long the operation takes. User can cancel the operation as in progress note.
       
   193          * @param aText - text to be displayed
       
   194          * @param aStatus - request status that indicates if user cancels the note
       
   195          */
       
   196         IMPORT_C void DisplayWaitNoteL( const TDesC& aText, TRequestStatus& aStatus );
       
   197 
       
   198         /**
       
   199          * Closes the wait note.
       
   200          */
       
   201         IMPORT_C void CloseWaitNote();
       
   202 
       
   203         /**
       
   204          * Launches help with the help context aContext for application aUid.
       
   205          * @param aContext - help context to be displayed
       
   206          * @param aUid - application which help needs to be launched
       
   207          */
       
   208         IMPORT_C void LaunchHelpL( const TDesC& aContext, const TUid& aUid );
       
   209 
       
   210         /**
       
   211          * Launches SW Install application (UID 0x101F8512) help using the
       
   212          * help context aContext.
       
   213          * @param aContext - help context to be displayed
       
   214          */
       
   215         IMPORT_C void LaunchHelpL( const TDesC& aContext );
       
   216 
       
   217     protected:  // from CActive
       
   218         void DoCancel();
       
   219         void RunL();
       
   220 
       
   221     private:    // from MHbDeviceDialogObserver
       
   222         void DataReceived( CHbSymbianVariantMap& aData );
       
   223         void DeviceDialogClosed( TInt aCompletionCode );
       
   224 
       
   225     private:    // new functions
       
   226         CSecQueryUi();
       
   227         void ConstructL();
       
   228         void ClearParamsL();
       
   229         void ClearParamsAndSetNoteTypeL( TInt aType );
       
   230         void AddParamL( const TDesC& aKey, TInt aValue );
       
   231         void AddParamL( const TDesC& aKey, const TDesC& aValue );
       
   232         void DisplayDeviceDialogL();
       
   233         TInt WaitUntilDeviceDialogClosed();
       
   234 
       
   235     private:    // data
       
   236         CHbDeviceDialogSymbian* iDeviceDialog;
       
   237         CHbSymbianVariantMap* iVariantMap;
       
   238         CActiveSchedulerWait* iWait;
       
   239         TBool iIsDisplayingDialog;
       
   240         TInt iCompletionCode;
       
   241         TInt iReturnValue;
       
   242 public:
       
   243 	   // previoulsy it was RMobilePhone::TMobilePassword iPassword; but this was only 10 bytes
       
   244         TSecUiPassword iPassword;
       
   245     };
       
   246 
       
   247 
       
   248 #endif  // C_SECQUERYUI_H
       
   249