21 #include <bautils.h> // BAFL utils (for language file) |
21 #include <bautils.h> // BAFL utils (for language file) |
22 #include <utf.h> // Unicode character conversion utilities |
22 #include <utf.h> // Unicode character conversion utilities |
23 #include <StringLoader.h> // Localisation stringloader |
23 #include <StringLoader.h> // Localisation stringloader |
24 #include <AknQueryDialog.h> |
24 #include <AknQueryDialog.h> |
25 #include <aknnotewrappers.h> |
25 #include <aknnotewrappers.h> |
26 #include <featmgr.h> |
|
27 |
26 |
28 #include <usbuinotif.h> // pck |
27 #include <usbuinotif.h> // pck |
29 #include <usbuinotif.rsg> // Own resources |
28 #include <usbuinotif.rsg> // Own resources |
30 #include "usbuinotifotgerror.h" // Own class definition |
29 #include "usbuinotifotgerror.h" // Own class definition |
31 #include "usbuinotifdebug.h" // Debugging macros |
30 #include "usbuinotifdebug.h" // Debugging macros |
65 { |
64 { |
66 //Make sure that the request is completed. Note that inside the destructor, |
65 //Make sure that the request is completed. Note that inside the destructor, |
67 //this virtual function call is to local CUsbUiNotifOtgError::Cancel, |
66 //this virtual function call is to local CUsbUiNotifOtgError::Cancel, |
68 //not to any possibly derived class implementation. |
67 //not to any possibly derived class implementation. |
69 Cancel(); |
68 Cancel(); |
70 delete iDialerWatcher; |
|
71 delete iQuery; |
|
72 } |
69 } |
73 |
70 |
74 void CUsbUiNotifOtgError::ConstructL() |
71 void CUsbUiNotifOtgError::ConstructL() |
75 { |
72 { |
76 CUSBUINotifierBase::ConstructL(); |
73 CUSBUINotifierBase::ConstructL(); |
106 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::GetParamsL")); |
103 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::GetParamsL")); |
107 if (iQuery || iReplySlot != 0 || iNeedToCompleteMessage) |
104 if (iQuery || iReplySlot != 0 || iNeedToCompleteMessage) |
108 { |
105 { |
109 User::Leave( KErrInUse ); |
106 User::Leave( KErrInUse ); |
110 } |
107 } |
111 |
108 |
112 iMessage = aMessage; |
|
113 iNeedToCompleteMessage = ETrue; |
|
114 iReplySlot = aReplySlot; |
|
115 |
|
116 // Get parameters |
109 // Get parameters |
117 // |
110 // |
118 iErrorId = 0; |
111 |
119 TPckgC<TInt> pckg( iErrorId ); |
112 TPckgC<TInt> pckg( iErrorId ); |
120 pckg.Set( aBuffer ); |
113 pckg.Set( aBuffer ); |
121 iErrorId = pckg(); |
114 iErrorId = pckg(); |
122 |
115 |
|
116 FTRACE(FPrint(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::GetParamsL iErrorId: %d"), iErrorId )); |
|
117 if ( iErrorId < 0 || iErrorId >= iStringIds.Count() ) |
|
118 { |
|
119 User::Leave( KErrArgument); |
|
120 } |
|
121 |
|
122 iMessage = aMessage; |
|
123 iNeedToCompleteMessage = ETrue; |
|
124 iReplySlot = aReplySlot; |
|
125 |
123 SetActive(); |
126 SetActive(); |
124 iStatus = KRequestPending; |
127 iStatus = KRequestPending; |
125 TRequestStatus* stat = &iStatus; |
128 TRequestStatus* stat = &iStatus; |
126 User::RequestComplete( stat, KErrNone ); |
129 User::RequestComplete( stat, KErrNone ); |
127 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::GetParamsL() completed")); |
130 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::GetParamsL() completed")); |
134 // |
137 // |
135 void CUsbUiNotifOtgError::RunL() |
138 void CUsbUiNotifOtgError::RunL() |
136 { |
139 { |
137 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::RunL")); |
140 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::RunL")); |
138 TInt returnValue = KErrNone; |
141 TInt returnValue = KErrNone; |
139 FeatureManager::InitializeLibL(); |
142 |
140 if ( FeatureManager::FeatureSupported( KFeatureIdFfKeypadNoSendKey ) ) |
|
141 { |
|
142 if (!iDialerWatcher) |
|
143 { |
|
144 iDialerWatcher = CUsbuinotifDialerWatcher::NewL(this); |
|
145 } |
|
146 } |
|
147 FeatureManager::UnInitializeLib(); |
|
148 iDismissed=EFalse; |
|
149 DisableKeylock(); |
143 DisableKeylock(); |
150 SuppressAppSwitching( ETrue ); |
144 SuppressAppSwitching( ETrue ); |
151 |
145 |
152 //Excute dialog and check return value |
146 //Excute dialog and check return value |
153 returnValue = QueryUserResponseL(); |
147 returnValue = QueryUserResponseL(); |
154 if (!iDismissed) |
148 |
155 { |
149 SuppressAppSwitching( EFalse ); |
156 SuppressAppSwitching( EFalse ); |
150 RestoreKeylock(); |
157 RestoreKeylock(); |
151 CompleteMessage( returnValue ); |
158 delete iDialerWatcher; |
|
159 iDialerWatcher = NULL; |
|
160 CompleteMessage( returnValue ); |
|
161 } |
|
162 |
152 |
163 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::RunL() completed")); |
153 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::RunL() completed")); |
164 } |
154 } |
165 |
155 |
166 // ---------------------------------------------------------------------------- |
156 // ---------------------------------------------------------------------------- |
168 // Release all own resources (member variables) |
158 // Release all own resources (member variables) |
169 // ---------------------------------------------------------------------------- |
159 // ---------------------------------------------------------------------------- |
170 // |
160 // |
171 void CUsbUiNotifOtgError::Cancel() |
161 void CUsbUiNotifOtgError::Cancel() |
172 { |
162 { |
173 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::Cancel")); |
163 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::Cancel")); |
174 |
|
175 // If dialog is not dismissed this is normal cancel and if query |
|
176 // doesn't exsist notifier is canceled during dismission |
|
177 if (!iDismissed || !iQuery ) |
|
178 { |
|
179 delete iDialerWatcher; |
|
180 iDialerWatcher = NULL; |
|
181 CompleteMessage( KErrCancel ); |
|
182 } |
|
183 if (iQuery) |
164 if (iQuery) |
184 { |
165 { |
185 delete iQuery; |
166 delete iQuery; |
186 iQuery = NULL; |
167 iQuery = NULL; |
187 } |
168 } |
|
169 CompleteMessage( KErrCancel ); |
|
170 |
188 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::Cancel() completed")); |
171 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::Cancel() completed")); |
189 } |
|
190 |
|
191 // ---------------------------------------------------------------------------- |
|
192 // CUsbUiNotifOtgError::DialerActivated |
|
193 // Release all own resources (member variables) |
|
194 // ---------------------------------------------------------------------------- |
|
195 // |
|
196 void CUsbUiNotifOtgError::DialerActivated() |
|
197 { |
|
198 FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::AppKeyPressed()")); |
|
199 if ( iQuery ) |
|
200 { |
|
201 iDismissed=ETrue; |
|
202 Cancel(); |
|
203 } |
|
204 } |
|
205 |
|
206 // ---------------------------------------------------------------------------- |
|
207 // CUsbUiNotifOtgError::ReActivateDialog |
|
208 // Release all own resources (member variables) |
|
209 // ---------------------------------------------------------------------------- |
|
210 // |
|
211 void CUsbUiNotifOtgError::ReActivateDialog() |
|
212 { |
|
213 FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::ReActivateDialog()")); |
|
214 if ( !IsActive()) |
|
215 { |
|
216 SetActive(); |
|
217 iStatus = KRequestPending; |
|
218 TRequestStatus* stat = &iStatus; |
|
219 User::RequestComplete( stat, KErrNone ); |
|
220 } |
|
221 } |
172 } |
222 |
173 |
223 // ---------------------------------------------------------------------------- |
174 // ---------------------------------------------------------------------------- |
224 // CUsbUiNotifOtgError::QueryUserResponseL |
175 // CUsbUiNotifOtgError::QueryUserResponseL |
225 // Show query dialog. |
176 // Show query dialog. |
228 TInt CUsbUiNotifOtgError::QueryUserResponseL() |
179 TInt CUsbUiNotifOtgError::QueryUserResponseL() |
229 { |
180 { |
230 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::QueryUserResponseL")); |
181 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::QueryUserResponseL")); |
231 TInt returnValue = KErrNone; |
182 TInt returnValue = KErrNone; |
232 TInt resourceId = R_USB_QUERY_OTG_ERROR; |
183 TInt resourceId = R_USB_QUERY_OTG_ERROR; |
233 if (iDismissed) |
184 |
234 { |
185 iQuery = CAknQueryDialog::NewL( CAknQueryDialog::EErrorTone ); |
235 iQuery = CAknQueryDialog::NewL(); |
186 |
236 } |
|
237 else |
|
238 { |
|
239 iQuery = CAknQueryDialog::NewL( CAknQueryDialog::EErrorTone ); |
|
240 } |
|
241 |
|
242 |
|
243 iDismissed=EFalse; |
|
244 if (iCoverDisplaySupported) |
187 if (iCoverDisplaySupported) |
245 { |
188 { |
246 iQuery->PublishDialogL( iErrorId, KUsbUiNotifOtgError ); |
189 iQuery->PublishDialogL( iErrorId, KUsbUiNotifOtgError ); |
247 } |
190 } |
248 HBufC *stringHolder = StringLoader::LoadLC( iStringIds[iErrorId] ); |
191 HBufC *stringHolder = StringLoader::LoadLC( iStringIds[iErrorId] ); |