pushmtm/MtmUtilSrc/PushMtmOperation.cpp
branchRCL_3
changeset 65 8e6fa1719340
parent 0 84ad3b177aa3
equal deleted inserted replaced
64:6385c4c93049 65:8e6fa1719340
       
     1 /*
       
     2 * Copyright (c) 2002 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 the License "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:  Implementation of CPushMtmOperation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 
       
    22 #include "PushMtmOperation.h"
       
    23 #include <msvids.h>
       
    24 #include <PushEntry.h>
       
    25 
       
    26 // ================= MEMBER FUNCTIONS =======================
       
    27 
       
    28 // ---------------------------------------------------------
       
    29 // CPushMtmOperation::~CPushMtmOperation
       
    30 // ---------------------------------------------------------
       
    31 //
       
    32 EXPORT_C CPushMtmOperation::~CPushMtmOperation()
       
    33     {
       
    34     Cancel();
       
    35     delete iCEntry;
       
    36     }
       
    37 
       
    38 // ---------------------------------------------------------
       
    39 // CPushMtmOperation::StartL
       
    40 // ---------------------------------------------------------
       
    41 //
       
    42 EXPORT_C void CPushMtmOperation::StartL()
       
    43     {
       
    44     // Enable restart.
       
    45     Cancel();
       
    46 	SetActive();
       
    47     InvokeRun();
       
    48     }
       
    49 
       
    50 // ---------------------------------------------------------
       
    51 // CPushMtmOperation::ProgressL
       
    52 // ---------------------------------------------------------
       
    53 //
       
    54 EXPORT_C const TDesC8& CPushMtmOperation::ProgressL()
       
    55     {
       
    56     return iProgressPckg;
       
    57     }
       
    58 
       
    59 // ---------------------------------------------------------
       
    60 // CPushMtmOperation::CPushMtmOperation
       
    61 // ---------------------------------------------------------
       
    62 //
       
    63 EXPORT_C CPushMtmOperation::CPushMtmOperation( CMsvSession& aSession, 
       
    64                                                TMsvId aId, 
       
    65                                                TRequestStatus& aObserverRequestStatus ) 
       
    66 :   CMsvOperation( aSession, EPriorityStandard, aObserverRequestStatus ), 
       
    67     iEntryId( aId ), 
       
    68     iProgressPckg( iProgress )
       
    69     {
       
    70     iProgress.Reset();
       
    71     // The Push MTM has no services.
       
    72 	iService = KMsvLocalServiceIndexEntryId;
       
    73     // The operation belongs to the Push MTM.
       
    74 	iMtm = KUidMtmWapPush;
       
    75     CActiveScheduler::Add( this );
       
    76     }
       
    77 
       
    78 // ---------------------------------------------------------
       
    79 // CPushMtmOperation::InvokeRun
       
    80 // ---------------------------------------------------------
       
    81 //
       
    82 EXPORT_C void CPushMtmOperation::InvokeRun()
       
    83     {
       
    84     TRequestStatus* status = &iStatus;
       
    85     User::RequestComplete( status, KErrNone );
       
    86     }
       
    87 
       
    88 // ---------------------------------------------------------
       
    89 // CPushMtmOperation::SignalObserver
       
    90 // ---------------------------------------------------------
       
    91 //
       
    92 EXPORT_C void CPushMtmOperation::SignalObserver( TInt aCompletionCode )
       
    93     {
       
    94     TRequestStatus* status = &iObserverRequestStatus;
       
    95     User::RequestComplete( status, aCompletionCode );
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------
       
    99 // CPushMtmOperation::ObserveEntryEventL
       
   100 // ---------------------------------------------------------
       
   101 //
       
   102 EXPORT_C void CPushMtmOperation::ObserveEntryEventL()
       
   103     {
       
   104     if ( iCEntry == NULL )
       
   105         {
       
   106         iCEntry = iMsvSession.GetEntryL( iEntryId );
       
   107         }
       
   108     iCEntry->AddObserverL( *this );
       
   109     }
       
   110 
       
   111 // ---------------------------------------------------------
       
   112 // CPushMtmOperation::CancelObserveEntryEvent
       
   113 // ---------------------------------------------------------
       
   114 //
       
   115 EXPORT_C void CPushMtmOperation::CancelObserveEntryEvent()
       
   116     {
       
   117     if ( iCEntry )
       
   118         {
       
   119         iCEntry->RemoveObserver( *this );
       
   120         }
       
   121     }
       
   122 
       
   123 // ---------------------------------------------------------
       
   124 // CPushMtmOperation::RunL
       
   125 // ---------------------------------------------------------
       
   126 //
       
   127 EXPORT_C void CPushMtmOperation::RunL()
       
   128     {
       
   129     SignalObserver( KErrNone );
       
   130     }
       
   131 
       
   132 // ---------------------------------------------------------
       
   133 // CPushMtmOperation::DoCancel
       
   134 // ---------------------------------------------------------
       
   135 //
       
   136 EXPORT_C void CPushMtmOperation::DoCancel()
       
   137     {
       
   138     CancelObserveEntryEvent();
       
   139     SignalObserver( KErrCancel );
       
   140     }
       
   141 
       
   142 // ---------------------------------------------------------
       
   143 // CPushMtmOperation::RunError
       
   144 // ---------------------------------------------------------
       
   145 //
       
   146 EXPORT_C TInt CPushMtmOperation::RunError( TInt aError )
       
   147     {
       
   148     CancelObserveEntryEvent();
       
   149     if ( aError )
       
   150         {
       
   151         // Signal the observer that a leave has occured.
       
   152         SignalObserver( aError );
       
   153         }
       
   154     return KErrNone;
       
   155     }
       
   156 
       
   157 // ---------------------------------------------------------
       
   158 // CPushMtmOperation::HandleEntryEventL
       
   159 // ---------------------------------------------------------
       
   160 //
       
   161 EXPORT_C void CPushMtmOperation::HandleEntryEventL( TMsvEntryEvent /*aEvent*/, 
       
   162                            TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/ )
       
   163     {
       
   164     }
       
   165 
       
   166 // End of file.