|
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: This the implementation of the view class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include <aknradiobuttonsettingpage.h> |
|
22 #include <akntitle.h> |
|
23 #include <bautils.h> // BAFL utils (for language file) |
|
24 #include <StringLoader.h> |
|
25 #include <usbui.mbg> |
|
26 #include <featmgr.h> |
|
27 #include <hlplch.h> // Help launcher |
|
28 #include <usbpersonalityids.h> |
|
29 #include <GSParentPlugin.h> |
|
30 #include <GSFWViewUIDs.h> |
|
31 #include <USBClassChangeUIPlugin.rsg> // Resources |
|
32 |
|
33 #include "USBClassChangeUIPluginView.h" |
|
34 #include "USBClassChangeUIPluginDebug.h" |
|
35 #include "USBClassChangeUIPlugin.h" |
|
36 #include "USBClassChangeUIPluginContainer.h" |
|
37 |
|
38 // ================= MEMBER FUNCTIONS ======================= |
|
39 |
|
40 // --------------------------------------------------------- |
|
41 // CUSBClassChangeUIPluginView::NewPluginL |
|
42 // Entry point for CGSPluginInterface. |
|
43 // Used by General Settings Application |
|
44 // --------------------------------------------------------- |
|
45 // |
|
46 CUSBClassChangeUIPluginView* CUSBClassChangeUIPluginView::NewPluginL() |
|
47 { |
|
48 FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::NewPluginL()")); |
|
49 |
|
50 CUSBClassChangeUIPluginView* self = new ( ELeave ) CUSBClassChangeUIPluginView(); |
|
51 |
|
52 self->iLoadAsGSPlugin = ETrue; |
|
53 |
|
54 CleanupStack::PushL( self ); |
|
55 self->ConstructL(); |
|
56 CleanupStack::Pop( self ); |
|
57 |
|
58 FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::NewPluginL() completed")); |
|
59 |
|
60 return self; |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------- |
|
64 // CUSBClassChangeUIPluginView::NewL |
|
65 // Entry point for CGSPluginInterface. |
|
66 // Used by USBClassChangeUIPluginAppUI. |
|
67 // --------------------------------------------------------- |
|
68 // |
|
69 CUSBClassChangeUIPluginView* CUSBClassChangeUIPluginView::NewL() |
|
70 { |
|
71 FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::NewL()")); |
|
72 |
|
73 CUSBClassChangeUIPluginView* self = new ( ELeave ) CUSBClassChangeUIPluginView(); |
|
74 |
|
75 self->iLoadAsGSPlugin = EFalse; |
|
76 |
|
77 CleanupStack::PushL( self ); |
|
78 self->ConstructL(); |
|
79 CleanupStack::Pop( self ); |
|
80 |
|
81 FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::NewL() completed")); |
|
82 |
|
83 return self; |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------- |
|
87 // CUSBClassChangeUIPluginView::ConstructL |
|
88 // Symbian 2nd phase constructor can leave. |
|
89 // --------------------------------------------------------- |
|
90 // |
|
91 void CUSBClassChangeUIPluginView::ConstructL() |
|
92 { |
|
93 FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::ConstructL()")); |
|
94 |
|
95 iEikEnv = CEikonEnv::Static(); |
|
96 |
|
97 TFileName filename; |
|
98 filename += KFileDrive; |
|
99 filename += KDC_RESOURCE_FILES_DIR; |
|
100 filename += KResourceFileName; |
|
101 BaflUtils::NearestLanguageFile(iEikEnv->FsSession(),filename); |
|
102 iResourceFileFlag = iEikEnv->AddResourceFileL(filename); |
|
103 |
|
104 //"Back" or "Exit" right-softkey resource |
|
105 BaseConstructL( iLoadAsGSPlugin ? |
|
106 R_USBUI_MAIN_VIEW_GS_PLUGIN : R_USBUI_MAIN_VIEW ); |
|
107 |
|
108 iAppUIRef = AppUi(); |
|
109 |
|
110 iModelRef = CUSBClassChangeUIPluginModel::NewL(); |
|
111 iModelRef->SetSettingsObserver(this); |
|
112 |
|
113 FeatureManager::InitializeLibL(); |
|
114 iHelpSupported = FeatureManager::FeatureSupported( KFeatureIdHelp ); |
|
115 FeatureManager::UnInitializeLib(); |
|
116 |
|
117 FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::ConstructL() completed")); |
|
118 } |
|
119 |
|
120 // --------------------------------------------------------- |
|
121 // Destructor. |
|
122 // --------------------------------------------------------- |
|
123 // |
|
124 CUSBClassChangeUIPluginView::~CUSBClassChangeUIPluginView() |
|
125 { |
|
126 FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::~CUSBClassChangeUIPluginView()")); |
|
127 |
|
128 if ( iContainer ) |
|
129 { |
|
130 if ( iAppUIRef ) |
|
131 { |
|
132 iAppUIRef->RemoveFromViewStack( *this, iContainer ); |
|
133 } |
|
134 delete iContainer; |
|
135 } |
|
136 |
|
137 if ( iEikEnv ) |
|
138 { |
|
139 iEikEnv->DeleteResourceFile ( iResourceFileFlag ); |
|
140 } |
|
141 |
|
142 if ( iModelRef ) |
|
143 { |
|
144 delete iModelRef; |
|
145 } |
|
146 |
|
147 if ( !iLoadAsGSPlugin ) |
|
148 { |
|
149 SignalDestruction(); |
|
150 } |
|
151 |
|
152 FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::~CUSBClassChangeUIPluginView() completed")); |
|
153 } |
|
154 |
|
155 // --------------------------------------------------------- |
|
156 // TUid CUSBClassChangeUIPluginView::Id |
|
157 // --------------------------------------------------------- |
|
158 // |
|
159 TUid CUSBClassChangeUIPluginView::Id() const |
|
160 { |
|
161 if ( iLoadAsGSPlugin ) |
|
162 { |
|
163 return KGsUSBUIPluginUid; //same as ecom impl UID, required by GS interface. |
|
164 } |
|
165 else |
|
166 { |
|
167 return KUSBUIMainViewId; //view id |
|
168 } |
|
169 } |
|
170 |
|
171 // --------------------------------------------------------- |
|
172 // CUSBClassChangeUIPluginView::HandleCommandL |
|
173 // Redirects commands to the appui class. |
|
174 // --------------------------------------------------------- |
|
175 // |
|
176 void CUSBClassChangeUIPluginView::HandleCommandL(TInt aCommand) |
|
177 { |
|
178 FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::HandleCommandL()")); |
|
179 |
|
180 switch ( aCommand ) |
|
181 { |
|
182 case EAknSoftkeyExit: |
|
183 case EEikCmdExit: |
|
184 { |
|
185 iAppUIRef->Exit(); |
|
186 break; |
|
187 } |
|
188 |
|
189 case EAknSoftkeyBack: |
|
190 /** |
|
191 * UPDATE THIS if this view has a sub-view. |
|
192 * In this case constant UID must be used instead of the |
|
193 * previous view - otherwise the "back" might return to the |
|
194 * sub-view. See GSFWViewUIDs.h for constant UIDs. |
|
195 */ |
|
196 iAppUIRef->ActivateLocalViewL( iPrevViewId.iViewUid ); |
|
197 break; |
|
198 |
|
199 case EUSBUICmdHelp: |
|
200 case EAknCmdHelp: |
|
201 { |
|
202 HlpLauncher::LaunchHelpApplicationL( |
|
203 iEikonEnv->WsSession(), iAppUIRef->AppHelpContextL() ); |
|
204 break; |
|
205 } |
|
206 |
|
207 case EUSBUICmdSelect: |
|
208 case EUSBUICmdMskSelect: |
|
209 { |
|
210 TInt CurrentIndex = iContainer->CurrentItemIndex() ; |
|
211 HandleCmdChangeUSBModeL(CurrentIndex); |
|
212 break; |
|
213 } |
|
214 |
|
215 default: |
|
216 { |
|
217 FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginAppUi::HandleCommandL default switch")); |
|
218 break; |
|
219 } |
|
220 } |
|
221 } |
|
222 |
|
223 // --------------------------------------------------------- |
|
224 // CUSBClassChangeUIPluginView::DoActivateL |
|
225 // --------------------------------------------------------- |
|
226 // |
|
227 void CUSBClassChangeUIPluginView::DoActivateL( const TVwsViewId& aPrevViewId, |
|
228 TUid /*aCustomMessageId*/, |
|
229 const TDesC8& /*aCustomMessage*/) |
|
230 { |
|
231 FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::DoActivateL()")); |
|
232 |
|
233 iPrevViewId = aPrevViewId; |
|
234 if( !iContainer ) |
|
235 { |
|
236 iContainer = CUSBClassChangeUIPluginContainer::NewL(this, iModelRef); |
|
237 iContainer->SetMopParent( this ); // MObjectProvider |
|
238 |
|
239 // Setup the title |
|
240 // |
|
241 HBufC* usbTitleMain = iCoeEnv->AllocReadResourceLC( R_USB_TITLE ); |
|
242 CEikStatusPane* statusPane = StatusPane(); |
|
243 CAknTitlePane* titlePane; |
|
244 titlePane = ( CAknTitlePane* ) statusPane->ControlL(TUid::Uid( EEikStatusPaneUidTitle )); |
|
245 titlePane->SetTextL( *usbTitleMain ); |
|
246 CleanupStack::PopAndDestroy(usbTitleMain); |
|
247 iAppUIRef->AddToStackL( *this, iContainer ); |
|
248 } |
|
249 FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::DoActivateL() completed")); |
|
250 } |
|
251 |
|
252 // --------------------------------------------------------- |
|
253 // CUSBClassChangeUIPluginView::DoDeactivate |
|
254 // --------------------------------------------------------- |
|
255 // |
|
256 void CUSBClassChangeUIPluginView::DoDeactivate() |
|
257 { |
|
258 FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::DoDeactivate()")); |
|
259 |
|
260 if ( iContainer ) |
|
261 { |
|
262 iAppUIRef->RemoveFromStack( iContainer ); |
|
263 delete iContainer; |
|
264 iContainer = NULL; |
|
265 } |
|
266 |
|
267 |
|
268 FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::DoDeactivate() completed")); |
|
269 } |
|
270 |
|
271 // --------------------------------------------------------- |
|
272 // CUSBClassChangeUIPluginView::GetCaptionL |
|
273 // Method for getting caption of this plugin. |
|
274 // --------------------------------------------------------- |
|
275 // |
|
276 void CUSBClassChangeUIPluginView::GetCaptionL (TDes& aCaption) const |
|
277 { |
|
278 FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::GetCaptionL()")); |
|
279 // The resource file is already opened, see ConstructL() |
|
280 // |
|
281 HBufC* result = StringLoader::LoadL( R_GS_USBUI_VIEW_CAPTION ); |
|
282 aCaption.Copy( *result ); |
|
283 delete result; |
|
284 FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::GetCaptionL() completed")); |
|
285 } |
|
286 |
|
287 // --------------------------------------------------------- |
|
288 // CUSBClassChangeUIPluginView::GetValue |
|
289 // Function for getting plugin's value for a certain key. |
|
290 // --------------------------------------------------------- |
|
291 // |
|
292 void CUSBClassChangeUIPluginView::GetValue(const TGSPluginValueKeys aKey, |
|
293 TDes& aValue) |
|
294 { |
|
295 switch( aKey ) |
|
296 { |
|
297 case EGSPluginKeySettingsItemValueString: |
|
298 { |
|
299 // Get Id pin state of UsbOtg-capable device |
|
300 TBool hasPeripheralEnabled = EFalse; |
|
301 // Ignore error code |
|
302 TInt ret = iModelRef->HasPeripheralEnabled(hasPeripheralEnabled); |
|
303 FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::GetValue - HasPeripheralEnabled=%d"), ret)); |
|
304 |
|
305 TInt resId = 0; |
|
306 if (hasPeripheralEnabled) |
|
307 { |
|
308 resId = R_CP_DETAIL_USB_OTG_CONN; |
|
309 } |
|
310 else if (IsUSBDeviceConnected()) |
|
311 { |
|
312 TInt mode = USBMode(); |
|
313 switch (mode) |
|
314 { |
|
315 case KUsbPersonalityIdPCSuite: |
|
316 case KUsbPersonalityIdPCSuiteMTP: |
|
317 resId = R_CP_DETAIL_USB_CONN_PC_SUITE; |
|
318 break; |
|
319 case KUsbPersonalityIdMS: |
|
320 resId = R_CP_DETAIL_USB_CONN_MASS_STORAGE; |
|
321 break; |
|
322 case KUsbPersonalityIdPTP: |
|
323 resId = R_CP_DETAIL_USB_CONN_PICTURE_TRANSFER; |
|
324 break; |
|
325 case KUsbPersonalityIdMTP: |
|
326 resId = R_CP_DETAIL_USB_CONN_MEDIA_TRANSFER; |
|
327 break; |
|
328 case KUsbPersonalityIdModemInst: |
|
329 resId = R_CP_DETAIL_USB_CONN_MODEM_INST; |
|
330 break; |
|
331 |
|
332 case KUsbPersonalityIdRNDIS: |
|
333 resId = R_CP_DETAIL_USB_CONN_RNDIS; |
|
334 break; |
|
335 default: |
|
336 // Leave value empty |
|
337 break; |
|
338 } |
|
339 } |
|
340 else |
|
341 { |
|
342 resId = R_CP_DETAIL_USB_NOT_CONNECTED; |
|
343 } |
|
344 |
|
345 if (resId) |
|
346 { |
|
347 TRAP_IGNORE( |
|
348 HBufC* text = StringLoader::LoadL(resId); |
|
349 aValue.Append(*text); |
|
350 delete text; |
|
351 ); |
|
352 } |
|
353 } |
|
354 break; |
|
355 |
|
356 default: |
|
357 CGSPluginInterface::GetValue(aKey, aValue); |
|
358 break; |
|
359 } |
|
360 } |
|
361 |
|
362 // ---------------------------------------------------------------------------- |
|
363 // CUSBClassChangeUIPluginView::SettingChanged() |
|
364 // A setting has been changed. |
|
365 // ---------------------------------------------------------------------------- |
|
366 // |
|
367 void CUSBClassChangeUIPluginView::SettingChanged() |
|
368 { |
|
369 if (iContainer) |
|
370 { |
|
371 iContainer->SettingChanged(); |
|
372 } |
|
373 |
|
374 // Personality changes only affect USB UI when USB device is connected |
|
375 if (IsUSBDeviceConnected()) |
|
376 { |
|
377 UpdateParentView(); |
|
378 } |
|
379 } |
|
380 |
|
381 // ---------------------------------------------------------------------------- |
|
382 // CUSBClassChangeUIPluginView::DeviceStateChanged() |
|
383 // USB device state has changed. |
|
384 // ---------------------------------------------------------------------------- |
|
385 // |
|
386 void CUSBClassChangeUIPluginView::DeviceStateChanged(TUsbDeviceState /*aPrevState*/, |
|
387 TUsbDeviceState aState) |
|
388 { |
|
389 //Transitions to EUsbDeviceStateUndefined, EUsbDeviceStateConfigured |
|
390 //and EUsbDeviceStateAttached states update UI view. |
|
391 if (aState == EUsbDeviceStateConfigured || |
|
392 aState == EUsbDeviceStateUndefined || |
|
393 aState == EUsbDeviceStateAttached) |
|
394 { |
|
395 UpdateParentView(); |
|
396 if (iContainer) |
|
397 { |
|
398 iContainer->SettingChanged(); |
|
399 } |
|
400 } |
|
401 } |
|
402 |
|
403 // ---------------------------------------------------------------------------- |
|
404 // CUSBClassChangeUIPluginView::OtgHostIdPinStateChanged |
|
405 // ---------------------------------------------------------------------------- |
|
406 // |
|
407 void CUSBClassChangeUIPluginView::OtgHostIdPinStateChanged(TBool aIsIdPinOn) |
|
408 { |
|
409 if (!aIsIdPinOn) |
|
410 { |
|
411 UpdateParentView(); |
|
412 } |
|
413 // else, Ignore Id pin on event, host event to be checked further |
|
414 } |
|
415 |
|
416 // ---------------------------------------------------------------------------- |
|
417 // From MUSBOtgHostStateObserver |
|
418 // Handle host event notification |
|
419 // ---------------------------------------------------------------------------- |
|
420 void CUSBClassChangeUIPluginView::HostEventNotify(TDeviceEventInformation /*aEventInfo*/) |
|
421 { |
|
422 UpdateParentView(); |
|
423 } |
|
424 |
|
425 // ---------------------------------------------------------------------------- |
|
426 // CUSBClassChangeUIPluginView::USBMode() |
|
427 // Gets the current USB mode from model |
|
428 // ---------------------------------------------------------------------------- |
|
429 // |
|
430 TInt CUSBClassChangeUIPluginView::USBMode() const |
|
431 { |
|
432 return iModelRef->USBMode(); |
|
433 } |
|
434 // ---------------------------------------------------------------------------- |
|
435 // CUSBClassChangeUIPluginView::SetUSBModeL(TInt) |
|
436 // Sets the current USB mode through model |
|
437 // ---------------------------------------------------------------------------- |
|
438 // |
|
439 void CUSBClassChangeUIPluginView::SetUSBModeL( TInt aMode ) |
|
440 { |
|
441 FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::SetUSBModeL()")); |
|
442 |
|
443 iModelRef->SetUSBModeL( aMode ); |
|
444 |
|
445 FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::SetUSBModeL complete")); |
|
446 } |
|
447 |
|
448 // ---------------------------------------------------------------------------- |
|
449 // CUSBClassChangeUIPluginView::CreateIconL() |
|
450 // Creates icon for General Settings application |
|
451 // ---------------------------------------------------------------------------- |
|
452 // |
|
453 CGulIcon* CUSBClassChangeUIPluginView::CreateIconL( const TUid aIconType ) |
|
454 { |
|
455 FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::CreateIconL() - aIconType=0x%x"), aIconType.iUid)); |
|
456 |
|
457 CGulIcon* icon = NULL; |
|
458 |
|
459 if( aIconType == KGSIconTypeLbxItem ) |
|
460 { |
|
461 TFileName usbUiIconFilename( KFileDrive ); |
|
462 usbUiIconFilename += KDC_APP_BITMAP_DIR; |
|
463 usbUiIconFilename += KUSBUIconFileName; |
|
464 |
|
465 |
|
466 // Get peripheral connected state of UsbOtg-capable device |
|
467 TBool hasPeripheralEnabled = EFalse; |
|
468 TInt ret = iModelRef->HasPeripheralEnabled(hasPeripheralEnabled); |
|
469 // In case of failure of getting the status, hasPeripheralEnabled is EFalse. |
|
470 // So ignore the error code here. |
|
471 FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::CreateIconL - HasPeripheralEnabled=%d"), ret)); |
|
472 |
|
473 if (hasPeripheralEnabled || IsUSBDeviceConnected()) |
|
474 { |
|
475 icon = AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), |
|
476 KAknsIIDQgnPropSetAppsUsb, usbUiIconFilename, |
|
477 EMbmUsbuiQgn_prop_set_apps_usb, |
|
478 EMbmUsbuiQgn_prop_set_apps_usb_mask ); |
|
479 } |
|
480 else |
|
481 { |
|
482 icon = AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), |
|
483 KAknsIIDQgnPropSetAppsUsbOff, usbUiIconFilename, |
|
484 EMbmUsbuiQgn_prop_set_apps_usb_off, |
|
485 EMbmUsbuiQgn_prop_set_apps_usb_off_mask ); |
|
486 } |
|
487 } |
|
488 else |
|
489 { |
|
490 icon = CGSPluginInterface::CreateIconL( aIconType ); |
|
491 } |
|
492 |
|
493 FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::CreateIconL() completed")); |
|
494 return icon; |
|
495 } |
|
496 |
|
497 |
|
498 // ---------------------------------------------------------------------------- |
|
499 // CUSBClassChangeUIPluginView::HandleCmdChangeUSBModeL() |
|
500 // sets the selected usb mode |
|
501 // ---------------------------------------------------------------------------- |
|
502 // |
|
503 void CUSBClassChangeUIPluginView::HandleCmdChangeUSBModeL(TInt aMode) |
|
504 { |
|
505 FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::HandleCmdChangeUSBModeL()")); |
|
506 const RArray<TInt> usbIndexes = iModelRef->GetUsbIds(); |
|
507 SetUSBModeL( usbIndexes[aMode] ); |
|
508 FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::HandleCmdChangeUSBModeL() completed")); |
|
509 } |
|
510 |
|
511 |
|
512 // ---------------------------------------------------------------------------- |
|
513 // Remove Help from options menu, if the feature is not supported. |
|
514 // ---------------------------------------------------------------------------- |
|
515 // |
|
516 void CUSBClassChangeUIPluginView::DynInitMenuPaneL( TInt /*aResId*/, CEikMenuPane* aMenu ) |
|
517 { |
|
518 FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::DynInitMenuPaneL()")); |
|
519 //dim help if it is not supported and it exists |
|
520 if (!iHelpSupported) |
|
521 { |
|
522 TInt tmp; |
|
523 if ( aMenu->MenuItemExists(EUSBUICmdHelp, tmp) ) |
|
524 { |
|
525 aMenu->SetItemDimmed(EUSBUICmdHelp, ETrue); |
|
526 } |
|
527 } |
|
528 FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::DynInitMenuPaneL() completed")); |
|
529 } |
|
530 |
|
531 // ---------------------------------------------------------------------------- |
|
532 // CUSBClassChangeUIPluginView::IsUSBDeviceConnected() |
|
533 // Checks whether USB device is connected. |
|
534 // ---------------------------------------------------------------------------- |
|
535 // |
|
536 TBool CUSBClassChangeUIPluginView::IsUSBDeviceConnected() |
|
537 { |
|
538 TUsbDeviceState state = EUsbDeviceStateUndefined; |
|
539 return (iModelRef->GetDeviceState(state) == KErrNone && |
|
540 state != EUsbDeviceStateUndefined); |
|
541 } |
|
542 |
|
543 // ---------------------------------------------------------------------------- |
|
544 // CUSBClassChangeUIPluginView::UpdateParentView() |
|
545 // Updates parent view if we are loaded by GS plugin. |
|
546 // Copied from irappgspluginview.cpp |
|
547 // ---------------------------------------------------------------------------- |
|
548 // |
|
549 void CUSBClassChangeUIPluginView::UpdateParentView() |
|
550 { |
|
551 if (iLoadAsGSPlugin) |
|
552 { |
|
553 // Note: GetActiveViewId returns KErrNotFound if GS application |
|
554 // is running in the background. |
|
555 TVwsViewId vid; |
|
556 AppUi()->GetTopViewId(vid); |
|
557 if (vid.iViewUid == KGSConPluginUid) |
|
558 { |
|
559 CGSParentPlugin* parent; |
|
560 parent = (CGSParentPlugin*)AppUi()->View(vid.iViewUid); |
|
561 parent->UpdateView(); |
|
562 } |
|
563 } |
|
564 } |
|
565 |
|
566 // End of File |