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