wlansecuritysettings/wapisecuritysettingsui/inc/wapisecuritysettingsdlg.h
changeset 17 8840d3e38314
equal deleted inserted replaced
2:1c7bc153c08e 17:8840d3e38314
       
     1 /*
       
     2 * ============================================================================
       
     3 *  Name     : wapisecuritysettingsdlg.h
       
     4 *  Part of  : WAPI Security Settings UI
       
     5 *
       
     6 *  Description:
       
     7 *     Declares dialog.
       
     8 *  Version: %version:  7 %
       
     9 *
       
    10 *  Copyright (C) 2008 Nokia Corporation.
       
    11 *  This material, including documentation and any related 
       
    12 *  computer programs, is protected by copyright controlled by 
       
    13 *  Nokia Corporation. All rights are reserved. Copying, 
       
    14 *  including reproducing, storing,  adapting or translating, any 
       
    15 *  or all of this material requires the prior written consent of 
       
    16 *  Nokia Corporation. This material also contains confidential 
       
    17 *  information which may not be disclosed to others without the 
       
    18 *  prior written consent of Nokia Corporation.
       
    19 *
       
    20 * ============================================================================
       
    21 */
       
    22 
       
    23 #ifndef WAPI_SECURITY_SETTINGS_DLG_H
       
    24 #define WAPI_SECURITY_SETTINGS_DLG_H
       
    25 
       
    26 
       
    27 // INCLUDES
       
    28 #include <eiklbo.h>
       
    29 #include <AknDialog.h>
       
    30 #include <aknlists.h>
       
    31 #include <WapiCertificates.h>
       
    32 #include "wapisecuritysettingsdefs.h"
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CAknTitlePane;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 /**
       
    39 * CWAPISecuritySettingsDlg dialog class
       
    40 */
       
    41 NONSHARABLE_CLASS( CWAPISecuritySettingsDlg ) : public CAknDialog, 
       
    42                                                public MEikListBoxObserver
       
    43     {
       
    44     public: // Constructors and destructor
       
    45 
       
    46         /**
       
    47         * Create and launch dialog.
       
    48         * @param aSecuritySettings Security settings
       
    49         * @param aTitle Title of the dialog
       
    50         * @return The ID of the button that closed the dialog
       
    51         */
       
    52         TInt ConstructAndRunLD( CWAPISecuritySettingsImpl* aSecuritySettings,
       
    53                                 const TDesC& aTitle );
       
    54 
       
    55 
       
    56         /**
       
    57         * Two-phase construction.
       
    58         * @param aEventStore A reference to hold the events happened
       
    59         * @return The constructed CWAPISecuritySettingsDlg object.
       
    60         */
       
    61         static CWAPISecuritySettingsDlg* NewL( TInt& aEventStore );
       
    62 
       
    63 
       
    64         /**
       
    65         * Destructor.
       
    66         */
       
    67         ~CWAPISecuritySettingsDlg();
       
    68 
       
    69         
       
    70     public: //Types
       
    71          
       
    72         enum TWapiMember
       
    73             {
       
    74             EWapiAuth,
       
    75             EWapiUserCert,
       
    76             EWapiCACert,
       
    77             EWapiPSKFormat,
       
    78             EWapiPSK
       
    79             };   
       
    80           
       
    81     protected:
       
    82         /**
       
    83         * Constructor.
       
    84         * @param aEventStore A reference to hold the events happened
       
    85         */
       
    86 
       
    87 	    CWAPISecuritySettingsDlg( TInt& aEventStore );
       
    88 
       
    89 	    
       
    90     public: // Functions from base classes
       
    91         /**
       
    92         * Handle key events. 
       
    93         * @param aKeyEvent: key event
       
    94         * @param aType: type of event
       
    95         * @return The key response, if it was consumed or not. 
       
    96         */
       
    97 		TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
    98                                      TEventCode aType );
       
    99 
       
   100 	private:
       
   101 
       
   102         /**
       
   103         * This function is called by the dialog framework before the dialog is 
       
   104         * sized and laid out.
       
   105         */
       
   106         virtual void PreLayoutDynInitL();
       
   107 
       
   108 
       
   109         /**
       
   110         * Handles a dialog button press for the specified button 
       
   111         * @param aButtonId  The ID of the button that was activated.
       
   112         * @return   ETrue to validate and exit the dialog, 
       
   113         *           EFalse to keep the dialog active
       
   114         */
       
   115         TBool OkToExitL( TInt aButtonId );
       
   116 
       
   117 
       
   118 		/**
       
   119         * Processes user commands.
       
   120         * @param aCommandId ID of the command to respond to. 
       
   121         */
       
   122         virtual void ProcessCommandL( TInt aCommandId );
       
   123 
       
   124 
       
   125 		/**
       
   126         * Handles list box events.
       
   127         * @param aListBox   The originating list box. 
       
   128         * @param aEventType A code for the event.
       
   129         */
       
   130         void HandleListBoxEventL( CEikListBox* aListBox, 
       
   131                                   TListBoxEvent aEventType );
       
   132 
       
   133         /**
       
   134         * Get help context.
       
   135         * @param aContext Help context is returned here.
       
   136         */
       
   137         void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   138 
       
   139         
       
   140         /**
       
   141         * Initialize menu pane.
       
   142         * @param aResourceId Menu pane resource id.
       
   143         * @param CEikMenuPane Menu pane.
       
   144         */
       
   145         void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   146 
       
   147 
       
   148     protected:  // New functions
       
   149 
       
   150         /**
       
   151         * Handles listbox data change
       
   152         */
       
   153         void HandleListboxDataChangeL();
       
   154 
       
   155 
       
   156         /**
       
   157         * Fills up the listbox with data
       
   158         * @param aItemArray Array where to add the elements
       
   159         * @param arr        Array to be used as list elements
       
   160         * @param aLength    The number of elements in the above array
       
   161         * @param aRes       Array of resource IDs to be used for the 
       
   162         *                   elements of arr
       
   163         */
       
   164         void FillListWithDataL( CDesCArrayFlat& aItemArray, 
       
   165                                 const TWapiMember& arr, 
       
   166                                 TInt aLength,
       
   167                                 const TInt* aRes );
       
   168 
       
   169 
       
   170         /**
       
   171         * Updates one listbox item for the given member
       
   172         * @param aMember    Value specifying which member has to be added to 
       
   173         *                   the list
       
   174         * @param aRes       Resource ID for the 'title text' for this member
       
   175         * @param aPos       The current position of the item in the list
       
   176         */
       
   177         void UpdateListBoxItemL( TWapiMember aMember, 
       
   178                                  TInt aRes, TInt aPos );
       
   179 
       
   180 
       
   181         /**
       
   182         * Creates one 'textual' listbox item for the given member
       
   183         * @param aMember    Value specifying which member has to be added to
       
   184         *                   the list
       
   185         * @param aRes       Resource ID for the 'title text' for this member
       
   186         * @return The created listbox item text.
       
   187         */
       
   188         HBufC* CreateTextualListBoxItemL( TWapiMember aMember, 
       
   189                                           TInt aRes );
       
   190 
       
   191         HBufC* CWAPISecuritySettingsDlg::FormatCertTextualListBoxItemL( 
       
   192                                                     TWapiMember aMember, TInt aRes );
       
   193         /**
       
   194         * Changes one setting. The setting, which is
       
   195         * highlighted as current in the listbox is changed.
       
   196         */
       
   197         void ChangeSettingsL();
       
   198 
       
   199 
       
   200         /**
       
   201         * Shows a popup setting page (radio buttons) for the given member
       
   202         * @param aDataMember    The member which needs to be changed
       
   203         * @return   A boolean indicating whether the current setting
       
   204         *           has been changed or not.
       
   205         */
       
   206         TBool   ShowPopupSettingPageL( TWapiMember aDataMember );
       
   207 
       
   208         /**
       
   209         * Shows a text setting page for setting PSK key.
       
   210         * @return   A boolean indicating whether the current setting
       
   211         *           has been changed or not.
       
   212         */
       
   213         TBool ShowPopupPSKSettingPageL();
       
   214 
       
   215         /**
       
   216         * Fills up a pop-up radio button setting page with the currently
       
   217         * valid and available choices for the given member.
       
   218         * @param aData      The member whose new setting is needed
       
   219         * @param aCurrvalue The current value of the setting
       
   220         * @return   An array of choices for the given member, pushed to the 
       
   221         *           CleanupStack.
       
   222         */
       
   223         CDesCArrayFlat* FillPopupSettingPageLC( TWapiMember aData,
       
   224                                                 TInt& aCurrvalue );
       
   225 
       
   226 
       
   227         /**
       
   228         * Updates the given member's data with the new setting from the setting
       
   229         * page.
       
   230         * @param aData      The member to update
       
   231         * @param aCurrvalue The new value
       
   232         * @return An integer boolean indicating if the value is actually changed
       
   233         */
       
   234         TBool UpdateFromPopupSettingPage( TWapiMember aData, 
       
   235                                           TInt aCurrvalue );
       
   236         
       
   237     private: //data
       
   238 
       
   239         // Stores the name of the connection, to be showed as the title.
       
   240       	TBuf<KMaxTextLength> iConnectionName;
       
   241 
       
   242         // Title pane. Not owned.
       
   243         CAknTitlePane* iTitlePane;
       
   244 
       
   245         // Pointer to the old title. Owned.
       
   246         HBufC* iOldTitleText;
       
   247 
       
   248        // Owned through resources, destroyed automatically by the dialog.
       
   249         CAknSettingStyleListBox* iList;
       
   250 
       
   251         // Array of the items. Not owned.
       
   252         CDesCArrayFlat* iItemArray;
       
   253 
       
   254         // Fields of the main view. Not owned.
       
   255         TWapiMember* iFieldsMain;
       
   256 
       
   257         // Titles of the main view. Not owned.
       
   258         TInt* iTitlesMain;
       
   259 
       
   260         // Pointer to the WAPI Security Settings. Not owned.
       
   261         CWAPISecuritySettingsImpl* iSecuritySettings;
       
   262 
       
   263         // To hold the events. Not owned.
       
   264         TInt* iEventStore;
       
   265 
       
   266         //Pointers to certificate arrays. Not owned.
       
   267         RArray<TBuf<KMaxLabelLength> >* iUserCertificates; 
       
   268         RArray<TBuf<KMaxLabelLength> >* iCACertificates;
       
   269         
       
   270     };
       
   271 
       
   272 
       
   273 #endif      // WAPI_SECURITY_SETTINGS_DLG_H
       
   274 
       
   275 // End of File