|
1 /* |
|
2 * Copyright (c) 2005-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: Client Side handle for using the Location System UI services |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // System Includes |
|
20 #include <aknenv.h> |
|
21 |
|
22 // User Includes |
|
23 #include "locsettingsuiclient.h" |
|
24 #include "loclaunchuiao.h" |
|
25 #include "locsettingsuiservice.h" |
|
26 |
|
27 // ======== MEMBER FUNCTIONS ======== |
|
28 |
|
29 // --------------------------------------------------------------------------- |
|
30 // C++ Default Constructor |
|
31 // --------------------------------------------------------------------------- |
|
32 // |
|
33 CLocSettingsUiClient::CLocSettingsUiClient() |
|
34 { |
|
35 } |
|
36 |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // Second phase of the two phase constructor |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 void CLocSettingsUiClient::ConstructL() |
|
43 { |
|
44 // Obtain the UI Environment. If the Client Library is constructed from |
|
45 // a non-UI application then the value of the UI Env should be NULL |
|
46 iCEikonEnv = CEikonEnv::Static(); |
|
47 |
|
48 // Create the Client side handle. |
|
49 iLocService = new ( ELeave ) RLocSettingsUiService; |
|
50 |
|
51 // Create the Active object that would be used by the client handle |
|
52 // sending asynchronous requests |
|
53 iLaunchUiAO = CLocLaunchUiAO::NewL( *iLocService ); |
|
54 |
|
55 // Set the Client Handles AO. The ownership is mainted with this class |
|
56 // since the Client side handle is an RClass and should preferably not |
|
57 // have any objects allocated on the heap |
|
58 iLocService->SetLaunchAO( iLaunchUiAO ); |
|
59 |
|
60 } |
|
61 |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // Two Phase constructor |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 EXPORT_C CLocSettingsUiClient* CLocSettingsUiClient::NewL() |
|
68 { |
|
69 CLocSettingsUiClient* self = CLocSettingsUiClient::NewLC(); |
|
70 CleanupStack::Pop( self ); |
|
71 return self; |
|
72 } |
|
73 |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // Two Phase constructor. Leaves the allocated object on the Clean-up stack |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 EXPORT_C CLocSettingsUiClient* CLocSettingsUiClient::NewLC() |
|
80 { |
|
81 CLocSettingsUiClient* self = new( ELeave ) CLocSettingsUiClient; |
|
82 CleanupStack::PushL( self ); |
|
83 self->ConstructL(); |
|
84 return self; |
|
85 } |
|
86 |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // C++ Destructor |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 CLocSettingsUiClient::~CLocSettingsUiClient() |
|
93 { |
|
94 |
|
95 // Delete the Client side handle |
|
96 delete iLocService; |
|
97 |
|
98 // Delete the Active Object |
|
99 delete iLaunchUiAO; |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // Launch a Settings UI in an ui app server |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 EXPORT_C void CLocSettingsUiClient::LaunchSettingsUiL( |
|
107 TUid aImplementationUid, |
|
108 TInt aParams, |
|
109 TRequestStatus& aStatus ) |
|
110 { |
|
111 // Call the Client Handle's Launch function |
|
112 iLocService->LaunchSettingsUiL( aImplementationUid, |
|
113 aParams, |
|
114 aStatus ); |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // Launch a Settings UI as an embedded application |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 EXPORT_C void CLocSettingsUiClient::LaunchSettingsUiAsEmbeddedAppL( |
|
122 TUid aImplementationUid, |
|
123 TInt aParams, |
|
124 TRequestStatus& aStatus ) |
|
125 { |
|
126 // Only an UI application can make a Launch as embedded call |
|
127 if( NULL == iCEikonEnv ) |
|
128 { |
|
129 User::Leave( KErrNotSupported ); |
|
130 } |
|
131 // Call the Client Handle's Launch function |
|
132 iLocService->LaunchSettingsUiAsEmbeddedAppL( aImplementationUid, |
|
133 aParams, |
|
134 aStatus ); |
|
135 } |
|
136 |
|
137 // --------------------------------------------------------------------------- |
|
138 // Launch a Settings UI in an ui app server |
|
139 // --------------------------------------------------------------------------- |
|
140 // |
|
141 EXPORT_C void CLocSettingsUiClient::LaunchSettingsUiL( |
|
142 TUid aImplementationUid, |
|
143 const TDesC& aStringParams, |
|
144 TRequestStatus& aStatus ) |
|
145 { |
|
146 // Call the Client Handle's Launch function |
|
147 iLocService->LaunchSettingsUiL( aImplementationUid, |
|
148 aStringParams, |
|
149 aStatus ); |
|
150 } |
|
151 |
|
152 // --------------------------------------------------------------------------- |
|
153 // Launch a Settings UI as an embedded application |
|
154 // --------------------------------------------------------------------------- |
|
155 // |
|
156 EXPORT_C void CLocSettingsUiClient::LaunchSettingsUiAsEmbeddedAppL( |
|
157 TUid aImplementationUid, |
|
158 const TDesC& aStringParams, |
|
159 TRequestStatus& aStatus ) |
|
160 { |
|
161 // Only an UI application can make a Launch as embedded call |
|
162 if( NULL == iCEikonEnv ) |
|
163 { |
|
164 User::Leave( KErrNotSupported ); |
|
165 } |
|
166 // Call the Client Handle's Launch function |
|
167 iLocService->LaunchSettingsUiAsEmbeddedAppL( aImplementationUid, |
|
168 aStringParams, |
|
169 aStatus ); |
|
170 } |
|
171 |
|
172 // --------------------------------------------------------------------------- |
|
173 // Cancels an already launched settings UI. |
|
174 // --------------------------------------------------------------------------- |
|
175 // |
|
176 EXPORT_C TInt CLocSettingsUiClient::CancelLaunchedSettingsUi() |
|
177 { |
|
178 return iLocService->CancelLaunchedSettingsUi(); |
|
179 } |
|
180 |
|
181 // --------------------------------------------------------------------------- |
|
182 // Launch Positioning Settings UI in an ui app server |
|
183 // --------------------------------------------------------------------------- |
|
184 // |
|
185 EXPORT_C void CLocSettingsUiClient::LaunchPosSettingsL( |
|
186 TRequestStatus& aStatus ) |
|
187 { |
|
188 // Only FrameWorks can make a Launch as non-embedded call |
|
189 if( iCEikonEnv ) |
|
190 { |
|
191 User::Leave( KErrNotSupported ); |
|
192 } |
|
193 // Call the Client Handle's Launch function |
|
194 iLocService->LaunchPosSettingsL( aStatus ); |
|
195 } |
|
196 |
|
197 // --------------------------------------------------------------------------- |
|
198 // Launch Positioning Settings UI as an embedded application |
|
199 // --------------------------------------------------------------------------- |
|
200 // |
|
201 EXPORT_C void CLocSettingsUiClient::LaunchPosSettingsAsEmbeddedAppL( |
|
202 TRequestStatus& aStatus ) |
|
203 { |
|
204 // Only an UI application can make a Launch as embedded call |
|
205 if( NULL == iCEikonEnv ) |
|
206 { |
|
207 User::Leave( KErrNotSupported ); |
|
208 } |
|
209 // Call the Client Handle's Launch function |
|
210 iLocService->LaunchPosSettingsAsEmbeddedAppL( aStatus ); |
|
211 } |
|
212 |
|
213 // --------------------------------------------------------------------------- |
|
214 // Closes an already launched Positioning Settings UI. |
|
215 // --------------------------------------------------------------------------- |
|
216 // |
|
217 EXPORT_C TInt CLocSettingsUiClient::ClosePosSettings() |
|
218 { |
|
219 return iLocService->ClosePosSettings(); |
|
220 } |