|
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_CATEGORIES_CONTAINER_H__ |
|
21 #define __LANDMARKS_CATEGORIES_CONTAINER_H__ |
|
22 |
|
23 |
|
24 #include "LandmarksContainerBase.h" |
|
25 #include <coecobs.h> |
|
26 |
|
27 |
|
28 class CLandmarksCategoriesModel; |
|
29 class CLandmarksDbEventHandler; |
|
30 class CLandmarksApplicationEngine; |
|
31 class CPosLandmarkCategory; |
|
32 class CEikMenuBar; |
|
33 |
|
34 |
|
35 |
|
36 /** |
|
37 * This is the categories container that contains a listbox and a search field |
|
38 * for listing categories. |
|
39 */ |
|
40 class CLandmarksCategoriesContainer : public CLandmarksContainerBase, |
|
41 public MCoeControlObserver |
|
42 { |
|
43 public: // Constructors and destructor |
|
44 |
|
45 /** |
|
46 * C++ constructor. |
|
47 * |
|
48 * @param aView the parent view |
|
49 * @param aEngine the landmark engine |
|
50 * @param aMenuBar the categories menubar |
|
51 */ |
|
52 CLandmarksCategoriesContainer( |
|
53 CAknView& aView, |
|
54 CLandmarksApplicationEngine& aEngine, |
|
55 CEikMenuBar& aMenuBar); |
|
56 |
|
57 /** |
|
58 * Symbian 2nd phase constructor. Should be called after constructor to |
|
59 * fully construct the object. |
|
60 * |
|
61 * @param aRect the rectangle this Container will be drawn to |
|
62 */ |
|
63 void ConstructL(const TRect& aRect); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 ~CLandmarksCategoriesContainer(); |
|
69 |
|
70 public: // New functions |
|
71 |
|
72 /** |
|
73 * Displays a onfirmation dialog and deletes the current category if |
|
74 * positive response. |
|
75 */ |
|
76 void DeleteCategoryL(); |
|
77 |
|
78 /** |
|
79 * Returns the current category id. |
|
80 * |
|
81 * @return the current category id |
|
82 */ |
|
83 TPosLmItemId CurrentCategoryId(); |
|
84 |
|
85 /** |
|
86 * Indicates whether a category is global or not. |
|
87 * |
|
88 * @return ETrue if global, EFalse otherwise. |
|
89 */ |
|
90 TBool IsGlobalL(); |
|
91 |
|
92 public: // from CoeControl |
|
93 |
|
94 /** |
|
95 * OfferKeyEventL handles key events. |
|
96 * |
|
97 * @param aKeyEvent the key event |
|
98 * @param aType the type of key event |
|
99 * @return EKeyWasConsumed if keyevent was handled, EKeyWasNotConsumed |
|
100 * otherwise |
|
101 */ |
|
102 TKeyResponse OfferKeyEventL( |
|
103 const TKeyEvent& aKeyEvent, TEventCode aType); |
|
104 |
|
105 public: // From MLandmarksOperationObserver |
|
106 |
|
107 /** |
|
108 * NotifyOperationProgressL notifies the progress and status of an |
|
109 * asynchronous operation. |
|
110 * |
|
111 * @param aOperation the type of operation that is reported. |
|
112 * @param aProgress the progress of the operation. |
|
113 * @param aErrorCode the status of the operation. |
|
114 */ |
|
115 void NotifyOperationProgressL( |
|
116 TOperation aOperation, |
|
117 TInt aProgress, |
|
118 TInt aErrorCode); |
|
119 |
|
120 public: // From MLandmarksDbObserver |
|
121 |
|
122 /** |
|
123 * NotifyDbEventL notifies that an event has occurred in the default |
|
124 * landmark database. |
|
125 * |
|
126 * @param aEvent contains info about the event. |
|
127 * @param aErrorCode possible error codes if reporting the event was |
|
128 * not successful. |
|
129 */ |
|
130 void NotifyDbEventL(TPosLmEvent& aEvent, TInt aErrorCode); |
|
131 |
|
132 public: // From MCoeControlObserver |
|
133 |
|
134 /** |
|
135 * HandleControlEventL handles an event from an observed control. |
|
136 * |
|
137 * @param aControl the control that reported the event |
|
138 * @param aEventType contains info about the event |
|
139 */ |
|
140 void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType); |
|
141 |
|
142 private: |
|
143 |
|
144 /** |
|
145 * StartUpdateListBoxL initiates an asynchronous refresh of the listbox. |
|
146 */ |
|
147 void StartUpdateListBoxL(); |
|
148 |
|
149 /** |
|
150 * HandleSearchReadyL updates the state of this class when a search |
|
151 * operation has completed. |
|
152 * |
|
153 * @param aErrorCode the error code of the search operation |
|
154 */ |
|
155 void HandleSearchReadyL(TInt aErrorCode); |
|
156 |
|
157 /** |
|
158 * HandleReadReadyL updates the state of this class when a read |
|
159 * operation has completed. |
|
160 * |
|
161 * @param aErrorCode the error code of the search operation |
|
162 */ |
|
163 void HandleReadReadyL(TInt aErrorCode); |
|
164 |
|
165 private: // Data |
|
166 |
|
167 //! The menubar displayed for this vew |
|
168 CEikMenuBar& iMenuBar; |
|
169 |
|
170 //! Contains the data model for the listbox |
|
171 CLandmarksCategoriesModel* iModel; |
|
172 |
|
173 //! Indicates if the first page of landmarks has been read. |
|
174 TBool iReadingFirstPage; |
|
175 }; |
|
176 |
|
177 |
|
178 #endif // __LANDMARKS_CATEGORIES_CONTAINER_H__ |
|
179 |