gssettingsuis/Gs/GSNetworkPlugin/Inc/GSNetworkPlugin.h
branchRCL_3
changeset 24 8ee96d21d9bf
parent 23 8bda91a87a00
child 25 7e0eff37aedb
equal deleted inserted replaced
23:8bda91a87a00 24:8ee96d21d9bf
     1 /*
       
     2 * Copyright (c) 2006-2007 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:  View for Network settings.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef GSNETWORKPLUGIN_H
       
    20 #define GSNETWORKPLUGIN_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <aknsettingpage.h>
       
    24 #include <ConeResLoader.h>
       
    25 #include <gsplugininterface.h>
       
    26 #include <gsfwviewuids.h>
       
    27 #include <gsbaseview.h>
       
    28 #include <MSSSettingsRefreshObserver.h>
       
    29 #include <MPsetNetworkInfoObs.h>//for base class
       
    30 #include <etelmm.h>
       
    31 #include <msatrefreshobserver.h>
       
    32 //For listening BT SAP events
       
    33 #include <gspubsubslistener.h>
       
    34 #include <mgssettingpsobserver.h>
       
    35 #include <eikmenup.h>
       
    36 
       
    37 #include "GSPhoneSettingConstants.h"
       
    38 #include "GSNetworkPluginContainer.h"
       
    39 #include "GsNetworkPlugin.hrh"
       
    40 #include "MGsFWMSKLabelObserver.h"
       
    41 
       
    42 #include <etelmm.h>
       
    43 #include <e32base.h>
       
    44 
       
    45 #include <NWHandlingEngine.h>
       
    46 
       
    47 // CONSTANTS
       
    48 const TUid KGSNetworkPluginUid = { 0x102824A8 };
       
    49 // Resource file name
       
    50 _LIT( KGSNetworkPluginResourceFileName, "z:GSNetworkPluginRsc.rsc" );
       
    51 // Icon file name
       
    52 _LIT( KGSNetworkPluginIconDirAndName, "z:GSNetworkPlugin.mbm");
       
    53 
       
    54 // MACROS
       
    55 
       
    56 // DATA TYPES
       
    57 
       
    58 // FUNCTION PROTOTYPES
       
    59 
       
    60 // FORWARD CLASS DECLARATION
       
    61 class CAknViewAppUi;
       
    62 class CGSNetworkPluginContainer;
       
    63 class CPsetNetwork;
       
    64 class CAknWaitDialog;
       
    65 class CPsetContainer;
       
    66 class CAknRadioButtonSettingPage;
       
    67 class CAknPopupList;
       
    68 class MSSSettingsRefreshObserver;
       
    69 class CPSetRefreshHandler;
       
    70 
       
    71 class CNWSession;
       
    72 class TNWInfo;
       
    73 class CGSParentPlugin;
       
    74 
       
    75 // CLASS DECLARATION
       
    76 /**
       
    77 *  CGSNetworkPlugin view class
       
    78 *
       
    79 *  Plugin implementation for Network settings
       
    80 *  @lib GSNetworkPlugin.lib
       
    81 *  @since Series 60_3.1
       
    82 */
       
    83 #ifdef FF_POWER_SAVE
       
    84     class CGSNetworkPluginAO;
       
    85 #endif // FF_POWER_SAVE
       
    86 
       
    87 class CGSNetworkPlugin : public CGSBaseView,
       
    88                          public MPsetNetworkInfoObserver,
       
    89                          public MSSSettingsRefreshObserver,
       
    90                          public MGsFWMSKObserver,
       
    91                          public MGSSettingPSObserver,
       
    92                          public MNWMessageObserver
       
    93     {
       
    94     public: // Constructors and destructor
       
    95 
       
    96         /** C++ Constructor */
       
    97         CGSNetworkPlugin();
       
    98 
       
    99         /**
       
   100         * Symbian OS two-phased constructor
       
   101         * @return GS connection view.
       
   102         */
       
   103         static CGSNetworkPlugin* NewL( TAny* aInitParams );
       
   104 
       
   105         static CGSNetworkPlugin* NewLC();
       
   106 
       
   107         /**
       
   108         * Destructor.
       
   109         */
       
   110         ~CGSNetworkPlugin();
       
   111 
       
   112     public: // from base classes
       
   113 
       
   114         /**
       
   115         * Returns view id.
       
   116         * @return TUid
       
   117         */
       
   118         TUid Id() const;
       
   119 
       
   120         /**
       
   121         * Handles commands.
       
   122         * @param aCommand Command to be handled.
       
   123         *
       
   124         */
       
   125         void HandleCommandL( TInt aCommand );
       
   126 
       
   127         /**
       
   128         * From MEikCommandObserver, handles the commands.
       
   129         *
       
   130         * @param aCommand identifies the command given.
       
   131         */
       
   132         void ProcessCommandL( TInt aCommand );
       
   133 
       
   134     public: // From CGSPluginInterface
       
   135 
       
   136         /**
       
   137         * @see CGSPluginInterface header file.
       
   138         */
       
   139         void GetCaptionL( TDes& aCaption ) const;
       
   140 
       
   141         /**
       
   142          * @see CGSPluginInterface header file.
       
   143          */
       
   144          void GetValue( const TGSPluginValueKeys aKey,
       
   145                         TDes& aValue );
       
   146 
       
   147         /**
       
   148         * @see CGSPluginInterface header file.
       
   149         */
       
   150         TInt PluginProviderCategory() const;
       
   151 
       
   152         /**
       
   153         * See base class.
       
   154         */
       
   155         CGulIcon* CreateIconL( const TUid aIconType );
       
   156 
       
   157         /**
       
   158         * @see CGSPluginInterface header file.
       
   159         */
       
   160         TBool Visible() const;
       
   161 
       
   162     public: //new
       
   163 
       
   164         /**
       
   165         * Get CGSNetworkPlugin's ccontainer.
       
   166         */
       
   167         CGSNetworkPluginContainer* Container();
       
   168 
       
   169         /**
       
   170         * Checks if the MSK label needs to be adjusted.
       
   171         */
       
   172         void CheckMiddleSoftkeyLabelL();
       
   173 
       
   174                 /**
       
   175         * Remove command and label from MSK.
       
   176         */
       
   177         void RemoveCommandFromMSK( const TBool flag);
       
   178 
       
   179         /**
       
   180         * Adds given resource text as MSK to CBA.
       
   181         *
       
   182         * @param aResourceId middle softkey label.
       
   183         * @param aCommandId command that should be performed when MSK
       
   184         *        is pressed.
       
   185         * @since S60 v3.1
       
   186         */
       
   187         void SetMiddleSoftKeyLabelL( const TInt aResourceId,const TInt aCommandId );
       
   188 
       
   189         /**
       
   190         * Shows a requested note.
       
   191         * @param aResourceId reource ID for note text
       
   192         * @param aType type of note
       
   193         */
       
   194         void ShowNoteL( TInt aResourceId, TInt aType );
       
   195 
       
   196     public: // from base class MPsetNetworkInfoObserver
       
   197 
       
   198         /**
       
   199         * @@see MPsetNetworkInfoObserver::HandleNetworkInfoReceivedL
       
   200         */
       
   201         void HandleNetworkInfoReceivedL(
       
   202             const CNetworkInfoArray* aInfoArray, const TInt aResult );
       
   203 
       
   204         /**
       
   205         * @@see MPsetNetworkInfoObserver::HandleCurrentNetworkInfoL - not used
       
   206         */
       
   207         inline void HandleCurrentNetworkInfoL(
       
   208             const MPsetNetworkSelect::TCurrentNetworkInfo& /* aCurrentInfo */,
       
   209             const TInt /* aResult */ ) {}
       
   210 
       
   211         /**
       
   212         * DEPRECATED in MPsetNetworkInfoObserver.
       
   213         *
       
   214         * @@see MPsetNetworkInfoObserver::HandleNetworkChangedL
       
   215         */
       
   216         void HandleNetworkChangedL(
       
   217             const MPsetNetworkSelect::TNetworkInfo& aCurrentInfo,
       
   218             const MPsetNetworkSelect::TCurrentNetworkStatus aStatus,
       
   219             const TInt aResult );
       
   220 
       
   221         /**
       
   222         * @@see MPsetNetworkInfoObserver::HandleNetworkChangedL
       
   223         */
       
   224         void HandleNetworkChangedL(
       
   225             const MPsetNetworkSelect::TNetworkInfo& aCurrentInfo,
       
   226             const RMobilePhone::TMobilePhoneRegistrationStatus& aStatus,
       
   227             const TInt aResult );
       
   228 
       
   229 
       
   230         /**
       
   231         * @@see MPsetNetworkInfoObserver::HandleSearchingNetworksL
       
   232         */
       
   233         void HandleSearchingNetworksL( TServiceRequest aRequest );
       
   234 
       
   235         /**
       
   236         * @@see MPsetNetworkInfoObserver::HandleRequestingSelectedNetworkL
       
   237         */
       
   238         void HandleRequestingSelectedNetworkL( TBool aOngoing );
       
   239 
       
   240         /**
       
   241         * @@see MPsetNetworkInfoObserver::HandleCallActivatedL
       
   242         */
       
   243         void HandleCallActivatedL();
       
   244 
       
   245         /**
       
   246         * @@see MPsetNetworkInfoObserver::HandleNetworkErrorL
       
   247         */
       
   248         void HandleNetworkErrorL( const TServiceRequest aRequest,
       
   249             const TInt aError );
       
   250 
       
   251     public: //from base class MSSSettingsRefreshObserver
       
   252         /**
       
   253         * @@see MSSSettingsRefreshObserver::AllowRefresh
       
   254         */
       
   255         TBool AllowRefresh(
       
   256             const TSatRefreshType aType,
       
   257             const TSatElementaryFiles aFiles );
       
   258 
       
   259         /**
       
   260         * @@see MSSSettingsRefreshObserver::Refresh
       
   261         */
       
   262         void Refresh(
       
   263             const TSatRefreshType aType,
       
   264             const TSatElementaryFiles aFiles );
       
   265 
       
   266     public: // From MNWMessageObserver
       
   267 
       
   268         /**
       
   269         * Offers message interface to the client
       
   270         * @param aMessage
       
   271         * This methods execute time must be short,since code
       
   272         * starting to run from RunL.
       
   273         *
       
   274         * Function updates data into iNWInfo.
       
   275         */
       
   276         void HandleNetworkMessage( const TNWMessages aMessage );
       
   277 
       
   278         /**
       
   279         * Offers error message interface to the client
       
   280         * @param aOperation operation which failed
       
   281         * @param aErrorCode returned Symbian OS error code
       
   282         *
       
   283         */
       
   284         void HandleNetworkError( const TNWOperation aOperation, TInt aErrorCode );
       
   285 
       
   286         /**
       
   287         * Updates network setting page in case it is visible. This is needed in
       
   288         * case network mode is change while setting page is oppen.
       
   289         */
       
   290         void UpdateNetworkSettingPageL();
       
   291     public:
       
   292 #ifdef FF_POWER_SAVE
       
   293         /*
       
   294          * Update network plugin view when PSM mode has changed
       
   295          */
       
   296         void UpdateOnPsmChanged();
       
   297 #endif
       
   298         
       
   299     protected: // From CAknView
       
   300         void DoActivateL( const TVwsViewId& aPrevViewId,
       
   301                           TUid aCustomMessageId,
       
   302                           const TDesC8& aCustomMessage );
       
   303         void DoDeactivate();
       
   304 
       
   305     protected: // From MEikMenuObserver
       
   306 
       
   307         void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   308 
       
   309     protected:
       
   310 
       
   311         /**
       
   312         * C++ default constructor.
       
   313         */
       
   314 /*        CGSNetworkPlugin();*/
       
   315 
       
   316         /**
       
   317         * Symbian OS default constructor.
       
   318         *
       
   319         */
       
   320         void ConstructL();
       
   321 
       
   322         void HandleClientRectChange();
       
   323 
       
   324     private: // from CGSBaseView
       
   325 
       
   326         void NewContainerL();
       
   327         void HandleListBoxSelectionL();
       
   328 
       
   329     private: // From MGSSettingPSObserver
       
   330         /**
       
   331         * Callback from MGSSettingPSObserver
       
   332         */
       
   333         void HandleNotifyPSL( const TUid aUid, const TInt& aKey,
       
   334                               const TRequestStatus& aStatus );
       
   335 
       
   336     private: //new methods
       
   337 
       
   338         /**
       
   339         * Check if calls are active. Show note if Nw-menu is tried to open.
       
   340         * @param aItemId list item ID in network view
       
   341         */
       
   342         void CheckCallActiveL( TGSNetworkItemIds aItemId );
       
   343 
       
   344         /**
       
   345         * Provides the network operator list.
       
   346         */
       
   347         void NetworkListL();
       
   348 
       
   349         /**
       
   350         * Displays setting page for highlighted setting.
       
   351         *
       
   352         * @param aPage identifies the page that will be displayed.
       
   353         */
       
   354         void ShowSettingPageL( TGSNetworkItemIds aPage );
       
   355 
       
   356         /**
       
   357         * Sets title to a popup list.
       
   358         * @param aList pointer to list
       
   359         * @param aTitleID resource ID of the title
       
   360         */
       
   361         void SetTitleToPopupL( CAknPopupList& aList, TInt aTitleID );
       
   362 
       
   363         /**
       
   364         * Adds item to a list.
       
   365         * @param aList pointer to a list
       
   366         * @param aItem resource ID of the item to be added
       
   367         */
       
   368         void AppendItemL( CDesCArrayFlat& aList, TInt aItem );
       
   369 
       
   370         /**
       
   371         * Sets title to a settings page.
       
   372         * @param aDlg setting page
       
   373         * @param aTitleID resource ID of the title
       
   374         */
       
   375         void SetTitleToSettingsL( CAknRadioButtonSettingPage& aDlg,
       
   376             TInt aTitleID );
       
   377 
       
   378         /**
       
   379         * Shows a note if GPRS is active, when MCN is turned on.
       
   380         * @param aCurrentItem value of setting currently
       
   381         */
       
   382         void CheckGPRSConnectionL( TInt aCurrentItem );
       
   383 
       
   384         /**
       
   385         * Switches between shared data and setting page values (0 > 1, 1 > 0).
       
   386         * @param aValue value to switch
       
   387         */
       
   388         void SwitchOnOffValue( TInt& aValue );
       
   389 
       
   390         /**
       
   391         * Makes a Network/MCN Ss operation.
       
   392         * @param aIndex currently active list item.
       
   393         * @param aPage which setting page is open
       
   394         */
       
   395         void CreateNetworkSsCallL( TInt aIndex, TGSNetworkItemIds aPage );
       
   396 
       
   397         /**
       
   398         * Creates a waiting note (member variable).
       
   399         * @param aDelayOff is the note shown immediately or not
       
   400         */
       
   401         void CheckAndCreateDlgL( TBool aDelayOff );
       
   402 
       
   403         /**
       
   404         * Empties fetched network provider's list.
       
   405         */
       
   406         void PurgeNetworkList();
       
   407 
       
   408         /**
       
   409         * Updates listbox in container
       
   410         */
       
   411         void UpdateListBoxL( const TInt& aListItem, const TInt aValue = -1 );
       
   412 
       
   413         /**
       
   414         * Activate the Phone Idle view.
       
   415         */
       
   416         void PhoneIdle();
       
   417 
       
   418         /**
       
   419         * To verify if the phone is in the offline mode. (or mostly if mode is supported???)
       
   420         */
       
   421         TBool IsPhoneOfflineL() const;
       
   422 
       
   423         /**
       
   424         * Actually checks from telephone server cached data (iNWInfo) if phone
       
   425         * is online.
       
   426         *
       
   427         * @return ETrue if phone is online.
       
   428         */
       
   429         TBool PhoneOnline();
       
   430 
       
   431         /**
       
   432         * Updates iNetworkText from the iNWInfo values.
       
   433         */
       
   434         void UpdateNetworkTextL();
       
   435 
       
   436         /**
       
   437         * Easy access to parent plugin. Casts view from AppUI.
       
   438         */
       
   439         CGSParentPlugin* Parent();
       
   440 
       
   441         /**
       
   442         *  Convert TInt to TGSNetworkModeItems.
       
   443         *  Will panic in case TInt is of wrong value.
       
   444         */
       
   445         TGSNetworkModeItems CGSNetworkPlugin::IntToEnum( TInt aFeatureId );
       
   446 
       
   447         /**
       
   448         * Closes dialog (iSettingDlg) if it is open. 
       
   449         */
       
   450         void CloseDialog();
       
   451         
       
   452 #ifdef FF_POWER_SAVE    
       
   453         /**
       
   454          *  Displays blocking note. Used if PSM is on.
       
   455          */
       
   456         void DisplayBlockNoteL();
       
   457 #endif // FF_POWER_SAVE
       
   458         
       
   459     public: //enumerations
       
   460 
       
   461         enum TGSNetworkList
       
   462             {
       
   463             EAutomaticMode,
       
   464             EManualMode
       
   465             };
       
   466 
       
   467     protected:
       
   468 
       
   469         // for load wait dialog
       
   470         CAknWaitDialog* iWaitDialog;
       
   471 
       
   472     private:
       
   473 
       
   474         //Requesting note
       
   475         CAknWaitDialog*         iDlg;
       
   476         //PhoneSettings container
       
   477         CPsetContainer*         iSettingsContainer;
       
   478         //PhoneSettings engine object
       
   479         CPsetNetwork*           iPhoneSettingsEngine;
       
   480         //Array of networks
       
   481         CNetworkInfoArray*      iNetworkArray;
       
   482         //Network selection list
       
   483         CAknPopupList*          iNetworkPopupList;
       
   484         //Setting page
       
   485         CAknRadioButtonSettingPage* iSettingDlg;
       
   486         //Value of MCN setting item
       
   487         TInt                    iMCN;
       
   488         //Has the user selected a valid network
       
   489         TBool                   iApprovedNetwork;
       
   490         //PhoneSettings refresh handler
       
   491         CPSetRefreshHandler*    iPSRefreshHandler;
       
   492         //Previous network selection state
       
   493         TBool                   iPreviousState;
       
   494         // check if which command MSK is set during destruction
       
   495         TBool                   iMskCommandFlag;
       
   496         //PubSub object for BT SAP state
       
   497         CGSPubSubsListener*     iBtSapListener;
       
   498         TBool                   iSearchForNetworksActive;
       
   499 
       
   500         // Session to network handling engine. Owned.
       
   501         CNWSession* iNWSession;
       
   502 
       
   503         // Cached network info structure. Will be updated by iNWSession in a
       
   504         // callback.
       
   505         TNWInfo iNWInfo;
       
   506 
       
   507         // Cached network text read by GetValue(). When network handling engine
       
   508         // updates data, this buffer is re-created accordingly.
       
   509         HBufC* iNetworkText;
       
   510 #ifdef FF_POWER_SAVE
       
   511         // Active object for handling PSM realted CenRep events.
       
   512         CGSNetworkPluginAO* iPsmActive;
       
   513 #endif // FF_POWER_SAVE
       
   514 
       
   515     };
       
   516 
       
   517 #endif // GSNETWORKPLUGIN_H
       
   518 
       
   519 //End of File