|
1 /* |
|
2 * Copyright (c) 2005-2007 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: XDM GS plugin main list container. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef GS_XDMPLUGIN_CONTAINER_H |
|
22 #define GS_XDMPLUGIN_CONTAINER_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <bldvariant.hrh> |
|
26 #include <coeccntx.h> |
|
27 #include <eikclb.h> |
|
28 #include <eikmobs.h> |
|
29 #include <akntitle.h> |
|
30 #include <aknview.h> |
|
31 |
|
32 #include "XDMPlugin.hrh" |
|
33 |
|
34 |
|
35 // FORWARD DECLARATION |
|
36 class CGSListBoxItemTextArray; |
|
37 class CEikTextListBox; |
|
38 class CAknSingleStyleListBox; |
|
39 class CXDMPluginMainList; |
|
40 class CAknColumnListBox; |
|
41 class CAknViewAppUi; |
|
42 class CXDMPlugin; |
|
43 class CMainView; |
|
44 |
|
45 // CLASS DECLARATION |
|
46 |
|
47 /** |
|
48 * CXDMPluginContainer main list container class |
|
49 */ |
|
50 class CXDMPluginContainer : public CCoeControl, |
|
51 public MEikListBoxObserver, |
|
52 public MEikMenuObserver |
|
53 { |
|
54 public: // Constructors and destructor |
|
55 |
|
56 /** |
|
57 * Constructor |
|
58 */ |
|
59 CXDMPluginContainer(CAknView* aView); |
|
60 |
|
61 /** |
|
62 * Symbian OS constructor. |
|
63 * |
|
64 * @param aRect Listbox's rect. |
|
65 */ |
|
66 void ConstructL( const TRect& aRect ); |
|
67 |
|
68 /** |
|
69 * Destructor. |
|
70 */ |
|
71 ~CXDMPluginContainer(); |
|
72 |
|
73 public: // From CCoeControl |
|
74 |
|
75 /** |
|
76 * See CCoeControl |
|
77 */ |
|
78 TInt CountComponentControls() const; |
|
79 |
|
80 /** |
|
81 * See CCoeControl |
|
82 */ |
|
83 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
84 |
|
85 /** |
|
86 * See CCoeControl |
|
87 */ |
|
88 TKeyResponse OfferKeyEventL( |
|
89 const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
90 |
|
91 /** |
|
92 * See CCoeControl |
|
93 */ |
|
94 void SizeChanged(); |
|
95 |
|
96 /** |
|
97 * See CCoeControl |
|
98 */ |
|
99 void HandleResourceChange( TInt aType ); |
|
100 |
|
101 /** |
|
102 * Gets help context |
|
103 */ |
|
104 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
105 |
|
106 /** |
|
107 * See CCoeControl |
|
108 */ |
|
109 void FocusChanged(TDrawNow aDrawNow); |
|
110 |
|
111 |
|
112 public: // own methods |
|
113 |
|
114 /** |
|
115 * Invokes editing on current item, in response to UI Edit command |
|
116 */ |
|
117 void EditCurrentItemL(); |
|
118 |
|
119 /** |
|
120 * See MEikListBoxObserver |
|
121 */ |
|
122 void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); |
|
123 |
|
124 /** |
|
125 * From MEikMenuObserver |
|
126 */ |
|
127 void SetEmphasis( CCoeControl* /*aMenuControl*/, TBool /*aEmphasis*/ ){}; |
|
128 |
|
129 |
|
130 /** |
|
131 * From MEikMenuObserver |
|
132 */ |
|
133 void ProcessCommandL( TInt /*aCommandId*/ ){}; |
|
134 |
|
135 /** |
|
136 * Finds whether main list is empty |
|
137 * @return ETrue if main list is empty. |
|
138 */ |
|
139 TBool IsListEmpty(); |
|
140 |
|
141 /** |
|
142 * Finds whether the current item is the last item in main list |
|
143 * @return ETrue if current item is last in main list. |
|
144 */ |
|
145 TBool IsLastItem(); |
|
146 |
|
147 /** |
|
148 * Delete the currently focused set. Also deletes it using XDM API |
|
149 */ |
|
150 void DeleteCurrentSetL(); |
|
151 |
|
152 /** |
|
153 * Load the main list using XDM API, and perform other necessary tasks |
|
154 */ |
|
155 void LoadSettingsListArrayL(); |
|
156 |
|
157 /** |
|
158 * Get the name of currently focused set. Usually called by UI. |
|
159 * The pointer to buffer remains on heap, which is deleted by caller. |
|
160 * @return HBufC* pointer to currently focused set name |
|
161 */ |
|
162 HBufC* GetCurrentSetNameLC(); |
|
163 |
|
164 /** |
|
165 * This function starts the deleting current XDM set. All sub functions |
|
166 * are called through this function. |
|
167 */ |
|
168 void DeleteSetProcedureL(); |
|
169 |
|
170 /** |
|
171 * This function does necessary action on layout change, it is called from |
|
172 * actual resource change function. |
|
173 * @param aType type of resource |
|
174 */ |
|
175 void HandleResourceChangeManual(TInt aType); |
|
176 |
|
177 /** |
|
178 * Set the focus to the given set name if it exist |
|
179 * @param aSetName Set name to set focus |
|
180 */ |
|
181 void SetFocusIfExist(TDes& aSetName); |
|
182 |
|
183 |
|
184 private: // own methods |
|
185 |
|
186 /** |
|
187 * Perform the initial setup of the main list. Called by Constructor |
|
188 */ |
|
189 void SetupListL(); |
|
190 |
|
191 /** |
|
192 * Get the Setting ID of the current set |
|
193 * @return TInt setting ID of the current set |
|
194 */ |
|
195 TInt CXDMPluginContainer::GetCurrentSetIdL(); |
|
196 |
|
197 /** |
|
198 * Load XDM Collection names with trap, useful when list doesnt have anything |
|
199 * @param Reference to setting ids |
|
200 * @return CDesCArray collection names |
|
201 */ |
|
202 CDesCArray* LoadCollectionNamesL(RArray<TInt>& aSettingIDs); |
|
203 |
|
204 |
|
205 |
|
206 private: // data |
|
207 |
|
208 // Pointer to the main list, owned |
|
209 CAknColumnListBox* iMainList; |
|
210 |
|
211 // Pointer to the application view, not owned |
|
212 CAknView* iView; // not owned |
|
213 |
|
214 // The XDM set names list array, not owned |
|
215 CDesCArray* iSettingListArray; |
|
216 |
|
217 // Buffer for holding new XDM set name |
|
218 TBuf<KMaxSettingSetNameLength> iSettingNewName; |
|
219 |
|
220 // Title for menu pane |
|
221 TBuf<KMaxSettingSetNameLength> iTitle; |
|
222 |
|
223 // Pointer to title pane, not owned |
|
224 CAknTitlePane* iTitlePane; |
|
225 |
|
226 // Menubar, owned |
|
227 CEikMenuBar* iEikMenuBar; |
|
228 }; |
|
229 |
|
230 #endif //GS_XDMPLUGIN_CONTAINER_H |