64
|
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: Location history manager class definition
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CESMRLOCATIONHISTORYMANAGER_H
|
|
20 |
#define CESMRLOCATIONHISTORYMANAGER_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <e32base.h>
|
|
24 |
#include <cenrepnotifyhandler.h>
|
|
25 |
|
|
26 |
class MESMRLocationHistoryItemFactory;
|
|
27 |
class CESMRLocationHistoryItemFactory;
|
|
28 |
class MESMRLocationHistoryItem;
|
|
29 |
class CRepository;
|
|
30 |
|
|
31 |
// CLASS DECLARATION
|
|
32 |
/**
|
|
33 |
* Location history manager
|
|
34 |
*/
|
|
35 |
NONSHARABLE_CLASS( CESMRLocationHistoryManager ) : public CBase,
|
|
36 |
public MCenRepNotifyHandlerCallback
|
|
37 |
{
|
|
38 |
public:
|
|
39 |
/**
|
|
40 |
* Two-phased constructor.
|
|
41 |
* Creates a new instance of class
|
|
42 |
*
|
|
43 |
* @return CESMRLocationHistoryManager instance
|
|
44 |
*/
|
|
45 |
static CESMRLocationHistoryManager* NewL();
|
|
46 |
|
|
47 |
/**
|
|
48 |
* Two-phased constructor.
|
|
49 |
* Creates a new instance of class
|
|
50 |
* and leaves it on the cleanupstack
|
|
51 |
*
|
|
52 |
* @return CESMRLocationHistoryManager instance
|
|
53 |
*/
|
|
54 |
static CESMRLocationHistoryManager* NewLC();
|
|
55 |
|
|
56 |
/**
|
|
57 |
* C++ Destructor.
|
|
58 |
*/
|
|
59 |
virtual ~CESMRLocationHistoryManager();
|
|
60 |
|
|
61 |
public: // new methods
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Updates the location history with the given location history item
|
|
65 |
*
|
|
66 |
* @param aItem location history item to be used to update location history
|
|
67 |
*/
|
|
68 |
void UpdateLocationHistoryL( const MESMRLocationHistoryItem* aItem );
|
|
69 |
|
|
70 |
/**
|
|
71 |
* Returns the location history item from index position
|
|
72 |
*
|
|
73 |
* @param aIndex position of the wanted item
|
|
74 |
*
|
|
75 |
* @return the location history item at given position
|
|
76 |
*/
|
|
77 |
const MESMRLocationHistoryItem& LocationHistoryItemL( TInt aIndex );
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Returns the number of location history items available
|
|
81 |
*
|
|
82 |
* @return the number of location history items available
|
|
83 |
*/
|
|
84 |
TUint ItemCount();
|
|
85 |
|
|
86 |
/**
|
|
87 |
* Creates a location history item. Ownership is transferred to
|
|
88 |
* caller.
|
|
89 |
*
|
|
90 |
* @param aAddress Address for the location history item
|
|
91 |
* @param aUrl Url for the location history item
|
|
92 |
*
|
|
93 |
* @return Pointer to created location history item object.
|
|
94 |
*/
|
|
95 |
MESMRLocationHistoryItem* CreateLocationHistoryItemL(
|
|
96 |
const TDesC& aAddress,
|
|
97 |
const TDesC& aUrl );
|
|
98 |
|
|
99 |
protected:
|
|
100 |
/**
|
|
101 |
* C++ default constructor.
|
|
102 |
*/
|
|
103 |
CESMRLocationHistoryManager();
|
|
104 |
|
|
105 |
private: // From MCenRepNotifyHandlerCallback
|
|
106 |
void HandleNotifyGeneric( TUint32 aId );
|
|
107 |
|
|
108 |
private:
|
|
109 |
/**
|
|
110 |
* ConstructL
|
|
111 |
*/
|
|
112 |
void ConstructL();
|
|
113 |
|
|
114 |
/**
|
|
115 |
* Reads the location order from central repository
|
|
116 |
*/
|
|
117 |
void ReadOrderDataL();
|
|
118 |
|
|
119 |
/**
|
|
120 |
* Reads the location history from central repository
|
|
121 |
*/
|
|
122 |
void ReadHistoryDataL();
|
|
123 |
|
|
124 |
private: // data
|
|
125 |
|
|
126 |
/// Own: Central Repository session
|
|
127 |
CRepository* iCRSession;
|
|
128 |
|
|
129 |
/// Own: Central Repository observer
|
|
130 |
CCenRepNotifyHandler* iNotifyHandler;
|
|
131 |
|
|
132 |
/// own: list of location history items
|
|
133 |
/**
|
|
134 |
* Notice that this list represents the contents of location history cenrep keys
|
|
135 |
* so that first key is always mapped to first list item. I.e. this list is never sorted
|
|
136 |
*/
|
|
137 |
RPointerArray<MESMRLocationHistoryItem> iHistoryList;
|
|
138 |
|
|
139 |
// location history item sort order
|
|
140 |
RArray<TUint> iOrder;
|
|
141 |
|
|
142 |
/// own: location history item factory instance
|
|
143 |
CESMRLocationHistoryItemFactory* iFactory;
|
|
144 |
|
|
145 |
// Maximum number of location history items available
|
|
146 |
TInt iMaxCount;
|
|
147 |
};
|
|
148 |
|
|
149 |
#endif // CESMRLOCATIONHISTORYMANAGER_H
|
|
150 |
|
|
151 |
// End of File
|