wvuing/wvuiave/AppSrc/CCAAppUi.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:  IM application AppUi class
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CCAAPPUI_H
       
    20 #define CCAAPPUI_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include "MCAViewSwitcher.h"	// MCAViewSwitcher
       
    25 #include "ChatDefinitions.h"
       
    26 #include "MCAAppUi.h"
       
    27 #include "MCAUiLoginCmdCB.h"
       
    28 #include "TEnumsPC.h"
       
    29 #include "MCAUiGlobalNotificationObserverPC.h"
       
    30 
       
    31 #include <aknviewappui.h>		// CAknViewAppUi
       
    32 #include <aknwaitdialog.h>
       
    33 #include <akntabobserver.h>
       
    34 #include <MWVSettingsCASettingsng.h>
       
    35 #include <MWVSettingsObserverng.h>
       
    36 #include "CAExternalInterface.h"
       
    37 #include <AknInfoPopupNoteController.h> // for CAKnInfoPopupNote
       
    38 #include <MIMPSSAPObserver.h>
       
    39 #include "MCABackGroundTaskObserver.h"
       
    40 #include "MCASplashScreenObserver.h"
       
    41 #include "MCASkinVariant.h"
       
    42 
       
    43 #include <cimpspresenceconnectionuing.h> // for enum TIMPSLoginType
       
    44 
       
    45 // FORWARD DECLARATIONS
       
    46 class CCAEngine;
       
    47 class CIMPSConnectionUiAgent;
       
    48 class CIMPSSAPSettingsStore;
       
    49 class CIMPSSAPSettings;
       
    50 
       
    51 class CCASplashScreen;
       
    52 class CCAStatusPaneHandler;
       
    53 class CCAAudioManager;
       
    54 class CCAInputAbsorber;
       
    55 class CIdle;
       
    56 class MCALayoutChangeObserver;
       
    57 class CCAGroupUtils;
       
    58 class CCAUISessionManager;
       
    59 class CCAIconLoader;
       
    60 class CCAMessageExtensionsHandler;
       
    61 class MCAOpBrandVariant;
       
    62 class MCAServerChangeNotify;
       
    63 class MCANotifierInterface;
       
    64 class MCALayoutInfo;
       
    65 class CCALayoutInfo;
       
    66 
       
    67 class CWVSettingsUIDialog;
       
    68 class MCAProcessManager;
       
    69 
       
    70 class TAknLayoutScalableParameterLimits;
       
    71 class TAknWindowComponentLayout;
       
    72 
       
    73 class MCAConversationMessage;
       
    74 class MCAApplicationNGPC;
       
    75 class MCAGroupManagerInterface;
       
    76 
       
    77 // CLASS DECLARATION
       
    78 
       
    79 /**
       
    80  *  Eikon application architectures AppUi class
       
    81  *
       
    82  *  @lib chatng.app
       
    83  *  @since 3.2
       
    84  */
       
    85 class CCAAppUi : public CAknViewAppUi,
       
    86             public MCAAppUi,
       
    87             public MCAViewSwitcher,
       
    88             public MProgressDialogCallback,
       
    89             public MAknTabObserver,
       
    90             public MCAUiGlobalNotificationObserverPC,
       
    91             public MWVSettingsCASettings,
       
    92             public MWVSettingsObserver,
       
    93             public MAknInfoPopupNoteObserver,
       
    94             public MIMPSSAPObserver,
       
    95             public MCABackGroundTaskObserver,
       
    96             public MCASplashScreenObserver
       
    97 
       
    98     {
       
    99     public: // Constructors and destructor
       
   100 
       
   101         /**
       
   102          * C++ default constructor.
       
   103          * @param aEngine Reference to application model (engine)
       
   104          */
       
   105         CCAAppUi( CCAEngine& aEngine, MCAProcessManager& aProcessManager );
       
   106 
       
   107         /**
       
   108          * Destructor.
       
   109          */
       
   110         virtual ~CCAAppUi();
       
   111 
       
   112     public: // New functions
       
   113     	
       
   114         class CKludgeScheduler : public CActiveScheduler
       
   115             {
       
   116             public:
       
   117                  TInt PublicLevel() const;
       
   118             };
       
   119         //Get the level of current active scheduler
       
   120         TInt LevelOfActiveScheduler();
       
   121         
       
   122         /**
       
   123         * Handle to IM Connection UI
       
   124         * @since 3.2
       
   125         * @return Handle to im connection ui
       
   126         */
       
   127         CIMPSPresenceConnectionUi& ConnectionUI();
       
   128 
       
   129         /**
       
   130         * Handle to UI session manager
       
   131         * @since 2.1
       
   132         * @return Handle to ui session manager
       
   133         */
       
   134         CCAUISessionManager& UISessionManager();
       
   135 
       
   136         /**
       
   137          * Fetches a handle to status pane handler
       
   138          * @return handle to status pane handler (CCAStatusPaneHandler*)
       
   139          */
       
   140         CCAStatusPaneHandler* CAStatusPane() const;
       
   141 
       
   142         /**
       
   143          * Fetches a handle to application's process manager
       
   144          * @see MCAProcessManager
       
   145          * @Returns a reference to process manager
       
   146          */
       
   147 
       
   148         MCAProcessManager& GetProcessManager() const;
       
   149 
       
   150         /**
       
   151          * Gets a pointer to screenname buffer containing
       
   152          * KScreenNameMaxLength of editable space
       
   153          * @return Descriptor that contains screen name
       
   154          */
       
   155         HBufC* ScreenNamePtr();
       
   156 
       
   157         /**
       
   158          * Clears Universal Indication Pane's IM-icon
       
   159          */
       
   160         void IMUIPIConForcedClear();
       
   161 
       
   162         /**
       
   163          * Sets new counter value to IM's soft notification
       
   164          * @param aCount new count of unread messages
       
   165          */
       
   166         void SetSoftNotificationCounterL( TInt aCount ) const;
       
   167 
       
   168         /**
       
   169          * Plays default beep
       
   170          */
       
   171         void PlayBeep();
       
   172 
       
   173         /**
       
   174          * Capture events if needed
       
   175          */
       
   176         void CaptureEventsL();
       
   177 
       
   178         /**
       
   179          * Releases events capturing
       
   180          */
       
   181         void ReleaseCapturingL();
       
   182 
       
   183         /**
       
   184          * Returns if events are captured
       
   185          * @return ETrue if captured
       
   186          */
       
   187         TBool AreEventsCaptured() const;
       
   188 
       
   189         /**
       
   190          * Handles the actual invitation response
       
   191          * @param aAcceptance ETrue if accepted
       
   192          * @param aUserId Descriptor that contains user id
       
   193          * @param aGroupName Descriptor that contains group name
       
   194          * @param aResponse Descriptor that contains response message
       
   195          */
       
   196         void DoHandleInvitationResponseL( TBool aAcceptance,
       
   197                                           const TDesC& aUserId,
       
   198                                           const TDesC& aGroupName,
       
   199                                           const TDesC& aResponse );
       
   200 
       
   201         /**
       
   202          * Returns the number of received messages (invitations + p2pmessages)
       
   203          * since last call to ResetMsgCount
       
   204          * @return received messages count
       
   205          */
       
   206         TInt ReceivedInvites() const;
       
   207 
       
   208         /**
       
   209          * Returns the instance of CCAGroupUtils
       
   210          * @return pointer to group utility class's instance
       
   211          */
       
   212         CCAGroupUtils* GroupUtils();
       
   213 
       
   214         /**
       
   215          * Sets the forwarded message. This method will not take the
       
   216          * ownership of the passed message, but will create a clone
       
   217          * of it. So it doesn't matter if the actual message gets deleted.
       
   218          * @param aFwdMessage forwarded message
       
   219          */
       
   220         void SetForwardMessageL( const MCAConversationMessage* aFwdMessage );
       
   221 
       
   222         /**
       
   223          * Gets the forwarded message or NULL
       
   224          * @return forwarded message
       
   225          */
       
   226         const MCAConversationMessage* ForwardMessage();
       
   227 
       
   228         /**
       
   229          * Shows wait dialog. Remember to call DismissWaitDialogL after this!
       
   230          * !! Remember to TRAP everything between ShowWaitDialogL and
       
   231          * DismissWaitDialogL and give the error code as parameter to
       
   232          * DismissWaitDialogL !!
       
   233          * @param aTextResource Resource ID of text to be displayed
       
   234          * @param aShowImmediately Should the dialog be shown immediately
       
   235          */
       
   236         void ShowWaitDialogL( TInt aTextResource, TBool aShowImmediately = EFalse );
       
   237 
       
   238         /**
       
   239          * Shows wait dialog. Remember to call CleanupStack::Pop and DismissWaitDialogL
       
   240          * after this! Call CleanupStack::Pop first. Leaves one item in cleanup stack.
       
   241          * @param aTextResource Resource ID of text to be displayed
       
   242          * @param aShowImmediately Should the dialog be shown immediately
       
   243          */
       
   244         void ShowWaitDialogLC( TInt aTextResource, TBool aShowImmediately = EFalse );
       
   245 
       
   246         /**
       
   247          * Overridden version that takes text descriptor as parameter
       
   248          * @param aText Prompt text
       
   249          * @param aShowImmediately Should the dialog be shown immediately
       
   250          */
       
   251         void ShowWaitDialogL( const TDesC& aText, TBool aShowImmediately = EFalse );
       
   252 
       
   253         /**
       
   254          * Overridden version that takes text descriptor as parameter and places one item
       
   255          * in cleanup stack. Remember to call CleanupStack::Pop and DismissWaitDialogL
       
   256          * after this! Call CleanupStack::Pop first.
       
   257          * @param aText Prompt text
       
   258          * @param aShowImmediately Should the dialog be shown immediately
       
   259          */
       
   260         void ShowWaitDialogLC( const TDesC& aText, TBool aShowImmediately = EFalse );
       
   261 
       
   262         /**
       
   263          * Dismisses the wait dialog. Shows also error note on imps errors.
       
   264          * @param aErrorCode Error code. Leaves on system error codes
       
   265          *        (greater than Imps_ERROR_BASE) after deleting the dialog.
       
   266          * @param aWaitUntilDismissed Should we wait until the dialog is gone
       
   267          * @param aAdditionalData Additional data for the dialog
       
   268          */
       
   269         void DismissWaitDialogL( TInt aErrorCode, TBool aWaitUntilDismissed = EFalse,
       
   270                                  const TDesC& aAdditionalData = KNullDesC );
       
   271 
       
   272         /**
       
   273          * Returns icon loader
       
   274          * @since 2.1
       
   275          * @return Reference to icon loader
       
   276          */
       
   277         CCAIconLoader& IconLoader() const;
       
   278 
       
   279         /**
       
   280          * Returns message handler
       
   281          * @since 2.1
       
   282          * @return Reference to message handler
       
   283          */
       
   284         CCAMessageExtensionsHandler& MessageHandler() const;
       
   285 
       
   286         /**
       
   287          * Modify ID for display. From userid, groupid "wv:" is hidden.
       
   288          * From list id "wv:userid" is hidden.
       
   289          * @param aId The id to modify
       
   290          * @param aListHiding Modify id for list hiding
       
   291          * @return The id with some parts hidden
       
   292          */
       
   293         static TPtrC DisplayId( const TDesC& aId, TBool aListHiding = EFalse );
       
   294 
       
   295         /**
       
   296          * Read the branded resources and set appropriate flags.
       
   297          * Done during construction and SAP change event.
       
   298          * Reads:
       
   299          *   - the wv: hiding setting.
       
   300          * @since 2.1
       
   301          */
       
   302         void ReadBrandedResourcesL();
       
   303 
       
   304         /**
       
   305          * Sets the refresh flag
       
   306          */
       
   307         void SetRefreshed();
       
   308 
       
   309         /**
       
   310          * @return ETrue if the "refresh list"-command has been used
       
   311          */
       
   312         TBool ListRefreshed();
       
   313 
       
   314         /**
       
   315          * Changes the resource of connection UI agent.
       
   316          * @param aNewResource the resource to be used
       
   317          */
       
   318         void ChangeConnUiAgentResourceL( const TDesC& aNewResource );
       
   319 
       
   320         /**
       
   321          * Returns view which should be called after refreshView.
       
   322          * @param aPrevious This is used normally. Override if needed.
       
   323          */
       
   324         TUid AfterRefreshViewId( const TUid& aPrevious );
       
   325 
       
   326         /**
       
   327          * Set mode of after refresh.
       
   328          * @param aMode True, use default, EFalse switch to MainView after refrehs.
       
   329          */
       
   330         void SetAfterRefreshMode( TBool aMode );
       
   331 
       
   332         /**
       
   333          * @return a MCALayoutInfo pointer
       
   334          */
       
   335         MCALayoutInfo* LayoutInfo();
       
   336 
       
   337         /**
       
   338          * To get information of refrheswaitflag.
       
   339          * @return reference to refresh wait flag.
       
   340          */
       
   341         TInt& RefreshWaitFlag();
       
   342 
       
   343 
       
   344         /**
       
   345         * Returns a flag which informs about the state of appui.
       
   346         * Either it's fully functional or being destroyed.
       
   347         * @return ETrue if appui is being destroyed
       
   348         */
       
   349         TBool IsUnderDestruction();
       
   350 
       
   351         /**
       
   352          * Initialize observers to the engine.
       
   353          * @since 3.0
       
   354          */
       
   355         void InitializeEngineObserversL();
       
   356 
       
   357         /**
       
   358          * Finalize construction of chat
       
   359          * @since 3.0
       
   360          */
       
   361         void FinalizeChatConstructionL();
       
   362 
       
   363         /**
       
   364          * Sets new message beep not to be played next time
       
   365          * when playing is requested.
       
   366          * @since 3.1
       
   367          * @param aPlayOnce ETrue if beep allready played, EFalse otherwise.
       
   368          */
       
   369         void SetPlayOnce( TBool aPlayOnce );
       
   370 
       
   371         /**
       
   372          * Launches server settings dialog
       
   373          * @since 3.1u
       
   374          */
       
   375         void LaunchServerSettingsDialogL();
       
   376 
       
   377         /**
       
   378          * Notify resource observers.
       
   379          * This should be called whenever resources are changed.
       
   380          * @since 3.0
       
   381          */
       
   382         void NotifyResourceChangeL();
       
   383 
       
   384 #ifdef RD_CHAT_GROUP_MESSAGE_INDICATION_NEW
       
   385         /**
       
   386          * Returns construction state.
       
   387          * @since S60 v3.2
       
   388          * @return ETrue if construction done, EFalse otherwise.
       
   389          */
       
   390         TBool IsFullyConstructed() const;
       
   391 #endif  // RD_CHAT_GROUP_MESSAGE_INDICATION_NEW
       
   392 
       
   393 #ifdef RD_SETTINGS_FACELIFT
       
   394         /**
       
   395          * Is settings dialog active or not.
       
   396          * @since S60 v3.2
       
   397          * @return ETrue if iServSettingsDialog != NULL
       
   398          */
       
   399         TBool IsSettingsDialogActive() const;
       
   400 #endif  // RD_SETTINGS_FACELIFT
       
   401 
       
   402         /**
       
   403          * Call this when asynchronously launched dialog has returned
       
   404          * @see ReportPendingDialog
       
   405          * @since 3.1
       
   406          */
       
   407         void ReportPendingDialogClosed();
       
   408 
       
   409         /**
       
   410          * When launching a dialog asynchronously, this method should be
       
   411          * called, so that AppUI knows to give dialog time to return.
       
   412          * If you call this, you MUST call ReportPendingDialogClosed when
       
   413          * the dialog is closed. Otherwise the AppUI hangs on exit!
       
   414          * @since 3.1
       
   415          */
       
   416         void ReportPendingDialog();
       
   417         /**
       
   418          * Sets if forward once.
       
   419          * ReSets if forward is more than once..
       
   420          */
       
   421         void SetResetForwardTo( TEnumsPC::TForwardStatus aForward );
       
   422 
       
   423         /**
       
   424          *  Return iForward.
       
   425          */
       
   426         TEnumsPC::TForwardStatus RetForwardTo( );
       
   427 
       
   428         /**
       
   429          * Unregisters the previous view registered
       
   430          * before forwarding.
       
   431          */
       
   432         void UnRegisterPreviousview();
       
   433 
       
   434 #ifdef RD_MULTIPLE_DRIVE
       
   435         /**
       
   436          * Gets the status of the drive.
       
   437          *	@since 2.1
       
   438          *  @param aDriveNumber: the drive to be checked.
       
   439          *	@return ETrue if accessable else EFalse.
       
   440          */
       
   441         TBool GetDriveStatusL( const TDriveNumber aDriveNumber );
       
   442 
       
   443 #endif
       
   444         // Get the value of iStopUpdateCba
       
   445         TBool GetStopUpdateCba();
       
   446 
       
   447         // Get the value of iIsFSWExit
       
   448         TBool  GetIsFSWExitFlag();
       
   449         // Set the value of iIsFSWExit
       
   450         void SetFSWExitFlag( TBool aValue );
       
   451 
       
   452     private: // From MWVSettingsCASettings
       
   453         /**
       
   454         * @see MWVSettingsCASettings
       
   455         */
       
   456         TInt LaunchSettingsL ( CIMPSSAPSettings& aServer );
       
   457 
       
   458     private: // From MWVSettingsObserver
       
   459 
       
   460         /**
       
   461          * @see MWVSettingsObserver
       
   462          */
       
   463         void ServerChangedL ( const TDesC& aNewServerName,
       
   464                               TBool aDefaultServerChanged  = EFalse );
       
   465 
       
   466         /**
       
   467          * @see MWVSettingsUICaller
       
   468          */
       
   469         HBufC* CurrentServerNameLC();
       
   470 
       
   471     public: // From MCAAppUi
       
   472 
       
   473         /**
       
   474          * @see MCAAppUi
       
   475          */
       
   476         TDes& MbmFullPath();
       
   477 
       
   478         /**
       
   479          * @see MCAAppUi
       
   480          */
       
   481         void AddLayoutChangeObserver( MCALayoutChangeObserver* aObserver );
       
   482 
       
   483         /**
       
   484          * @see MCAAppUi
       
   485          */
       
   486         void RemoveLayoutChangeObserver( MCALayoutChangeObserver* aObserver );
       
   487 
       
   488         /**
       
   489          * @see MCAAppUi
       
   490          */
       
   491         void AddResourceChangeObserver( MCAResourceChangeObserver* aObserver );
       
   492 
       
   493         /**
       
   494          * @see MCAAppUi
       
   495          */
       
   496         void RemoveResourceChangeObserver( MCAResourceChangeObserver* aObserver );
       
   497 
       
   498 
       
   499     private: // From MProgressDialogCallback
       
   500 
       
   501         /**
       
   502          * From MProgressDialogCallback Get's called when a dialog is dismissed
       
   503          * @param aButtonId Button that was used to dismiss the dialog
       
   504          */
       
   505         void DialogDismissedL( TInt aButtonId );
       
   506 
       
   507     private:
       
   508         //popup pane related functionss.
       
   509         void AddToPreviewListL( const TDesC& aContactId, const TDesC& aMsg );
       
   510 
       
   511         void CalculatePreviewPaneWidth();
       
   512 
       
   513         TInt SelectWindowVariety( const TInt aNumberOfLines,
       
   514                                   const TAknLayoutScalableParameterLimits& aLimits ) const;
       
   515 
       
   516         TRect RectFromLayout( const TRect& aParent,
       
   517                               const TAknWindowComponentLayout& aComponentLayout ) const;
       
   518 
       
   519 
       
   520     public: // Functions from base classes
       
   521 
       
   522         /**
       
   523          * From CEikAppUi, takes care of command handling.
       
   524          * @param aCommand command to be handled
       
   525          */
       
   526         void HandleCommandL( TInt aCommand );
       
   527 
       
   528         /**
       
   529          * From MCAViewSwitcher, handles view-switch requests
       
   530          * @param aViewId View to be switched
       
   531          */
       
   532         void SwitchViewL( TUid aViewId );
       
   533 
       
   534         /**
       
   535          * From MCAViewSwitcher, handles view-switch requests
       
   536          * @param aViewId View to be switched
       
   537          * @param aCustomMessageId Passed messages id
       
   538          * @param aCustomMessage Message to be passed
       
   539          */
       
   540         void SwitchViewL( TUid aViewId,
       
   541                           TUid aCustomMessageId,
       
   542                           const TDesC8& aCustomMessage );
       
   543 
       
   544         /**
       
   545          * From MCAViewSwitcher, handles view-switch requests
       
   546          */
       
   547         void SwitchViewBackL( TUid aViewId, TUid aCustomMessageId = KUidMainView,
       
   548                               const TDesC8& aCustomMessage = KNullDesC8 );
       
   549 
       
   550         /**
       
   551          * From MCAViewSwitcher, handles view-switch requests
       
   552          */
       
   553         void RegisterSwitchBack( TUid aViewId,
       
   554                                  TUid aCustomMessageId,
       
   555                                  HBufC8* aCustomMessage,
       
   556                                  TUid aNextView );
       
   557 
       
   558         /**
       
   559          * From MCAViewSwitcher, deregisters switch back info
       
   560          */
       
   561         void DeRegisterSwitchBack( TUid aViewId,
       
   562                                    const TDesC& aTarget );
       
   563 
       
   564         /**
       
   565          * From MCAViewSwitcher, checks if view exists
       
   566          * @see MCAViewSwitcher
       
   567          * @since 2.1
       
   568          */
       
   569         TBool ViewExists( TUid aViewId );
       
   570 
       
   571         /**
       
   572          * From MCAViewSwitcher
       
   573          * @return Active view's id
       
   574          */
       
   575         TUid ActiveViewId();
       
   576 
       
   577         /**
       
   578          * From CEikAppui, Handles a change to the application's resources
       
   579          * which are shared across the environment
       
   580          * @param aType The type of resources that have changed
       
   581          */
       
   582         void HandleResourceChangeL( TInt aType );
       
   583 
       
   584         /**
       
   585          * From CAknAppUi, Handles window server events.
       
   586          * aEvent Event to be handled
       
   587          * aDestination Destination of event.
       
   588          */
       
   589         void HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination );
       
   590 
       
   591         /**
       
   592          * Show info popup note
       
   593          */
       
   594         void ShowInfoPopupL();
       
   595 
       
   596     private:
       
   597         /**
       
   598          * Handles events reported from info popup note.
       
   599          * @see MAknInfoPopupNoteObserver
       
   600          */
       
   601         void HandleInfoPopupNoteEvent(
       
   602             CAknInfoPopupNoteController* aController,
       
   603             TAknInfoPopupNoteEvent aEvent );
       
   604 
       
   605     private: // From MAknTabObserver
       
   606 
       
   607         /**
       
   608          * @see MAknTabObserver
       
   609          */
       
   610         void TabChangedL( TInt aIndex );
       
   611 
       
   612     private: // From CAknViewAppUi
       
   613 
       
   614         /**
       
   615          * From CAknViewAppUi
       
   616          * @see CAknViewAppUi
       
   617          */
       
   618         void HandleForegroundEventL( TBool aForeground );
       
   619 
       
   620     private:  // From MCAUiGlobalNotificationObserverPC
       
   621         /**
       
   622         * @see MCAUiGlobalNotificationObserverPC
       
   623         */
       
   624         void HandleDelete( const TDesC& aContactId , TEnumsPC::TItem type ) ;
       
   625 
       
   626         /**
       
   627         * @see MCAUiGlobalNotificationObserverPC
       
   628         */
       
   629         void HandleAddition( TEnumsPC::TItem type ) ;
       
   630 
       
   631         /**
       
   632         * @see MCAUiGlobalNotificationObserverPC
       
   633         */
       
   634         void HandleChange( TEnumsPC::TItem type, TEnumsPC::TChange changeType ) ;
       
   635 
       
   636         /**
       
   637         * @see MCAUiGlobalNotificationObserverPC
       
   638         */
       
   639         void HandleInvitationEventL( TEnumsPC::TInviteType aInviteType,
       
   640                                      const TDesC& aUserID,
       
   641                                      const TDesC& aMessage ) ;
       
   642 
       
   643         /**
       
   644         * @see MCAUiGlobalNotificationObserverPC
       
   645         */
       
   646         void HandleInvitationResponse( TBool aAcceptance,
       
   647                                        const TDesC& aUserId,
       
   648                                        const TDesC& aGroupName,
       
   649                                        const TDesC& aResponse ) ;
       
   650         /**
       
   651         * Handles setting changes.
       
   652         * @see MCAUiGlobalNotificationObserverPC
       
   653         * @param aChangedSettingEnum specifies the changed setting.
       
   654         */
       
   655         void HandleSettingsChangeL( TInt aChangedSettingEnum );
       
   656 
       
   657         /**
       
   658         * From MCAUiGlobalNotificationObserverPC
       
   659         */
       
   660         void HandleChatEvent( const TEnumsPC::TChatEventType aEvent,
       
   661                               const TDesC& aWvid,
       
   662                               const TDesC& aContactId,
       
   663                               const TDesC& aMessage,
       
   664                               const TEnumsPC::TMessagerType aMsgrType,
       
   665                               const TEnumsPC::TMessageType aMsgType );
       
   666 
       
   667         /**
       
   668         * From MCAUiGlobalNotificationObserverPC
       
   669         */
       
   670         void HandleMessageError( TInt aError, const TDesC& aInfo );
       
   671 
       
   672 
       
   673 
       
   674 
       
   675     private: // New functions
       
   676 
       
   677         /**
       
   678          * Symbian OS default constructor.
       
   679          */
       
   680         void ConstructL();
       
   681 
       
   682         /**
       
   683          * Solves resource file paths.
       
   684          * @param aPathWithoutDrive, a resource file path without drive letter.
       
   685          * @return HBufC*, allocated + added on cleanup stack.
       
   686          */
       
   687         HBufC* SolveResPathLC( const TDesC& aPathWithoutDrive ) const;
       
   688 
       
   689         /**
       
   690          * Real implementation of waiting for engine to shutdown
       
   691          * @return Need for recall
       
   692          */
       
   693         TInt DoExitCallback();
       
   694 
       
   695         /**
       
   696          * CIdle-kind of function for waiting for engine to shutdown
       
   697          * @param aInstance Instance of this class
       
   698          * @return Need for recall
       
   699          */
       
   700         static TInt ExitCallback( TAny* aInstance );
       
   701 
       
   702         /**
       
   703          * This method closes wait dialog. This happens when wait dialog is running
       
   704          * and leave occurred.
       
   705          * Pushed into CleanupStack. Used with TCleanupItem.
       
   706          * This handles leaves with wait dialog by closing wait dialog if a leave occurs.
       
   707          * Wait dialog in CleanupStack, example usage:
       
   708          * ShowWaitDialogL( _L("Test"), ETrue );
       
   709          * CleanupStack::PushL( TCleanupItem( CCAAppUi::CloseDialog, this) ); // this = CCAAppUi pointer
       
   710          * User::Leave( KErrDiskFull );
       
   711          * @param aInstance Instance of this class
       
   712          */
       
   713         static void CloseDialog( TAny* aInstance );
       
   714 
       
   715         /**
       
   716         * Retrieves branding settings and changed UI brand
       
   717         * @since 2.1
       
   718         * @param aBrand Brand variant
       
   719         */
       
   720         void RetrieveBrandL( MCAOpBrandVariant& aBrand );
       
   721 
       
   722         /**
       
   723          * Initializes UIP icon handling
       
   724          * @since 2.1
       
   725          */
       
   726         void InitializeUIPHandlingL();
       
   727 
       
   728         /**
       
   729          * Update icon if it is needed. Disable it if not.
       
   730          */
       
   731         void UpdateIMUIPIcon();
       
   732 
       
   733         /**
       
   734          * Update soft note if it is needed. Disable it if not.
       
   735          *
       
   736          */
       
   737         void UpdateSoftNote( TInt aUnreadCount );
       
   738 
       
   739         /**
       
   740          * Start process for changing status
       
   741          */
       
   742         void ChangeStatusProcessL();
       
   743 
       
   744         /**
       
   745          * Changes current status message
       
   746          * @param aStatus Status which message is needed.
       
   747          * @param aUpdateToNetwork ETrue update, EFalse do not update.
       
   748          * @return KErrCancel if canceled.
       
   749          */
       
   750         TInt AskStatusMessageL( TEnumsPC::TOnlineStatus aStatus,
       
   751                                 TBool aUpdateToNetwork );
       
   752 
       
   753         /**
       
   754          * Get status old status messages from file.
       
   755          * @param aStatus Status which message is needed.
       
   756          * @param aArray. Array of messages. Don't clear before filling.
       
   757          */
       
   758         void ReadStatusMessagesL( TEnumsPC::TOnlineStatus aStatus,
       
   759                                   CDesCArray& aArray );
       
   760 
       
   761         /**
       
   762          * Write status messages to file.
       
   763          * @param aStatus Status which messages are written
       
   764          * @param aArray. Array of messages to write. Newest in top.
       
   765          *                Do not write duplicates.
       
   766          */
       
   767         void WriteStatusMessagesL( TEnumsPC::TOnlineStatus aStatus,
       
   768                                    MDesCArray& aArray );
       
   769 
       
   770         /**
       
   771          * Maps TEnumsPC::TOnlineStatus to TEnumsPC::TCASettingStrings,
       
   772          * which stores the status messages.
       
   773          * @param aStatus Online state which is mapped to correct setting
       
   774          *                string
       
   775          * @return Setting string value of the given online status.
       
   776          */
       
   777         TEnumsPC::TCASettingStrings ConvertToTEnumsStatusMsgValue(
       
   778             TEnumsPC::TOnlineStatus aStatus );
       
   779         /**
       
   780          * Shows information note about low memory situation.
       
   781          * @since S60 v3.2
       
   782          */
       
   783         void ShowMemLowNoteL();
       
   784 
       
   785         /**
       
   786          * Get default SAP Uid
       
   787          * @return SAP Uid
       
   788          */
       
   789         TUint32 DefaultSAPUid();
       
   790         /**
       
   791         * Shows Splash Screen.
       
   792         * @since S60 v3.2
       
   793         */
       
   794         void ShowSplashScreenL( MCASkinVariant& aSkinVariant );
       
   795 
       
   796 
       
   797 
       
   798     private: // Functions from base classes
       
   799 
       
   800         /**
       
   801          * From CEikAppUi, handles key events.
       
   802          * @param aKeyEvent Event to handled.
       
   803          * @param aType Type of the key event.
       
   804          * @return Reponse code (EKeyWasConsumed, EKeyWasNotConsumed).
       
   805          */
       
   806         virtual TKeyResponse HandleKeyEventL(
       
   807             const TKeyEvent& aKeyEvent, TEventCode aType );
       
   808 
       
   809     public:
       
   810 
       
   811         /**
       
   812          * Tab keys are fwded to this function
       
   813          * @param aKeyEvent Event to handled.
       
   814          * @param aType Type of the key event.
       
   815          * @return Reponse code (EKeyWasConsumed, EKeyWasNotConsumed).
       
   816          */
       
   817         TKeyResponse OfferTabEventL( const TKeyEvent&
       
   818                                      aKeyEvent, TEventCode aType );
       
   819 
       
   820     public:
       
   821         /**
       
   822         * The observer is added to get the server change callback
       
   823         * .
       
   824         */
       
   825         void AddServerChangeObsL( MCAServerChangeNotify* aObserver );
       
   826 
       
   827         /**
       
   828          * The observer is removed by using this method
       
   829          * .
       
   830          */
       
   831         void RemoveServerChangeObs( MCAServerChangeNotify* aObserver );
       
   832         /**
       
   833         * From MIMPSSAPObserver
       
   834         * @see MIMPSSAPObserver for more information
       
   835         */
       
   836         void HandleSAPEvent( TSAPEvent aEvent );
       
   837         /**
       
   838          * Sets th focus Flag : Used for Tab switching
       
   839          */
       
   840         void SetFocusFlag( TBool aFlag );
       
   841         /**
       
   842          * returns value of focus flag : Used for tab switching
       
   843          */
       
   844         TBool FocusFlag();
       
   845 
       
   846         // from MCABackGroundTaskObserver
       
   847         void HandleBackGroundTaskCompleteL( TBool aCompleted );
       
   848 
       
   849         // from MCASplashScreenObserver
       
   850         void SplashScreenShowed();
       
   851 
       
   852         /**
       
   853          * From IsQueryAccepted
       
   854          * @return ETrue if exit query accepted or EFalse
       
   855          */
       
   856         TBool IsQueryAccepted();
       
   857 
       
   858     private :
       
   859 
       
   860         /**
       
   861          * To know whether Background task has started
       
   862          * @return TBool
       
   863          */
       
   864         TBool IsBackgroundTaskPendingL();
       
   865 
       
   866         /**
       
   867          * WaitToCompleteBackgroundTaskL
       
   868          * Pop the wait note processing
       
   869          * @return ETrue
       
   870          */
       
   871         TBool WaitToCompleteBackgroundTaskL();
       
   872 
       
   873 
       
   874     private: //Data
       
   875 
       
   876         // Owns. Shared data is used for Universal Indicator Pane changes
       
   877         MCANotifierInterface* iNotifierAPI;
       
   878 
       
   879         // Owns. Handle to status pane handler
       
   880         CCAStatusPaneHandler* iStatusPaneHandler;
       
   881 
       
   882         // Doesn't own. Handle to application engine
       
   883         CCAEngine& iEngine;
       
   884 
       
   885         //reference to the app ui process component
       
   886         MCAApplicationNGPC& iApplicationNGPC;
       
   887 
       
   888 
       
   889         // invitation active or not
       
   890         TBool iInviteActive;
       
   891 
       
   892         // we are foreground or not
       
   893         TBool iIsAppForeground;
       
   894 
       
   895         //Owns. Audiomanager for playing sounds
       
   896         CCAAudioManager* iAudioManager;
       
   897 
       
   898         // Owns. holds the current screenname
       
   899         HBufC* iScreenName;
       
   900 
       
   901         //Owns. Capture events when active
       
   902         CCAInputAbsorber* iInputAbsorber;
       
   903 
       
   904         //Stores active view id
       
   905         TUid iActiveViewId;
       
   906 
       
   907         // Owns
       
   908         CIdle* iExitIdle;
       
   909 
       
   910         // helper arrays to count if UIP icon should shown or not
       
   911         CDesCArrayFlat* iUIPInvitations;   // owns
       
   912         CDesCArrayFlat* iUIPConversations; // owns
       
   913 
       
   914         TFileName		iChatMbmFullPath;
       
   915         TInt			iResourceFileOffset;
       
   916         RPointerArray<MCALayoutChangeObserver> iLayoutObservers;
       
   917 
       
   918         // Doesn't own objects. Array of resource observers
       
   919         RPointerArray<MCAResourceChangeObserver> iResourceObservers;
       
   920 
       
   921         // Owned. Clone of the forwarded message.
       
   922         const MCAConversationMessage* iForwardMessage;
       
   923 
       
   924         // Owns.
       
   925         CCAGroupUtils* iGroupUtils;
       
   926 
       
   927         // Doesn't own (destroys itself)
       
   928         CAknWaitDialog* iWaitDialog;
       
   929         CActiveSchedulerWait iWait;
       
   930         TBool iWaitDialogDismissed;
       
   931 
       
   932         // Owns. UI session manager
       
   933         CCAUISessionManager* iUISessionManager;
       
   934 
       
   935         // Owns. Icon loader
       
   936         CCAIconLoader* iIconLoader;
       
   937 
       
   938         // Owns. Message handler
       
   939         CCAMessageExtensionsHandler* iMessageHandler;
       
   940 
       
   941         // Owns. Domain part of current server
       
   942         HBufC* iServerDomain;
       
   943 
       
   944         // view switcher custom messages
       
   945         TUid iCustomMessageId;
       
   946         HBufC8* iCustomMessage;
       
   947         TBool iOkToSwitch;
       
   948 
       
   949         // Back-support
       
   950         TUid iLastView;
       
   951         RArray<TUid> iSwitchView;
       
   952         RArray<TUid> iSwitchMessage;
       
   953         RPointerArray<HBufC8> iSwitchMessageContent;
       
   954 
       
   955         // Owns. Connection UI agent
       
   956         CIMPSConnectionUiAgent* iConnUIAgent;
       
   957 
       
   958         // The splash screen showed at the startup
       
   959         CCASplashScreen* iSplashScreen;
       
   960 
       
   961 
       
   962         TBool iRefreshed;
       
   963 
       
   964         // Override mode can be set with this for view switch after refreshView.
       
   965         TBool iDefaultRefreshInUse;
       
   966 
       
   967         ///
       
   968         CCALayoutInfo* iLayoutInfo;
       
   969 
       
   970         // Owns. Status message ptr to original message
       
   971         HBufC* iStatusMessage;
       
   972 
       
   973         /// Flag to inform if refresh is happening or not.
       
   974         TBool iRefreshWaitFlag;
       
   975 
       
   976         // Flag to inform that appui is being destroyed
       
   977         TBool iDestructingFlag;
       
   978 
       
   979         // ETrue when engine has been properly initialized
       
   980         TBool iEngineInitialized;
       
   981 
       
   982         // ETrue when chat has been fully constructed
       
   983         TBool iChatFullyConstructed;
       
   984 
       
   985         // ETrue if beep allready played
       
   986         TBool iPlayOnce;
       
   987 
       
   988         // SAP settings store
       
   989         CIMPSSAPSettingsStore* iSAPSettingsStore;
       
   990 
       
   991         // Doesn't own (destroys itself).
       
   992         CWVSettingsUIDialog* iServSettingsDialog;
       
   993 
       
   994         TBool iNeedRefresh;
       
   995 
       
   996         // How many times has the message been forwarded
       
   997         TInt iForwardCount;
       
   998 
       
   999         // If ETrue, last forward was to contact
       
  1000         // if EFalse, to group
       
  1001         TBool iForwardedToContact;
       
  1002 
       
  1003         // Not owned, destroyed in RunLD of dialog
       
  1004         CEikDialog* iMemLowNote;
       
  1005 
       
  1006         // Flag is read from CR, ETrue in releases >= 3.2
       
  1007         // EFalse in releases < 3.2
       
  1008         TBool iShowMemLowNote;
       
  1009 
       
  1010         // Flag is read from CR in construction
       
  1011         // @see IMVariant.hrh
       
  1012         // ETrue if feature EIMFeatBrandableTones is
       
  1013         // variated on, EFalse otherwise.
       
  1014         TBool iBrandableToneList;
       
  1015 
       
  1016         // How many async dialogs are open.
       
  1017         TInt iPendingDialogCounter;
       
  1018 
       
  1019         //Reference to appln's process manager
       
  1020         MCAProcessManager& iProcessManager;
       
  1021 
       
  1022         /// Owns - Popup info for showing info popupnote.
       
  1023         CAknInfoPopupNoteController* iInfoPopup;
       
  1024 
       
  1025         //ETrue - denotes that the popup pane is active
       
  1026         TBool iInfoNoteShowing;
       
  1027 
       
  1028         //owns - holds the array of messages to be shown in the preview pane
       
  1029         CDesCArray* iPreviewMessageList;
       
  1030 
       
  1031         //holds the length of the message in the preview pane
       
  1032         TInt iTotalPreviewMsgLength;
       
  1033 
       
  1034         //holds the preview pane's Max no. of characters tat can be visible
       
  1035         TRect iPreviewPaneRect;
       
  1036 
       
  1037         //holds the current font - doesnt own
       
  1038         CFont* iCurrentFont;
       
  1039 
       
  1040         RPointerArray<MCAServerChangeNotify> iServerChangeNotify;
       
  1041 
       
  1042         // used for tab swithching
       
  1043         TBool iFocusFlag;
       
  1044 
       
  1045         // background task complete or not
       
  1046         TBool iBackgroundTaskPending;
       
  1047 
       
  1048         // processing note is visible
       
  1049         TBool iWaitVisible;
       
  1050         // owned queryaccepted for exit
       
  1051         TBool iQueryAccepted;
       
  1052 
       
  1053         //Forward once(ETrue) else EFlase;
       
  1054         TEnumsPC::TForwardStatus iForward;
       
  1055 
       
  1056         // Owns. Connection UI
       
  1057         CIMPSPresenceConnectionUi* iConnUI;
       
  1058 
       
  1059         //Maintaining count to Unread messages.
       
  1060         TInt iUnreadMsgCount;
       
  1061 
       
  1062         //Maintain record if exit is required after back ground processing completed.
       
  1063         //because of Fast swaping window exit.
       
  1064         TBool iIsFSDExitNeeded;
       
  1065 
       
  1066         // An indicator to decide whether to update current cba
       
  1067         TBool iStopUpdateCba;
       
  1068 
       
  1069         TBool iLaunchSettingsDialogWait;
       
  1070 
       
  1071         TBool iIsFSWExit;
       
  1072         MCAGroupManagerInterface* iGroupManagerInterface;
       
  1073         TBool iStatusFlag;
       
  1074     };
       
  1075 
       
  1076 #endif // CCAAPPUI_H
       
  1077 
       
  1078 // End of File