author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 22:59:08 +0300 | |
branch | RCL_3 |
changeset 46 | 5146369cfdc9 |
parent 26 | 5d0ec8b709be |
permissions | -rw-r--r-- |
5 | 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: CLandmarkManageObjects class implementation. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#include "clandmarkmanageobjects.h" |
|
20 |
#include "clandmarkcmdbase.h" |
|
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
21 |
#include "clandmarkdummyao.h" |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
22 |
#include "clandmarkoperation.h" |
5 | 23 |
|
24 |
// ============================ MEMBER FUNCTIONS =============================== |
|
25 |
||
26 |
// ----------------------------------------------------------------------------- |
|
27 |
// CLandmarkManageObjects::NewL() |
|
28 |
// Two-phased constructor. |
|
29 |
// ----------------------------------------------------------------------------- |
|
30 |
// |
|
31 |
CLandmarkManageObjects* CLandmarkManageObjects::NewL( ) |
|
32 |
{ |
|
33 |
CLandmarkManageObjects* self = new (ELeave) CLandmarkManageObjects(); |
|
34 |
return self; |
|
35 |
} |
|
36 |
||
37 |
// ----------------------------------------------------------------------------- |
|
38 |
// CLandmarkManageObjects::CLandmarkManageObjects() |
|
39 |
// C++ default constructor can NOT contain any code, that might leave. |
|
40 |
// ----------------------------------------------------------------------------- |
|
41 |
// |
|
42 |
CLandmarkManageObjects::CLandmarkManageObjects( ) : |
|
43 |
CActive(EPriorityNormal) |
|
44 |
{ |
|
45 |
CActiveScheduler::Add (this ); |
|
46 |
} |
|
47 |
||
48 |
// ----------------------------------------------------------------------------- |
|
49 |
// CLandmarkManageObjects::~CLandmarkManageObjects() |
|
50 |
// Destructor. |
|
51 |
// ----------------------------------------------------------------------------- |
|
52 |
// |
|
53 |
CLandmarkManageObjects::~CLandmarkManageObjects( ) |
|
54 |
{ |
|
55 |
Cancel ( ); |
|
56 |
iObjects.ResetAndDestroy ( ); |
|
57 |
iObjects.Close(); |
|
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
58 |
iDummyObjects.ResetAndDestroy(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
59 |
iDummyObjects.Close(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
60 |
iOrgObjects.ResetAndDestroy(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
61 |
iOrgObjects.Close(); |
5 | 62 |
} |
63 |
||
64 |
// ----------------------------------------------------------------------------- |
|
65 |
// CLandmarkManageObjects::Start() |
|
66 |
// Start asynchronous operation. |
|
67 |
// ----------------------------------------------------------------------------- |
|
68 |
// |
|
69 |
void CLandmarkManageObjects::Start( ) |
|
70 |
{ |
|
71 |
SetActive ( ); |
|
72 |
TRequestStatus* status = &iStatus; |
|
73 |
User::RequestComplete (status, KErrNone ); |
|
74 |
} |
|
75 |
||
76 |
// ----------------------------------------------------------------------------- |
|
77 |
// CLandmarkManageObjects::AppendL( CLandmarkCmdBase* aObject ) |
|
78 |
// Execute the next step. |
|
79 |
// ----------------------------------------------------------------------------- |
|
80 |
// |
|
81 |
void CLandmarkManageObjects::AppendL( CLandmarkCmdBase* aObject ) |
|
82 |
{ |
|
83 |
iObjects.AppendL (aObject ); |
|
84 |
} |
|
85 |
||
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
86 |
void CLandmarkManageObjects::AppendL(CLandmarkDummyAO* aObject) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
87 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
88 |
iDummyObjects.AppendL(aObject); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
89 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
90 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
91 |
void CLandmarkManageObjects::AppendL(CLandmarkOperation* aObject) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
92 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
93 |
iOrgObjects.AppendL(aObject); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
94 |
} |
5 | 95 |
// ----------------------------------------------------------------------------- |
96 |
// CLandmarkManageObjects::CancelObject() |
|
97 |
// Execute the next step. |
|
98 |
// ----------------------------------------------------------------------------- |
|
99 |
// |
|
100 |
void CLandmarkManageObjects::CancelObject( TInt32 aTransactionId ) |
|
101 |
{ |
|
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
102 |
TBool isDone = EFalse; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
103 |
TInt count = iObjects.Count(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
104 |
for (TInt i = 0; i < count; ++i) |
5 | 105 |
{ |
106 |
if ( iObjects[i]->TransactionId ( )== aTransactionId ) |
|
107 |
{ |
|
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
108 |
iObjects[i]->Cancel(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
109 |
isDone = ETrue; |
5 | 110 |
break; |
111 |
} |
|
112 |
} |
|
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
113 |
if( !isDone ) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
114 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
115 |
count = iOrgObjects.Count(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
116 |
for (TInt i = 0; i < count; ++i) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
117 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
118 |
if (iOrgObjects[i]->TransactionId() == aTransactionId) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
119 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
120 |
iOrgObjects[i]->Cancel(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
121 |
break; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
122 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
123 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
124 |
} |
5 | 125 |
} |
126 |
// ----------------------------------------------------------------------------- |
|
127 |
// CLandmarkManageObjects::RunL() |
|
128 |
// Notify Observer on completion of the asynchronous call. |
|
129 |
// ----------------------------------------------------------------------------- |
|
130 |
// |
|
131 |
void CLandmarkManageObjects::RunL( ) |
|
132 |
{ |
|
133 |
TInt count = iObjects.Count ( ); |
|
134 |
for (TInt i = 0; i< count; ++i ) |
|
135 |
{ |
|
136 |
if ( !iObjects[i]->IsActive() ) |
|
137 |
{ |
|
138 |
delete iObjects[i]; |
|
139 |
//Removes a node from the RPointerArray. |
|
140 |
iObjects.Remove (i ); |
|
141 |
//Decrement node count. |
|
142 |
--count; |
|
143 |
//Decrement index count since the present node |
|
144 |
//has been deleted. |
|
145 |
--i; |
|
146 |
} |
|
147 |
} |
|
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
148 |
count = iDummyObjects.Count(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
149 |
for (TInt i = 0; i < count; ++i) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
150 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
151 |
if (!iDummyObjects[i]->IsActive()) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
152 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
153 |
delete iDummyObjects[i]; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
154 |
//Removes a node from the RPointerArray. |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
155 |
iDummyObjects.Remove(i); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
156 |
//Decrement node count. |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
157 |
--count; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
158 |
//Decrement index count since the present node |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
159 |
//has been deleted. |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
160 |
--i; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
161 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
162 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
163 |
count = iOrgObjects.Count(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
164 |
for (TInt i = 0; i < count; ++i) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
165 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
166 |
if (!iOrgObjects[i]->IsActive()) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
167 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
168 |
delete iOrgObjects[i]; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
169 |
//Removes a node from the RPointerArray. |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
170 |
iOrgObjects.Remove(i); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
171 |
//Decrement node count. |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
172 |
--count; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
173 |
//Decrement index count since the present node |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
174 |
//has been deleted. |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
175 |
--i; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
176 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
177 |
} |
5 | 178 |
} |
179 |
||
180 |
// ----------------------------------------------------------------------------- |
|
181 |
// CLandmarkManageObjects::DoCancel() |
|
182 |
// Cancel asynchronous call. |
|
183 |
// ----------------------------------------------------------------------------- |
|
184 |
// |
|
185 |
void CLandmarkManageObjects::DoCancel( ) |
|
186 |
{ |
|
187 |
} |
|
188 |
//end of file |