localconnectivityservice/obexserviceman/utils/src/obexutilsentryhandler.cpp
branchRCL_3
changeset 39 4096754ee773
parent 38 3dcb815346df
child 40 52a167391590
equal deleted inserted replaced
38:3dcb815346df 39:4096754ee773
     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 "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:  Handles the global progress dialog 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include <msvstore.h>
       
    22 #include <mmsvattachmentmanager.h>
       
    23 
       
    24 #include "obexutilsentryhandler.h"
       
    25 #include "obexutilsdebug.h"
       
    26 
       
    27 
       
    28 // ======== MEMBER FUNCTIONS ========
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // CObexutilsEntryhandler()
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 CObexutilsEntryhandler::CObexutilsEntryhandler(): CActive ( EPriorityNormal )
       
    35     {
       
    36     CActiveScheduler::Add(this);
       
    37     }
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // ConstructL()
       
    41 // ---------------------------------------------------------------------------
       
    42 //
       
    43 void CObexutilsEntryhandler::ConstructL()
       
    44     {
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // NewL()
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 CObexutilsEntryhandler* CObexutilsEntryhandler::NewL()
       
    52     {
       
    53     CObexutilsEntryhandler* self = CObexutilsEntryhandler::NewLC();
       
    54     CleanupStack::Pop( self );
       
    55     return self;
       
    56     }
       
    57 
       
    58 
       
    59 // ---------------------------------------------------------------------------
       
    60 // NewLC()
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 CObexutilsEntryhandler* CObexutilsEntryhandler::NewLC()
       
    64     {
       
    65     CObexutilsEntryhandler* self = new( ELeave ) CObexutilsEntryhandler();
       
    66     CleanupStack::PushL( self );
       
    67     self->ConstructL();
       
    68     return self;
       
    69     }
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // AddLinkAttachment()
       
    73 // ---------------------------------------------------------------------------
       
    74 //
       
    75 TInt CObexutilsEntryhandler::AddEntryAttachment(
       
    76     const TDesC &aFilePath, 
       
    77     CMsvAttachment* anAttachInfo, 
       
    78     CMsvStore* aStore)
       
    79     {
       
    80     FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::AddEntryAttachment()"));       
       
    81     
       
    82     iStatus = KRequestPending;
       
    83   
       
    84     TRAPD(error, aStore->AttachmentManagerL().AddLinkedAttachmentL(aFilePath,anAttachInfo, iStatus););
       
    85     
       
    86     if (error != KErrNone )
       
    87         {        
       
    88         //Complete request
       
    89         TRequestStatus* status = &iStatus;
       
    90         User::RequestComplete(status, error);
       
    91         }
       
    92     
       
    93     SetActive();
       
    94     iSyncWaiter.Start();
       
    95     
       
    96     FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::AddEntryAttachment() Done"));
       
    97     return iStatus.Int();
       
    98     }
       
    99 
       
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // From class CActive.
       
   103 // RunL()
       
   104 // ---------------------------------------------------------------------------
       
   105 //
       
   106 void CObexutilsEntryhandler::RunL()
       
   107     {
       
   108     if ( iSyncWaiter.IsStarted() )
       
   109         {
       
   110         iSyncWaiter.AsyncStop();
       
   111         }
       
   112     FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::RunL() Done"));           
       
   113     }
       
   114 
       
   115 // ---------------------------------------------------------------------------
       
   116 // ~CObexutilslinkhandler()
       
   117 // ---------------------------------------------------------------------------
       
   118 //
       
   119 CObexutilsEntryhandler::~CObexutilsEntryhandler()
       
   120     {
       
   121     FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::Destructor"));     
       
   122     Cancel();    
       
   123     }
       
   124 
       
   125 // ---------------------------------------------------------------------------
       
   126 // From class CActive.
       
   127 // DoCancel()
       
   128 // ---------------------------------------------------------------------------
       
   129 //
       
   130 void CObexutilsEntryhandler::DoCancel()
       
   131     {
       
   132     FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::DoCancel()"));           
       
   133     if ( iSyncWaiter.IsStarted() )
       
   134         {
       
   135         iSyncWaiter.AsyncStop();
       
   136         }
       
   137     FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::DoCancel() done"));               
       
   138     }