|
1 /* |
|
2 * Copyright (c) 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: GSDiagnosticsPlugin implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // User includes |
|
20 #include "GSDiagnosticsPlugin.h" |
|
21 #include <GSParentPlugin.h> |
|
22 #include <GSCommon.hrh> |
|
23 #include <gsdiagnosticspluginrsc.rsg> // GUI Resource |
|
24 #include <GSPrivatePluginProviderIds.h> |
|
25 #include <GSFWViewUIDs.h> |
|
26 #include "GSLogger.h" |
|
27 |
|
28 // System includes |
|
29 #include <AknWaitDialog.h> |
|
30 #include <aknnotewrappers.h> |
|
31 #include <AknRadioButtonSettingPage.h> |
|
32 #include <AknTextSettingPage.h> |
|
33 #include <AknViewAppUi.h> |
|
34 #include <bautils.h> |
|
35 #include <FeatMgr.h> |
|
36 #include <hlplch.h> // HlpLauncher |
|
37 #include <StringLoader.h> |
|
38 |
|
39 #include <ImplementationInformation.h> |
|
40 #include <UTF.H> // CnvUtfConverter |
|
41 |
|
42 // Constants |
|
43 |
|
44 // ========================= MEMBER FUNCTIONS ================================ |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // CGSDiagnosticsPlugin::CGSDiagnosticsPlugin() |
|
48 // Constructor |
|
49 // |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 CGSDiagnosticsPlugin::CGSDiagnosticsPlugin() |
|
53 : iResources( *iCoeEnv ) |
|
54 { |
|
55 } |
|
56 |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // CGSDiagnosticsPlugin::~CGSDiagnosticsPlugin() |
|
60 // Destructor |
|
61 // |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 CGSDiagnosticsPlugin::~CGSDiagnosticsPlugin() |
|
65 { |
|
66 iResources.Close(); |
|
67 } |
|
68 |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // CGSDiagnosticsPlugin::ConstructL(const TRect& aRect) |
|
72 // Symbian OS two-phased constructor |
|
73 // |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 void CGSDiagnosticsPlugin::ConstructL() |
|
77 { |
|
78 OpenLocalizedResourceFileL( KOperatorLogoResourceFileName, iResources ); |
|
79 BaseConstructL( R_GS_DIAGNOSTICS_VIEW ); |
|
80 __GSLOGSTRING( "[CGSDiagnosticsPlugin] ConstructL()" ); |
|
81 } |
|
82 |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // CGSDiagnosticsPlugin::NewL() |
|
86 // Static constructor |
|
87 // |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 CGSDiagnosticsPlugin* CGSDiagnosticsPlugin::NewL( TAny* /*aInitParams*/ ) |
|
91 { |
|
92 CGSDiagnosticsPlugin* self = new( ELeave ) CGSDiagnosticsPlugin(); |
|
93 CleanupStack::PushL(self); |
|
94 self->ConstructL(); |
|
95 CleanupStack::Pop(self); |
|
96 return self; |
|
97 } |
|
98 |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CGSDiagnosticsPlugin::Id |
|
102 // |
|
103 // |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 TUid CGSDiagnosticsPlugin::Id() const |
|
107 { |
|
108 return KGSDiagnosticsPluginUID; |
|
109 } |
|
110 |
|
111 |
|
112 // ----------------------------------------------------------------------------- |
|
113 // CGSDiagnosticsPlugin::DoActivateL |
|
114 // |
|
115 // |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 void CGSDiagnosticsPlugin::DoActivateL( const TVwsViewId& /*aPrevViewId*/, |
|
119 TUid /*aCustomMessageId*/, |
|
120 const TDesC8& /*aCustomMessage*/ ) |
|
121 { |
|
122 // Update these values to define what is tested. |
|
123 iPrintInfo = ETrue; |
|
124 iTestLoad = EFalse; |
|
125 iCheckHeap = EFalse; |
|
126 |
|
127 CheckInfoL( KGSPluginInterfaceUid ); |
|
128 } |
|
129 |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CGSDiagnosticsPlugin::DoDeactivate |
|
133 // |
|
134 // |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 void CGSDiagnosticsPlugin::DoDeactivate() |
|
138 { |
|
139 } |
|
140 |
|
141 |
|
142 // ========================= From CGSPluginInterface ================== |
|
143 |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // CGSDiagnosticsPlugin::GetCaptionL |
|
147 // |
|
148 // |
|
149 // ----------------------------------------------------------------------------- |
|
150 // |
|
151 void CGSDiagnosticsPlugin::GetCaptionL( TDes& aCaption ) const |
|
152 { |
|
153 HBufC* result = StringLoader::LoadL( R_GS_DIAGNOSTICS_PLUGIN_CAPTION ); |
|
154 aCaption.Copy( *result ); |
|
155 delete result; |
|
156 } |
|
157 |
|
158 |
|
159 // ----------------------------------------------------------------------------- |
|
160 // CGSDiagnosticsPlugin::PluginProviderCategory |
|
161 // |
|
162 // |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 TInt CGSDiagnosticsPlugin::PluginProviderCategory() const |
|
166 { |
|
167 return KGSPluginProviderInternal; |
|
168 } |
|
169 |
|
170 |
|
171 // ----------------------------------------------------------------------------- |
|
172 // CGSDiagnosticsPlugin::ItemType() |
|
173 // |
|
174 // |
|
175 // ----------------------------------------------------------------------------- |
|
176 // |
|
177 TGSListboxItemTypes CGSDiagnosticsPlugin::ItemType() |
|
178 { |
|
179 return EGSItemTypeSettingDialog; |
|
180 } |
|
181 |
|
182 |
|
183 // ----------------------------------------------------------------------------- |
|
184 // CGSDiagnosticsPlugin::GetValue() |
|
185 // |
|
186 // |
|
187 // ----------------------------------------------------------------------------- |
|
188 // |
|
189 void CGSDiagnosticsPlugin::GetValue( const TGSPluginValueKeys /*aKey*/, |
|
190 TDes& /*aValue*/ ) |
|
191 { |
|
192 |
|
193 } |
|
194 |
|
195 |
|
196 // ----------------------------------------------------------------------------- |
|
197 // CGSDiagnosticsPlugin::HandleSelection() |
|
198 // |
|
199 // |
|
200 // ----------------------------------------------------------------------------- |
|
201 // |
|
202 void CGSDiagnosticsPlugin::HandleSelection( |
|
203 const TGSSelectionTypes aSelectionType ) |
|
204 { |
|
205 TRAP_IGNORE( CheckInfoL( KGSPluginInterfaceUid ) ); |
|
206 } |
|
207 |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // CGSDiagnosticsPlugin::Visible() |
|
211 // |
|
212 // |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 TBool CGSDiagnosticsPlugin::Visible() const |
|
216 { |
|
217 return ETrue; |
|
218 } |
|
219 |
|
220 |
|
221 // ----------------------------------------------------------------------------- |
|
222 // CGSDiagnosticsPlugin::OpenLocalizedResourceFileL() |
|
223 // |
|
224 // |
|
225 // ----------------------------------------------------------------------------- |
|
226 // |
|
227 void CGSDiagnosticsPlugin::OpenLocalizedResourceFileL( |
|
228 const TDesC& aResourceFileName, |
|
229 RConeResourceLoader& aResourceLoader ) |
|
230 { |
|
231 RFs fsSession; |
|
232 User::LeaveIfError( fsSession.Connect() ); |
|
233 |
|
234 // Find the resource file: |
|
235 TParse parse; |
|
236 parse.Set( aResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL ); |
|
237 TFileName fileName( parse.FullName() ); |
|
238 |
|
239 // Get language of resource file: |
|
240 BaflUtils::NearestLanguageFile( fsSession, fileName ); |
|
241 |
|
242 // Open resource file: |
|
243 aResourceLoader.OpenL( fileName ); |
|
244 |
|
245 // If leave occurs before this, close is called automatically when the |
|
246 // thread exits. |
|
247 fsSession.Close(); |
|
248 } |
|
249 |
|
250 |
|
251 // ---------------------------------------------------------------------------- |
|
252 // CGSDiagnosticsPlugin::PrintInfoDebug |
|
253 // Print CImplementationInformation to log. Used for debugging. |
|
254 // |
|
255 // ---------------------------------------------------------------------------- |
|
256 // |
|
257 void CGSDiagnosticsPlugin::PrintInfoDebug( CImplementationInformation* aInfo ) |
|
258 { |
|
259 TBuf16<256> dataType; |
|
260 TBuf16<256> opaqueData; |
|
261 CnvUtfConverter::ConvertToUnicodeFromUtf8( |
|
262 dataType, aInfo->DataType() ); |
|
263 CnvUtfConverter::ConvertToUnicodeFromUtf8( |
|
264 opaqueData, aInfo->OpaqueData() ); |
|
265 |
|
266 __GSLOGSTRING( "." ); |
|
267 __GSLOGSTRING1( " DisplayName: %S", &aInfo->DisplayName() ); |
|
268 __GSLOGSTRING1( " ImplementationUid: 0x%X", aInfo->ImplementationUid() ); |
|
269 __GSLOGSTRING1( " DataType: %S", &dataType ); |
|
270 __GSLOGSTRING1( " OpaqueData: %S", &opaqueData ); |
|
271 |
|
272 } |
|
273 |
|
274 |
|
275 // ----------------------------------------------------------------------------- |
|
276 // CGSDiagnosticsPlugin::CheckInfoL() |
|
277 // |
|
278 // |
|
279 // ----------------------------------------------------------------------------- |
|
280 // |
|
281 void CGSDiagnosticsPlugin::CheckInfoL( TUid aInterfaceUid ) |
|
282 { |
|
283 RImplInfoPtrArray implInfoArray; |
|
284 |
|
285 REComSession::ListImplementationsL( aInterfaceUid, implInfoArray ); |
|
286 |
|
287 if( iPrintInfo ) |
|
288 { |
|
289 __GSLOGSTRING( "[CGSDiagnosticsPlugin implementation information]" ); |
|
290 for( TInt i = 0; i < implInfoArray.Count(); i++ ) |
|
291 { |
|
292 PrintInfoDebug( implInfoArray[i] ); |
|
293 } |
|
294 __GSLOGSTRING( "[End of implementation information]" ); |
|
295 } |
|
296 |
|
297 CImplementationInformation* info; |
|
298 CGSPluginInterface* plugin; |
|
299 |
|
300 if( iTestLoad ) |
|
301 { |
|
302 __GSLOGSTRING( "[CGSDiagnosticsPlugin plugin load/delete checks...]" ); |
|
303 for( TInt i = 0; i < implInfoArray.Count(); i++ ) |
|
304 { |
|
305 info = implInfoArray[i]; |
|
306 __GSLOGSTRING1( "[CGSDiagnosticsPlugin] Checking: %S", |
|
307 &info->DisplayName() ); |
|
308 |
|
309 if ( iCheckHeap ) |
|
310 { |
|
311 __UHEAP_MARK; |
|
312 } |
|
313 |
|
314 //Load plugin: |
|
315 plugin = CGSPluginInterface::NewL( |
|
316 info->ImplementationUid(), |
|
317 AppUi() ); |
|
318 |
|
319 // Delete plugin: |
|
320 delete plugin; |
|
321 plugin = NULL; |
|
322 |
|
323 if ( iCheckHeap ) |
|
324 { |
|
325 __UHEAP_MARKEND; |
|
326 } |
|
327 |
|
328 __GSLOGSTRING1( "[CGSDiagnosticsPlugin] %S OK", |
|
329 &info->DisplayName() ); |
|
330 } |
|
331 } |
|
332 |
|
333 implInfoArray.ResetAndDestroy();// This is needed |
|
334 } |
|
335 |
|
336 |
|
337 // End of file |