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