1 /* |
|
2 * Copyright (c) 2006-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 Settings implementation of Location UIs. This class |
|
15 * extends the Location UI interface for Location sub-settings |
|
16 * plug-ins. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 // System Include |
|
22 #include <aknViewAppUi.h> |
|
23 |
|
24 // User Include |
|
25 #include "locationsettings.h" |
|
26 #include "locsettingsui.h" |
|
27 #include "locsettingsuiparams.h" |
|
28 |
|
29 // Constant |
|
30 const TInt KMaxSettingsUiCaptionSize = 0x100; |
|
31 |
|
32 // ========================= MEMBER FUNCTIONS ================================ |
|
33 |
|
34 // --------------------------------------------------------------------------- |
|
35 // CLocationSettings::CLocationSettings |
|
36 // Overloaded Constructor |
|
37 // |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 CLocationSettings::CLocationSettings( const TUid aImplementationId ) |
|
41 :iImplementationId( aImplementationId ) |
|
42 { |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // CLocationSettings::~CLocationSettings |
|
47 // Destructor |
|
48 // |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 CLocationSettings::~CLocationSettings() |
|
52 { |
|
53 // Delete the caption string |
|
54 delete iCaption; |
|
55 |
|
56 // Delete the contained Settings UI pointer |
|
57 delete iLocationSettings; |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CLocationSettings* CLocationSettings::NewL |
|
62 // Two Phase Constructor. |
|
63 // |
|
64 // @param aImplementationId Implementation UID of the settings plug-in. |
|
65 // @param aAppUi Application's AppUi reference. |
|
66 // @return CLocationSettings* Pointer to the created object |
|
67 // --------------------------------------------------------------------------- |
|
68 // |
|
69 CLocationSettings* CLocationSettings::NewL( const TUid aImplementationId, |
|
70 CAknViewAppUi& aAppUi ) |
|
71 { |
|
72 CLocationSettings* self = CLocationSettings::NewLC( aImplementationId, |
|
73 aAppUi ); |
|
74 CleanupStack::Pop( self ); |
|
75 return self; |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // CLocationSettings* CLocationSettings::NewLC |
|
80 // Two Phase Constructor. |
|
81 // |
|
82 // @param aImplementationId Implementation UID of the settings plug-in. |
|
83 // @param aAppUi Application's AppUi reference. |
|
84 // @return CLocationSettings* Pointer to the created object |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 CLocationSettings* CLocationSettings::NewLC( const TUid aImplementationId, |
|
88 CAknViewAppUi& aAppUi ) |
|
89 { |
|
90 CLocationSettings* self = new(ELeave) CLocationSettings( aImplementationId ); |
|
91 CleanupStack::PushL( self ); |
|
92 self->ConstructL( aAppUi ); |
|
93 return self; |
|
94 } |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // void CLocationSettings::ConstructL |
|
98 // Second Phase of the two phase constructor. |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 void CLocationSettings::ConstructL( CAknViewAppUi& aAppUi ) |
|
102 { |
|
103 // Create the Location Settings ECom plug-in |
|
104 CLocSettingsUiParams* param = CLocSettingsUiParams::NewLC( *this, |
|
105 aAppUi ); |
|
106 |
|
107 iLocationSettings = CLocSettingsUi::NewL( iImplementationId, *param ); |
|
108 |
|
109 // Pop and destroy the Settings parameter |
|
110 CleanupStack::PopAndDestroy( param ); |
|
111 |
|
112 // Allocate the buffer for the Caption string and copy the caption from |
|
113 // the plug-in |
|
114 iCaption = HBufC::NewMaxL( KMaxSettingsUiCaptionSize ); |
|
115 TPtr captionPtr = iCaption->Des(); |
|
116 iLocationSettings->GetCaptionL( captionPtr ); |
|
117 |
|
118 } |
|
119 |
|
120 // --------------------------------------------------------------------------- |
|
121 // const TPtrC CLocationSettings::Caption |
|
122 // Accessor Function for the Setings UI Caption |
|
123 // |
|
124 // @return const TPtrC Caption String |
|
125 // --------------------------------------------------------------------------- |
|
126 // |
|
127 TPtrC CLocationSettings::Caption() |
|
128 { |
|
129 return iCaption->Des(); |
|
130 } |
|
131 |
|
132 // --------------------------------------------------------------------------- |
|
133 // const TInt CLocationSettings::Priority() |
|
134 // Returns the priority of the UI module. |
|
135 // |
|
136 // @return const TInt Priority of the Settings UI |
|
137 // --------------------------------------------------------------------------- |
|
138 // |
|
139 TInt CLocationSettings::Priority() |
|
140 { |
|
141 return iLocationSettings->GetPriority(); |
|
142 } |
|
143 |
|
144 // --------------------------------------------------------------------------- |
|
145 // const TUid CLocationSettings::ImplementationUid() |
|
146 // Accessor Function for the Setings UI Implementation UID |
|
147 // |
|
148 // @return const TUid Settings UI Plug In's implementation UID |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 const TUid CLocationSettings::ImplementationUid() |
|
152 { |
|
153 return iImplementationId; |
|
154 } |
|
155 |
|
156 // --------------------------------------------------------------------------- |
|
157 // void CLocationSettings::LaunchLocationUIL |
|
158 // Launches a Location UI component. |
|
159 // |
|
160 // @param aUiInputParams Flags that define specific configuration of the |
|
161 // Location UI, that the user of the API wants to |
|
162 // launch. If more than one functionality is |
|
163 // requested then the various combinations are to be |
|
164 // ORed. The interpretation of these flag values is |
|
165 // a part of the understanding between the API user |
|
166 // and the corresponding Location UI. |
|
167 // @param aObserver Observer where the termination of the Launch call |
|
168 // needs to be notified. |
|
169 // --------------------------------------------------------------------------- |
|
170 // |
|
171 void CLocationSettings::LaunchLocationUIL( TInt aUiInputParams, |
|
172 MLocationUIObserver* aObserver ) |
|
173 { |
|
174 // Set the Observer for the launch call |
|
175 iObserver = aObserver; |
|
176 |
|
177 // Launch the sub-settings UI |
|
178 iLocationSettings->LaunchL( aUiInputParams ); |
|
179 } |
|
180 |
|
181 // --------------------------------------------------------------------------- |
|
182 // void CLocationSettings::LaunchLocationUIL |
|
183 // Launches a Location UI component. |
|
184 // |
|
185 // @param aUiInputParams String passed as a parameter to the |
|
186 // Location UI, that the user of the API wants to |
|
187 // launch. The interpretation of this string is |
|
188 // a part of the understanding between the API user |
|
189 // and the corresponding Location UI. |
|
190 // @param aObserver Observer where the termination of the Launch call |
|
191 // needs to be notified. |
|
192 // --------------------------------------------------------------------------- |
|
193 // |
|
194 void CLocationSettings::LaunchLocationUIL( const TDesC& aUiInputParams, |
|
195 MLocationUIObserver* aObserver ) |
|
196 { |
|
197 // Set the Observer for the launch call |
|
198 iObserver = aObserver; |
|
199 |
|
200 // Launch the sub-settings UI |
|
201 iLocationSettings->LaunchL( aUiInputParams ); |
|
202 } |
|
203 |
|
204 // --------------------------------------------------------------------------- |
|
205 // void CLocationSettings::Close |
|
206 // Closes the running Location UI prematurely. |
|
207 // --------------------------------------------------------------------------- |
|
208 // |
|
209 void CLocationSettings::Close() |
|
210 { |
|
211 // Closes the Location sub-settings |
|
212 iLocationSettings->Close(); |
|
213 } |
|
214 |
|
215 // --------------------------------------------------------------------------- |
|
216 // void CLocationSettings::SettingClosed |
|
217 // Inherited from MLocSettingsUiObserver. Notification from the Settings UI |
|
218 // to indicate the termination of the Settings UI application |
|
219 // |
|
220 // @param aErrorCode The termination reason. KErrNone for normal |
|
221 // terminations. In case of error or pre-mature aborting |
|
222 // System wide Error codes. |
|
223 // --------------------------------------------------------------------------- |
|
224 // |
|
225 void CLocationSettings::SettingClosed( TInt aErrorCode ) |
|
226 { |
|
227 if( iObserver ) |
|
228 { |
|
229 iObserver->LocationUIDismissed( aErrorCode ); |
|
230 } |
|
231 } |
|