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