1 /* |
1 /* |
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
31 #include <avkon.mbg> |
31 #include <avkon.mbg> |
32 #include <AknsConstants.h> |
32 #include <AknsConstants.h> |
33 #include <aknmessagequerydialog.h> |
33 #include <aknmessagequerydialog.h> |
34 //for cover display support |
34 //for cover display support |
35 #include <AknMediatorFacade.h> |
35 #include <AknMediatorFacade.h> |
36 #include <SecondaryDisplay/usbuinotifsecondarydisplay.h> // Dialog index for cover UI |
36 #include <secondarydisplay/usbuinotifsecondarydisplay.h> // Dialog index for cover UI |
37 #include <akndiscreetpopup.h> |
37 #include <akndiscreetpopup.h> |
38 #include <e32uid.h> // KExecutableImageUid |
38 #include <e32uid.h> // KExecutableImageUid |
39 #include <usbui.mbg> |
39 #include <usbui.mbg> |
|
40 |
40 #include "usbuincableconnectednotifier.h" // Own class definition |
41 #include "usbuincableconnectednotifier.h" // Own class definition |
41 #include "usbuinotifdebug.h" // Debugging macros |
42 #include "usbuinotifdebug.h" // Debugging macros |
42 #include "UsbWatcherInternalCRKeys.h" |
43 #include "UsbWatcherInternalCRKeys.h" |
43 #include "usbpersonalityids.h" |
44 #include "usbpersonalityids.h" |
44 #include "usbuinotif.hrh" |
45 #include "usbuinotif.hrh" |
45 |
46 |
46 // Literals |
47 // Literals |
47 |
48 |
48 _LIT(KUSBExe, "usbclasschangeui.exe"); |
49 _LIT(KUSBExe, "usbclasschangeui.exe"); |
49 const TInt KUSBUIUid = 0x102068E2; |
50 const TInt KUSBUIUid = 0x102068E2; |
50 _LIT(KFileDrive,"z:"); |
|
51 _LIT(KUSBUIconFileName, "usbui.mif"); |
|
52 |
51 |
53 // ================= MEMBER FUNCTIONS ========================================= |
52 // ================= MEMBER FUNCTIONS ========================================= |
54 |
53 |
55 // ---------------------------------------------------------------------------- |
54 // ---------------------------------------------------------------------------- |
56 // CUSBUICableConnectedNotifier::NewL |
55 // CUSBUICableConnectedNotifier::NewL |
74 // C++ default constructor can NOT contain any code, that |
73 // C++ default constructor can NOT contain any code, that |
75 // might leave. |
74 // might leave. |
76 // ---------------------------------------------------------------------------- |
75 // ---------------------------------------------------------------------------- |
77 // |
76 // |
78 CUSBUICableConnectedNotifier::CUSBUICableConnectedNotifier(): |
77 CUSBUICableConnectedNotifier::CUSBUICableConnectedNotifier(): |
79 iNoteVisible(EFalse) |
78 iNoteVisible(EFalse), |
|
79 iNoteTapped(EFalse) |
80 { |
80 { |
81 FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::default constructor")); |
81 FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::default constructor")); |
82 } |
82 } |
83 |
83 |
84 // ---------------------------------------------------------------------------- |
84 // ---------------------------------------------------------------------------- |
174 CUSBUINotifierBase::Cancel(); |
172 CUSBUINotifierBase::Cancel(); |
175 |
173 |
176 FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::Cancel() completed")); |
174 FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::Cancel() completed")); |
177 } |
175 } |
178 |
176 |
179 // ----------------------------------------------------------------------------------------------------------- |
177 // ---------------------------------------------------------------------------- |
180 // CUSBUICableConnectedNotifier::GetPersonalityStringL |
178 // CUSBUICableConnectedNotifier::GetPersonalityStringL |
181 // Get the strings for ask on connection message query |
179 // Get the strings for ask on connection message query |
182 // ----------------------------------------------------------------------------------------------------------- |
180 // ---------------------------------------------------------------------------- |
183 // |
181 // |
184 void CUSBUICableConnectedNotifier::GetPersonalityStringL( |
182 void CUSBUICableConnectedNotifier::GetPersonalityStringL( |
185 HBufC*& aHeader,HBufC*& aDescription ) |
183 HBufC*& aHeader,HBufC*& aDescription ) |
186 { |
184 { |
187 FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetPersonalityStringL")); |
185 FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetPersonalityStringL")); |
197 aHeader = StringLoader::LoadL(R_USB_MODE_MSG_HEADER); |
195 aHeader = StringLoader::LoadL(R_USB_MODE_MSG_HEADER); |
198 |
196 |
199 FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetPersonalityStringL completed")); |
197 FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetPersonalityStringL completed")); |
200 } |
198 } |
201 |
199 |
202 // ----------------------------------------------------------------------------------------------------------- |
200 // ---------------------------------------------------------------------------- |
203 // CUSBUICableConnectedNotifier::RunQueryL |
201 // CUSBUICableConnectedNotifier::RunQueryL |
204 // Run the ask on connection message query |
202 // Run the ask on connection message query |
205 // ----------------------------------------------------------------------------------------------------------- |
203 // ---------------------------------------------------------------------------- |
206 // |
204 // |
207 void CUSBUICableConnectedNotifier::RunQueryL() |
205 void CUSBUICableConnectedNotifier::RunQueryL() |
208 { |
206 { |
209 FLOG( _L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL()")); |
207 FLOG( _L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL()")); |
210 |
208 |
211 HBufC* header = NULL; |
209 HBufC* header = NULL; |
212 HBufC* description =NULL; |
210 HBufC* description =NULL; |
213 GetPersonalityStringL(header, description); |
211 GetPersonalityStringL(header, description); |
214 |
212 |
215 CleanupStack::PushL(header); |
213 CleanupStack::PushL(header); |
216 CleanupStack::PushL(description); |
214 CleanupStack::PushL(description); |
217 |
215 |
218 TFileName usbUiIconFilename( KFileDrive ); |
216 iNoteVisible = ETrue; |
219 usbUiIconFilename += KDC_APP_BITMAP_DIR; |
217 CAknDiscreetPopup::ShowGlobalPopupL( |
220 usbUiIconFilename += KUSBUIconFileName; |
218 *header, |
221 iNoteVisible = ETrue; |
219 *description, |
222 CAknDiscreetPopup::ShowGlobalPopupL(*header,*description, KAknsIIDQgnPropUsb, AknIconUtils::AvkonIconFileName(), |
220 KAknsIIDQgnPropUsb, |
223 EMbmAvkonQgn_prop_usb, EMbmAvkonQgn_prop_usb_mask,KAknDiscreetPopupDurationLong, EUSBUICmdDiscreetTapped,( MEikCommandObserver* ) this); |
221 AknIconUtils::AvkonIconFileName(), |
|
222 EMbmAvkonQgn_prop_usb, |
|
223 EMbmAvkonQgn_prop_usb_mask, |
|
224 KAknDiscreetPopupDurationLong, |
|
225 EUSBUICmdDiscreetTapped, |
|
226 (MEikCommandObserver*) this); |
224 |
227 |
225 CleanupStack::PopAndDestroy(description); |
228 CleanupStack::PopAndDestroy(description); |
226 CleanupStack::PopAndDestroy(header); |
229 CleanupStack::PopAndDestroy(header); |
227 |
230 |
228 FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL completed")); |
231 FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL completed")); |
249 // when discreet pop up is tapped the command will be handled here |
252 // when discreet pop up is tapped the command will be handled here |
250 // ---------------------------------------------------------------------------- |
253 // ---------------------------------------------------------------------------- |
251 // |
254 // |
252 void CUSBUICableConnectedNotifier::ProcessCommandL(TInt aCommandId) |
255 void CUSBUICableConnectedNotifier::ProcessCommandL(TInt aCommandId) |
253 { |
256 { |
|
257 FTRACE(FPrint(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::ProcessCommandL: %d"), |
|
258 aCommandId)); |
|
259 SuppressAppSwitching(EFalse); |
|
260 |
254 switch ( aCommandId ) |
261 switch ( aCommandId ) |
255 { |
262 { |
256 case EUSBUICmdDiscreetTapped: |
263 case EUSBUICmdDiscreetTapped: |
257 { |
264 { |
258 TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00),TUid::Uid(KUSBUIUid)); |
265 TUidType uidtype(KExecutableImageUid, TUid::Null(), TUid::Uid(KUSBUIUid)); |
259 CreateChosenViewL(KUSBExe(),uidtype); |
266 CreateChosenViewL(KUSBExe(),uidtype); |
|
267 iNoteTapped = ETrue; |
260 } |
268 } |
261 case EAknDiscreetPopupCmdClose: |
269 //fall through |
|
270 case EAknDiscreetPopupCmdClose: |
262 if ( iNoteWaiter.IsStarted() ) |
271 if ( iNoteWaiter.IsStarted() ) |
263 { |
272 { |
264 iNoteWaiter.AsyncStop(); |
273 iNoteWaiter.AsyncStop(); |
265 } |
274 } |
266 iNoteVisible = EFalse; |
275 iNoteVisible = EFalse; |
267 CompleteMessage( KErrCancel ); |
276 CompleteMessage( KErrCancel ); |
268 break; |
277 break; |
269 default: |
278 default: |
270 |
279 break; |
271 break; |
280 } |
272 } |
281 |
273 } |
282 if (!iNoteTapped) |
|
283 { |
|
284 FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::ProcessCommandL() restore keylock")); |
|
285 RestoreKeylock(); |
|
286 } |
|
287 |
|
288 FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::ProcessCommandL() completed")); |
|
289 } |
|
290 |
274 // --------------------------------------------------------------------------- |
291 // --------------------------------------------------------------------------- |
275 // CUSBUICableConnectedNotifier::CreateChosenViewL() |
292 // CUSBUICableConnectedNotifier::CreateChosenViewL() |
276 // creates the USB UI setting view |
293 // creates the USB UI setting view |
277 // --------------------------------------------------------------------------- |
294 // --------------------------------------------------------------------------- |
278 // |
295 // |
279 void CUSBUICableConnectedNotifier::CreateChosenViewL(const TDesC & aProcessName,const TUidType & aUidType) const |
296 void CUSBUICableConnectedNotifier::CreateChosenViewL( |
|
297 const TDesC & aProcessName, const TUidType & aUidType) const |
280 { |
298 { |
281 FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::CreateDesiredViewL() ")); |
299 FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::CreateDesiredViewL() ")); |
282 RProcess usbUiProcess; |
300 RProcess usbUiProcess; |
283 User::LeaveIfError(usbUiProcess.Create(aProcessName, KNullDesC, aUidType)); |
301 User::LeaveIfError(usbUiProcess.Create(aProcessName, KNullDesC, aUidType)); |
284 usbUiProcess.Resume(); |
302 usbUiProcess.Resume(); |
285 usbUiProcess.Close(); |
303 usbUiProcess.Close(); |
286 FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::CreateDesiredViewL() ")); |
304 FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::CreateDesiredViewL() ")); |
287 |
305 } |
288 } |
306 |
289 // End of File |
307 // End of File |