18
|
1 |
/*
|
|
2 |
* Copyright (c) 2004 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: LandmarksUi Content File - Abstract base class for landmark and category providers.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
#ifndef CLMKLMITEMLISTPROVIDER_H
|
|
26 |
#define CLMKLMITEMLISTPROVIDER_H
|
|
27 |
|
|
28 |
// INCLUDES
|
|
29 |
#include "CLmkListProviderBase.h"
|
|
30 |
#include "MLmkAOOperationObserver.h"
|
|
31 |
#include "MLmkDbObserver.h"
|
|
32 |
#include "landmarks.hrh"
|
|
33 |
#include <EPos_Landmarks.h> // Lm typedefs, constants etc.
|
|
34 |
#include <EPos_CPosLandmark.h>
|
|
35 |
|
|
36 |
// FORWARD DECLARATIONS
|
|
37 |
class CPosLandmarkDatabase;
|
|
38 |
class CLmkDbUtils;
|
|
39 |
class CLmkDbInitializer;
|
|
40 |
class CLmkAOOperation;
|
|
41 |
class CAknWaitDialog;
|
|
42 |
|
|
43 |
// CLASS DECLARATION
|
|
44 |
|
|
45 |
/**
|
|
46 |
* Abstract base class for landmark and category providers.
|
|
47 |
* Each concrete provider is responsible of notifying observer about all
|
|
48 |
* provider events.
|
|
49 |
*/
|
|
50 |
class CLmkLmItemListProvider
|
|
51 |
: public CLmkListProviderBase,
|
|
52 |
public MLmkAOOperationObserver,
|
|
53 |
public MLmkDbObserver
|
|
54 |
{
|
|
55 |
public: // Constructors and destructor
|
|
56 |
/**
|
|
57 |
* Destructor.
|
|
58 |
*/
|
|
59 |
~CLmkLmItemListProvider();
|
|
60 |
|
|
61 |
public: // New methods
|
|
62 |
/**
|
|
63 |
* Any item which is not found is ignored.
|
|
64 |
* @param aSelectedItems database ids for selected items
|
|
65 |
* @return array containing selected items, ownership is transferred
|
|
66 |
*/
|
|
67 |
IMPORT_C CArrayFix<TInt>* SelectedIndexesL(
|
|
68 |
const RArray<TPosLmItemId>& aSelectedItems ) const;
|
|
69 |
|
|
70 |
/**
|
|
71 |
* Any item which is not found is ignored.
|
|
72 |
* @param aSelectedIndexes will be set by this method
|
|
73 |
* @param aSelectedItems database ids for selected items
|
|
74 |
*/
|
|
75 |
IMPORT_C void GetSelectedIndexesL( CArrayFix<TInt>& aSelectedIndexes,
|
|
76 |
const RArray<TPosLmItemId>& aSelectedItems ) const;
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Leaves if appending an item to aSelectedItems fails.
|
|
80 |
* Panics if any index is out of bounds.
|
|
81 |
* @param aSelectedItems
|
|
82 |
* @param aSelectedIndexes
|
|
83 |
*/
|
|
84 |
IMPORT_C void GetSelectedItemIdsL(
|
|
85 |
RArray<TPosLmItemId>& aSelectedItems,
|
|
86 |
const CArrayFix<TInt>& aSelectedIndexes ) const;
|
|
87 |
|
|
88 |
IMPORT_C void GetAllItemIdsL(
|
|
89 |
RArray<TPosLmItemId>& aSelectedItems ) const;
|
|
90 |
|
|
91 |
/**
|
|
92 |
* Returns KErrNotFound if item is not found.
|
|
93 |
* @param aSelectedItem
|
|
94 |
* @return error code
|
|
95 |
*/
|
|
96 |
IMPORT_C TInt SelectedIndex( TPosLmItemId aSelectedItem ) const;
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Panics if index is out of bounds.
|
|
100 |
* @param aSelected
|
|
101 |
* @param aIndex
|
|
102 |
*/
|
|
103 |
IMPORT_C void GetSelectedItemId( TPosLmItemId& aSelected,
|
|
104 |
TInt aIndex ) const;
|
|
105 |
|
|
106 |
/**
|
|
107 |
* Any item which is not found is ignored.
|
|
108 |
* @param aSelectedItemsCount will set iSelectedItemsCount class variable by this method
|
|
109 |
*/
|
|
110 |
IMPORT_C void SetSelectedItemsCount( TInt aSelectedItemsCount );
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Any item which is not found is ignored.
|
|
114 |
* @param aItemId will be removed from the iIdArray
|
|
115 |
*/
|
|
116 |
IMPORT_C void RemoveItem( TPosLmItemId aItemId );
|
|
117 |
|
|
118 |
/**
|
|
119 |
* Any item which is not found is ignored.
|
|
120 |
* @param aOperationCmd will set the Database Operation Command
|
|
121 |
*/
|
|
122 |
IMPORT_C void SetOperationCmd( TLmkAppCmdId aOperationCmd );
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Any item which is not found is ignored.
|
|
126 |
* The Function must be used if no of selected items is greater than 10
|
|
127 |
* @param aSelectedItems, the item count should be greater than 10
|
|
128 |
* @param aType is a operation type
|
|
129 |
* @param aCategoryId will set the category id to filter for deletion
|
|
130 |
*/
|
|
131 |
IMPORT_C void RemoveItemsL( const RArray<TPosLmItemId>& aSelectedItems,
|
|
132 |
MLmkAOOperationObserver::TOperationTypes aType,
|
|
133 |
TPosLmItemId aCategoryId );
|
|
134 |
|
|
135 |
public: // From CLmkListProviderBase
|
|
136 |
void InitializeL();
|
|
137 |
TInt ItemCount() const;
|
|
138 |
TBool StartSearchingLandmarksL(
|
|
139 |
const TDesC& aSearchPattern,
|
|
140 |
TBool aSearchOnlyInPreviousMatches);
|
|
141 |
|
|
142 |
protected: // From MLmkAOOperationObserver
|
|
143 |
void HandleOperationL( TOperationTypes aType,
|
|
144 |
TReal32 aProgress,
|
|
145 |
TInt aStatus );
|
|
146 |
|
|
147 |
protected: // From MLmkDbObserver
|
|
148 |
void HandleDatabaseEvent( TPosLmEvent& aEvent );
|
|
149 |
|
|
150 |
protected: // New functions
|
|
151 |
/**
|
|
152 |
* "Template method" implemented by subclasses.
|
|
153 |
* List preparation cannot be done in construction phase, but
|
|
154 |
* only after database initialization is complete.
|
|
155 |
*/
|
|
156 |
virtual void PrepareListL() = 0;
|
|
157 |
virtual TBool PrepareListL(const TDesC& aSearchPattern,
|
|
158 |
TBool aSearchOnlyInPreviousMatches) = 0;
|
|
159 |
|
|
160 |
virtual void RemoveLandmarksL(const RArray<TPosLmItemId>& aSelectedItems ) = 0;
|
|
161 |
|
|
162 |
/**
|
|
163 |
* Internal helper method for performing steps after
|
|
164 |
* database initialization.
|
|
165 |
*/
|
|
166 |
void HandleDatabaseInitializedL();
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Internal helper method which handles provider errors. It
|
|
170 |
* resets iIdArray and notifies observers.
|
|
171 |
* @param aError error code
|
|
172 |
*/
|
|
173 |
void HandleError( TInt aError );
|
|
174 |
|
|
175 |
protected: // Constructors and destructor
|
|
176 |
/**
|
|
177 |
* C++ constructor.
|
|
178 |
* @param aDb
|
|
179 |
* @return newly instantiated object
|
|
180 |
*/
|
|
181 |
CLmkLmItemListProvider( CPosLandmarkDatabase& aDb );
|
|
182 |
|
|
183 |
/**
|
|
184 |
* By default Symbian 2nd phase constructor is private.
|
|
185 |
*/
|
|
186 |
void BaseConstructL();
|
|
187 |
|
|
188 |
/**
|
|
189 |
* This function gets the landmark from the database &
|
|
190 |
* update its icon with the category icon, if it is associated
|
|
191 |
* with one category.
|
|
192 |
*/
|
|
193 |
CPosLandmark* GetLandmarkLC(TInt aIndex);
|
|
194 |
|
|
195 |
protected: // Data
|
|
196 |
|
|
197 |
///Ref: landmark database
|
|
198 |
CPosLandmarkDatabase& iDb;
|
|
199 |
|
|
200 |
/// Provide all db items or only the ones in the array?
|
|
201 |
TBool iListAllItemsInDb;
|
|
202 |
|
|
203 |
/// TPosLmItemId list
|
|
204 |
RArray<TPosLmItemId> iIdArray;
|
|
205 |
|
|
206 |
///Own:
|
|
207 |
CLmkDbUtils* iDbUtils;
|
|
208 |
|
|
209 |
///Own: helper for initialization
|
|
210 |
CLmkDbInitializer* iInitializer;
|
|
211 |
|
|
212 |
//own: stores only those CPosLandmark objects, for which user has not set the icons
|
|
213 |
// explicitly
|
|
214 |
RPointerArray<CPosLandmark>* iIconChangeLmkArray;
|
|
215 |
|
|
216 |
///Own:
|
|
217 |
//CLmkAOOperation* iSearchAO;
|
|
218 |
|
|
219 |
///Own
|
|
220 |
TInt iSelectedItemsCount;
|
|
221 |
|
|
222 |
///Own : stores the search result count
|
|
223 |
TInt iCount;
|
|
224 |
|
|
225 |
//Own
|
|
226 |
TBool iRequestFromFindBox;
|
|
227 |
|
|
228 |
//Own : set the progress note flag to start CAOOperation
|
|
229 |
// to get asynchronous search result
|
|
230 |
TBool iOperationNotInUse;
|
|
231 |
|
|
232 |
//Own : sets the operation given from the ui
|
|
233 |
TLmkAppCmdId iOperationCmd;
|
|
234 |
|
|
235 |
//Own : Operation type assign for operation
|
|
236 |
MLmkAOOperationObserver::TOperationTypes iType;
|
|
237 |
|
|
238 |
//Own : to store the
|
|
239 |
RArray<TPosLmItemId> iSelectedForDelete;
|
|
240 |
|
|
241 |
//Own : no of landmarks to be deleted
|
|
242 |
TInt iItemsToDelete;
|
|
243 |
|
|
244 |
//Own : no of landmarks deleted while in the operation
|
|
245 |
TInt iItemsDeleted;
|
|
246 |
|
|
247 |
//Own is removelandmars operation going on.
|
|
248 |
TBool iIsRemoveLandmarks;
|
|
249 |
|
|
250 |
//Own : Waitnot for operations
|
|
251 |
CAknWaitDialog* iWaitNote;
|
|
252 |
|
|
253 |
//Own : CategoryId to remove landmarks from category operation
|
|
254 |
TPosLmItemId iCategoryId;
|
|
255 |
};
|
|
256 |
|
|
257 |
#endif // CLMKLMITEMLISTPROVIDER_H
|
|
258 |
|
|
259 |
// End of File
|