|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 #include "nmframeworkadapterheaders.h" |
|
18 |
|
19 /*! |
|
20 \class NmFwaDeleteMailboxOperation |
|
21 |
|
22 \brief NmFwaDeleteMailboxOperation is an async operation which deletes a mailbox. |
|
23 |
|
24 NmFwaDeleteMailboxOperation is an async operation which deletes a mailbox. |
|
25 \sa NmOperation |
|
26 */ |
|
27 |
|
28 /*! |
|
29 Constructor |
|
30 |
|
31 \param mailboxId Mailbox id to be deleted. |
|
32 \param mailClient Reference to mail client object. |
|
33 */ |
|
34 NmFwaDeleteMailboxOperation::NmFwaDeleteMailboxOperation( |
|
35 const NmId &mailboxId, |
|
36 CFSMailClient &mailClient) : |
|
37 mMailboxId(mailboxId), |
|
38 mMailClient(mailClient), |
|
39 mRequestId(NmNotFoundError) |
|
40 { |
|
41 NM_FUNCTION; |
|
42 |
|
43 mMailClient.IncReferenceCount(); |
|
44 } |
|
45 |
|
46 /*! |
|
47 Destructor |
|
48 */ |
|
49 NmFwaDeleteMailboxOperation::~NmFwaDeleteMailboxOperation() |
|
50 { |
|
51 NM_FUNCTION; |
|
52 |
|
53 doCancelOperation(); |
|
54 mMailClient.Close(); // decrease ref count |
|
55 } |
|
56 |
|
57 /*! |
|
58 Called after base object construction via timer event, runs the |
|
59 async operation. |
|
60 |
|
61 \sa NmOperation |
|
62 */ |
|
63 void NmFwaDeleteMailboxOperation::doRunAsyncOperation() |
|
64 { |
|
65 NM_FUNCTION; |
|
66 |
|
67 TRAPD(err, deleteMailboxL()); |
|
68 |
|
69 if (err != KErrNone) { |
|
70 completeOperation(NmGeneralError); |
|
71 } |
|
72 } |
|
73 |
|
74 /*! |
|
75 |
|
76 */ |
|
77 void NmFwaDeleteMailboxOperation::doCompleteOperation() |
|
78 { |
|
79 NM_FUNCTION; |
|
80 |
|
81 mRequestId = NmNotFoundError; |
|
82 } |
|
83 |
|
84 /*! |
|
85 |
|
86 */ |
|
87 void NmFwaDeleteMailboxOperation::doCancelOperation() |
|
88 { |
|
89 NM_FUNCTION; |
|
90 |
|
91 // delete mailbox operation is not cancellable |
|
92 } |
|
93 |
|
94 /*! |
|
95 Asynchronous request response message. |
|
96 |
|
97 \param aEvent Plugin event description. |
|
98 \param aRequestId Request id of asyncronous operation. |
|
99 */ |
|
100 void NmFwaDeleteMailboxOperation::RequestResponseL(TFSProgress aEvent, |
|
101 TInt aRequestId) |
|
102 { |
|
103 NM_FUNCTION; |
|
104 |
|
105 TFSProgress::TFSProgressStatus status = aEvent.iProgressStatus; |
|
106 |
|
107 if (aRequestId == mRequestId) { |
|
108 if (status == TFSProgress::EFSStatus_RequestComplete && !aEvent.iError) { |
|
109 completeOperation(NmNoError); |
|
110 } |
|
111 else { |
|
112 completeOperation(NmGeneralError); |
|
113 } |
|
114 } |
|
115 } |
|
116 |
|
117 /*! |
|
118 Removes the message. |
|
119 */ |
|
120 void NmFwaDeleteMailboxOperation::deleteMailboxL() |
|
121 { |
|
122 NM_FUNCTION; |
|
123 const TFSMailMsgId mailboxId(mMailboxId); |
|
124 mRequestId = mMailClient.DeleteMailBoxByUidL(mailboxId, *this); |
|
125 } |