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: CLandmarkCmdGetLandmarks class implementation. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
23
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
19 |
#include <EPos_CPosLmOperation.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
20 |
#include <EPos_CPosLandmarkSearch.h> |
5 | 21 |
#include "clandmarkcmdgetlandmarks.h" |
22 |
#include "mlandmarkobserver.h" |
|
23 |
#include "clandmarkmanagehandlers.h" |
|
24 |
#include "clandmarkfilter.h" |
|
25 |
#include "clandmarkmanageobjects.h" |
|
26 |
||
27 |
// ============================ MEMBER FUNCTIONS =============================== |
|
28 |
||
29 |
// ----------------------------------------------------------------------------- |
|
30 |
// CLandmarkCmdGetLandmarks::NewL( MLandmarkObserver* aObserver, CLandmarkManageObjects* aManageObjects ) |
|
31 |
// Two-phased constructor. |
|
32 |
// ----------------------------------------------------------------------------- |
|
33 |
// |
|
34 |
CLandmarkCmdGetLandmarks* CLandmarkCmdGetLandmarks::NewL( |
|
35 |
MLandmarkObserver* aObserver, CLandmarkManageObjects* aManageObjects ) |
|
36 |
{ |
|
37 |
CLandmarkCmdGetLandmarks* self = CLandmarkCmdGetLandmarks::NewLC ( |
|
38 |
aObserver, aManageObjects ); |
|
39 |
CleanupStack::Pop ( self ); |
|
40 |
return self; |
|
41 |
} |
|
42 |
||
43 |
// ----------------------------------------------------------------------------- |
|
44 |
// CLandmarkCmdGetLandmarks::NewLC( MLandmarkObserver* aObserver, CLandmarkManageObjects* aManageObjects ) |
|
45 |
// Two-phased constructor. |
|
46 |
// ----------------------------------------------------------------------------- |
|
47 |
// |
|
48 |
CLandmarkCmdGetLandmarks* CLandmarkCmdGetLandmarks::NewLC( |
|
49 |
MLandmarkObserver* aObserver, CLandmarkManageObjects* aManageObjects ) |
|
50 |
{ |
|
51 |
CLandmarkCmdGetLandmarks* self = new (ELeave) CLandmarkCmdGetLandmarks(aObserver,aManageObjects); |
|
52 |
CleanupStack::PushL ( self ); |
|
53 |
return self; |
|
54 |
} |
|
55 |
||
56 |
// ----------------------------------------------------------------------------- |
|
57 |
// CLandmarkCmdGetLandmarks::CLandmarkCmdGetLandmarks( MLandmarkObserver* aObserver, CLandmarkManageObjects* aManageObjects ) |
|
58 |
// C++ default constructor can NOT contain any code, that might leave. |
|
59 |
// ----------------------------------------------------------------------------- |
|
60 |
// |
|
61 |
CLandmarkCmdGetLandmarks::CLandmarkCmdGetLandmarks( |
|
62 |
MLandmarkObserver* aObserver, CLandmarkManageObjects* aManageObjects ) |
|
63 |
{ |
|
64 |
iObserver = aObserver; |
|
65 |
iManageObjects = aManageObjects; |
|
66 |
CActiveScheduler::Add ( this ); |
|
67 |
} |
|
68 |
||
69 |
// ----------------------------------------------------------------------------- |
|
70 |
// CLandmarkCmdGetLandmarks::~CLandmarkCmdGetLandmarks() |
|
71 |
// Destructor. |
|
72 |
// ----------------------------------------------------------------------------- |
|
73 |
// |
|
74 |
CLandmarkCmdGetLandmarks::~CLandmarkCmdGetLandmarks( ) |
|
75 |
{ |
|
76 |
Cancel ( ); |
|
77 |
delete iSearchOperation; |
|
78 |
} |
|
79 |
||
80 |
// ----------------------------------------------------------------------------- |
|
81 |
// CLandmarkCmdGetLandmarks::StartL( CLandmarkHandler* aHandle, TInt32 aTransactionId, CLandmarkFilter* aFilter ) |
|
82 |
// Start asynchronous operation. |
|
83 |
// ----------------------------------------------------------------------------- |
|
84 |
// |
|
85 |
void CLandmarkCmdGetLandmarks::StartL( CLandmarkHandler* aHandle, |
|
86 |
TInt32 aTransactionId, CLandmarkFilter& aFilter ) |
|
87 |
{ |
|
88 |
iHandle = aHandle; |
|
89 |
iTransactionId = aTransactionId; |
|
90 |
CPosLandmarkSearch* search = iHandle->LandmarkSearchHandle ( ); |
|
91 |
search->SetMaxNumOfMatches (aFilter.MaximumMatches ( ) ); |
|
92 |
iSearchOperation = search->StartLandmarkSearchL (aFilter.Criteria ( ), |
|
93 |
aFilter.LmSortPref ( ), aFilter.PreviousMatches ( ) ); |
|
94 |
NextStep ( ); |
|
95 |
} |
|
96 |
||
97 |
// ----------------------------------------------------------------------------- |
|
98 |
// CLandmarkCmdGetLandmarks::NextStep() |
|
99 |
// Execute the next step. |
|
100 |
// ----------------------------------------------------------------------------- |
|
101 |
// |
|
102 |
void CLandmarkCmdGetLandmarks::NextStep( ) |
|
103 |
{ |
|
104 |
iSearchOperation->NextStep (iStatus, iProgress ); |
|
105 |
SetActive ( ); |
|
106 |
} |
|
107 |
||
108 |
// ----------------------------------------------------------------------------- |
|
109 |
// CLandmarkCmdGetLandmarks::RunL() |
|
110 |
// Notify Observer on completion of the asynchronous call. |
|
111 |
// ----------------------------------------------------------------------------- |
|
112 |
// |
|
113 |
void CLandmarkCmdGetLandmarks::RunL( ) |
|
114 |
{ |
|
115 |
if ( iStatus == KPosLmOperationNotComplete ) |
|
116 |
{ |
|
117 |
NextStep ( ); |
|
118 |
} |
|
119 |
else |
|
120 |
{ |
|
121 |
User::LeaveIfError (iStatus.Int ( ) ); |
|
122 |
CPosLmItemIterator* iterator= NULL; |
|
123 |
CPosLandmarkSearch* search = iHandle->LandmarkSearchHandle ( ); |
|
124 |
iterator = search->MatchIteratorL ( ); |
|
125 |
CleanupStack::PushL (iterator ); |
|
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
126 |
TRAP_IGNORE(iObserver->HandleLandmarkItemsL(iterator,iTransactionId,KErrNone,iHandle)); |
5 | 127 |
CleanupStack::Pop (iterator ); |
128 |
//set active garbage collector |
|
129 |
if ( !iManageObjects->IsActive() ) |
|
130 |
{ |
|
131 |
iManageObjects->Start ( ); |
|
132 |
} |
|
133 |
} |
|
134 |
} |
|
135 |
||
136 |
// ----------------------------------------------------------------------------- |
|
137 |
// CLandmarkCmdGetLandmarks::DoCancel() |
|
138 |
// Cancel asynchronous call. |
|
139 |
// ----------------------------------------------------------------------------- |
|
140 |
// |
|
141 |
void CLandmarkCmdGetLandmarks::DoCancel( ) |
|
142 |
{ |
|
143 |
if ( iSearchOperation ) |
|
144 |
{ |
|
145 |
delete iSearchOperation; |
|
146 |
iSearchOperation = NULL; |
|
147 |
} |
|
148 |
} |
|
149 |
||
150 |
// ----------------------------------------------------------------------------- |
|
151 |
// CLandmarkCmdGetLandmarks::RunError( TInt aError ) |
|
152 |
// This functions handles a leave occurring in the request completion event handler. |
|
153 |
// ----------------------------------------------------------------------------- |
|
154 |
// |
|
155 |
TInt CLandmarkCmdGetLandmarks::RunError( TInt aError ) |
|
156 |
{ |
|
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
157 |
TRAP_IGNORE(iObserver->HandleLandmarkItemsL(NULL,iTransactionId,aError,NULL)); |
5 | 158 |
if ( !iManageObjects->IsActive() ) |
159 |
{ |
|
160 |
iManageObjects->Start ( ); |
|
161 |
} |
|
162 |
return KErrNone; |
|
163 |
} |
|
164 |
//End of file |