| Start/ | End/ | |||
| True | False | - | Line | Source |
| 1 | /* | |||
| 2 | * =========================================================================== | |||
| 3 | * Name : cvimpstcmdchangeownstatus.cpp | |||
| 4 | * Part of : IMUiServiceTab/vimpstcmdprocess | |||
| 5 | * Description : | |||
| 6 | * Version : %version: 5.1.2 % | |||
| 7 | * | |||
| 8 | * Copyright © 2008 Nokia. All rights reserved. | |||
| 9 | * This material, including documentation and any related computer | |||
| 10 | * programs, is protected by copyright controlled by Nokia. All | |||
| 11 | * rights are reserved. Copying, including reproducing, storing, | |||
| 12 | * adapting or translating, any or all of this material requires the | |||
| 13 | * prior written consent of Nokia. This material also contains | |||
| 14 | * confidential information which may not be disclosed to others | |||
| 15 | * without the prior written consent of Nokia. | |||
| 16 | * ============================================================================ | |||
| 17 | */ | |||
| 18 | ||||
| 19 | // INCLUDE FILES | |||
| 20 | #include "cvimpstcmdchangeownstatus.h" | |||
| 21 | #include "mvimpstenginepresencesubservice.h" | |||
| 22 | ||||
| 23 | #include "vimpstcmd.hrh" | |||
| 24 | #include "mvimpstcmdobserver.h" | |||
| 25 | #include "vimpstdebugprint.h" | |||
| 26 | ||||
| 27 | #include <e32def.h> | |||
| 28 | #include "mvimpstengine.h" | |||
| 29 | #include "mvimpstenginesubservice.h" | |||
| 30 | ||||
| 31 | // Constants | |||
| 32 | ||||
| 33 | // -------------------------------------------------------------------------- | |||
| 34 | // CVIMPSTCmdChangeOwnStatus::CVIMPSTCmdChangeOwnStatus | |||
| 35 | // -------------------------------------------------------------------------- | |||
| 36 | // | |||
| 4 | 4 | 37 | CVIMPSTCmdChangeOwnStatus::CVIMPSTCmdChangeOwnStatus( | |
| 38 | const TInt aCommandId ,TStatusAndStatusText aStatus, | |||
| 39 | MVIMPSTEngine& aEngine) : | |||
| 40 | iCommandId( aCommandId ), | |||
| 41 | iStatus(aStatus.iStatus), | |||
| 42 | iEngine(aEngine) | |||
| 43 | { | |||
| 44 | iStatusText.Copy(aStatus.iStatusText); | |||
| 45 | } | |||
| 46 | ||||
| 47 | // -------------------------------------------------------------------------- | |||
| 48 | // CVIMPSTCmdChangeOwnStatus::~CVIMPSTCmdChangeOwnStatus | |||
| 49 | // -------------------------------------------------------------------------- | |||
| 50 | // | |||
| 4 | 4 | 51 | CVIMPSTCmdChangeOwnStatus::~CVIMPSTCmdChangeOwnStatus() | |
| 52 | { | |||
| 53 | ||||
| 54 | } | |||
| 55 | ||||
| 56 | // -------------------------------------------------------------------------- | |||
| 57 | // CVIMPSTCmdChangeOwnStatus::NewL | |||
| 58 | // -------------------------------------------------------------------------- | |||
| 59 | // | |||
| 4 | 0 | 60 | CVIMPSTCmdChangeOwnStatus* CVIMPSTCmdChangeOwnStatus::NewL( | |
| 61 | const TInt aCommandId,TStatusAndStatusText aStatus, | |||
| 62 | MVIMPSTEngine& aEngine) | |||
| 63 | { | |||
| 64 | CVIMPSTCmdChangeOwnStatus* self = new (ELeave ) CVIMPSTCmdChangeOwnStatus( aCommandId ,aStatus, aEngine); | |||
| 65 | self->ConstructL(); //use contsurctL if necessary | |||
| 66 | return self; | |||
| 67 | } | |||
| 68 | // -------------------------------------------------------------------------- | |||
| 69 | // CVIMPSTCmdChangeOwnStatus::ConstructL | |||
| 70 | // -------------------------------------------------------------------------- | |||
| 71 | // | |||
| 4 | 4 | 72 | void CVIMPSTCmdChangeOwnStatus::ConstructL() | |
| 73 | { | |||
| 74 | iError = KErrNone; | |||
| 75 | } | |||
| 76 | ||||
| 77 | // -------------------------------------------------------------------------- | |||
| 78 | // CVIMPSTCmdChangeOwnStatus::ExecuteLD | |||
| 79 | // -------------------------------------------------------------------------- | |||
| 80 | // | |||
| 4 | 4 | 81 | void CVIMPSTCmdChangeOwnStatus::ExecuteLD() | |
| 82 | { | |||
| 83 | CHAT_DP_FUNC_ENTER("CVIMPSTCmdChangeOwnStatus::ExecuteLD"); | |||
| 84 | //push to the cleanupstack | |||
| 85 | CleanupStack::PushL( this ); | |||
| 86 | ||||
| 87 | //Get Presence SubService | |||
| 88 | MVIMPSTEngineSubService* subService = | |||
| 89 | (iEngine.SubService(TVIMPSTEnums::EPresence)); | |||
| 90 | ||||
| 91 | if(subService) | |||
| 92 | { | |||
| 93 | MVIMPSTEnginePresenceSubService& presence = | |||
| 94 | MVIMPSTEnginePresenceSubService::Cast (*subService); | |||
| 95 | ||||
| 96 | if ( iStatus == TVIMPSTEnums::EInvisible) | |||
| 97 | { | |||
| 98 | //Status set to Appear Offline | |||
| 99 | iError = presence.PublishOwnPresenceL(iStatus, KNullDesC); | |||
| 100 | } | |||
| 101 | else | |||
| 102 | { | |||
| 103 | iError = presence.PublishOwnPresenceL(iStatus, iStatusText); | |||
| 104 | } | |||
| 105 | } | |||
| 106 | ||||
| 107 | if(iObserver) | |||
| 108 | { | |||
| 109 | iObserver->CommandFinishedL(*this); | |||
| 110 | } | |||
| 111 | ||||
| 112 | ||||
| 113 | ||||
| 114 | CHAT_DP_FUNC_ENTER("CVIMPSTCmdChangeOwnStatus:: CommandFinished"); | |||
| 115 | CleanupStack::PopAndDestroy(); | |||
| 116 | CHAT_DP_FUNC_DONE("CVIMPSTCmdChangeOwnStatus::ExecuteLD"); | |||
| 117 | } | |||
| 118 | ||||
| 119 | ||||
| 120 | // -------------------------------------------------------------------------- | |||
| 121 | // CVIMPSTCmdChangeOwnStatus::AddObserver | |||
| 122 | // -------------------------------------------------------------------------- | |||
| 123 | // | |||
| 2 | 2 | 124 | void CVIMPSTCmdChangeOwnStatus::AddObserver( MVIMPSTCmdObserver& aObserver ) | |
| 125 | { | |||
| 126 | // store the observer to notify the command completion | |||
| 127 | iObserver = &aObserver; | |||
| 128 | } | |||
| 129 | ||||
| 130 | ||||
| 131 | // -------------------------------------------------------------------------- | |||
| 132 | // CVIMPSTCmdChangeOwnStatus::CommandId | |||
| 133 | // -------------------------------------------------------------------------- | |||
| 134 | // | |||
| 4 | 0 | 135 | TInt CVIMPSTCmdChangeOwnStatus::CommandId() const | |
| 136 | { | |||
| 137 | return iCommandId; | |||
| 138 | } | |||
| 139 | ||||
| 140 | // -------------------------------------------------------------------------- | |||
| 141 | // CVIMPSTCmdChangeOwnStatus::Result | |||
| 142 | // -------------------------------------------------------------------------- | |||
| 143 | // | |||
| 2 | 0 | 144 | TInt CVIMPSTCmdChangeOwnStatus::Result() const | |
| 145 | { | |||
| 146 | //return valid data regd the command operation | |||
| 147 | return iError; | |||
| 148 | } | |||
| 149 | ||||
| 150 | // End of File | |||
| ***TER 100% (8/8) of SOURCE FILE cvimpstcmdchangeownstatus.cpp | ||||