wvuing/wvuiave/AppSrc/CCAUISessionManager.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2006 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:  UI Session Manager - does the UI related things like branding
       
    15 *                setting status pane icon etc during login, logout, etc.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CCAUISESSIONMANAGER_H
       
    21 #define CCAUISESSIONMANAGER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "PublicEngineDefinitions.h"
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <badesca.h>
       
    28 #include <PEngWVServices2.h>
       
    29 #include "MCAUiLoginCmdCB.h"
       
    30 #include <cimpspresenceconnectionuing.h> // for enum TIMPSLoginType
       
    31 #include <WVSettingsSharedDataNG.h> // for enum TWVSettingsChatLoginValues
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class MCASkinVariant;
       
    35 class MEikCommandObserver;
       
    36 class CCAStatusPaneHandler;
       
    37 class MCAOpBrandVariant;
       
    38 class MCAViewSwitcher;
       
    39 class CIMPSSAPSettings;
       
    40 class MProfileEngine;
       
    41 class CPEngNWSessionSlotID2;
       
    42 class MCAContactFetchObserver;
       
    43 class MCAServiceStateObserver;
       
    44 class CCAReactiveAuthorization;
       
    45 
       
    46 
       
    47 
       
    48 // CLASS DECLARATION
       
    49 
       
    50 /**
       
    51 * UI Session Manager - does the UI related things like branding
       
    52 * setting status pane icon etc during login, logout, etc.
       
    53 */
       
    54 class CCAUISessionManager : public CBase, public MCAUiLoginCmdCB
       
    55 
       
    56 
       
    57 
       
    58     {
       
    59     public: // Enums
       
    60         /**
       
    61         * Use to ask if a feature is supported or not
       
    62         * EGroup:  Group feature
       
    63         * ESearch: Search feature
       
    64         * EInvite: Invite feature
       
    65         * EBlock:  Block feature
       
    66         * EAttrList: Attribute List Function (defined in Preseence Engine)
       
    67         * ECLIMod: Support for create contact list
       
    68         * EGroupRejectList:  Support for reject user(s) from group
       
    69         */
       
    70         enum TSupportedFeature
       
    71             {
       
    72             EGroup = 1,
       
    73             ESearch,
       
    74             EInvite,
       
    75             EBlock,
       
    76             EAttrList,
       
    77             ECLIMod,
       
    78             EGroupRejectList
       
    79             };
       
    80 
       
    81     public:  // Constructors and destructor
       
    82 
       
    83         /**
       
    84         * Two-phased constructor.
       
    85         * @param aConnUI		   Connection UI..
       
    86         * @param aSkin             Handle to skin variant for Series 60 Platform skin support
       
    87         * @param aBrand            Handle to operator branding variant
       
    88         *                          (UI branding)
       
    89         * @param aCommandObserver  For relaying exit-commands
       
    90         * @param aViewSwitcher     For view switching functionality (needed
       
    91         *                          to refresh currect view after branding)
       
    92         * @param aStatusPane       For handling status-pane changes caused by
       
    93         *                          session state change
       
    94         * @param aBrandMbmFullPath Full path to branding resource
       
    95         */
       
    96         static CCAUISessionManager* NewL( CIMPSPresenceConnectionUi& aConnUI,
       
    97                                           MCASkinVariant* aSkin  = NULL,
       
    98                                           MCAOpBrandVariant* aBrand  = NULL,
       
    99                                           MEikCommandObserver* aCommandObserver = NULL,
       
   100                                           MCAViewSwitcher* aViewSwitcher  = NULL,
       
   101                                           CCAStatusPaneHandler* aStatusPane  = NULL,
       
   102                                           TDes* aBrandMbmFullPath = NULL );
       
   103 
       
   104         /**
       
   105         * Destructor.
       
   106         */
       
   107         virtual ~CCAUISessionManager();
       
   108 
       
   109     private:
       
   110 
       
   111         /**
       
   112          * C++ default constructor.
       
   113          * @param aConnUI		   Connection UI..
       
   114          * @param aSkin             Handle to skin variant for Series 60 Platform skin support
       
   115          * @param aBrand            Handle to operator branding variant
       
   116          *                          (UI branding)
       
   117          * @param aCommandObserver  For relaying exit-commands
       
   118          * @param aViewSwitcher     For view switching functionality (needed
       
   119          *                          to refresh currect view after branding)
       
   120          * @param aStatusPane       For handling status-pane changes caused by
       
   121          *                          session state change
       
   122          * @param aBrandMbmFullPath Full path to branding resource
       
   123          */
       
   124 
       
   125         CCAUISessionManager( CIMPSPresenceConnectionUi& aConnUI,
       
   126                              MCASkinVariant* aSkin,
       
   127                              MCAOpBrandVariant* aBrand,
       
   128                              MEikCommandObserver* aCommandObserver,
       
   129                              MCAViewSwitcher* aViewSwitcher,
       
   130                              CCAStatusPaneHandler* aStatusPane,
       
   131                              TDes* aBrandMbmFullPath );
       
   132 
       
   133         /**
       
   134         * By default Symbian 2nd phase constructor is private.
       
   135         */
       
   136         void ConstructL();
       
   137 
       
   138     public: // New functions
       
   139 
       
   140         /**
       
   141         * Is IM logged to network server
       
   142         * @return Is IM online
       
   143         */
       
   144         TBool IsLoggedIn() const;
       
   145 
       
   146         /**
       
   147          * Command creation n starts Command execution for Login,Logout or Exit
       
   148          * @param aLoginParams specifies if it is a login/logout or exit
       
   149          */
       
   150         TBool LoginL( MCAUiLoginCmdCB::TLoginParams aLoginParams );
       
   151         /**
       
   152         * Returns is the given feature supported by the session
       
   153         * @since 3.2
       
   154         * @param aFeature Feature
       
   155         * @return Is supported
       
   156         */
       
   157         TBool IsSupported( TSupportedFeature aFeature );
       
   158 
       
   159         /**
       
   160          * @return Current SAP data
       
   161          */
       
   162         CIMPSSAPSettings* CurrentSAPLC();
       
   163 
       
   164         /**
       
   165         * Checks if phone offline profile is phone current profile.
       
   166          * @since 3.2
       
   167         * @return ETrue if off-line profile is phone current profile
       
   168         */
       
   169         TBool IsOfflineProfileOn() const;
       
   170 
       
   171         /**
       
   172          * Displays a list query for selecting a domain ("@domain.com" etc.)
       
   173          * implemented in IMPS Connection UI because of the
       
   174          * variation.
       
   175          * @param aSelectedDomain Here is copied the domain user selected.
       
   176          * @return If user cancelled the query return 0,
       
   177          *         otherwise the dialog dismiss key code
       
   178          * @since 3.2
       
   179          */
       
   180         TInt DisplayDomainSelectionQueryL( TDes& aSelectedDomain );
       
   181 
       
   182         /**
       
   183          * Checks if background login is running.
       
   184          * @return ETrue if background login is running.
       
   185          */
       
   186         TBool IsBackgroundTaskRunning();
       
   187 
       
   188     public: //From Base Class MCAUiLoginCmdCB
       
   189 
       
   190 
       
   191 
       
   192         /**
       
   193         * Used by the login command to check if it is a login,logout or exit command
       
   194         * @param aLoginParams is set with enum value for login or logout or exit
       
   195         */
       
   196         void GetParameters( MCAUiLoginCmdCB::TLoginParams& aLoginParams );
       
   197 
       
   198         /**
       
   199         * Updates status pane icon according to session state
       
   200         * @param aLandscapeOnly If ETrue, set the icons only in landscape mode
       
   201         */
       
   202         void SetStatusPaneIconsL( TBool aLandscapeOnly = EFalse );
       
   203 
       
   204         /**
       
   205         * Changes UI brand for selected logged in server
       
   206         * @since 3.2
       
   207         * @param aRefreshView Refresh current view after changing brand.
       
   208         *                     This closes dialogs so make sure that no dialogs
       
   209         *                     are open when this is called with ETrue
       
   210         * @param aServerName  If given, then branding will be done based on
       
   211                               given server, otherwise current server will be
       
   212                               retrieved from connectionUI/SAPSettingsStore
       
   213         * return Did branding actually change anything.
       
   214         */
       
   215         TBool BrandUIL( TBool aRefreshView = ETrue,
       
   216                         const TDesC& aServerName = KNullDesC );
       
   217         /**
       
   218          * @return iCancelLogin value
       
   219          */
       
   220         TBool CancelLoginValue();
       
   221 
       
   222         /**
       
   223          * Clears Universal Indication Pane's IM-icon
       
   224          */
       
   225         void IMUIPIConForcedClear();
       
   226 
       
   227         /**
       
   228          * Closes all open dialogs on forced logout.
       
   229          */
       
   230         void ShutDialogsL();
       
   231 
       
   232         /**
       
   233          * Capture events if needed
       
   234          */
       
   235         void CaptureEventsL();
       
   236 
       
   237         /**
       
   238          * Releases events capturing
       
   239          */
       
   240         void ReleaseCapturingL();
       
   241 
       
   242         /**
       
   243          * Refresh View After Login
       
   244          */
       
   245         void RefreshViewAfterLoginL();
       
   246 
       
   247         /**
       
   248          * Shows wait dialog. Remember to call CleanupStack::Pop and DismissWaitDialogL
       
   249          * after this! Call CleanupStack::Pop first. Leaves one item in cleanup stack.
       
   250          * @param aTextResource Resource ID of text to be displayed
       
   251          * @param aShowImmediately Should the dialog be shown immediately
       
   252          */
       
   253         void ShowProcessingNoteLC();
       
   254 
       
   255         /**
       
   256          * DismissProcessingNoteL to dismiss the note
       
   257          * @param aError ,show the error if any
       
   258          */
       
   259         void DismissProcessingNoteL( TInt aError, TBool aValue );
       
   260         /**
       
   261          * Finalize construction of chat
       
   262          * @since 3.2
       
   263          */
       
   264         void FinalizeChatConstructionL();
       
   265 
       
   266         /**
       
   267         * Refreshes current view
       
   268         * @since 3.2
       
   269         * @return ETrue, if refresh view launched. EFalse if not.
       
   270         */
       
   271         TBool RefreshCurrentViewL();
       
   272 
       
   273         /**
       
   274          * Sets the ImpsServices on UISessionManager by SessionHandler Cmd
       
   275          * @param aImpsServices - the Supported IMPS services
       
   276          * @param aBrandUIFlag - if true BrandUIL fn would be called else not
       
   277          * @param aRefreshFlag - if true refreshing of the view would be done in BrandUIL() else not
       
   278          */
       
   279         void SetIMPSServices( TPEngWVCspServicesTree2 aImpsServices,
       
   280                               TBool aBrandUIFlag = EFalse, TBool aRefreshFlag = EFalse ) ;
       
   281         /**
       
   282          * Checkes whether server is defined, if the server is not defined
       
   283          * then returns false.
       
   284          */
       
   285 
       
   286         TBool IsServerDefined();
       
   287 
       
   288         /**
       
   289          * Shows Post Login Notes like welcome note etc if not always online case
       
   290          * @param aCurrentLoginIsFirst is true if the current login is first login
       
   291          * @param aManualLogin is true if login is manual else false
       
   292          */
       
   293         void ShowPostLoginNotesL ( TBool aCurrentLoginIsFirst, TBool aManualLogin ) ;
       
   294 
       
   295         /**
       
   296         * Notifes observer from SAP access events.
       
   297         * (Connection UI is logging into or logging
       
   298         * out from certain network server.)
       
   299         * @see MIMPSConnProcessUi.
       
   300         *
       
   301         * @since 3.2
       
   302         * @param aServerName The accessed server name.
       
   303         * @param aServerURL The accessed server URL.
       
   304         * @param aConnProcessUi Connection process UI.
       
   305         * If connection process is executed in environment
       
   306         * which doesn't have UI, aConnProcessUi is NULL.
       
   307         * Else aConnProcessUi is a valid pointer to
       
   308         * Connection Process UI interface.
       
   309         */
       
   310         //Callback from Command Session Handler
       
   311         void HandleSapAccessEventEventL( const TDesC& aServerName,
       
   312                                          const TDesC& aServerURL,
       
   313                                          MIMPSConnProcessUi* aConnProcessUi );
       
   314 
       
   315 
       
   316     private:
       
   317 
       
   318         /**
       
   319          * Checks if there is default server information available, and launches
       
   320          * server-query, if not.
       
   321          * @param aShowNote If ETrue, show an error note in error situations
       
   322          * @return Tells if server information is available after call
       
   323          */
       
   324         TBool CheckCurrentServerDataL( TBool aShowNote = ETrue );
       
   325 
       
   326         /**
       
   327          * Check for and show queries to change login type to always
       
   328          * online after manual login, according to variation.
       
   329          */
       
   330         void ShowAlwaysOnlineAfterFirstLoginL();
       
   331 
       
   332         /**
       
   333          * Gets the current login type
       
   334          * @return the login type
       
   335          */
       
   336         TIMPSLoginType LoginType();
       
   337 
       
   338         /**
       
   339          * Sets the current login type
       
   340          * @param aLoginType tells login type e.g. Manual etc
       
   341          */
       
   342         void SetLoginTypeL( TWVSettingsChatLoginValues aLoginType );
       
   343 
       
   344         /**
       
   345          * Asks alias and updates presence, etc.
       
   346          */
       
   347         void AskAliasL();
       
   348 
       
   349 
       
   350         /**
       
   351          * Show welcome note, if it's enabled by resource variation
       
   352          */
       
   353         void ShowWelcomeNoteL();
       
   354 
       
   355         /**
       
   356          * Show the password queries, if they are enabled by resource
       
   357          * variation.
       
   358          */
       
   359         void ShowPasswordQueriesL();
       
   360 
       
   361         /**
       
   362          * Show the application launch query, if it's enabled
       
   363          * by resource variation.
       
   364          */
       
   365         void ShowApplicationLaunchQueryL();
       
   366 
       
   367         /**
       
   368          * Set the current server as default.
       
   369          */
       
   370         void SetCurrentServerAsDefaultL();
       
   371 
       
   372         /**
       
   373          * @return ETrue if current server is default
       
   374          * @since 3.2
       
   375          */
       
   376         TBool CurrentServerIsDefaultL();
       
   377 
       
   378 
       
   379         /**
       
   380          * Shows warning (message query) note about password saving
       
   381          * if variatred so.
       
   382          * @since S60 v3.1
       
   383          */
       
   384         void ShowPasswordSavingWarningL() const;
       
   385 
       
   386     private:    // Data
       
   387 
       
   388         // Doesnt Own. Connection UI
       
   389         //Removed the ownership of iConnUI from this file and made it a reference
       
   390         //APPUI owns this connection UI instance and shares the same with this component.
       
   391         CIMPSPresenceConnectionUi& iConnUI;
       
   392 
       
   393         // Negotiated services
       
   394         TPEngWVCspServicesTree2 iImpsServices;
       
   395 
       
   396         // Command observer
       
   397         MEikCommandObserver* iCommandObserver;
       
   398 
       
   399         // Used skin
       
   400         MCASkinVariant* iSkin;
       
   401 
       
   402         // UI branding
       
   403         MCAOpBrandVariant* iBrand;
       
   404 
       
   405         // Status pane
       
   406         CCAStatusPaneHandler* iStatusPane;
       
   407 
       
   408         // Handle to mbm-file full path
       
   409         TDes* iBrandMbmFullPath;
       
   410 
       
   411         // View switching (for refreshing views)
       
   412         MCAViewSwitcher* iViewSwitcher;
       
   413 
       
   414 
       
   415         // Doesn't own. Profile API  checking if offline profile is on
       
   416         MProfileEngine* iProfileApi;
       
   417 
       
   418         // should the view be refreshed
       
   419         TBool iRefresh;
       
   420 
       
   421         // if application is already logged in and we are
       
   422         // fetching lists, this is set.
       
   423         //for later ref
       
   424         //TBool iAlreadyLoggedIn;
       
   425 
       
   426 
       
   427         // Network session slot ID
       
   428         CPEngNWSessionSlotID2* iSessionSlotID;
       
   429 
       
   430         // alias support
       
   431         // owns, the alias given by the user (although stored in Settings)
       
   432         HBufC*  iAlias;
       
   433         TPtr    iAliasDes;      // ptr to iAlias
       
   434         TBool   iSupportAlias;  // alias support enabled or not
       
   435 
       
   436 
       
   437         // cancelling the alias query
       
   438         TBool iCancelLogin;
       
   439 
       
   440 
       
   441         // current login is the first one to this server
       
   442         // (set by UpdateFirstLoginL)
       
   443         TBool iCurrentLoginIsFirst;
       
   444 
       
   445         // ETrue if user saved the user id and password
       
   446         TBool iUidAndPasswordSaved;
       
   447 
       
   448 
       
   449         //Tells if it is a login/logout or exit
       
   450         MCAUiLoginCmdCB::TLoginParams iLoginParams;
       
   451 
       
   452         // reactive authorization handler, owned
       
   453         CCAReactiveAuthorization* iReactiveAuth;
       
   454 
       
   455 
       
   456     };
       
   457 
       
   458 #endif      // CCAUISESSIONMANAGER_H
       
   459 
       
   460 // End of File
       
   461