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