uiservicetab/vimpstcmdprocess/inc/cvimpstprocessarrayitem.h
branchRCL_3
changeset 29 9a48e301e94b
equal deleted inserted replaced
28:3104fc151679 29:9a48e301e94b
       
     1 /*
       
     2 * Copyright (c) 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:  CVIMPSTProcessContactItem, CVIMPSTProcessContactListItem, CVIMPSTProcessOwnDataItem, 
       
    15 *				 CVIMPSTProcessConversationItem
       
    16 *                are the different types of array items stored in the MCAMainViewArrayPC
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef CVIMPSTPROCESSARRAYITEM_H
       
    23 #define CVIMPSTPROCESSARRAYITEM_H
       
    24 #include <e32base.h>
       
    25 
       
    26 #include "tvimpstenums.h"
       
    27 #include "cvimpstprocessarray.h"
       
    28 //  FORWARD DECLARATION
       
    29 class MVPbkContactLink;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34 * Base class for cimcontactitem, cimcontactlistitem, cimowndataitem
       
    35 * to be stored into an array of <CCAArrayItemPC> on the process component side.
       
    36 * The UI components will query for each item in this heterogeneous array to display 
       
    37 * information like contactlist, contact, conversation, groups etc in the listbox of 
       
    38 * the main view class
       
    39 * @lib vimpstcmdprocess.dll
       
    40 * @since 5.0
       
    41 */
       
    42 class MVIMPSTProcessArrayItem
       
    43     {
       
    44      
       
    45     public:
       
    46     
       
    47     /**
       
    48     * Returns the default type of the listbox item 
       
    49     * @return TEnumsPC::TItem: type of the listbox item as either EContactitem, EContactListItem etc
       
    50     */
       
    51     virtual TVIMPSTEnums::TItem Type() = 0;
       
    52     
       
    53     /**
       
    54     * Returns the name of the listbox item 
       
    55     * @return TPtrC: name of the listbox item to be displayed
       
    56     */
       
    57     virtual TPtrC GetItemNameText() = 0 ;
       
    58     
       
    59     /**
       
    60     * Sets the name of the listbox item 
       
    61     * @param aName: Name of the listbox item to be set
       
    62     * @return void
       
    63     */
       
    64     
       
    65     virtual void SetMsgPending(TBool aMsgPending) = 0;
       
    66     
       
    67     /**
       
    68      * gets the messages pending status of the contact item 
       
    69      * @return iSMsgPending: true if the contact has pending messages 
       
    70      * else false
       
    71      */
       
    72     virtual TBool IsMsgPending() = 0 ;
       
    73     
       
    74     /**
       
    75      * Sets the name of the listbox item 
       
    76      * @param aName: Name of the listbox item to be set
       
    77      * @return void
       
    78      */
       
    79 
       
    80     virtual void SetConversationOpen(TBool aConvOpen ) = 0;
       
    81 
       
    82     /**
       
    83      * gets the messages pending status of the contact item 
       
    84      * @return iSMsgPending: true if the contact has pending messages 
       
    85      * else false
       
    86      */
       
    87     virtual TBool IsConversationOpen() = 0 ;
       
    88         
       
    89     /**
       
    90     * Returns the array index of the listbox item on engine/storage side
       
    91     * @return TInt: index of the listbox item on engine/storage side
       
    92     */
       
    93     virtual TInt GetItemIndex() = 0;
       
    94     
       
    95     /**
       
    96     * return the VPBK Contact Link
       
    97     */
       
    98     virtual MVPbkContactLink* ContactLink() = 0;  
       
    99     
       
   100     
       
   101     /**
       
   102     * Sets the on engine/storage side index of the listbox item 
       
   103     * @param aIndex: index of the listbox item on engine/storage side
       
   104     * @return void
       
   105     */
       
   106     virtual void SetItemIndex(TInt aIndex) = 0;
       
   107     
       
   108     /**
       
   109     * Returns the user id of the listbox item 
       
   110     * @return TPtrC: user id of the listbox item.
       
   111     */
       
   112     virtual TPtrC GetItemUserId() = 0 ;
       
   113     /**
       
   114      * Returns the avatar index of the listbox item 
       
   115      * @return TInt: avatar index of the listbox item.
       
   116      */
       
   117     virtual TInt  AvatarIndex() = 0;
       
   118     
       
   119     /**
       
   120      * sets the avatar index of the listbox item 
       
   121      * @param aAvatarIndex: avatar index to be set 
       
   122      */
       
   123     virtual void  SetAvatarIndex(TInt aAvatarIndex ) = 0; 
       
   124     
       
   125     
       
   126     /**
       
   127      * returns status text of the contact
       
   128      */
       
   129     virtual const TDesC& StatusText() = 0;
       
   130     
       
   131     /**
       
   132      * returns online status of the contact
       
   133      */
       
   134     virtual TVIMPSTEnums::TOnlineStatus OnlineStatus() = 0;
       
   135     
       
   136     
       
   137     /**
       
   138      * return formatted string needed for listbox for this item
       
   139      */
       
   140     virtual TPtrC16 FormattedItemString() = 0;
       
   141     
       
   142     
       
   143     /*
       
   144      * Format and Reformat the string for listbox
       
   145      */
       
   146     virtual void DoFormatStringL() = 0;
       
   147     
       
   148    
       
   149     /**
       
   150      * virtual destructor.
       
   151      */
       
   152     virtual ~MVIMPSTProcessArrayItem(){};    
       
   153    
       
   154     
       
   155     };
       
   156     
       
   157 /**
       
   158 * CCAContactItemPC is a structure that will encapsualte information on a contact 
       
   159 * item in the single array on the process component side.
       
   160 * @lib vimpstcmdprocess.dll
       
   161 * @since 5.0
       
   162 */    
       
   163 class CVIMPSTProcessContactItem : public CBase,
       
   164                                   public MVIMPSTProcessArrayItem
       
   165     {
       
   166     
       
   167     public: // symbain constructor , destructor
       
   168 		
       
   169 		/**
       
   170 		 *  Creates a new instance of this class.
       
   171 		 * @param aContactId, reference to contactid.
       
   172 		 * @param aContactLink, pointer to Contactlink.		 
       
   173 		 * @return the ContactitemPC instance
       
   174 		 */
       
   175     	static CVIMPSTProcessContactItem* NewL( CVIMPSTProcessArray& aParent, const TDesC& aContactName,
       
   176 					    						const TDesC& aContactId, 
       
   177 					    						MVPbkContactLink* aContactLink,
       
   178 					    						const TDesC& aStatusText,
       
   179 					    						TVIMPSTEnums::TOnlineStatus aOnlineStatus
       
   180 					    						);
       
   181     	/**
       
   182     	* symbain way of construction
       
   183     	*/
       
   184     	void ConstructL(  const TDesC& aContactId, 
       
   185                           const TDesC& aContactName,
       
   186                           const TDesC& aStatusText,
       
   187                           TVIMPSTEnums::TOnlineStatus aOnlineStatus 
       
   188                           );
       
   189     	
       
   190     	/**
       
   191     	* destructor
       
   192     	*/
       
   193     	virtual ~CVIMPSTProcessContactItem();
       
   194     	
       
   195     private:
       
   196 
       
   197 		/**
       
   198 		* C++ default constructor
       
   199 	    * @param aContactId, reference to contactid.
       
   200         * @param aContactLink, pointer to Contactlink.        
       
   201 		*/
       
   202 		CVIMPSTProcessContactItem( CVIMPSTProcessArray& aParent, MVPbkContactLink* aContactLink);
       
   203 
       
   204     public:
       
   205      //to be used later.
       
   206 	    /**
       
   207 	    * Returns the blocked status of the contact item 
       
   208 	    * @return bool: true if the contact item is blocked else false
       
   209 	    */
       
   210 	    //TBool IsBlocked();
       
   211 		   
       
   212 		/**
       
   213 		* Sets the blocked status of the contact item 
       
   214 		* @param aBlockedStatus: true if the contact is blocked else false
       
   215 		*/
       
   216 	    //void SetBlockedStatus(TBool aBlockedStatus);
       
   217 
       
   218 		/**
       
   219 		* Sets the messages pending status of the contact item 
       
   220 		* @param aPendingMessageStatus: true if the contact has pending messages 
       
   221 		* else false
       
   222 		*/
       
   223 	    void SetMsgPending(TBool aPendingMessageStatus);
       
   224 	    
       
   225 	   /**
       
   226 		* gets the messages pending status of the contact item 
       
   227 		* @return iSMsgPending: true if the contact has pending messages 
       
   228 		* else false
       
   229 		*/
       
   230 	    TBool IsMsgPending();
       
   231 	    
       
   232 	    /**
       
   233 	     * Sets the name of the listbox item 
       
   234 	     * @param aName: Name of the listbox item to be set
       
   235 	     * @return void
       
   236 	     */
       
   237 
       
   238 	    void SetConversationOpen(TBool aConvOpen ) ;
       
   239 
       
   240 	    /**
       
   241 	     * gets the messages pending status of the contact item 
       
   242 	     * @return iSMsgPending: true if the contact has pending messages 
       
   243 	     * else false
       
   244 	     */
       
   245 	    TBool IsConversationOpen() ;
       
   246 	    
       
   247     public: //From MImArrayItem
       
   248     
       
   249 	    /**
       
   250 	    * Returns the name of the contact item 
       
   251 	    * @return TPtrC: name of the contact item to be displayed
       
   252 	    */
       
   253 	    TPtrC GetItemNameText();
       
   254 	    
       
   255 	   /**
       
   256 	    * Returns the default type of the contact item 
       
   257 	    * @return TEnumsPC::TItem: type of the contact item as either 
       
   258 	    * EContactitem, EContactListItem etc
       
   259 	    */
       
   260 	    TVIMPSTEnums::TItem Type();
       
   261     
       
   262     	
       
   263     	/**
       
   264 	    * Get the index of the contact item from engine side model
       
   265 	    * @return TInt, index
       
   266 	    */
       
   267     	inline TInt GetItemIndex()   
       
   268     		{ 	
       
   269     		return iIndex;    
       
   270     		}
       
   271 		
       
   272 		/**
       
   273 	    * Set the index of the contact item from engine side model
       
   274 	    * @param TInt, aIndex
       
   275 	    */
       
   276 	    inline void SetItemIndex(TInt aIndex) 	
       
   277 			{  
       
   278 			iIndex  = aIndex;
       
   279 			}
       
   280 		
       
   281 	   /**
       
   282     	* @returns the VPBK Contact Link
       
   283     	*/
       
   284 		inline MVPbkContactLink* ContactLink()
       
   285 			{
       
   286 			return iContactLink;
       
   287 			}
       
   288 			
       
   289 		
       
   290 	    /**
       
   291 	    * Returns the user id of the listbox item 
       
   292 	    * @return TPtrC: user id of the listbox item.
       
   293 	    */
       
   294 	    TPtrC GetItemUserId();
       
   295 	      
       
   296 	    /**
       
   297 	     * Returns the avatar index of the listbox item 
       
   298 	     * @return TInt: avatar index of the listbox item.
       
   299 	     */
       
   300 	     inline TInt  AvatarIndex() 
       
   301 	         {
       
   302 	         return iAvatarIndex;
       
   303 	         }
       
   304 	    
       
   305 	    /**
       
   306 	     * sets the avatar index of the listbox item 
       
   307 	     * @param aAvatarIndex: avatar index to be set 
       
   308 	     */
       
   309 	    inline void  SetAvatarIndex(TInt aAvatarIndex ) 
       
   310 	        {
       
   311 	        iAvatarIndex = aAvatarIndex;
       
   312 	        
       
   313 	        TRAP_IGNORE(DoFormatStringL());
       
   314 	        }
       
   315 	    
       
   316 	    /**
       
   317 	     * returns status text of the contact
       
   318 	     */
       
   319 	    const TDesC& StatusText();
       
   320 	    
       
   321 	    /**
       
   322 	     * returns online status of the contact
       
   323 	     */
       
   324 	    TVIMPSTEnums::TOnlineStatus OnlineStatus();
       
   325 	    
       
   326 	    /*
       
   327 	     * Format and Reformat the string for listbox
       
   328 	     */
       
   329 	    void DoFormatStringL();
       
   330 
       
   331 	    /**
       
   332 	     * return formatted string needed for listbox for this item
       
   333 	     */
       
   334 	    TPtrC16 FormattedItemString();	    
       
   335     			
       
   336     private:
       
   337 	    
       
   338 	    // Process Array
       
   339 	    CVIMPSTProcessArray& iParent;
       
   340 	    
       
   341   	   /**
       
   342 	    * The name of the listbox item
       
   343 	    */
       
   344 	    HBufC* iItemNameTextContact;
       
   345 	    
       
   346 	    
       
   347 	    /**
       
   348 	    * The name of the listbox item
       
   349 	    */
       
   350 	    HBufC* iContactUserId;
       
   351 
       
   352 	   /**
       
   353   	 	* Index of the item in engines model class
       
   354   	 	*/
       
   355   	 	TInt iIndex;
       
   356   	 	
       
   357   	 	//Not owned
       
   358   	 	MVPbkContactLink* iContactLink; 	 	
       
   359   	 	
       
   360   	 	// ETrue if it has a pending message, else EFalse.
       
   361   	 	TBool iSMsgPending;
       
   362   	 	
       
   363   	 	TBool iIsConversationOpen;
       
   364   	 	
       
   365  	 	// avatar index
       
   366   	 	TInt iAvatarIndex;
       
   367   	 	
       
   368   	 	// Status text Message
       
   369   	 	HBufC* iStatusText;
       
   370   	 	
       
   371   	 	// Stores the status of the contact
       
   372   	 	TVIMPSTEnums::TOnlineStatus iOnlineStatus;
       
   373   	 	
       
   374   	 	HBufC* iFormattedString;
       
   375 	        
       
   376     };
       
   377 
       
   378 
       
   379 /**
       
   380 * CVIMPSTProcessContactListItem is a structure that will encapsualte information on a contact 
       
   381 * list in the single array on the process component side.
       
   382 * @lib vimpstcmdprocess.dll
       
   383 * @since 5.0
       
   384 */ 
       
   385 class CVIMPSTProcessContactListItem : public CBase,
       
   386                                       public MVIMPSTProcessArrayItem 
       
   387     {
       
   388     
       
   389     public:
       
   390        /**
       
   391         * Creates a new instance of this class.
       
   392 		* @return the CVIMPSTProcessContactListItem instance
       
   393 		*/
       
   394     	static CVIMPSTProcessContactListItem* NewL(CVIMPSTProcessArray& aParent);
       
   395     	
       
   396        /**
       
   397     	* second phase constructor
       
   398     	*/
       
   399     	void ConstructL();
       
   400     	
       
   401        /**
       
   402     	* destructor
       
   403     	*/
       
   404     	virtual ~CVIMPSTProcessContactListItem();
       
   405 
       
   406 	private:
       
   407 
       
   408 	   /**
       
   409 		* C++ default constructor
       
   410 		*/	
       
   411    		CVIMPSTProcessContactListItem(CVIMPSTProcessArray& aParent);
       
   412    		
       
   413     public:
       
   414     
       
   415 	    /**
       
   416 	    * Returns the expanded or collapsed state information of the contact list 
       
   417 	    * @return bool, true if the contact list is collapsed else return false
       
   418 	    */
       
   419 	    TBool IsCollapsed();
       
   420 	    
       
   421 	   	    
       
   422 	    /**
       
   423 		* Sets the collapsed/expanded state of the contact list
       
   424 		* @param aCollapsed, true if the contact list item is collapsed else false
       
   425 		*/
       
   426 		void SetCollapsed(TBool aCollapsed);
       
   427 	   	    
       
   428 	public: //From CImArrayItem
       
   429 
       
   430 		/**
       
   431 		* Returns the name of the contact list item 
       
   432 		* @return TPtrC, name of the contact item to be displayed
       
   433 		*/
       
   434 		TPtrC GetItemNameText();
       
   435 
       
   436 		/**
       
   437 		* Sets the name of the contact list item 
       
   438 		* @param aName: Name of the contact list item to be set
       
   439 		* @return void
       
   440 		*/
       
   441 		void SetItemNameText(const TDesC&);    
       
   442 
       
   443 		/**
       
   444 		* Returns the default type of the contact list item 
       
   445 		* @return TEnumsPC::TItem: type of the contact list item as either 
       
   446 		* EContactitem, EContactListItem etc
       
   447 		*/
       
   448 		TVIMPSTEnums::TItem Type();
       
   449     	
       
   450     	/**
       
   451 	    * Get the index of the contact item from engine side model
       
   452 	    * @return TInt: index
       
   453 	    */
       
   454 	    inline TInt GetItemIndex()   
       
   455     		{ 	
       
   456     		return iIndex;    
       
   457     		}
       
   458 		
       
   459 		/**
       
   460 	    * Set the index of the contact item from engine side model
       
   461 	    * @param TInt: aIndex
       
   462 	    */
       
   463 	    inline void SetItemIndex(TInt aIndex) 	
       
   464 			{  
       
   465 			iIndex  = aIndex;
       
   466 			}
       
   467     	
       
   468 	    /**
       
   469          * @return the VPBK Contact Link
       
   470          */
       
   471     	inline MVPbkContactLink* ContactLink()
       
   472 			{
       
   473 			return 0;
       
   474 			}
       
   475 		
       
   476        /**
       
   477         * Returns the user id of the listbox item 
       
   478         * @return TPtrC: user id of the listbox item.
       
   479         */
       
   480         inline TPtrC GetItemUserId()
       
   481             {
       
   482             return KNullDesC();
       
   483             }
       
   484         /**
       
   485          * Returns the avatar index of the listbox item 
       
   486          * @return TInt: avatar index of the listbox item.
       
   487          */
       
   488         inline TInt  AvatarIndex() 
       
   489             {
       
   490             return KErrNone; // always return zero
       
   491             }
       
   492 
       
   493         /**
       
   494          * sets the avatar index of the listbox item 
       
   495          * @param aAvatarIndex: avatar index to be set 
       
   496          */
       
   497         inline void  SetAvatarIndex(TInt /*aAvatarIndex*/ ) 
       
   498             {
       
   499            // dummy not used
       
   500             }
       
   501         void SetMsgPending(TBool /*aMsgPending*/)
       
   502             {
       
   503             // NA
       
   504             }
       
   505         /**
       
   506          * Sets the messages pending status of the contact item 
       
   507          * @param aPendingMessageStatus: true if the contact has pending messages 
       
   508          * else false
       
   509          */
       
   510         TBool IsMsgPending()
       
   511             {
       
   512             return EFalse;
       
   513             }
       
   514         /**
       
   515          * Sets the name of the listbox item 
       
   516          * @param aName: Name of the listbox item to be set
       
   517          * @return void
       
   518          */
       
   519 
       
   520         void SetConversationOpen(TBool /*aConvOpen*/ )
       
   521             {
       
   522             // NA
       
   523             }
       
   524 
       
   525         /**
       
   526          * gets the messages pending status of the contact item 
       
   527          * @return iSMsgPending: true if the contact has pending messages 
       
   528          * else false
       
   529          */
       
   530         TBool IsConversationOpen() 
       
   531             {
       
   532             return EFalse;
       
   533             }
       
   534         
       
   535         /**
       
   536          * returns status text of the contact
       
   537          */
       
   538         const TDesC& StatusText()
       
   539             {
       
   540             //NA
       
   541             return KNullDesC;
       
   542             }
       
   543         
       
   544         /**
       
   545          * returns online status of the contact
       
   546          */
       
   547         TVIMPSTEnums::TOnlineStatus OnlineStatus()
       
   548             {
       
   549             //NA
       
   550             return TVIMPSTEnums::EUnknown;
       
   551             }
       
   552         
       
   553         /*
       
   554          * Format and Reformat the string for listbox
       
   555          */
       
   556         void DoFormatStringL();
       
   557 
       
   558         /**
       
   559          * return formatted string needed for listbox for this item
       
   560          */
       
   561         TPtrC16 FormattedItemString();
       
   562         
       
   563     private:
       
   564         
       
   565         // Process Array
       
   566         CVIMPSTProcessArray& iParent;
       
   567     
       
   568     	/**
       
   569 	 	* collapsed/expanded status of the contact list
       
   570 	    */
       
   571 		TBool iCollapsedStatus;
       
   572 		
       
   573 			
       
   574 		/**
       
   575 	 	* Total no. of contacts in the contact list
       
   576 	    */
       
   577 	    TInt  iTotalContacts;
       
   578 
       
   579 		/**
       
   580 	 	* name of the contact list followed by 
       
   581 	 	* the (No. of Online Contacts/ Total contacts) in that contact list
       
   582 	    */
       
   583 	    HBufC* iText;
       
   584 	    
       
   585        /**
       
   586   	 	* Index of the item in engines model class
       
   587   	 	*/
       
   588   	 	TInt	iIndex;
       
   589      
       
   590                 
       
   591         /**
       
   592         * The name of the listbox item
       
   593         * Till the contalist is supported in futuer, 
       
   594         * iItemNameTextList is a pointer.
       
   595         */
       
   596         HBufC* iItemNameTextList; 
       
   597     };
       
   598     
       
   599 /**
       
   600 * CVIMPSTProcessOwnDataItem is a structure that will encapsualte information on Own data 
       
   601 * item in the single array on the process component side.
       
   602 */   
       
   603  class CVIMPSTProcessOwnDataItem : public CBase,
       
   604                                    public MVIMPSTProcessArrayItem
       
   605     {
       
   606     	
       
   607     public:
       
   608 	   /**
       
   609 	    * Creates a new instance of this class.
       
   610 		* @param aContactId, id of the contact		
       
   611 		*/
       
   612     	static CVIMPSTProcessOwnDataItem* NewL(CVIMPSTProcessArray& aParent, TDesC& aContactId);
       
   613     	
       
   614        /**
       
   615     	* second phase constructor
       
   616     	*/
       
   617     	void ConstructL();
       
   618     	
       
   619        /**
       
   620     	* destructor
       
   621     	*/
       
   622     	virtual ~CVIMPSTProcessOwnDataItem();
       
   623 
       
   624    private:
       
   625 
       
   626        /**
       
   627         * symbian default constructor
       
   628         * @param aContactId, id of the contact        
       
   629         */
       
   630 	
       
   631         CVIMPSTProcessOwnDataItem(CVIMPSTProcessArray& aParent,TDesC& aContactId);
       
   632 		    
       
   633 	public: //From CImArrayItem
       
   634 
       
   635 		/**
       
   636 		* Returns the name of the contact list item 
       
   637 		* @return TPtrC, name of the contact item to be displayed
       
   638 		**/
       
   639 		TPtrC GetItemUserId();
       
   640 
       
   641 	
       
   642 		/**
       
   643 		* Returns the default type of the contact list item 
       
   644 		* @return TEnumsPC::TItem, type of the contact list item as either 
       
   645 		* EContactitem, EContactListItem etc
       
   646 		*/
       
   647 		TVIMPSTEnums::TItem Type();
       
   648 
       
   649      	/**
       
   650 	    * Get the index of the contact item from engine side model
       
   651 	    * @return TInt, index
       
   652 	    */
       
   653 	    inline TInt GetItemIndex()   
       
   654     		{ 	
       
   655     		return iIndex;    
       
   656     		}
       
   657 		
       
   658 		/**
       
   659 	    * Set the index of the contact item from engine side model
       
   660 	    * @param TInt, aIndex
       
   661 	    */
       
   662 	    inline void SetItemIndex(TInt aIndex) 	
       
   663 			{  
       
   664 			iIndex  = aIndex;
       
   665 			}
       
   666 	    /**
       
   667          * @return the VPBK Contact Link
       
   668          */
       
   669     	inline MVPbkContactLink* ContactLink()
       
   670 			{
       
   671 			return 0;
       
   672 			}
       
   673     	
       
   674         /**
       
   675         * Returns the user id of the listbox item 
       
   676         * @return TPtrC: user id of the listbox item.
       
   677         */
       
   678         inline TPtrC GetItemNameText()
       
   679             {
       
   680             return KNullDesC();
       
   681             }
       
   682         /**
       
   683          * Returns the avatar index of the listbox item 
       
   684          * @return TInt: avatar index of the listbox item.
       
   685          */
       
   686         inline TInt  AvatarIndex() 
       
   687             {
       
   688             return iAvatarIndex;
       
   689             }
       
   690 
       
   691         /**
       
   692          * sets the avatar index of the listbox item 
       
   693          * @param aAvatarIndex: avatar index to be set 
       
   694          */
       
   695         inline void  SetAvatarIndex(TInt aAvatarIndex ) 
       
   696             {
       
   697             iAvatarIndex = aAvatarIndex;
       
   698             
       
   699             TRAP_IGNORE(DoFormatStringL());
       
   700             }
       
   701         /**
       
   702          * returns the mimetype
       
   703          * @return returns the mimetype
       
   704          */
       
   705         inline const TDesC8& MimeType()
       
   706             {
       
   707             if( iMimeType )
       
   708                 {
       
   709                 return *iMimeType;
       
   710                 }
       
   711             else
       
   712                 {
       
   713                 return KNullDesC8();
       
   714                 }    
       
   715             }
       
   716         /**
       
   717          * sets the mimetype
       
   718          * @param  the mimetype to be set
       
   719          */
       
   720         inline void SetMimeType( const TDesC8& aMime)
       
   721             {
       
   722             delete iMimeType; 
       
   723             iMimeType = NULL;
       
   724             iMimeType = aMime.Alloc();
       
   725             } 
       
   726         void SetMsgPending(TBool /*aMsgPending*/)
       
   727             {
       
   728             // NA
       
   729             }
       
   730         /**
       
   731          * Sets the messages pending status of the contact item 
       
   732          * @param aPendingMessageStatus: true if the contact has pending messages 
       
   733          * else false
       
   734          */
       
   735         TBool IsMsgPending()
       
   736             {
       
   737             return EFalse;
       
   738             }
       
   739         /**
       
   740          * Sets the name of the listbox item 
       
   741          * @param aName: Name of the listbox item to be set
       
   742          * @return void
       
   743          */
       
   744 
       
   745         void SetConversationOpen(TBool /*aConvOpen*/ )
       
   746             {
       
   747             // NA
       
   748             }
       
   749 
       
   750         /**
       
   751          * gets the messages pending status of the contact item 
       
   752          * @return iSMsgPending: true if the contact has pending messages 
       
   753          * else false
       
   754          */
       
   755         TBool IsConversationOpen() 
       
   756             {
       
   757             return EFalse;
       
   758             }
       
   759         
       
   760         /**
       
   761          * returns status text of the contact
       
   762          */
       
   763         const TDesC& StatusText()
       
   764             {
       
   765             //NA
       
   766             return KNullDesC;
       
   767             }
       
   768         
       
   769         /**
       
   770          * returns online status of the contact
       
   771          */
       
   772         TVIMPSTEnums::TOnlineStatus OnlineStatus()
       
   773             {
       
   774             //NA
       
   775             return TVIMPSTEnums::EUnknown;
       
   776             }
       
   777         
       
   778         /*
       
   779          * Format and Reformat the string for listbox
       
   780          */
       
   781         void DoFormatStringL();
       
   782 
       
   783         /**
       
   784          * return formatted string needed for listbox for this item
       
   785          */
       
   786         TPtrC16 FormattedItemString();
       
   787         
       
   788     private:
       
   789        	    
       
   790         //Process Array
       
   791         CVIMPSTProcessArray& iParent;
       
   792         
       
   793 	    /**
       
   794   	 	* Index of the item in engines model class
       
   795   	 	*/
       
   796   	 	TInt	iIndex;
       
   797      
       
   798         /**
       
   799         * The name of the listbox item
       
   800         */
       
   801         TDesC& iOwnDataId;
       
   802         
       
   803         
       
   804         // avatar index	
       
   805     	TInt iAvatarIndex;
       
   806     	// owned mimetype
       
   807     	HBufC8* iMimeType;
       
   808     };
       
   809 
       
   810 
       
   811 
       
   812 /**
       
   813  * unknown contact item
       
   814  * Responsible for handling feriend requests.
       
   815  * @lib vimpstcmdprocess.dll
       
   816  * @since 5.0
       
   817  */
       
   818 class CVIMPSTProcessUnknownContactItem :  public CBase,
       
   819                                           public MVIMPSTProcessArrayItem
       
   820     {
       
   821     public: // symbain constructor , destructor
       
   822         
       
   823         /**
       
   824         * Returns the instance of tis class.
       
   825         * @param aBuddyId, buddyId id.
       
   826         * @return CVIMPSTProcessFriendRequestItem, instance of this class.
       
   827         */
       
   828         static CVIMPSTProcessUnknownContactItem* NewL(CVIMPSTProcessArray& aParent, const TDesC& aBuddyId);
       
   829         
       
   830         /**
       
   831          * symbain way of construction
       
   832          * @param aBuddyId, requestor id.
       
   833          */
       
   834         void ConstructL(const TDesC& aBuddyId);
       
   835         
       
   836         /**
       
   837          * destructor
       
   838          */
       
   839         virtual ~CVIMPSTProcessUnknownContactItem();
       
   840         
       
   841     private:
       
   842 
       
   843          /**
       
   844           * C++ default constructor
       
   845           */
       
   846         CVIMPSTProcessUnknownContactItem(CVIMPSTProcessArray& aParent);
       
   847         
       
   848     public : // new method
       
   849         
       
   850         /**
       
   851          * Sets the messages pending status of the contact item 
       
   852          * @param aPendingMessageStatus: true if the contact has pending messages 
       
   853          * else false
       
   854          */
       
   855         void SetMsgPending(TBool aPendingMessageStatus);
       
   856 
       
   857         /**
       
   858          * gets the messages pending status of the contact item 
       
   859          * @return iSMsgPending: true if the contact has pending messages 
       
   860          * else false
       
   861          */
       
   862         TBool IsMsgPending();
       
   863         
       
   864     public: //From MImArrayItem
       
   865     
       
   866         /**
       
   867          * Returns the name of the contact item 
       
   868          * @return TPtrC, name of the contact item to be displayed
       
   869          */
       
   870         TPtrC GetItemNameText();
       
   871         
       
   872        /**
       
   873         * Returns the default type of the contact item 
       
   874         * @return TEnumsPC::TItem: type of the contact item as either 
       
   875         * EContactitem, EContactListItem etc
       
   876         */
       
   877         TVIMPSTEnums::TItem Type();
       
   878     
       
   879         
       
   880         /**
       
   881          * Get the index of the contact item from engine side model
       
   882          * @return TInt: index
       
   883          */
       
   884         inline TInt GetItemIndex()   
       
   885             {   
       
   886             return iIndex;    
       
   887             }
       
   888         
       
   889         /**
       
   890          * Set the index of the contact item from engine side model
       
   891          * @param TInt: aIndex
       
   892          */
       
   893         inline void SetItemIndex(TInt aIndex)   
       
   894             {  
       
   895             iIndex  = aIndex;
       
   896             }
       
   897         
       
   898         /**
       
   899          * @return the VPBK Contact Link
       
   900          */
       
   901         inline MVPbkContactLink* ContactLink()
       
   902             {
       
   903             return NULL;
       
   904             }
       
   905          
       
   906         /**
       
   907          * Returns the user id of the listbox item 
       
   908          * @return TPtrC, user id of the listbox item.
       
   909          */
       
   910         inline TPtrC GetItemUserId();
       
   911 
       
   912         /**
       
   913          * Returns the avatar index of the listbox item 
       
   914          * @return TInt: avatar index of the listbox item.
       
   915          */
       
   916         inline TInt  AvatarIndex() 
       
   917             {
       
   918             return KErrNone; // always return zero
       
   919             }
       
   920 
       
   921         /**
       
   922          * sets the avatar index of the listbox item 
       
   923          * @param aAvatarIndex: avatar index to be set 
       
   924          */
       
   925         inline void  SetAvatarIndex(TInt /*aAvatarIndex*/ ) 
       
   926             {
       
   927             // dummy not used
       
   928             }
       
   929         
       
   930         /**
       
   931          * Sets the name of the listbox item 
       
   932          * @param aName: Name of the listbox item to be set
       
   933          * @return void
       
   934          */
       
   935 
       
   936         void SetConversationOpen(TBool aConvOpen );
       
   937         
       
   938         /**
       
   939          * gets the messages pending status of the contact item 
       
   940          * @return iSMsgPending: true if the contact has pending messages 
       
   941          * else false
       
   942          */
       
   943         TBool IsConversationOpen(); 
       
   944         
       
   945         /**
       
   946          * returns status text of the contact
       
   947          */
       
   948         const TDesC& StatusText()
       
   949             {
       
   950             //NA
       
   951             return KNullDesC;
       
   952             }
       
   953         
       
   954         /**
       
   955          * returns online status of the contact
       
   956          */
       
   957         TVIMPSTEnums::TOnlineStatus OnlineStatus()
       
   958             {
       
   959             //NA
       
   960             return TVIMPSTEnums::EUnknown;
       
   961             }
       
   962         
       
   963         /*
       
   964          * Format and Reformat the string for listbox
       
   965          */
       
   966         void DoFormatStringL();
       
   967 
       
   968         /**
       
   969          * return formatted string needed for listbox for this item
       
   970          */
       
   971         TPtrC16 FormattedItemString();
       
   972         
       
   973     private://member variables.
       
   974         
       
   975         // Process Array
       
   976         CVIMPSTProcessArray& iParent;
       
   977         
       
   978         /**
       
   979          * The name of the listbox item (owned).
       
   980          */
       
   981          HBufC* iItemNameText;          
       
   982              
       
   983         /**
       
   984          * Index of the item in engines model class
       
   985          */
       
   986          TInt iIndex;
       
   987          
       
   988          // Owns, user id of item.
       
   989          HBufC* iUesrId;
       
   990          
       
   991          // if any message is pending
       
   992          
       
   993          TBool iSMsgPending;
       
   994          
       
   995          TBool iIsConversationOpen;
       
   996          
       
   997          HBufC* iFormattedString;
       
   998     };
       
   999     
       
  1000 #endif  //CVIMPSTPROCESSARRAYITEM_H