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