apengine/apsettingshandlerui/inc/ApSettingsDlg.h
changeset 61 8b0c979bbe8c
parent 59 2709c04a4af5
child 70 ac5daea24fb0
equal deleted inserted replaced
59:2709c04a4af5 61:8b0c979bbe8c
     1 /*
       
     2 * Copyright (c) 2002 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: 
       
    15 *     Declares dialog for access point view/edit.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef APSETTINGS_DLG_H
       
    21 #define APSETTINGS_DLG_H
       
    22 
       
    23 
       
    24 
       
    25 // INCLUDES
       
    26 #include <coecntrl.h>
       
    27 #include <coeccntx.h>
       
    28 
       
    29 #include <eiklbo.h>
       
    30 #include <eikapp.h>
       
    31 #include <eikdoc.h>
       
    32 
       
    33 #include <AknDialog.h>
       
    34 #include <ApSettingsHandlerCommons.h>
       
    35 #include <ActiveApDb.h>
       
    36 #include <ApAccessPointItem.h>
       
    37 #include <ApEngineConsts.h>
       
    38 
       
    39 
       
    40 // CONSTANTS
       
    41 const TInt KBearers     = 4;
       
    42 
       
    43 
       
    44 // FORWARD DECLARATIONS
       
    45 class CTextOverrides;
       
    46 class CEikStatusPane;
       
    47 class CAknTitlePane;
       
    48 class CAknNavigationControlContainer;
       
    49 class CAknNavigationDecorator;
       
    50 class CApSettingsModel;
       
    51 class CApSettingsHandlerImpl;
       
    52 class CFeatureManagerWrapper;
       
    53 
       
    54 
       
    55 // CLASS DECLARATION
       
    56 /**
       
    57 * CApSettingsDlg dialog class
       
    58 *
       
    59 */
       
    60 
       
    61 const TInt KEndOfArray = -1;
       
    62 
       
    63 const TInt KCsdAnalogue[]       = { KSpeedAutobaud, KSpeed9600, KSpeed14400, 
       
    64                                     KEndOfArray };
       
    65 
       
    66 const TInt KCsdAnalogueWcdma[]  = { KSpeedAutobaud, KSpeed9600, KSpeed14400,
       
    67                                     KSpeed28800, KEndOfArray };
       
    68 
       
    69 const TInt KCsdIsdn110[]        = { KSpeed9600, KSpeed14400, KEndOfArray };
       
    70 
       
    71 const TInt KCsdIsdn110Wcdma[]   = { KSpeed9600, KSpeed14400, KSpeed28800, 
       
    72                                     KSpeed38400, KEndOfArray };
       
    73 
       
    74 const TInt KCsdIsdn120[]        = { KSpeed9600, KSpeed14400, KEndOfArray };
       
    75 
       
    76 const TInt KCsdIsdn120Wcdma[]   = { KSpeed9600, KSpeed14400, KSpeed28800, 
       
    77                                     KSpeed56000, KEndOfArray };
       
    78 
       
    79 const TInt KHcsdAnalogue[]      = { KSpeedAutobaud, KSpeed9600, KSpeed14400,
       
    80                                     KSpeed19200, KSpeed28800, KEndOfArray };
       
    81 
       
    82 const TInt KHcsdIsdn110[]       = { KSpeed9600, KSpeed14400, KSpeed19200, 
       
    83                                     KSpeed28800, KSpeed38400, KEndOfArray };
       
    84 
       
    85 const TInt KHcsdIsdn120[]       = { KSpeed9600, KSpeed14400, KSpeed19200,
       
    86                                     KSpeed28800, KSpeed43200, KEndOfArray };
       
    87 
       
    88 //Resources
       
    89 const TInt KResCsdAnalogue[]        = { R_APUI_VIEW_SPEED_AUTODETECT,
       
    90                                         R_APUI_VIEW_SPEED_9600, 
       
    91                                         R_APUI_VIEW_SPEED_14400, KEndOfArray };
       
    92 
       
    93 const TInt KResCsdAnalogueWcdma[]   = { R_APUI_VIEW_SPEED_AUTODETECT, 
       
    94                                         R_APUI_VIEW_SPEED_9600, 
       
    95                                         R_APUI_VIEW_SPEED_14400,
       
    96                                         R_APUI_VIEW_SPEED_28800, KEndOfArray };
       
    97 
       
    98 const TInt KResCsdIsdn110[]         = { R_APUI_VIEW_SPEED_9600,
       
    99                                         R_APUI_VIEW_SPEED_14400, KEndOfArray };
       
   100 
       
   101 const TInt KResCsdIsdn110Wcdma[]    = { R_APUI_VIEW_SPEED_9600,
       
   102                                         R_APUI_VIEW_SPEED_14400,
       
   103                                         R_APUI_VIEW_SPEED_28800,
       
   104                                         R_APUI_VIEW_SPEED_38400, KEndOfArray };
       
   105 
       
   106 const TInt KResCsdIsdn120[]         = { R_APUI_VIEW_SPEED_9600, 
       
   107                                         R_APUI_VIEW_SPEED_14400, KEndOfArray };
       
   108 
       
   109 const TInt KResCsdIsdn120Wcdma[]    = { R_APUI_VIEW_SPEED_9600, 
       
   110                                         R_APUI_VIEW_SPEED_14400,
       
   111                                         R_APUI_VIEW_SPEED_28800, 
       
   112                                         R_APUI_VIEW_SPEED_56000, KEndOfArray };
       
   113 
       
   114 const TInt KResHcsdAnalogue[]       = { R_APUI_VIEW_SPEED_AUTODETECT, 
       
   115                                         R_APUI_VIEW_SPEED_9600, 
       
   116                                         R_APUI_VIEW_SPEED_14400,
       
   117                                         R_APUI_VIEW_SPEED_19200,
       
   118                                         R_APUI_VIEW_SPEED_28800, KEndOfArray };
       
   119 
       
   120 const TInt KResHcsdIsdn110[]        = { R_APUI_VIEW_SPEED_9600, 
       
   121                                         R_APUI_VIEW_SPEED_14400, 
       
   122                                         R_APUI_VIEW_SPEED_19200, 
       
   123                                         R_APUI_VIEW_SPEED_28800, 
       
   124                                         R_APUI_VIEW_SPEED_38400, KEndOfArray };
       
   125 
       
   126 const TInt KResHcsdIsdn120[]        = { R_APUI_VIEW_SPEED_9600, 
       
   127                                         R_APUI_VIEW_SPEED_14400, 
       
   128                                         R_APUI_VIEW_SPEED_19200,
       
   129                                         R_APUI_VIEW_SPEED_28800,
       
   130                                         R_APUI_VIEW_SPEED_43200, KEndOfArray };
       
   131 
       
   132 NONSHARABLE_CLASS( CApSettingsDlg ) : public CAknDialog, 
       
   133                                       public MEikListBoxObserver, 
       
   134                                       public MActiveApDbObserver
       
   135     {
       
   136 
       
   137     public: // Constructors and destructor
       
   138 
       
   139         enum TSaveAction
       
   140             {
       
   141             EApCanSave,
       
   142             EApMustDelete,
       
   143             EApShallGoBack,
       
   144             EApNoAction
       
   145             };
       
   146 
       
   147         /**
       
   148         * Create and launch dialog.
       
   149         * @param aModel     Model to be used for handling access point data. 
       
   150         *                   Not owned. Must remain intact while the dialog
       
   151         *                   exists.
       
   152         * @param aHandler   The data handling object
       
   153         * @param aUid       The Wap Access Point ID of the access point 
       
   154         *                   to view/edit.
       
   155         * @param aItem      An optional CApAccessPointItem to edit
       
   156         * @return           The code returned by the dialogs' ExecuteLD
       
   157         */
       
   158         TInt ConstructAndRunLD( CApSettingsModel& aModel,
       
   159                                 CApSettingsHandlerImpl& aHandler,
       
   160                                 TUint32& aUid,
       
   161                                 CApAccessPointItem* aItem = NULL );
       
   162 
       
   163 
       
   164 
       
   165         /**
       
   166         * Two-phase construction.
       
   167         * @param aIspFilter         The Isp filter to be used
       
   168         * @param aBearerFilter      The bearer filter to be used
       
   169         * @param aSortType          The sorting to be used
       
   170         * @param aEventStore        A reference to hold the events happened
       
   171         *                           while running this setting dialog.        
       
   172         * @param aNeedIpv6Support Specifies whether the caller would like to 
       
   173         *   have IPv6 support or not. If it is ETrue, in case of IPv6 support
       
   174         *   is available as a feature, it will be supported. If IPv6 feature 
       
   175         *   is not supported by the phone, it simply defaults to the normal 
       
   176         *   IPv4 version.
       
   177         *   If it is False, it uses the default IPv4 version independently 
       
   178         *   from IPv6 feature beeing available or not.
       
   179         */
       
   180         static CApSettingsDlg* NewL( TInt aIspFilter,
       
   181                                      TInt aBearerFilter,
       
   182                                      TInt aSortType,
       
   183                                      TUint32& aEventStore,
       
   184                                      TInt aNeedIpv6Support = EFalse
       
   185                                      );
       
   186 
       
   187 
       
   188         /**
       
   189         * Destructor.
       
   190         */
       
   191         ~CApSettingsDlg();
       
   192 
       
   193 
       
   194         // From CCoeControl
       
   195         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   196                                      TEventCode aType ) ;
       
   197 
       
   198     protected:
       
   199         /**
       
   200         * Constructor.
       
   201         * @param aIspFilter         The Isp filter to be used
       
   202         * @param aBearerFilter      The bearer filter to be used
       
   203         * @param aSortType          The sorting to be used
       
   204         * @param aEventStore        A reference to hold the events happened
       
   205         *                           while running this setting dialog.        
       
   206         * @param aNeedIpv6Support Specifies whether the caller would like to 
       
   207         *   have IPv6 support or not. If it is ETrue, in case of IPv6 support
       
   208         *   is available as a feature, it will be supported. If IPv6 feature 
       
   209         *   is not supported by the phone, it simply defaults to the normal 
       
   210         *   IPv4 version.
       
   211         *   If it is False, it uses the default IPv4 version independently 
       
   212         *   from IPv6 feature beeing available or not.
       
   213         */
       
   214         CApSettingsDlg(  TInt aIspFilter,
       
   215                          TInt aBearerFilter,
       
   216                          TInt aSortType,
       
   217                          TUint32& aEventStore,
       
   218                          TBool aNeedIpv6Support
       
   219                          );
       
   220 
       
   221 
       
   222 
       
   223     public: // New functions
       
   224 
       
   225         /**
       
   226         * Initialises texts.
       
   227         */
       
   228         void InitTextsL();
       
   229 
       
   230 
       
   231         /**
       
   232         * Handles listbox data change
       
   233         * @param aReRead Boolean indicating whether the data must be re-read
       
   234         * from the database or only 'value' or 'structural' changes
       
   235         */
       
   236         void HandleListboxDataChangeL( TBool aReRead );
       
   237 
       
   238 
       
   239         /**
       
   240         * Sets the text overrides
       
   241         * @param aOverrides The text overrides object to be used
       
   242         */
       
   243         void SetTextOverrides( CTextOverrides* aOverrides );
       
   244 
       
   245 
       
   246         /**
       
   247         * Handles database events, implementation of the
       
   248         * MActiveApDbObserver protocol
       
   249         * @param anEvent The event code
       
   250         */
       
   251         virtual void HandleApDbEventL( TEvent anEvent );
       
   252 
       
   253         // From CCoeControl
       
   254         virtual void GetHelpContext(TCoeHelpContext& aContext) const;
       
   255 
       
   256     private:
       
   257 
       
   258         // From CEikDialog
       
   259         virtual void PreLayoutDynInitL();
       
   260 
       
   261         // From CAknDialog
       
   262         TBool OkToExitL( TInt aButtonId );
       
   263 
       
   264         // From MEikCommandObserver
       
   265         virtual void ProcessCommandL( TInt aCommandId ) ;
       
   266 
       
   267         // From MEikMenuObserver
       
   268         virtual void DynInitMenuPaneL( TInt aResourceId, 
       
   269                                        CEikMenuPane* aMenuPane ) ;
       
   270 
       
   271         // From MEikListBoxObserver
       
   272         void HandleListBoxEventL( CEikListBox* aListBox, 
       
   273                                   TListBoxEvent aEventType );
       
   274 
       
   275     protected:  // New functions
       
   276 
       
   277         /**
       
   278         * Fills up the listbox with data
       
   279         * @param aItemArray     The itemarray to fill up
       
   280         * @param arr            A pointer to a TApMember array to be used as 
       
   281         *                       list elements
       
   282         * @param aLength        The number of elements in the above array
       
   283         * @param aRes           A pointer to an array of resource ID's to use 
       
   284         *                       for the elements of the TApMember array
       
   285         * @param aCompulsory    A pointer to an array of TInts indicating that
       
   286         *                       the elements of the TApMember array are 
       
   287         *                       compulsory or not
       
   288         */
       
   289         void    FillListWithDataL
       
   290                     (
       
   291                     CDesCArrayFlat& aItemArray,
       
   292                     const TApMember& arr,
       
   293                     TInt aLength,
       
   294                     const TInt* aRes,
       
   295                     const TInt* aCompulsory
       
   296                     );
       
   297 
       
   298 
       
   299 
       
   300         /**
       
   301         * Adds one textual listbox item for the given member
       
   302         * @param aItemArray     The itemarray to add the item        
       
   303         * @param aMember        A TApMember value specifying which member of 
       
   304         *                       the access point had to be added to the list
       
   305         * @param aRes           Resource ID for the 'title text' for this 
       
   306         *                       member
       
   307         * @param aCompulsory    a TInt indicating whether this member is 
       
   308         *                       compulsory or not
       
   309         */
       
   310         void    AddTextualListBoxItemL
       
   311                         (
       
   312                         CDesCArrayFlat& aItemArray,
       
   313                         TApMember aMember,
       
   314                         TInt aRes,
       
   315                         TInt aCompulsory
       
   316                         );
       
   317 
       
   318 
       
   319         /**
       
   320         * Adds one 'on/off' listbox item for the given member
       
   321         * @param aItemArray     The itemarray to add the item        
       
   322         * @param aMember        A TApMember value specifying which member of
       
   323         *                       the access point had to be added to the list
       
   324         * @param aRes           Resource ID for the 'title text' for this 
       
   325         *                       member
       
   326         * @param aCompulsory    TInt showing if the member is compulsory or not
       
   327         */
       
   328         void    AddOnOffListBoxItemL
       
   329                         (
       
   330                         CDesCArrayFlat& aItemArray,
       
   331                         TApMember aMember, TInt aRes,
       
   332                         TInt aCompulsory
       
   333                         );
       
   334 
       
   335 
       
   336         /**
       
   337         * Updates one 'on/off' listbox item for the given member
       
   338         * @param aMember A TApMember value specifying which member of the
       
   339         * access point had to be added to the list
       
   340         * @param aRes Resource ID for the 'title text' for this member
       
   341         * @param aPos The current position of the item in the list
       
   342         * @param aCompulsory a TInt indicating whether
       
   343         * this member is compulsory or not
       
   344         */
       
   345         void    UpdateOnOffListBoxItemL( TApMember aMember, TInt aRes,
       
   346                                          TInt aPos, TInt aCompulsory );
       
   347 
       
   348 
       
   349         /**
       
   350         * Updates one 'textual' listbox item for the given member
       
   351         * @param aMember A TApMember value specifying which member of the
       
   352         * access point had to be added to the list
       
   353         * @param aRes Resource ID for the 'title text' for this member
       
   354         * @param aPos The current position of the item in the list
       
   355         * @param aCompulsory a TInt indicating whether
       
   356         * this member is compulsory or not
       
   357         */
       
   358         void    UpdateTextualListBoxItemL( TApMember aMember, TInt aRes,
       
   359                                         TInt aPos, TInt aCompulsory );
       
   360 
       
   361 
       
   362         /**
       
   363         * Creates one 'textual' listbox item for the given member
       
   364         * @param aMember A TApMember value specifying which member of the
       
   365         * access point had to be added to the list
       
   366         * @param aRes Resource ID for the 'title text' for this member
       
   367         * @param aCompulsory a TInt indicating whether
       
   368         * this member is compulsory or not
       
   369         * @return A HBufC* pointing to the created listbox item text.
       
   370         */
       
   371         HBufC*  CreateTextualListBoxItemL( TApMember aMember, TInt aRes,
       
   372                                         TInt aCompulsory );
       
   373 
       
   374 
       
   375         /**
       
   376         * Creates one 'on/off' listbox item for the given member
       
   377         * @param aMember A TApMember value specifying which member of the
       
   378         * access point had to be added to the list
       
   379         * @param aRes Resource ID for the 'title text' for this member
       
   380         * @param aCompulsory a TInt indicating whether
       
   381         * this member is compulsory or not
       
   382         * @return A HBufC* pointing to the created listbox item text.
       
   383         */
       
   384         HBufC*  CreateOnOffListBoxItemL( TApMember aMember, TInt aRes,
       
   385                                         TInt aCompulsory );
       
   386 
       
   387 
       
   388         /**
       
   389         * Changes one setting. The setting, which is
       
   390         * highlighted as current in the listbox is changed.
       
   391         * @param aQuick a TBool indicating whether a 'quick' change is needed
       
   392         * or not. Quick changes are not bring up any setting dialog but simply
       
   393         * change the current value to the next available one.
       
   394         * This can be used only for 'on/off' type settings
       
   395         */
       
   396         void    ChangeSettingsL( TBool aQuick );
       
   397 
       
   398 
       
   399         /**
       
   400         * Sets the internal bearer type, list is re-arranged according to the
       
   401         * newly set bearer type
       
   402         * @param aBearer The new bearertype
       
   403         */
       
   404         void    SetBearerTypeL( TApBearerType aBearer );
       
   405 
       
   406 
       
   407         /**
       
   408         * Inverts one boolean member of the access point
       
   409         * @param aData the member to invert.
       
   410         * if the member does not exists,
       
   411         * or not a boolean memeber, code will _ASSERT_DEBUG
       
   412         */
       
   413         void    InvertSettingsL( TApMember aData );
       
   414 
       
   415 
       
   416         /**
       
   417         * Shows a popup setting page (radio buttons) for the given member
       
   418         * @param aDataMember The access point member which need to be changed
       
   419         * @return A boolean indicating whether the current setting
       
   420         * had been changed or not.
       
   421         */
       
   422         TBool   ShowPopupSettingPageL( TApMember aDataMember );
       
   423 
       
   424 
       
   425         /**
       
   426         * Shows a popup text setting page for the given member
       
   427         * @param aDataMember The access point member which need to be changed
       
   428         * @return A boolean indicating whether the current setting
       
   429         * had been changed or not.
       
   430         */
       
   431         TBool   ShowPopupTextSettingPageL( TApMember aData );
       
   432 
       
   433 
       
   434         /**
       
   435         * Gets the text for the passed (text-type) member.
       
   436         * @param aDataMember The access point member for which to get the text
       
   437         * @return a HBufC* to the newly allocated text.
       
   438         * Text is placed onto the CleanupStack. Ownership passed to caller.
       
   439         */
       
   440         HBufC*  GetTextLC( TApMember aData );
       
   441 
       
   442 
       
   443         /**
       
   444         * Gets the resource ID for the passed (text-type) member
       
   445         * along with the setting page flags
       
   446         * @param aDataMember    The access point member for which to get 
       
   447         *                       the resource ID
       
   448         * @param aTextSettingPageFlags A reference to hold the setting 
       
   449         *                       page flags for the given member
       
   450         */
       
   451         void    GetTextResId( TApMember aData, TInt& apage,
       
   452                               TInt& aTextSettingPageFlags );
       
   453 
       
   454 
       
   455         /**
       
   456         * Gets the resource ID for the passed (NOT text-type) member
       
   457         * @param aDataMember    The access point member for which to get 
       
   458         *                       the resource ID
       
   459         * @param aattr          A reference to hold the resource ID
       
   460         *                       for the given member
       
   461         */
       
   462         void    GetResId( TApMember aData, TInt& aattr );
       
   463 
       
   464 
       
   465         /**
       
   466         * Fills up a pop-up radio button setting page with the currently
       
   467         * valid and available choices for the given member.
       
   468         * @param aData The member whose chances are needed
       
   469         * @param aCurrvalue The current value of the setting
       
   470         * @return An array of choices for the given member,
       
   471         * pushed to the CleanupStack.
       
   472         */
       
   473         CDesCArrayFlat* FillPopupSettingPageLC( TApMember aData,
       
   474                                                 TInt& aCurrvalue );
       
   475 
       
   476 
       
   477         /**
       
   478         * Updates the given member's data with the new
       
   479         * setting from the setting page.
       
   480         * @param aData the member to update
       
   481         * @param aCurrvalue The new value
       
   482         */
       
   483         void    UpdateFromPopupSettingPageL( TApMember aData, 
       
   484                                              TInt aCurrvalue );
       
   485 
       
   486 
       
   487         /**
       
   488         * Returns whether the access point in question can be saved or not.
       
   489         * If a compulsory item is missing, user is prompted whether to delete
       
   490         * it or to go back for re-editing.
       
   491         * @param aDataNeeded If the AP can not be saved because a compulsory
       
   492         * item is missing, this holds the TApMember which is not filled.
       
   493         * It lists always the first item causing the 'failure'.
       
   494         * @return a TSaveAction indicating whether it can be saved,
       
   495         * must re-edit or must be deleted.
       
   496         */
       
   497         TSaveAction CanSaveL( TApMember& aDataNeeded );
       
   498 
       
   499 
       
   500         /**
       
   501         * Handles IP address editing of the given field
       
   502         * Brings up the IP address editor page, fills up with the current
       
   503         * value, handles editing and after editing, it stores the new value
       
   504         * in the AP item.
       
   505         * @param aData The (IP-address) member which needs to be changed
       
   506         */
       
   507         void    ShowPopupIpAddrSettingPageL( TApMember aData );
       
   508 
       
   509 
       
   510         /**
       
   511         * Handles phone number editing of the given field
       
   512         * Brings up the phone number editor page, fills up with the current
       
   513         * value, handles editing and after editing, it stores the new value
       
   514         * in the AP item.
       
   515         * In case the entered phone number is invalid, an 'invalid number'
       
   516         * note is shown and original value is kept.
       
   517         * @param aData The (phone-number) member which needs to be changed
       
   518         */
       
   519         void    ShowPopupPhoneNumSettingPageL( TApMember aData );
       
   520 
       
   521 
       
   522         /**
       
   523         * Handles password setting
       
   524         * Brings up the password editor page, handles editing
       
   525         * and after editing, it stores the new value in the AP item.
       
   526         * @param a TApMember specifying the member
       
   527         */
       
   528         void    ShowPopupPasswordPageL( TApMember aData );
       
   529 
       
   530 
       
   531         /*
       
   532         * Reads up a Boolean type data, ensures that it is in the
       
   533         * required range (0 or 1)
       
   534         * @param aData The member to get
       
   535         * @param aInvert Whether the logic is inverted or not
       
   536         * @param aCurrvalue The current value
       
   537         */
       
   538         void    GetBoolDataValue( TApMember aData, TBool aInvert,
       
   539                                   TInt& aCurrvalue );
       
   540     private:
       
   541 
       
   542         /**
       
   543         * Does the bearer change according to
       
   544         * the current value of the selection
       
   545         * @param a TInt specifying the current value
       
   546         */
       
   547         void    DoBearerChangeL( TInt aCurrvalue );
       
   548 
       
   549 
       
   550         /**
       
   551         * Handles bearer change.
       
   552         * Sets AP item bearer type, re-reads AP data, re-arranges listbox
       
   553         * according to the new bearer type
       
   554         * @param aBearer A TApBearerType specifying the current bearer.
       
   555         */
       
   556         void    HandleBearerChangeL( TApBearerType aBearer );
       
   557 
       
   558 
       
   559         /*
       
   560         * This part holds functions available only in the case of 
       
   561         * 'multiple bearer support', that means that 
       
   562         * as long as the user does not saves the AP, multiple instances of
       
   563         * the same AP are kept with different bearers...
       
   564         */
       
   565 
       
   566         /**
       
   567         * Returns the array index for a bearer type
       
   568         * @param aBearer    The bearer type to get the index of
       
   569         * @return The index
       
   570         */
       
   571         TInt32  BearerToArrayIndexL( TApBearerType aBearer );
       
   572 
       
   573         
       
   574         /**
       
   575         * Returns the bearer type for an index
       
   576         * @param aIndex The index to get the bearer type for
       
   577         * @return The bearer type
       
   578         */
       
   579         TApBearerType ArrayIndexToBearer( TInt32 aIndex );
       
   580 
       
   581 
       
   582         /**
       
   583         * Fills the passed array with the possible bearer speed values.
       
   584         * Array MUST be empty to get correct result as speed values are
       
   585         * simply APPENDED to the end of the list.
       
   586         * Adds only valid and available values according to the current
       
   587         * bearer type and call type.
       
   588         * @param aItems The array to hold the bearer speed values
       
   589         * @param aCurrvalue The index of the current speed value
       
   590         */
       
   591         void    FillUpBearerSpeedValuesL( CDesCArrayFlat& aItems,
       
   592                                           TInt& aCurrvalue );
       
   593 
       
   594 
       
   595         /**
       
   596         * Tries to save current access point data.
       
   597         * Checks if the data can be saved: each compulsory fields are filled,
       
   598         * Name is valid and does not exist already.
       
   599         * If data can not be saved, pops up query about delete? Yes/No
       
   600         * If user choses delete, AP will be deleted.
       
   601         * If user chooses NO, the 'faulty' item will be highlighted in the
       
   602         * list and it will return to the setting list, giving a chance to edit
       
   603         * the faulty/missing data.
       
   604         * @return Whether the 'Save' procedure had been successfull or not.
       
   605         * It also means that if the user had choosen 'Delete', after deleting
       
   606         * the AP it will return 'ETrue' indicating successfull operation.
       
   607         */
       
   608         TBool   SaveDataL( );
       
   609 
       
   610 
       
   611         /**
       
   612         * Handles list structure changes.
       
   613         * Refreshes the list of members needed to represent the current AP and
       
   614         * the current settings.
       
   615         */
       
   616         void    HandleListStructureChangeL();
       
   617 
       
   618 
       
   619         /**
       
   620         * This function 'limits' the connection speed after a bearertype or
       
   621         * calltype change so the current bearer speed will be always valid.
       
   622         */
       
   623         void    LimitSpeed();
       
   624 
       
   625 
       
   626         /**
       
   627         * Selects one item of the listbox.
       
   628         * @param aItemIndex The index of the item to be select.
       
   629         */
       
   630         void    SelectItem( TInt aItemIndex );
       
   631 
       
   632 
       
   633 
       
   634         /*
       
   635         * Converts EParagraphDelimiter-s to /n-s
       
   636         * Returned text is owned by the caller!
       
   637         * @param aInText The original text where replacement is needed
       
   638         * @return A new HBufC (pushed to the CleanupStack) with
       
   639         * the modified text
       
   640         */
       
   641         HBufC* ConvertDelimToPerNLC( const TDesC& aInText );
       
   642 
       
   643 
       
   644         /*
       
   645         * Converts /n-s to EParagraphDelimiter-s
       
   646         * Returned text is owned by the caller!
       
   647         * @param aInText The original text where replacement is needed
       
   648         * @return A new HBufC (pushed to the CleanupStack) with
       
   649         * the modified text
       
   650         */
       
   651         HBufC* ConvertPerNToDelimLC( const TDesC& aInText );
       
   652 
       
   653 
       
   654         /**
       
   655         * Changes one setting. The setting, which is
       
   656         * highlighted as current in the listbox is changed.
       
   657         * @param aQuick a TBool indicating whether a 'quick' change is needed
       
   658         * or not. Quick changes are not bring up any setting dialog but simply
       
   659         * change the current value to the next available one.
       
   660         * This can be used only for 'on/off' type settings
       
   661         */
       
   662         void DoChangeSettingsL( TBool aQuick );
       
   663 
       
   664 
       
   665         /**
       
   666         * Converts the selected speed index to the current speed value
       
   667         * based on the bearer type (CSD/HSCSD) and whether it is analogue,
       
   668         * ISDN v110 or ISDN v120
       
   669         * @param aCurrvalue TInt The current selection index
       
   670         * @return The TApCallSpeed value
       
   671         */
       
   672         TApCallSpeed GetBearerSpeedForSelection( TInt aCurrvalue );
       
   673 
       
   674 
       
   675         /**
       
   676         * Calculates the index for the current speed value
       
   677         * based on the bearer type (CSD/HSCSD) and whether it is analogue,
       
   678         * ISDN v110 or ISDN v120
       
   679         * @return TInt the index of the current speed in the list
       
   680         */
       
   681         TInt GetCurrIndexFromBearerSpeed( );
       
   682 
       
   683 
       
   684         /**
       
   685         * Converts whitespace characters to spaces
       
   686         * Returned text is owned by the caller!
       
   687         * @param aInText The original text where replacement is needed
       
   688         * @return A new HBufC (pushed to the CleanupStack) with
       
   689         * the modified text
       
   690         */
       
   691         HBufC* ReplaceWhiteSpaceCharactersLC(  const TDesC& aInText );
       
   692 
       
   693 
       
   694         void ChangeNetworkGroupL();
       
   695 
       
   696 
       
   697         /**
       
   698         * Gets the shareddata value whether HSCSD is enabled or not
       
   699         * @return A TInt stating if it is enabled (1) or not (0)
       
   700         */
       
   701         TInt IsHSCSDEnabledL();
       
   702 
       
   703 
       
   704         /**
       
   705         * Gets the CSD settings array according to the passed variant
       
   706         * It sets member pointers to Field, Title & Compulsory values
       
   707         * @param variant    Variant
       
   708         */
       
   709         void GetCSDSettingArrays( TInt variant );
       
   710 
       
   711 
       
   712         /**
       
   713         * Gets the GPRS settings array according to the passed variant
       
   714         * It sets member pointers to Field, Title & Compulsory values
       
   715         * @param aVariant    Variant
       
   716         */
       
   717         void GetGPRSSettingArrays( TInt aVariant );
       
   718 
       
   719         
       
   720         /**
       
   721         * Gets the WLAN settings array according to the passed variant
       
   722         * It sets member pointers to Field, Title & Compulsory values
       
   723         * @param variant    Variant
       
   724         */
       
   725         void GetWLANSettingArraysL( TInt variant );
       
   726 
       
   727 
       
   728         /**
       
   729         * Asks a query if wcdma speed had been selected.
       
   730         * only checks if a speed-related member had been changed.
       
   731         * @param aMember    The member which had been changed
       
   732         * @param aCurrValue The current value of the setting
       
   733         * @return   Whether the query had been accepted or not. 
       
   734         *           Default return value is ETrue
       
   735         */
       
   736         TBool AskQueryIfWcdmaL( TApMember aMember, TInt aCurrvalue  );
       
   737 
       
   738 
       
   739         /**
       
   740         * Displays the domain name servers data query 
       
   741         * @param AIp6 Determines whether ip4 or ip6 query is to be launched.
       
   742         * Internally takes care about whether IP6 is supported or not.
       
   743         * If IP4 is selected, it uses IP address editor.
       
   744         * If IP6 is selected, it uses standard text editor.
       
   745         * @return The result of the dialog's ExecuteLD
       
   746         */
       
   747         TInt GetNameServersL( TBool aIp6 );
       
   748 
       
   749 
       
   750         /**
       
   751         * Adds one 'Menu' listbox item (which will open another setting list)
       
   752         * for the given member.
       
   753         * @param aMember A TApMember value specifying which member of the
       
   754         * access point had to be added to the list
       
   755         * @param aRes Resource ID for the 'title text' for this member
       
   756         * @param aCompulsory a TInt indicating whether
       
   757         * this member is compulsory or not
       
   758         */
       
   759         void AddMenuListBoxItemL( 
       
   760                                 CDesCArrayFlat& aItemArray,
       
   761                                 TApMember aMember,
       
   762                                 TInt aRes,
       
   763                                 TInt aCompulsory
       
   764                                 );
       
   765 
       
   766 
       
   767         /**
       
   768         * Returns the current domain name server type
       
   769         * It can be 3: Dynamic, Well-known, User defined
       
   770         * Return values are 0, 1, 2, respectively
       
   771         */
       
   772         TInt GetDomainNameServersTypeL();
       
   773 
       
   774 
       
   775         /**
       
   776         * Pops up an IPv4 IP address multiline query
       
   777         * IP address is entered into IPv4 address editors
       
   778         * @return Returns the returned value of the multiline query
       
   779         */
       
   780         TInt GetIpv4NameServerL();
       
   781 
       
   782 
       
   783         /**
       
   784         * Pops up an IPv6 IP address multiline query
       
   785         * IP address is entered into TEXT editors
       
   786         * @return Returns the returned value of the multiline query
       
   787         */
       
   788         TInt GetIpv6NameServerL();
       
   789 
       
   790 
       
   791         /**
       
   792         * Returns the current domain name server type for IPv6 type
       
   793         * It can be 3: Dynamic, Well-known, User defined
       
   794         * Return values are 0, 1, 2, respectively
       
   795         */
       
   796         TInt GetIPv6DNSTypeL();
       
   797 
       
   798 
       
   799         /**
       
   800         * Returns the current domain name server type for IPv4 type
       
   801         * It can be 3: Dynamic, Well-known, User defined
       
   802         * Return values are 0, 1, 2, respectively
       
   803         */
       
   804         TInt GetIPv4DNSTypeL();
       
   805 
       
   806 
       
   807         /**
       
   808         * Strips non-number chars from the passed text
       
   809         * @return a HBufC8 holding the new text
       
   810         */
       
   811         HBufC* StripNonNumberLC( const TDesC16& aInText );
       
   812 
       
   813 
       
   814         /**
       
   815         * Returns the index for the given bearertype in the list of 
       
   816         * currently available bearer types.
       
   817         * Leaves with KErrNotSupported if the passed bearer type currently 
       
   818         * is not supported
       
   819         */
       
   820         TInt BearerType2BearerItemPosL( TApBearerType aBearer );
       
   821 
       
   822 
       
   823         /**
       
   824         * Returns the bearer type for the given position in the list of 
       
   825         * currently available bearer types.
       
   826         * @param The position in the list
       
   827         * @return The bearer type of the item bbeing in aPos position
       
   828         */
       
   829         TApBearerType BearerItemPos2BearerTypeL( TInt aPos );
       
   830 
       
   831 
       
   832         /**
       
   833         * Changes WLAN network name.
       
   834         */
       
   835         void ChangeWlanNetworkNameL();
       
   836 
       
   837 
       
   838         /**
       
   839         * Changes WLAN security settings.
       
   840         * @return TInt giving exit or shutdown required if any, otherwise, 0
       
   841         */
       
   842         TInt ChangeWlanSecuritySettingsL();
       
   843 
       
   844 
       
   845         /**
       
   846         * Changes WEP security settings.
       
   847         * Leaves on errors.
       
   848         * @return TInt giving exit or shutdown required if any, otherwise, 0
       
   849         */
       
   850         TInt ChangeWepSecuritySettingsL();
       
   851 
       
   852 
       
   853         /**
       
   854         * Changes WPA security settings.
       
   855         * Leaves on errors.
       
   856         * @return TInt giving exit or shutdown required if any, otherwise, 0
       
   857         */
       
   858         TInt ChangeWpaSecuritySettingsL();
       
   859 
       
   860 
       
   861         /**
       
   862         * Changes 802.1x security settings.
       
   863         * Leaves on errors.
       
   864         * @return TInt giving exit or shutdown required if any, otherwise, 0
       
   865         */
       
   866         TInt Change8021xSecuritySettingsL();
       
   867 
       
   868 
       
   869         /**
       
   870         * Returns whether WLAN is supported or not.
       
   871         * @return a boolean indicating whether WLAN is supported or not.
       
   872         */
       
   873         TBool IsWlanSupported();
       
   874 
       
   875 
       
   876         /**
       
   877         * Get the Wlan network name with a popup query
       
   878         * @return A boolean indicating whether the current setting
       
   879         * had been changed or not.
       
   880         */
       
   881         TBool QueryWlanNetworkNameL();
       
   882 
       
   883 
       
   884         /**
       
   885         * @return Whether the EApIspIPNetMask and EApIspIPGateway fields 
       
   886         * are visible in the settings or not.
       
   887         */
       
   888         TBool IsNetMaskAndGatewayVisibleL();
       
   889 
       
   890         
       
   891         /**
       
   892         * Returns the ad-hoc channel number asked from the user
       
   893         */
       
   894         TUint32 GetAdHocChannelL();
       
   895         
       
   896         
       
   897         /**
       
   898         * Returns whether the ad-hoc channel ID is visible or not
       
   899         */
       
   900         TBool IsAdhocChannelVisible();
       
   901         
       
   902         
       
   903         /**
       
   904         * Returns whether the security settings are filled correctly in case
       
   905         * of a WLAN access point or not.
       
   906         */
       
   907         TBool HasSecuritySettingsFilledL();
       
   908         
       
   909         
       
   910         /**
       
   911         * Limits the security mode when the network mode has changed.
       
   912         * In case of infrastructure, it should not be called
       
   913         * In case of Ad-hoc, it should be called and it will limit the
       
   914         * current security mode into the curren range, which is EOpen and EWep
       
   915         *
       
   916         */
       
   917         void LimitSecMode();
       
   918         
       
   919         
       
   920         /**
       
   921         * Returns whether the access point in question can be saved or not.
       
   922         * If a compulsory item is missing, user is prompted whether to quit 
       
   923         * without saving it or to go back for re-editing.
       
   924         * @param aDataNeeded If the AP can not be saved because a compulsory
       
   925         * item is missing, this holds the TApMember which is not filled.
       
   926         * It lists always the first item causing the 'failure'.
       
   927         * @return a TSaveAction indicating whether it can be saved,
       
   928         * must re-edit or must be quited(deleted).
       
   929         */
       
   930         TSaveAction CanSaveWlanCompulsoriesL( TApMember& aDataNeeded );
       
   931         
       
   932         /**
       
   933         * Restores Ipv4 settings to iApItem from iBackupApItem.
       
   934         */
       
   935         void RestoreIpv4SettingsL();
       
   936         
       
   937 protected:  // Functions from base classes
       
   938 
       
   939 
       
   940 
       
   941     private: //data
       
   942         TUint32*                        iUid;
       
   943 
       
   944         TUint32                         iLevel;         // current level
       
   945         // when leaving level 0, the two indexes are stored: top & current
       
   946         // to enable getting back to the same position & state
       
   947         TInt                            iOldIndex;    // current index
       
   948         TInt                            iOldTopIndex;   // top index
       
   949 
       
   950         TInt                            iAdvIndex;
       
   951 
       
   952         TApBearerType                   iBearerType;
       
   953         TInt                            iIspFilter;
       
   954         TInt                            iBearerFilter;
       
   955         TInt                            iSortType;
       
   956 
       
   957         CEikStatusPane*                 iStatusPane;    // NOT owned
       
   958         CAknTitlePane*                  iTitlePane;     // NOT owned
       
   959         CAknNavigationControlContainer* iNaviPane;      // NOT owned
       
   960         CAknNavigationDecorator*        iNaviDecorator; // owned
       
   961 
       
   962         HBufC*                          iOldTitleText;
       
   963 
       
   964         CApSettingsModel*               iDataModel;     // NOT owned
       
   965 
       
   966         CAknSettingStyleListBox*        iList;      // owned through resources,
       
   967                                                     // destroyed automatically 
       
   968                                                     // by the dialog
       
   969 
       
   970         CApAccessPointItem*             iApItem;        // owned
       
   971         CApAccessPointItem*             iOldApItem;     // owned
       
   972         TUint32*                        iEventStore;
       
   973 
       
   974         CArrayPtrFlat<CApAccessPointItem>*  iBearerItemArray; // owned
       
   975 
       
   976         TApMember*                      iField;
       
   977         TApMember*                      iFieldAdvanced;
       
   978         TApMember*                      iFieldL2;
       
   979         TInt                            iFieldCount;
       
   980         TInt                            iAdvancedFieldCount;
       
   981         TInt                            iFieldCountL2;
       
   982         TInt*                           iTitles;
       
   983         TInt*                           iTitlesAdvanced;
       
   984         TInt*                           iTitlesL2;
       
   985         TInt*                           iCompulsory;
       
   986         TInt*                           iCompulsoryAdvanced;
       
   987         TInt*                           iCompulsoryL2;
       
   988         TApUiExitReason                 iExitReason;
       
   989 
       
   990         CDesCArrayFlat*                 iItemArray; // not owned
       
   991 
       
   992         CTextOverrides*                 iTextOverrides;// does not owns it, 
       
   993                                                        // just passed for usage
       
   994         CApSettingsHandlerImpl*         iHandler;
       
   995 
       
   996         TInt                            iReqIpvType;    // Default is IPv4
       
   997         TBool                           iL2Ipv4;        // Default is NO 
       
   998         TInt                            iVariant;       /// Local variant value
       
   999        
       
  1000         /**
       
  1001         * CFeatureManagerWrapper wraps FeatureManager to eliminate maintenance 
       
  1002         * of existance of FeatureManager.
       
  1003         * Owned.
       
  1004         */
       
  1005         CFeatureManagerWrapper*         iFeatureManagerWrapper; 
       
  1006 
       
  1007 
       
  1008 #ifdef __TEST_OOMDEBUG
       
  1009         TBool                           iMemTestOn;
       
  1010 #endif // __TEST_OOMDEBUG
       
  1011         TInt                            iSecSettingsExitReason;
       
  1012         TApBearerType                   iOriginalBearerType;
       
  1013         
       
  1014         CApAccessPointItem*             iBackupApItem;     // owned
       
  1015         TBool							iHelpSupported;
       
  1016     };
       
  1017 
       
  1018 #endif
       
  1019 
       
  1020 // End of File