imstutils/imconversationview/imcvuiapp/inc/cimcvappview.h
changeset 0 5e5d6b214f4f
child 3 3aab497fdbb7
equal deleted inserted replaced
-1:000000000000 0:5e5d6b214f4f
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  application main view
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef _CIMCVAPPVIEW_H
       
    21 #define _CIMCVAPPVIEW_H
       
    22 
       
    23 // INCLUDES
       
    24 #include "cimcvappviewcontainer.h" 
       
    25 #include <coecntrl.h>
       
    26 #include <aknview.h>
       
    27 #include "mimcvenginemessagehandlerobserver.h"
       
    28 #include "mimcvrecipientobserver.h"
       
    29 #include "mimcvtabobserver.h"
       
    30 #include "mimcvnewmsgfadecontrolobserver.h"
       
    31 #include "mimcvenginechatlistobserver.h"
       
    32 #include <akntoolbarobserver.h>
       
    33 //For KMaxPackedContactLinkLength
       
    34 #include "imcvuiparams.h"
       
    35 #include "mimcvngineservicechangeobserver.h"
       
    36 // FORWARD DECLARATIONS
       
    37 class CIMCVAppUi;
       
    38 class MIMCVEngineChatInterface;
       
    39 class CFindItemMenu;
       
    40 class CItemFinder;
       
    41 class CIMCVAppUi;
       
    42 class CIMCVEngine;
       
    43 class CIMCVAppStatusPaneHandler;
       
    44 class MCCAConnection;
       
    45 class MCCAParameter;
       
    46 class CIMCVMenuExtensionManager;
       
    47 class MIMCVEngineFactory;
       
    48 
       
    49 // CLASS DECLARATION
       
    50 
       
    51 /**
       
    52  *  This is view class for conversation view
       
    53  */
       
    54  
       
    55 class CIMCVAppView : public CAknView,
       
    56 					 public MIMCVRecipientObserver,
       
    57 					 public MIMCVTabObserver,
       
    58 					 public MIMCVNewMsgFadeControlObserver,
       
    59 					 public MAknToolbarObserver,
       
    60 					 public MIMCVEngineServiceChangeObserver
       
    61     
       
    62     {
       
    63 
       
    64     public:  // Constructors and destructor
       
    65 
       
    66         /**
       
    67          * C++ default constructor.
       
    68          */
       
    69         CIMCVAppView();
       
    70 
       
    71         /**
       
    72          * Symbian 2nd phase constructor.
       
    73          * @param aAvkonViewResourceId Resource id for view
       
    74          * @param aViewId Id of the view
       
    75          */
       
    76         void ConstructL( TInt aAvkonViewResourceId, TUid aViewId, 
       
    77                             CIMCVAppMessageExtensionsHandler& aMessageHandler);
       
    78 
       
    79         /**
       
    80          * Destructor.
       
    81          */
       
    82         virtual ~CIMCVAppView();
       
    83 	
       
    84 	
       
    85 	public : // MIMCVEngineServiceChangeObserver
       
    86 	
       
    87 	    /*
       
    88 	     * new service has been installed
       
    89 	     */
       
    90 	    void HandleNewServiceL( TInt aServiceId )  ;
       
    91 	    /*
       
    92 	     *  service has been deleted
       
    93 	     */
       
    94 	    void HandleServiceDeletedL( TInt aServiceId ) ;
       
    95 	    /**
       
    96 	     * handle presence change notification
       
    97 	     * call back from imcvuiengine
       
    98 	     */
       
    99 	    void HandlePresenceChangedL(TInt aServiceId, const TDesC& aBuddyId ) ;
       
   100 
       
   101 	    /**
       
   102 	     * Handle message send operation completion.
       
   103 	     * @param aResult result  to handle.
       
   104 	     */
       
   105 	    void HandleOperationCompletdL(TInt aServiceId , MIMCVEngineMessage::TMessagerType aType , TInt aResult);
       
   106 
       
   107 	    /**
       
   108 	     * @see HandleConnectionTerminatedL
       
   109 	     * to handle the connection lost
       
   110 	     * @param aReason, reason report
       
   111 	     */
       
   112 	    void HandleConnectionEventL(TInt aServiceId, TIMCVConnectionState aState, TInt aReason )  ;
       
   113 
       
   114 	    /*
       
   115 	     * See MIMCVEngineChatListObserver
       
   116 	     */
       
   117 	    void HandleChatListEvent(TInt aServiceId,  TChatListEventType aEvent, 
       
   118 	            MIMCVEngineMessageReadInterface* aContainerInfo  ) ;
       
   119 
       
   120 	           
       
   121     public: // New methods
       
   122 
       
   123         /**
       
   124          * Handles changes in CBA states
       
   125 		 * @since 5.0
       
   126          * @param aResourceId Resource that changes
       
   127          */		
       
   128         void HandleCbaChangeL( TInt aResourceId );
       
   129         
       
   130         /**
       
   131          * SetStatusPaneIconsL set the icons based on presence status
       
   132 		 * @since 5.0
       
   133          */	
       
   134         void SetStatusPaneIconsL();
       
   135         
       
   136          /**
       
   137          * From MIMCVRecipientObserver
       
   138          * Shows customized menu
       
   139          */
       
   140         void ShowPopUpMenuL( );
       
   141 
       
   142         /**
       
   143          * Function to launch help
       
   144          */
       
   145         void LaunchHelpL( const TDesC& aContext);          
       
   146 
       
   147         void ShowMeL( const TDesC8& aParamData ) ;
       
   148         
       
   149         void UpdateToolbarButtonsStateL();
       
   150         
       
   151         /**
       
   152          * Launches the contact details view 
       
   153          * 
       
   154          */
       
   155         void LaunchCcaL();
       
   156         
       
   157         /*
       
   158          * return active engine reference
       
   159          */
       
   160         CIMCVEngine& ActiveEngine() const ;
       
   161    
       
   162     private: // Functions from base classes
       
   163 
       
   164         /**
       
   165          * From MEikMenuObserver, Called by framework before 
       
   166          * constructing menupane
       
   167          * @param aResourceId Resource to be constructed
       
   168          * @param aMenuPane Pointer to menupane being constructed
       
   169 		 * @see MEikMenuObserver
       
   170          */
       
   171         void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
       
   172         
       
   173         /**
       
   174 	     * Resolve currently selected item type and set it to CItemFinder
       
   175 	     */
       
   176         void UpdateItemTypeL();    
       
   177    
       
   178     private:
       
   179 
       
   180         /**
       
   181          * From CAknView, Gets called from framework when activating this view
       
   182          * @param aPrevViewId Previous view id
       
   183          * @param aCustomMessageId Custom message's id
       
   184          * @param aCustomMessage Custom message
       
   185 		 * @see CAknView
       
   186          */
       
   187         void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
       
   188                 const TDesC8& aCustomMessage);
       
   189 
       
   190         /**
       
   191          * From AknView, deactivates view
       
   192 		 * @see CAknView
       
   193          */
       
   194         void DoDeactivate();
       
   195 
       
   196        
       
   197 
       
   198         /**
       
   199          * From CAknView 
       
   200          * @param aCommand Command that was received
       
   201 		 * @see CAknView
       
   202          */
       
   203         void HandleCommandL(TInt aCommand);
       
   204 
       
   205         /**
       
   206          * Handles foreground event
       
   207          * @param aForeground ETrue if foreground else EFalse
       
   208 		 * @see CAknView
       
   209 		 */
       
   210         void HandleForegroundEventL( TBool aForeground );
       
   211         
       
   212 		/**
       
   213 		* Show query dialog
       
   214 		* @param aDialogResourceId resource id
       
   215 		* @param aPrompt text to be shown
       
   216 		*/
       
   217 		TInt DisplayQueryDialogL( TInt aDialogResourceId, 
       
   218             					  const TDesC& aPrompt );
       
   219 		
       
   220 	
       
   221 
       
   222 
       
   223 
       
   224 	private:
       
   225 		/** Helper Function
       
   226 		 * This function is to be called when switching between tabs
       
   227 		 * @param aChatId - Switch to this chat item
       
   228 		 * @param aTabIndex - Index of the tab
       
   229 		 */
       
   230 		
       
   231 		void SwitchTabL(TInt aActiveServiceId , const TDesC& aChatId, const TInt aTabIndex);
       
   232 		
       
   233 	
       
   234 		
       
   235 	private:
       
   236 		
       
   237 		/**
       
   238          * From MIMCVNewMsgFadeControlObserver          
       
   239 		 * @see MIMCVNewMsgFadeControlObserver
       
   240          */		
       
   241 		void NotifyWhenCompleted() ;
       
   242 		
       
   243 		/**
       
   244          * From MIMCVNewMsgFadeControlObserver          
       
   245 		 * @see MIMCVNewMsgFadeControlObserver
       
   246          */
       
   247 		void NotifyWhenStarted();
       
   248 	    
       
   249 	   public:
       
   250 	   		/** 
       
   251 		 		* This function is to be called when left/right Navigation key is pressed
       
   252 		 		* @param aKeyEvent 
       
   253 		 		* @param aType
       
   254 		 		*/
       
   255 	       TKeyResponse OfferTabEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
   256 	public: // MAknToolbarObserver
       
   257 	    /**
       
   258 	     * Called when toolbar events occur
       
   259 	     *
       
   260 	     * @since 5.0
       
   261 	     * @return void
       
   262 	     */
       
   263 	    void OfferToolbarEventL( TInt aCommand ) { HandleCommandL(aCommand); }
       
   264 		
       
   265 	private:
       
   266 		/**
       
   267 		 * id from base clas.
       
   268 		 */
       
   269 	           
       
   270 	    TUid Id() const;
       
   271 	    
       
   272 	   /**
       
   273          * constructs necessary icons for this decorator
       
   274          * @return Icon. 
       
   275          **/
       
   276 		 CGulIcon* LoadBitmapL(  );
       
   277 	   
       
   278 	        
       
   279          /**
       
   280          * refreshes the view.
       
   281          */
       
   282          void ViewRefreshL();
       
   283          
       
   284          /*
       
   285 		 *  switch the valid service references
       
   286 		 */
       
   287          void SwitchToValidServiceL( TInt aServiceId );
       
   288          
       
   289          /*
       
   290           * Deltete the CIMCVAppRichTextContainerCache when xsp id deleted from detail view..
       
   291           */
       
   292          void DeleteContainerCache(const TDesC& aPrimaryKey, TInt aServiceId );
       
   293 
       
   294     private: // Data
       
   295 
       
   296         // View's UID
       
   297         TUid iViewId;
       
   298 
       
   299         // Owns. Container
       
   300         CIMCVAppViewContainer* iContainer;
       
   301 
       
   302         //Owns. Contact id
       
   303         HBufC* iRecipientUserId;
       
   304       		
       
   305 	    //Doesn't own. Message handler
       
   306         CIMCVAppMessageExtensionsHandler* iExtensionHandler;
       
   307        
       
   308               
       
   309         // not owned, from CCoeEnv
       
   310         CIMCVAppUi* iAppUi;
       
   311         
       
   312          
       
   313 	    //stores the default MBM path
       
   314 	    TFileName iDefaultMbmPath;
       
   315               
       
   316           // Owns. Popup-menu for find item UI
       
   317         CEikMenuBar* iFindContextMenu;   
       
   318         
       
   319         // owns. menu pane for find item functionality
       
   320         CFindItemMenu* iFindMenu;
       
   321         
       
   322         // owns. 
       
   323         CItemFinder* iItemFinder;    
       
   324 		
       
   325 		//Service Id
       
   326 		TInt iServiceId;
       
   327 		
       
   328 		//Doesnt Own
       
   329 		CIMCVAppStatusPaneHandler* iStatusPane;
       
   330 
       
   331 		
       
   332 		 MCCAConnection* iConnection;
       
   333 		 
       
   334 		 MCCAParameter* iParameter;
       
   335 		
       
   336        	TBool iViewDeactivated;
       
   337        	
       
   338        	//Owns Cache to store CIMCVAppRichTextContainer objects
       
   339        	CIMCVAppRichTextContainerCache* iRTContainerCache;
       
   340        	
       
   341         //Owns. "From me" icon
       
   342         CGulIcon* iFromMe;
       
   343         
       
   344         //Owns. "To me" icon
       
   345         CGulIcon* iToMe;
       
   346         
       
   347         //Owns Menu Extention manager
       
   348         CIMCVMenuExtensionManager* iMenuExtManager;
       
   349         
       
   350         // not owns : reference to imcvuiengine component
       
   351         MIMCVEngineFactory* iEngineFactory ;
       
   352         
       
   353         // not owns : active change engine pointer
       
   354         CIMCVEngine* iActiveEngine;
       
   355         
       
   356         // not owned , chat interface
       
   357          MIMCVEngineChatInterface* iActiveChatInterface;
       
   358          
       
   359          //Keep track if Detail view is opened.
       
   360          TBool iDetailViewOpen;
       
   361          
       
   362          //Keep track, if conv. view need to be closed when xsp id is deleted
       
   363          //when doing back operation conv. view need to be closed if xsp id deleted from detail view.
       
   364          TBool iConvViewDel ; 
       
   365      
       
   366 
       
   367     };
       
   368 
       
   369 #endif // _CIMCVAPPVIEW_H