accesssec_plat/wapi_security_settings_ui_api/inc/wapisecuritysettingsui.h
changeset 0 c8830336c852
child 2 1c7bc153c08e
equal deleted inserted replaced
-1:000000000000 0:c8830336c852
       
     1 /*
       
     2 * Copyright (c) 2001-2009 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 the License "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: Declares the main handler CWAPISecuritySettings, UI CWAPISecuritySettingsUI and public API for the WAPI Security Settings. 
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef WAPISECURITYSETTINGSUI_H
       
    19 #define WAPISECURITYSETTINGSUI_H
       
    20 
       
    21 // INCLUDES
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <WapiCertificates.h>
       
    25 
       
    26 #include <metadatabase.h>
       
    27 #include <commsdattypesv1_1.h>
       
    28 
       
    29 using namespace CommsDat;
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CEikonEnv;
       
    33 class CWAPISecuritySettingsUi;
       
    34 class CWAPISecuritySettingsUiImpl;
       
    35 class CWAPISecuritySettingsImpl;
       
    36 class CCommsDatabase;
       
    37 
       
    38 // CLASS DECLARATION
       
    39 /*
       
    40 * WAPI Security Settings. Enables loading, saving and editing the settings
       
    41 * (editing via CWAPISecuritySettingsUi).
       
    42 * Proxy around the real implementation in CWAPISecuritySettingsUiImpl. 
       
    43 */
       
    44 NONSHARABLE_CLASS( CWAPISecuritySettings ) : public CBase
       
    45     {
       
    46 
       
    47     public: // Constructors and destructor
       
    48 
       
    49         /**
       
    50         * Two-phased constructor. Leaves on failure.
       
    51         * @return The constructed CWAPISecuritySettings object.
       
    52         */
       
    53         IMPORT_C static CWAPISecuritySettings* NewL();
       
    54 
       
    55 
       
    56         /**
       
    57         * Destructor.
       
    58         */
       
    59         IMPORT_C ~CWAPISecuritySettings();
       
    60 
       
    61 
       
    62     public:     // Types
       
    63 
       
    64         enum TEvent                     // Events happening during edit.
       
    65             {
       
    66             ENone           = 0x0000,   // Nothing happened.
       
    67             EModified       = 0x0001,   // Data changed.
       
    68             EValid          = 0x0010,   // All data entered are valid, they can be
       
    69                                         // saved
       
    70             
       
    71             EExitReq        = 0x0020,   // Exit option requested, also caller 
       
    72                                         // app should close
       
    73             EShutDownReq    = 0x0040    // ShutDown was requested
       
    74             };
       
    75         
       
    76         enum TWapiKeyFormat
       
    77             {
       
    78             EWapiKeyAscii   = 0,
       
    79             EWapiKeyHex     = 1
       
    80             };
       
    81         
       
    82     public:     // New methods
       
    83 
       
    84         
       
    85         /**
       
    86         * Edit WAPI certificate settings.
       
    87         * @param aUi UI to be used.
       
    88         * @param aTitle Title Pane text to display during edit.
       
    89         * @return Exit reason.
       
    90         */
       
    91         IMPORT_C TInt EditL( CWAPISecuritySettingsUi& aUi, 
       
    92                              const TDesC& aTitle );
       
    93 
       
    94         
       
    95         /**
       
    96         * Load WAPI certificate settings and configuration from database.
       
    97         * @param aIapRecordID 
       
    98         * @param aSession Commsdat session
       
    99         */
       
   100         IMPORT_C void LoadL( TUint32 aIapRecordId, CMDBSession& aSession );
       
   101 
       
   102         /**
       
   103         * Tells if the settings are valid and can be saved
       
   104         * @return ETrue if all the compulsory settings have been entered
       
   105         */
       
   106         IMPORT_C TBool IsValid() const;
       
   107 
       
   108         /**
       
   109         * Save WAPI certificate settings of the IAP to the database.
       
   110         * @param aIapRecordID 
       
   111         * @param aSession Commsdat session
       
   112         */
       
   113         IMPORT_C void SaveL( TUint32 aIapRecordId, CMDBSession& aSession ) const;
       
   114 
       
   115         /**
       
   116         * Sets the Pre-shared key. Also sets Authentication method to PSK.
       
   117         * @param aKeyFormat     Key format
       
   118         * @param aPreSharedKey  The key to be set
       
   119         */
       
   120         IMPORT_C void SetPreSharedKeyL( const TWapiKeyFormat aKeyFormat, const TDesC& aPreSharedKey );
       
   121                 
       
   122         /**
       
   123         * Delete AP related data from certificate database tables
       
   124         *
       
   125         * @param aId        Service table id
       
   126         */
       
   127         IMPORT_C void DeleteAPSpecificDataL( const TInt aId );
       
   128     
       
   129     private:    // Data 
       
   130 
       
   131         // Implementation. Owned.
       
   132         CWAPISecuritySettingsImpl* iImpl;  
       
   133 
       
   134     };
       
   135 
       
   136 /**
       
   137 * User interface to edit WAPI Security Settings.
       
   138 * Proxy around the real implementation in CWAPISecuritySettingsUiImpl.
       
   139 */
       
   140 NONSHARABLE_CLASS( CWAPISecuritySettingsUi ) : public CBase
       
   141     {
       
   142 
       
   143     public:     // Constructors and destructor
       
   144 
       
   145         /**
       
   146         * Two-phased constructor. Leaves on failure.
       
   147         * @param aEikEnv Eikon environment.
       
   148         * @return The constructed CWAPISecuritySettingsUi object.
       
   149         */
       
   150         IMPORT_C static CWAPISecuritySettingsUi* NewL( CEikonEnv& aEikEnv );
       
   151 
       
   152         /**
       
   153         * Destructor.
       
   154         */
       
   155         IMPORT_C virtual ~CWAPISecuritySettingsUi();
       
   156 
       
   157     private:    // Friends
       
   158 
       
   159         friend class CWAPISecuritySettings;
       
   160 
       
   161     private:    // Data 
       
   162 
       
   163         // Implementation. Owned.
       
   164         CWAPISecuritySettingsUiImpl* iImpl;
       
   165 
       
   166     };
       
   167 #endif
       
   168 
       
   169 
       
   170 // End of File