wlansecuritysettings/wpasecuritysettingsui/inc/WPASecuritySettingsDlg.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 dialog. 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef WPA_SECURITY_SETTINGS_DLG_H
       
    20 #define WPA_SECURITY_SETTINGS_DLG_H
       
    21 
       
    22 
       
    23 // ENUMERATIONS
       
    24 
       
    25 // Members to be showed in the setting pages
       
    26 enum TWpaMember
       
    27     {
       
    28     EWpaMode,           // WPA mode
       
    29     EWpaEapConfig,      // EAP Plugin configuration
       
    30     EWpaWpa2Only,       // Wpa2 only mode
       
    31     EWpaPreSharedKey    // Pre-shared key
       
    32     };
       
    33 
       
    34 
       
    35 // INCLUDES
       
    36 #include <AknDialog.h>
       
    37 #include <eiklbo.h>
       
    38 #include <aknlists.h>
       
    39 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    40 #include <commsdat.h>
       
    41 #else
       
    42 #include <commsdat.h>
       
    43 #include <commsdat_partner.h>
       
    44 #endif
       
    45 #include "WPASecuritySettingsImpl.h"
       
    46 
       
    47 // FORWARD DECLARATIONS
       
    48 class CAknTitlePane;
       
    49 class CWPASecuritySettingsImpl;
       
    50 class CEAPPluginConfigurationIf;
       
    51 
       
    52 
       
    53 // CLASS DECLARATION
       
    54 /**
       
    55 * CWPASecuritySettingsDlg dialog class
       
    56 */
       
    57 NONSHARABLE_CLASS( CWPASecuritySettingsDlg ) : public CAknDialog, 
       
    58                                                public MEikListBoxObserver
       
    59     {
       
    60 
       
    61     public: // Constructors and destructor
       
    62 
       
    63         /**
       
    64         * Create and launch dialog.
       
    65         * @param aSecuritySettings Security settings
       
    66         * @param aTitle Title of the dialog
       
    67         * @return The ID of the button that closed the dialog
       
    68         */
       
    69         TInt ConstructAndRunLD( CWPASecuritySettingsImpl* aSecuritySettings,
       
    70                                 const TDesC& aTitle );
       
    71 
       
    72 
       
    73         /**
       
    74         * Two-phase construction.
       
    75         * @param aEventStore A reference to hold the events happened
       
    76         * @param aIapId Id of the IAP.
       
    77         * @param aPlugin The EAP Configuration plugin.
       
    78         * @return The constructed CWPASecuritySettingsDlg object.
       
    79         */
       
    80         static CWPASecuritySettingsDlg* NewL( TInt& aEventStore, 
       
    81                                           const TUint32 aIapId,
       
    82                                           CEAPPluginConfigurationIf* aPlugin );
       
    83 
       
    84         /**
       
    85         * Destructor.
       
    86         */
       
    87         ~CWPASecuritySettingsDlg();
       
    88 
       
    89 
       
    90 	protected:
       
    91         /**
       
    92         * Constructor.
       
    93         * @param aEventStore A reference to hold the events happened
       
    94         * @param aIapId Id of the IAP.
       
    95         * @param aPlugin The EAP Configuration plugin.
       
    96         */
       
    97         CWPASecuritySettingsDlg( TInt& aEventStore, const TUint32 aIapId,
       
    98                                  CEAPPluginConfigurationIf* aPlugin );
       
    99 
       
   100 
       
   101     public:     // Functions from base classes
       
   102         /**
       
   103         * Handle key events. 
       
   104         * @param aKeyEvent: key event
       
   105         * @param aType: type of event
       
   106         * @return The key response, if it was consumed or not. 
       
   107         */
       
   108 		TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   109                                      TEventCode aType );
       
   110 
       
   111 	private:    // Functions from base classes
       
   112 
       
   113         /**
       
   114         * This function is called by the dialog framework before the dialog is 
       
   115         * sized and laid out.
       
   116         */
       
   117         virtual void PreLayoutDynInitL();
       
   118 
       
   119 
       
   120         /**
       
   121         * Handles a dialog button press for the specified button 
       
   122         * @param aButtonId  The ID of the button that was activated.
       
   123         * @return   ETrue to validate and exit the dialog, 
       
   124         *           EFalse to keep the dialog active
       
   125         */
       
   126         TBool OkToExitL( TInt aButtonId );
       
   127 
       
   128 
       
   129 		/**
       
   130         * Processes user commands.
       
   131         * @param aCommandId ID of the command to respond to. 
       
   132         */
       
   133 		virtual void ProcessCommandL( TInt aCommandId );
       
   134 
       
   135 
       
   136 		/**
       
   137         * Handles list box events.
       
   138         * @param aListBox   The originating list box. 
       
   139         * @param aEventType A code for the event.
       
   140         */
       
   141 		void HandleListBoxEventL( CEikListBox* aListBox, 
       
   142                                   TListBoxEvent aEventType );
       
   143 
       
   144         /**
       
   145         * Get help context.
       
   146         * @param aContext Help context is returned here.
       
   147         */
       
   148         void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   149 
       
   150         /**
       
   151         * Initialize menu pane.
       
   152         * @param aResourceId Menu pane resource id.
       
   153         * @param CEikMenuPane Menu pane.
       
   154         */
       
   155         void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   156 
       
   157 
       
   158     protected:  // New functions
       
   159 
       
   160         /**
       
   161         * Handles listbox data change
       
   162         */
       
   163         void HandleListboxDataChangeL();
       
   164 
       
   165 
       
   166         /**
       
   167         * Fills up the listbox with data
       
   168         * @param aItemArray Array where to add the elements
       
   169         * @param arr        Array to be used as list elements
       
   170         * @param aRes       Array of resource IDs to be used for the 
       
   171         *                   elements of arr
       
   172         */
       
   173         void FillListWithDataL( CDesCArrayFlat& aItemArray, 
       
   174                                 const TWpaMember& arr, const TInt* aRes );
       
   175 
       
   176 
       
   177         /**
       
   178         * Updates one 'textual' listbox item for the given member
       
   179         * @param aMember    Value specifying which member has to be added to 
       
   180         *                   the list
       
   181         * @param aRes       Resource ID for the 'title text' for this member
       
   182         * @param aPos       The current position of the item in the list
       
   183         */
       
   184         void UpdateTextualListBoxItemL( TWpaMember aMember, TInt aRes, 
       
   185                                         TInt aPos );
       
   186 
       
   187 
       
   188         /**
       
   189         * Creates one 'textual' listbox item for the given member
       
   190         * @param aMember    Value specifying which member has to be added to
       
   191         *                   the list
       
   192         * @param aRes       Resource ID for the 'title text' for this member
       
   193         * @return The created listbox item text.
       
   194         */
       
   195         HBufC* CreateTextualListBoxItemL( TWpaMember aMember, TInt aRes );
       
   196 
       
   197 
       
   198         /**
       
   199         * Changes one setting. The setting, which is
       
   200         * highlighted as current in the listbox is changed.
       
   201         * @param aQuick ETrue if the setting is "two-choices", and can be 
       
   202         *               automatically changed, without showing the list of 
       
   203         *               elements
       
   204         */
       
   205         void ChangeSettingsL( TBool aQuick );
       
   206 
       
   207 
       
   208         /**
       
   209         * Shows a popup setting page (radio buttons) for the given member
       
   210         * @param aDataMember    The member which needs to be changed
       
   211         * @return   A boolean indicating whether the current setting
       
   212         *           has been changed or not.
       
   213         */
       
   214         TBool ShowPopupSettingPageL( TWpaMember aDataMember );
       
   215 
       
   216 
       
   217         /**
       
   218         * Shows a popup text setting page for the given member
       
   219         * @return   A boolean indicating whether the current setting
       
   220         *           has been changed or not.
       
   221         */
       
   222         TBool ShowPopupTextSettingPageL();
       
   223 
       
   224 
       
   225         /**
       
   226         * Fills up a pop-up radio button setting page with the currently
       
   227         * valid and available choices for the given member.
       
   228         * @param aData      The member whose new setting is needed
       
   229         * @param aCurrvalue The current value of the setting
       
   230         * @return   An array of choices for the given member, pushed to the 
       
   231         *           CleanupStack.
       
   232         */
       
   233         CDesCArrayFlat* FillPopupSettingPageLC( TWpaMember aData,
       
   234                                                 TInt& aCurrvalue );
       
   235 
       
   236 
       
   237         /**
       
   238         * Updates the given member's data with the new setting from the setting
       
   239         * page.
       
   240         * @param aData      The member to update
       
   241         * @param aCurrvalue The new value
       
   242         * @return   A boolean indicating if the value is actually changed
       
   243         */
       
   244         TBool UpdateFromPopupSettingPage( TWpaMember aData, TBool aCurrvalue );
       
   245 
       
   246 
       
   247         /**
       
   248         * Cleanup for the iEapConfigActive semaphore flag
       
   249         * @since S60 5.0
       
   250         * @param aPtr Pointer to this class
       
   251         */
       
   252         static void ResetEapConfigFlag( TAny* aPtr );
       
   253         
       
   254         /**
       
   255         * @see CEikDialog
       
   256         */
       
   257         void HandleDialogPageEventL( TInt aEventID );
       
   258 
       
   259     private: //data
       
   260 
       
   261         // Stores the name of the connection, to be showed as the title.
       
   262       	TBuf<CommsDat::KMaxTextLength> iConnectionName;
       
   263 
       
   264         // Title pane. Not owned.
       
   265         CAknTitlePane* iTitlePane;
       
   266 
       
   267         // Pointer to the old title. Owned.
       
   268         HBufC* iOldTitleText;
       
   269 
       
   270         // Owned through resources, destroyed automatically by the dialog.
       
   271         CAknSettingStyleListBox* iList;
       
   272 
       
   273         // Array of the items. Not owned.
       
   274         CDesCArrayFlat* iItemArray;
       
   275 
       
   276         // Fields of the main view. Not owned.
       
   277         TWpaMember* iFieldsMain;
       
   278 
       
   279         // Titles of the main view. Not owned.
       
   280         TInt* iTitlesMain;
       
   281 
       
   282         // Pointer to the WPA Security Settings. Not owned.
       
   283         CWPASecuritySettingsImpl* iSecuritySettings;
       
   284 
       
   285         // To hold the events. Not owned.
       
   286         TInt* iEventStore;
       
   287         
       
   288         // The Id of the AP.
       
   289         TUint32 iIapId;
       
   290 
       
   291         // The EAP Configuration plugin. Not owned.
       
   292         CEAPPluginConfigurationIf* iPlugin;
       
   293         
       
   294         // Indicates whether the EAP plugin configuration is active
       
   295         TBool iEapConfigActive;
       
   296         
       
   297         TBuf8<KWLANEAPLISTLENGTH> iEnabledPluginList;
       
   298         TBuf8<KWLANEAPLISTLENGTH> iDisabledPluginList;
       
   299     };
       
   300 
       
   301 
       
   302 #endif      // WPA_SECURITY_SETTINGS_DLG_H
       
   303 
       
   304 // End of File