35
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2010 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 Settings list container.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#ifndef GS_XDMPLUGIN_SL_CONTAINER_H
|
|
22 |
#define GS_XDMPLUGIN_SL_CONTAINER_H
|
|
23 |
|
|
24 |
// INCLUDES
|
|
25 |
#include <bldvariant.hrh>
|
|
26 |
#include <coeccntx.h>
|
|
27 |
#include <eikclb.h>
|
|
28 |
#include <aknview.h>
|
|
29 |
|
|
30 |
#include "XDMPlugin.hrh"
|
|
31 |
|
|
32 |
// FORWARD DECLARATION
|
|
33 |
class CGSListBoxItemTextArray;
|
|
34 |
class CEikTextListBox;
|
|
35 |
class CSettingsData;
|
|
36 |
class CXDMPluginSettinglist;
|
|
37 |
class CAknColumnListBox;
|
|
38 |
class CAknViewAppUi;
|
|
39 |
|
|
40 |
/**
|
|
41 |
* CXDMPluginSLContainer Settings list container class
|
|
42 |
*/
|
|
43 |
class CXDMPluginSLContainer : public CCoeControl, MEikListBoxObserver
|
|
44 |
{
|
|
45 |
public:
|
|
46 |
|
|
47 |
/**
|
|
48 |
* C++ Constructor
|
|
49 |
*/
|
|
50 |
CXDMPluginSLContainer(CAknView* aView);
|
|
51 |
|
|
52 |
/**
|
|
53 |
* Symbian OS constructor.
|
|
54 |
* @param aRect Listbox's rect.
|
|
55 |
*/
|
|
56 |
void ConstructL( const TRect& aRect);
|
|
57 |
|
|
58 |
/**
|
|
59 |
* Destructor.
|
|
60 |
*/
|
|
61 |
~CXDMPluginSLContainer();
|
|
62 |
|
|
63 |
public: // From CCoeControl
|
|
64 |
|
|
65 |
/**
|
|
66 |
* See CCoeControl.
|
|
67 |
*/
|
|
68 |
TInt CountComponentControls() const;
|
|
69 |
|
|
70 |
/**
|
|
71 |
* See CCoeControl.
|
|
72 |
*/
|
|
73 |
CCoeControl* ComponentControl( TInt aIndex ) const;
|
|
74 |
|
|
75 |
/**
|
|
76 |
* See CCoeControl.
|
|
77 |
*/
|
|
78 |
TKeyResponse OfferKeyEventL(
|
|
79 |
const TKeyEvent& aKeyEvent, TEventCode aType );
|
|
80 |
|
|
81 |
/**
|
|
82 |
* See CCoeControl.
|
|
83 |
*/
|
|
84 |
void SizeChanged();
|
|
85 |
|
|
86 |
/**
|
|
87 |
* See CCoeControl.
|
|
88 |
*/
|
|
89 |
void Draw(const TRect& aRect) const;
|
|
90 |
|
|
91 |
/**
|
|
92 |
* See CCoeControl
|
|
93 |
*/
|
|
94 |
void HandleResourceChange( TInt aType );
|
|
95 |
|
|
96 |
/**
|
|
97 |
* Gets help context
|
|
98 |
*/
|
|
99 |
void GetHelpContext( TCoeHelpContext& aContext ) const;
|
|
100 |
|
|
101 |
/**
|
|
102 |
* See CCoeControl
|
|
103 |
*/
|
|
104 |
void FocusChanged(TDrawNow aDrawNow);
|
|
105 |
|
|
106 |
public:
|
|
107 |
|
|
108 |
/**
|
|
109 |
* Edit currently focused item on settings list. called from UI
|
|
110 |
*/
|
|
111 |
void EditCurrentItemL();
|
|
112 |
|
|
113 |
/**
|
|
114 |
* See MEikListBoxObserver
|
|
115 |
*/
|
|
116 |
void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
|
|
117 |
|
|
118 |
/**
|
|
119 |
* Prepare the XDM set with given name for editing
|
|
120 |
* @param aXDMSetName reference to the XDM set name to be edited
|
|
121 |
*/
|
|
122 |
void PrepareXDMSetForEditingL(TDesC& aXDMSetName);
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Prepare the a new XDM set with default values
|
|
126 |
* @param none
|
|
127 |
*/
|
|
128 |
void PrepareXDMSetNewDefaultL();
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Prepare the a new XDM set with values from an existing set
|
|
132 |
* @param aXDMSetName reference to the new XDM set name
|
|
133 |
*/
|
|
134 |
void PrepareNewXDMSetFromExistingL(TDesC& aXDMSetName);
|
|
135 |
|
|
136 |
/**
|
|
137 |
* Display the dialog to the user to select the creation of new set
|
|
138 |
* from existing sets. Saves the selected name to iData
|
|
139 |
* @return ETrue if user has choosen a set, return EFalse if user cancels
|
|
140 |
*/
|
|
141 |
TBool DisplayNewXDMSetOptionsL();
|
|
142 |
|
|
143 |
/**
|
|
144 |
* Called by the UI when back button is pressed, to perform needed steps
|
|
145 |
* @return ETrue if settings list is allowed to close
|
|
146 |
*/
|
|
147 |
TBool IsExitProcessingOKL();
|
|
148 |
|
|
149 |
/**
|
|
150 |
* Handle manual resource change with its type
|
|
151 |
* @param aType, type of resource
|
|
152 |
*/
|
|
153 |
void HandleResourceChangeManual(TInt aType);
|
|
154 |
|
|
155 |
/**
|
|
156 |
* Save settings if possible, without any user interaction.
|
|
157 |
* this is useful for force exit, e.g. when mmc taken out
|
|
158 |
*/
|
|
159 |
void SaveSettingsIfPossibleL();
|
|
160 |
|
|
161 |
/**
|
|
162 |
* Return the name of current set in iData
|
|
163 |
* @return TDes reference to current set
|
|
164 |
*/
|
|
165 |
TDes& GetCurrentSetName();
|
|
166 |
|
|
167 |
/**
|
|
168 |
* Returns ETrue is AP used by XDM settings is in use
|
|
169 |
* @return ETrue if ap in use
|
|
170 |
*/
|
|
171 |
TBool SettingsApInUseL(TDesC& aXDMSetName);
|
|
172 |
|
|
173 |
|
|
174 |
private: // Most of these methods perform operations using iData
|
|
175 |
|
|
176 |
/**
|
|
177 |
* Sets the title pane text with given discriptor
|
|
178 |
* @param aTitleText text to be shown on title pane
|
|
179 |
*/
|
|
180 |
void SetTitlePaneTextL( const TDesC& aTitleText ) const;
|
|
181 |
|
|
182 |
/**
|
|
183 |
* Finds out whether compulsory items are filled
|
|
184 |
* @return ETrue if compulsory items are filled
|
|
185 |
*/
|
|
186 |
TBool AreCompulsoryItemsFilled();
|
|
187 |
|
|
188 |
/**
|
|
189 |
* Display a query dialog to user that compulsory settings are not
|
|
190 |
* filled, and if user wants to delete the settings
|
|
191 |
* @return ETrue if user wants to delete the settings
|
|
192 |
*/
|
|
193 |
TBool DisplayDeleteOrDontSaveDialogL();
|
|
194 |
|
|
195 |
/**
|
|
196 |
* Update an XDM set if it already exist or create it if it doesnt exist
|
|
197 |
* @param aShowDialog whether dialog will be displayed or not
|
|
198 |
* @return ETrue if save procedure goes ok
|
|
199 |
*/
|
|
200 |
TBool SaveOrCreateAndSaveXDMSetL(TBool aShowDialog);
|
|
201 |
|
|
202 |
/**
|
|
203 |
* Deletes the XDM set if it exist in the XDM settings API
|
|
204 |
*/
|
|
205 |
void DeleteXDMSetIfExistL();
|
|
206 |
|
|
207 |
/**
|
|
208 |
* Gets the setting id of the given set name
|
|
209 |
* @param aXDMSetName reference to XDM set name
|
|
210 |
* @return settingid of the given xdm set
|
|
211 |
*/
|
|
212 |
TInt GetSettingIdL(TDesC& aXDMSetName);
|
|
213 |
|
|
214 |
/**
|
|
215 |
* If the given XDM set name with given ID is exist or not
|
|
216 |
* @param aXDMSetName reference to XDM set name
|
|
217 |
* aSettingId settings id of the XDM
|
|
218 |
* @return ETrue of XDM set exist with given name
|
|
219 |
*/
|
|
220 |
TBool IsXDMSetNameExistL(TDesC& aXDMSetName, TInt32& aSettingId);
|
|
221 |
|
|
222 |
/**
|
|
223 |
* Load XDM Collection names with trap, useful when list doesnt have anything
|
|
224 |
* @param Reference to setting ids
|
|
225 |
* @return CDesCArray collection names
|
|
226 |
*/
|
|
227 |
CDesCArray* LoadCollectionNamesL(RArray<TInt>& aSettingIDs, TBool aDisp);
|
|
228 |
|
|
229 |
/**
|
|
230 |
* Check the given name and returns the possible altered name. NULL
|
|
231 |
* pointer is returned no change is needed in aName, so aName can be
|
|
232 |
* used if NULL pointer is returned. If some valid pointer is returned
|
|
233 |
* then that pointer is owned by client, and needed to be deleted after
|
|
234 |
* usage.
|
|
235 |
* @param aName, the name from which to start suggestion.
|
|
236 |
* @param aChanged, returns ETrue if an alternate name is returned.
|
|
237 |
* @return HBufC* pointer to the new name, can be NULL if not needed.
|
|
238 |
*/
|
|
239 |
HBufC* DoMakeValidNameL(HBufC* aName, TBool& aChanged);
|
|
240 |
|
|
241 |
/**
|
|
242 |
* Ensures that the passed name is valid, length > 0 & length < max.
|
|
243 |
* If length == 0, leaves with KErrInvalidName
|
|
244 |
* If name is only whitespace, leaves with KErrInvalidName
|
|
245 |
* If name is longer than max, name is truncated
|
|
246 |
* It copies the name, pushes it onto the CleanupStack and passes
|
|
247 |
* ownership.
|
|
248 |
|
|
249 |
* @param aName The name
|
|
250 |
* @param aChanged A reference to a boolean to hold whether the name
|
|
251 |
* had been changed or not.
|
|
252 |
* @return The valid-length name
|
|
253 |
*/
|
|
254 |
HBufC* EnsureMaxLengthLC( const TDesC* aName, TBool& aChanged);
|
|
255 |
|
|
256 |
/**
|
|
257 |
* Given aName in the format <prefix> or
|
|
258 |
* <prefix><brace><integer><brace>, return a
|
|
259 |
* pointer to the leading part. That is, if there is
|
|
260 |
* trailing <space><integer>, then that is excluded;
|
|
261 |
* if there is no trailing part, then the original
|
|
262 |
* decriptor is returned.
|
|
263 |
* Examples:
|
|
264 |
* - "Foo" returns "Foo";
|
|
265 |
* - "Foo 12" returns "Foo 12";
|
|
266 |
* - "Foo(12)" returns "Foo";
|
|
267 |
* - "Foo 12 (34)" returns "Foo 12 ";
|
|
268 |
* - "Foo bar" returns "Foo bar";
|
|
269 |
* - "Foo " returns "Foo ".
|
|
270 |
* @param aName The name to get the prefix from
|
|
271 |
* @return The prefix
|
|
272 |
*/
|
|
273 |
TPtrC GetPrefix( const TDesC& aName );
|
|
274 |
|
|
275 |
|
|
276 |
/**
|
|
277 |
* If aName is constructed from aPrefix with a postfix, get the numeric
|
|
278 |
* value of the postfix, e.g:
|
|
279 |
* - GetPostfix( "Foo (3)", "Foo" ) == 3
|
|
280 |
* - GetPostfix( "Foo 23 (45)", "Foo 23" ) == 45
|
|
281 |
* If aName is the same as aPrefix, return 0, e.g.:
|
|
282 |
* - GetPostfix( "Foo", "Foo" ) == 0
|
|
283 |
* If aName is not constructed from aPrefix, return -1, e.g.:
|
|
284 |
* - GetPostfix( "Foobar", "Foo" ) == -1
|
|
285 |
* - GetPostfix( "Fo 23 45", "Foo" ) == -1
|
|
286 |
* @param aName The name to get the postfix from
|
|
287 |
* @param aPrefix The prefix
|
|
288 |
* @return The postfix
|
|
289 |
*/
|
|
290 |
TInt GetPostfix( const TDesC& aName, const TDesC& aPrefix );
|
|
291 |
|
|
292 |
|
|
293 |
private: // data
|
|
294 |
|
|
295 |
// CXDMPluginSettinglist owned
|
|
296 |
CXDMPluginSettinglist* iSettingList;
|
|
297 |
|
|
298 |
// Pointer to settings data owned
|
|
299 |
CSettingsData* iData;
|
|
300 |
|
|
301 |
// Pointer to the application view, not owned
|
|
302 |
CAknView* iView; // not owned
|
|
303 |
|
|
304 |
};
|
|
305 |
|
|
306 |
#endif //GS_XDMPLUGIN_SL_CONTAINER_H
|