|
1 /* |
|
2 * Copyright (c) 2004-2005 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 * See class description below |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __LANDMARKS_CONTAINER_H__ |
|
21 #define __LANDMARKS_CONTAINER_H__ |
|
22 |
|
23 #include "LandmarksContainerBase.h" |
|
24 #include <coecobs.h> |
|
25 |
|
26 class CLandmarksApplicationEngine; |
|
27 class CAknNavigationDecorator; |
|
28 class CLandmarksModel; |
|
29 |
|
30 /** |
|
31 * This is the landmarks container that contains a listbox and a search field |
|
32 * for listing landmarks. |
|
33 */ |
|
34 class CLandmarksContainer : |
|
35 public CLandmarksContainerBase, |
|
36 public MCoeControlObserver |
|
37 { |
|
38 public: // Constructors and destructor |
|
39 |
|
40 /** |
|
41 * C++ constructor. |
|
42 * |
|
43 * @param aView parent view |
|
44 * @param aEngine the landmark engine |
|
45 * @param aNaviDecorator the tab group to hide when editing landmarks |
|
46 */ |
|
47 CLandmarksContainer( |
|
48 CAknView& aView, |
|
49 CLandmarksApplicationEngine& aEngine, |
|
50 CAknNavigationDecorator* aNaviDecorator); |
|
51 |
|
52 /** |
|
53 * Symbian 2nd phase constructor. Should be called after constructor to |
|
54 * fully construct the object. |
|
55 * |
|
56 * @param aRect the rectangle this Container will be drawn to |
|
57 */ |
|
58 void ConstructL(const TRect& aRect); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 ~CLandmarksContainer(); |
|
64 |
|
65 public: // New functions |
|
66 |
|
67 /** |
|
68 * Gets currently highlighted landmarks |
|
69 * @return The landmark item id. |
|
70 */ |
|
71 TPosLmItemId CurrentLandmark(); |
|
72 |
|
73 /** Returns IDs of currentlyt selected items */ |
|
74 void GetSelectedLandmarksL( RArray<TPosLmItemId>& aItemIds ); |
|
75 |
|
76 /** |
|
77 * Displays a confirmation dialog and deletes the current landmark if |
|
78 * positive response. |
|
79 */ |
|
80 void DeleteLandmarkL(); |
|
81 |
|
82 public: // from CoeControl |
|
83 |
|
84 /** |
|
85 * OfferKeyEventL handles key events. |
|
86 * |
|
87 * @param aKeyEvent the key event |
|
88 * @param aType the type of key event |
|
89 * @return EKeyWasConsumed if keyevent was handled, EKeyWasNotConsumed |
|
90 * otherwise |
|
91 */ |
|
92 TKeyResponse OfferKeyEventL( |
|
93 const TKeyEvent& aKeyEvent, |
|
94 TEventCode aType); |
|
95 |
|
96 public: // From MLandmarksOperationObserver |
|
97 |
|
98 /** |
|
99 * NotifyOperationProgressL notifies the progress and status of an |
|
100 * asynchronous operation. |
|
101 * |
|
102 * @param aOperation the type of operation that is reported. |
|
103 * @param aProgress the progress of the operation. |
|
104 * @param aErrorCode the status of the operation. |
|
105 */ |
|
106 void NotifyOperationProgressL( |
|
107 TOperation aOperation, |
|
108 TInt aProgress, |
|
109 TInt aErrorCode); |
|
110 |
|
111 public: // From MLandmarksDbObserver |
|
112 |
|
113 /** |
|
114 * NotifyDbEventL notifies that an event has occurred in the default |
|
115 * landmark database. |
|
116 * |
|
117 * @param aEvent contains info about the event. |
|
118 * @param aErrorCode possible error codes if reporting the event was |
|
119 * not successful. |
|
120 */ |
|
121 void NotifyDbEventL(TPosLmEvent& aEvent, TInt aErrorCode); |
|
122 |
|
123 public: // From MCoeControlObserver |
|
124 |
|
125 /** |
|
126 * HandleControlEventL handles an event from an observed control. |
|
127 * |
|
128 * @param aControl the control that reported the event |
|
129 * @param aEventType contains info about the event |
|
130 */ |
|
131 void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType); |
|
132 |
|
133 private: |
|
134 |
|
135 /** |
|
136 * StartUpdateListBoxL initiates an asynchronous refresh of the listbox. |
|
137 */ |
|
138 void StartUpdateListBoxL(); |
|
139 |
|
140 /** |
|
141 * HandleSearchReadyL updates the state of this class when a search |
|
142 * operation has completed. |
|
143 * |
|
144 * @param aErrorCode the error code of the search operation |
|
145 */ |
|
146 void HandleSearchReadyL(TInt aErrorCode); |
|
147 |
|
148 /** |
|
149 * HandleReadReadyL updates the state of this class when a read |
|
150 * operation has completed. |
|
151 * |
|
152 * @param aErrorCode the error code of the search operation |
|
153 * @param aFinished ETrue if there are no more landmarks to read, |
|
154 * EFalse otherwise |
|
155 */ |
|
156 void HandleReadReadyL(TInt aErrorCode, TBool aFinished); |
|
157 |
|
158 /** |
|
159 * Indicates if it is necessary to refresh the listbox |
|
160 * when a landmark has been updated. |
|
161 * |
|
162 * @param aModifiedLandmark the id of the landmark that has been updated |
|
163 * @return ETrue if refresh is necessary, EFalse otherwise |
|
164 */ |
|
165 TBool IsRefreshNeededL(TPosLmItemId& aModifiedLandmark); |
|
166 |
|
167 /** |
|
168 * Stores the name of the current landmark. |
|
169 */ |
|
170 void StoreCurrentLandmarkNameL(); |
|
171 |
|
172 private: // Data |
|
173 |
|
174 //! Decorates the navi pane (with navigation arrows etc) |
|
175 CAknNavigationDecorator* iNaviDecorator; |
|
176 |
|
177 //! The data model for the listbox |
|
178 CLandmarksModel* iModel; |
|
179 |
|
180 //! Indicates if the first page of landmarks has been read. |
|
181 TBool iReadingFirstPage; |
|
182 |
|
183 //! Keeps the name of the current item |
|
184 HBufC* iCurrentName; |
|
185 |
|
186 //! Indicates if the landmark list is being refreshed |
|
187 TBool iIsActive; |
|
188 }; |
|
189 |
|
190 #endif // __LANDMARKS_CONTAINER_H__ |