syncmlfw/ds/hostserver/dshostserverbase/src/Nsmldshostsessioncancel.cpp
branchRCL_3
changeset 12 9e9792ae22e3
child 13 86979fe66c4c
equal deleted inserted replaced
11:06f47423ecee 12:9e9792ae22e3
       
     1 /*
       
     2 * ==============================================================================
       
     3 *  Name        : Nsmldshostsessioncancel.cpp
       
     4 *  Part of     : Nokia SyncML / DS Loader Framework
       
     5 *  Description : Handling Session cancel for DS host server.
       
     6 *  Version     : $Revision: 41 $ $Modtime: 09.02.10 8:05 $
       
     7 *
       
     8 *  Copyright © 2005 Nokia Corporation.
       
     9 *  This material, including documentation and any related 
       
    10 *  computer programs, is protected by copyright controlled by 
       
    11 *  Nokia Corporation. All rights are reserved. Copying, 
       
    12 *  including reproducing, storing, adapting or translating, any 
       
    13 *  or all of this material requires the prior written consent of 
       
    14 *  Nokia Corporation. This material also contains confidential 
       
    15 *  information which may not be disclosed to others without the 
       
    16 *  prior written consent of Nokia Corporation.
       
    17 * ==============================================================================
       
    18 */
       
    19 //#include <sbdefs.h>
       
    20 #include <d32dbms.h>
       
    21 #include <nsmldebug.h>
       
    22 #include <DataSyncInternalPSKeys.h>
       
    23 #include "nsmldshostsessioncanceleventhandler.h"
       
    24 #include "nsmldshostsessioncancel.h"
       
    25 // --------------------------------------------------------------------------
       
    26 // CNSmlHostSessionCancel* CNSmlHostSessionCancel::NewL( MNSmlDsHostSessionCancelEventHandler* aHandler )
       
    27 // --------------------------------------------------------------------------
       
    28 //
       
    29 CNSmlHostSessionCancel* CNSmlHostSessionCancel::NewL( MNSmlDsHostSessionCancelEventHandler* aHandler )
       
    30 	{
       
    31 	CNSmlHostSessionCancel* self = new (ELeave) CNSmlHostSessionCancel( aHandler );
       
    32 	CleanupStack::PushL(self);
       
    33     self->ConstructL();
       
    34     CleanupStack::Pop(); // self
       
    35 	return self;
       
    36 	}
       
    37 
       
    38 // --------------------------------------------------------------------------
       
    39 // CNSmlHostSessionCancel::CNSmlHostSessionCancel( MNSmlDsHostSessionCancelEventHandler* aHandler )
       
    40 // --------------------------------------------------------------------------
       
    41 //
       
    42 CNSmlHostSessionCancel::CNSmlHostSessionCancel( MNSmlDsHostSessionCancelEventHandler* aHandler ) :
       
    43     CActive( EPriorityNormal ),
       
    44     iHandler( aHandler )
       
    45 	{
       
    46     CActiveScheduler::Add(this);
       
    47 	}
       
    48 
       
    49 // --------------------------------------------------------------------------
       
    50 // void CNSmlHostSessionCancel::Subscribe()
       
    51 // --------------------------------------------------------------------------
       
    52 //
       
    53 void CNSmlHostSessionCancel::Subscribe()
       
    54     {
       
    55     if ( !IsActive() )
       
    56         {
       
    57         iProperty.Subscribe( iStatus );    
       
    58         SetActive();
       
    59         }
       
    60     }
       
    61 
       
    62 // --------------------------------------------------------------------------
       
    63 // void CNSmlHostSessionCancel::ConstructL()
       
    64 // --------------------------------------------------------------------------
       
    65 //
       
    66 void CNSmlHostSessionCancel::ConstructL()
       
    67     {
       
    68     iProperty.Attach( KPSUidNSmlDSSyncApp, KDsJobCancel );
       
    69     Subscribe();    
       
    70     }
       
    71 
       
    72 // --------------------------------------------------------------------------
       
    73 // CNSmlHostSessionCancel::~CNSmlHostSessionCancel()
       
    74 // --------------------------------------------------------------------------
       
    75 //
       
    76 CNSmlHostSessionCancel::~CNSmlHostSessionCancel()
       
    77 	{
       
    78     Cancel();
       
    79     iProperty.Close();
       
    80     }
       
    81 
       
    82 // --------------------------------------------------------------------------
       
    83 // void CNSmlHostSessionCancel::RunL()
       
    84 // --------------------------------------------------------------------------
       
    85 //
       
    86 void CNSmlHostSessionCancel::RunL()
       
    87     {
       
    88     _DBG_FILE("CNSmlHostSessionCancel::RunL() : Begin");
       
    89     
       
    90     TInt value(0);
       
    91     iProperty.Get( value );
       
    92     
       
    93     if( value == KErrCancel)
       
    94         {
       
    95         _DBG_FILE("CNSmlHostSessionCancel::RunL() :: user has canceled the operation");
       
    96 
       
    97         //user has canceled the opeartion inform session
       
    98         iHandler->HandleCancelEventL();
       
    99         }
       
   100     else
       
   101         {
       
   102         Subscribe();
       
   103         }
       
   104 
       
   105     _DBG_FILE("CNSmlHostSessionCancel::RunL() : End");
       
   106     }
       
   107 
       
   108 // --------------------------------------------------------------------------
       
   109 // void CNSmlHostSessionCancel::DoCancel()
       
   110 // --------------------------------------------------------------------------
       
   111 //
       
   112 void CNSmlHostSessionCancel::DoCancel()
       
   113     {
       
   114     iProperty.Cancel();
       
   115     }
       
   116 
       
   117 //  End of File