uiservicetab/vimpstcmdprocess/src/cvimpstcmdchangeownavtar.cpp
changeset 15 81eeb8c83ce5
parent 0 5e5d6b214f4f
equal deleted inserted replaced
0:5e5d6b214f4f 15:81eeb8c83ce5
     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:  command process for set own avtar
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "cvimpstcmdchangeownavtar.h"
       
    21 
       
    22 #include "vimpstcmd.hrh"
       
    23 #include "mvimpstcmdobserver.h"
       
    24 #include "vimpstdebugprint.h" 
       
    25 
       
    26 #include <e32def.h>
       
    27 #include "mvimpstengine.h"
       
    28 #include "mvimpstenginepresencesubservice.h"
       
    29 #include "mvimpstenginesubservice.h"
       
    30 
       
    31 
       
    32 // --------------------------------------------------------------------------
       
    33 // CVIMPSTCmdChangeOwnAvtar::CVIMPSTCmdChangeOwnAvtar
       
    34 // --------------------------------------------------------------------------
       
    35 //
       
    36 CVIMPSTCmdChangeOwnAvtar::CVIMPSTCmdChangeOwnAvtar( 
       
    37         const TInt aCommandId ,const TAvatarData& aData,
       
    38         MVIMPSTEngine& aEngine) :            
       
    39             iCommandId( aCommandId ),
       
    40             iData(aData),
       
    41             iEngine(aEngine)
       
    42     {
       
    43     }
       
    44 
       
    45 // --------------------------------------------------------------------------
       
    46 // CVIMPSTCmdChangeOwnAvtar::~CVIMPSTCmdChangeOwnAvtar
       
    47 // --------------------------------------------------------------------------
       
    48 //
       
    49 CVIMPSTCmdChangeOwnAvtar::~CVIMPSTCmdChangeOwnAvtar()
       
    50     {    
       
    51     
       
    52     }
       
    53 
       
    54 // --------------------------------------------------------------------------
       
    55 // CVIMPSTCmdChangeOwnAvtar::NewL
       
    56 // --------------------------------------------------------------------------
       
    57 //
       
    58 CVIMPSTCmdChangeOwnAvtar* CVIMPSTCmdChangeOwnAvtar::NewL( 
       
    59         const TInt aCommandId,const TAvatarData& aData,
       
    60         MVIMPSTEngine& aEngine)
       
    61     {
       
    62     CVIMPSTCmdChangeOwnAvtar* self = new (ELeave ) CVIMPSTCmdChangeOwnAvtar( aCommandId ,aData, aEngine);
       
    63     self->ConstructL(); //use contsurctL if necessary
       
    64     return self;
       
    65     }
       
    66 // --------------------------------------------------------------------------
       
    67 // CVIMPSTCmdChangeOwnAvtar::ConstructL
       
    68 // --------------------------------------------------------------------------
       
    69 //
       
    70 void CVIMPSTCmdChangeOwnAvtar::ConstructL()
       
    71     {    
       
    72     iError = KErrNone;
       
    73     }
       
    74 
       
    75 // --------------------------------------------------------------------------
       
    76 // CVIMPSTCmdChangeOwnAvtar::ExecuteLD
       
    77 // --------------------------------------------------------------------------
       
    78 //
       
    79 void CVIMPSTCmdChangeOwnAvtar::ExecuteLD()
       
    80     {
       
    81     CHAT_DP_FUNC_ENTER("CVIMPSTCmdChangeOwnAvtar::ExecuteLD");
       
    82     //push to the cleanupstack
       
    83     CleanupStack::PushL( this );   
       
    84 	
       
    85 	//Get Presence SubService  			
       
    86    	MVIMPSTEngineSubService* subService =    	   
       
    87    	   			(iEngine.SubService(TVIMPSTEnums::EPresence));
       
    88     if(subService)
       
    89         {
       
    90         MVIMPSTEnginePresenceSubService& presence = 
       
    91         		MVIMPSTEnginePresenceSubService::Cast (*subService);
       
    92         presence.PublishOwnPresenceL(iData.iStatus, iData.iStatusText, iData.iFileName , iData.iMimeType, ETrue );
       
    93         }      
       
    94   
       
    95     CHAT_DP_FUNC_ENTER("CVIMPSTCmdChangeOwnAvtar:: CommandFinished");
       
    96 
       
    97     if(iObserver)
       
    98 	    {
       
    99 	    iObserver->CommandFinishedL(*this);
       
   100 	    }
       
   101 	CHAT_DP_FUNC_ENTER("CVIMPSTCmdChangeOwnAvtar:: CommandFinished");	
       
   102 	CleanupStack::PopAndDestroy();	
       
   103 	CHAT_DP_FUNC_DONE("CVIMPSTCmdChangeOwnAvtar::ExecuteLD");	
       
   104     }
       
   105 
       
   106 
       
   107 // --------------------------------------------------------------------------
       
   108 // CVIMPSTCmdChangeOwnAvtar::AddObserver
       
   109 // --------------------------------------------------------------------------
       
   110 //
       
   111 void CVIMPSTCmdChangeOwnAvtar::AddObserver( MVIMPSTCmdObserver& aObserver )
       
   112     {
       
   113     // store the observer to notify the command completion
       
   114     iObserver = &aObserver;
       
   115     }
       
   116 
       
   117 
       
   118 // --------------------------------------------------------------------------
       
   119 // CVIMPSTCmdChangeOwnAvtar::CommandId
       
   120 // --------------------------------------------------------------------------
       
   121 //
       
   122 TInt CVIMPSTCmdChangeOwnAvtar::CommandId() const
       
   123 	{
       
   124 	return iCommandId;	
       
   125 	}
       
   126 
       
   127 // --------------------------------------------------------------------------
       
   128 // CVIMPSTCmdChangeOwnAvtar::Result
       
   129 // --------------------------------------------------------------------------
       
   130 //
       
   131 TInt CVIMPSTCmdChangeOwnAvtar::Result() const
       
   132 	{
       
   133 	//return valid data regd the command operation
       
   134 	return iError;
       
   135 	}
       
   136 
       
   137 // End of File