1 /* |
1 /* |
2 * Copyright (c) 2007, 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2007 - 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". |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 #include <hb/hbwidgets/hbdevicemessageboxsymbian.h> // dialog |
20 #include <hb/hbwidgets/hbdevicemessageboxsymbian.h> // dialog |
|
21 #include <hb/hbwidgets/hbdevicenotificationdialogsymbian.h> //discreet |
21 #include <hb/hbcore/hbtextresolversymbian.h> |
22 #include <hb/hbcore/hbtextresolversymbian.h> |
22 #include <usb/hostms/srverr.h> |
23 #include <usb/hostms/srverr.h> |
23 #include <usbuinotif.h> // pck |
24 #include <usbuinotif.h> // pck |
24 #include "usbuinotifmsmmerror.h" // Own class definition |
25 #include "usbuinotifmsmmerror.h" // Own class definition |
25 #include "usbuinotifdebug.h" // Debugging macros |
26 #include "usbuinotifdebug.h" // Debugging macros |
26 |
27 |
27 |
28 |
28 // CONSTANTS |
29 // CONSTANTS |
29 /** granularity for allocating error strings */ |
30 /** granularity for allocating error strings */ |
30 const TInt KUsbMsmmErrorGranularity = 3; |
31 const TInt KUsbMsmmErrorGranularity = 5; |
31 |
32 _LIT(KUSBUIconFileName, "qtg_large_usb"); |
32 // ================= MEMBER FUNCTIONS ========================================= |
33 // ================= MEMBER FUNCTIONS ========================================= |
33 |
34 |
34 // ---------------------------------------------------------------------------- |
35 // ---------------------------------------------------------------------------- |
35 // CUsbUiNotifOtgError::NewL |
36 // CUsbUiNotifOtgError::NewL |
36 // Two-phased constructor. |
37 // Two-phased constructor. |
74 CUSBUINotifierBase::ConstructL(); |
75 CUSBUINotifierBase::ConstructL(); |
75 iStringIds = new (ELeave) CDesCArrayFlat(KUsbMsmmErrorGranularity); |
76 iStringIds = new (ELeave) CDesCArrayFlat(KUsbMsmmErrorGranularity); |
76 _LIT(KGeneralError,"txt_usb_info_error_in_usb_connection_disconnect_d"); |
77 _LIT(KGeneralError,"txt_usb_info_error_in_usb_connection_disconnect_d"); |
77 _LIT(KUnknownFileSys, "txt_usb_info_unknown_file_system_disconnect_devic"); |
78 _LIT(KUnknownFileSys, "txt_usb_info_unknown_file_system_disconnect_devic"); |
78 _LIT(KOutOfMemory, "txt_usb_info_disk_full_remove_some_files_and_try"); |
79 _LIT(KOutOfMemory, "txt_usb_info_disk_full_remove_some_files_and_try"); |
|
80 _LIT(KSafeToRemove, "txt_usb_dpinfo_safe_to_remove"); |
|
81 _LIT(KUnableToEject,"txt_usb_info_unable_to_eject_the_usb_device_some" ); |
79 |
82 |
80 iStringIds->AppendL(KGeneralError); |
83 iStringIds->AppendL(KGeneralError); |
81 iStringIds->AppendL(KUnknownFileSys); |
84 iStringIds->AppendL(KUnknownFileSys); |
82 iStringIds->AppendL(KOutOfMemory); |
85 iStringIds->AppendL(KOutOfMemory); |
|
86 iStringIds->AppendL(KSafeToRemove); |
|
87 iStringIds->AppendL(KUnableToEject); |
83 } |
88 } |
84 |
89 |
85 // ---------------------------------------------------------------------------- |
90 // ---------------------------------------------------------------------------- |
86 // CUsbUiNotifMSMMError::RegisterL |
91 // CUsbUiNotifMSMMError::RegisterL |
87 // Register notifier. |
92 // Register notifier. |
112 InitializeTextResolver(); |
117 InitializeTextResolver(); |
113 |
118 |
114 iMessage = aMessage; |
119 iMessage = aMessage; |
115 iNeedToCompleteMessage = ETrue; |
120 iNeedToCompleteMessage = ETrue; |
116 iReplySlot = aReplySlot; |
121 iReplySlot = aReplySlot; |
117 |
122 _LIT(KUsbDisconnected, "txt_usb_dpophead_usb_disconnected"); |
118 // Get parameters |
123 // Get parameters |
119 // |
124 // |
120 THostMsErrData error; |
125 THostMsErrData error; |
121 TPckgC<THostMsErrData> pckg( error ); |
126 TPckgC<THostMsErrData> pckg( error ); |
122 pckg.Set( aBuffer ); |
127 pckg.Set( aBuffer ); |
126 case EHostMsErrUnknownFileSystem: |
131 case EHostMsErrUnknownFileSystem: |
127 errorId = EUsbMSMMUnknownFileSystem; |
132 errorId = EUsbMSMMUnknownFileSystem; |
128 break; |
133 break; |
129 case EHostMsErrOutOfMemory: |
134 case EHostMsErrOutOfMemory: |
130 errorId = EUsbMSMMOutOfMemory; |
135 errorId = EUsbMSMMOutOfMemory; |
131 break; |
136 break; |
|
137 case EHostMsErrNone: |
|
138 errorId = EUsbMSMMSafeToRemove; |
|
139 break; |
|
140 case EHostMsErrInUse: |
|
141 errorId = EUsbMSMMUnableToEject; |
|
142 break; |
132 default: |
143 default: |
133 errorId = EUsbMSMMGeneralError; |
144 errorId = EUsbMSMMGeneralError; |
134 } |
145 } |
135 |
146 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(iStringIds->MdcaPoint(errorId)); |
136 //Delete the query in case the client didn't cancel the notifier |
147 |
137 //or close the session after the previous query. |
148 |
138 if (iQuery) |
149 if ( errorId == EUsbMSMMSafeToRemove) |
139 { |
150 { |
140 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::GetParamsL() deleting previous dialog")); |
151 // "safe to remove" discreet popup |
141 delete iQuery; |
152 HBufC* header = HbTextResolverSymbian::LoadLC(KUsbDisconnected); |
142 iQuery = NULL; |
153 if (iDiscreet) |
143 } |
154 { |
144 |
155 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::StartDialogL() deleting previous dialog")); |
145 iQuery = CHbDeviceMessageBoxSymbian::NewL( |
156 delete iDiscreet; |
146 CHbDeviceMessageBoxSymbian::EWarning, this); |
157 iDiscreet = NULL; |
147 iQuery->SetTimeout(0); |
158 } |
148 |
159 iDiscreet = CHbDeviceNotificationDialogSymbian::NewL(this); |
149 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(iStringIds->MdcaPoint(errorId)); |
160 iDiscreet->SetTitleL(*header); |
150 iQuery->SetTextL(*stringHolder); |
161 iDiscreet->SetTextL(*stringHolder); |
151 iQuery->ShowL(); |
162 iDiscreet->SetIconNameL(KUSBUIconFileName ); |
|
163 iDiscreet->ShowL(); |
|
164 CleanupStack::PopAndDestroy( header ); |
|
165 } |
|
166 else |
|
167 { |
|
168 //Delete the query in case the client didn't cancel the notifier |
|
169 //or close the session after the previous query. |
|
170 |
|
171 if (iQuery) |
|
172 { |
|
173 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::StartDialogL() deleting previous dialog")); |
|
174 delete iQuery; |
|
175 iQuery = NULL; |
|
176 } |
|
177 |
|
178 iQuery = CHbDeviceMessageBoxSymbian::NewL( |
|
179 CHbDeviceMessageBoxSymbian::EWarning, this); |
|
180 iQuery->SetTimeout(0); |
|
181 |
|
182 |
|
183 iQuery->SetTextL(*stringHolder); |
|
184 iQuery->ShowL(); |
|
185 } |
|
186 |
152 CleanupStack::PopAndDestroy( stringHolder ); |
187 CleanupStack::PopAndDestroy( stringHolder ); |
|
188 |
153 |
189 |
154 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::GetParamsL() completed")); |
190 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::StartDialogL() completed")); |
155 } |
191 } |
156 |
192 |
157 // ---------------------------------------------------------------------------- |
193 // ---------------------------------------------------------------------------- |
158 // CUsbUiNotifMSMMError::Cancel |
194 // CUsbUiNotifMSMMError::Cancel |
159 // Release all own resources (member variables) |
195 // Release all own resources (member variables) |
169 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::Cancel iQuery closed")); |
205 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::Cancel iQuery closed")); |
170 delete iQuery; |
206 delete iQuery; |
171 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::Cancel iQuery deleted")); |
207 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::Cancel iQuery deleted")); |
172 iQuery = NULL; |
208 iQuery = NULL; |
173 } |
209 } |
|
210 if (iDiscreet) |
|
211 { |
|
212 iDiscreet->Close(); |
|
213 delete iDiscreet; |
|
214 iDiscreet = NULL; |
|
215 } |
174 CUSBUINotifierBase::Cancel(); |
216 CUSBUINotifierBase::Cancel(); |
175 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::Cancel() completed")); |
217 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::Cancel() completed")); |
176 } |
218 } |
177 |
219 |
178 // ---------------------------------------------------------------------------- |
220 // ---------------------------------------------------------------------------- |
201 CompleteMessage( returnValue ); |
243 CompleteMessage( returnValue ); |
202 |
244 |
203 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::MessageBoxClosed completed")); |
245 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::MessageBoxClosed completed")); |
204 } |
246 } |
205 |
247 |
|
248 void CUsbUiNotifMSMMError::NotificationDialogActivated( |
|
249 const CHbDeviceNotificationDialogSymbian* /*aDialog*/) |
|
250 { |
|
251 |
|
252 } |
|
253 |
|
254 void CUsbUiNotifMSMMError::NotificationDialogClosed( |
|
255 const CHbDeviceNotificationDialogSymbian* /*aDialog*/, TInt /*aCompletionCode*/) |
|
256 { |
|
257 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::NotificationDialogClosed()")); |
|
258 CompleteMessage( KErrCancel ); |
|
259 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::NotificationDialogClosed() complete")); |
|
260 } |
206 // End of File |
261 // End of File |