16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 #include "cpbk2deletemycardcmd.h" |
20 #include "cpbk2deletemycardcmd.h" |
|
21 #include <StringLoader.h> |
|
22 #include <AknQueryDialog.h> |
|
23 #include <Pbk2ExNamesListRes.rsg> |
21 |
24 |
22 // Phonebook2 |
25 // Phonebook2 |
23 #include <CPbk2ApplicationServices.h> |
26 #include <CPbk2ApplicationServices.h> |
24 #include <MPbk2CommandObserver.h> |
27 #include <MPbk2CommandObserver.h> |
25 #include <Pbk2UIControls.rsg> |
28 #include <Pbk2UIControls.rsg> |
87 { |
90 { |
88 iUiControl->RegisterCommand(NULL); |
91 iUiControl->RegisterCommand(NULL); |
89 } |
92 } |
90 |
93 |
91 delete iContactsArray; |
94 delete iContactsArray; |
92 delete iRetrieveOperation; |
|
93 delete iDeleteOperation; |
95 delete iDeleteOperation; |
94 delete iStoreContact; |
|
95 Release( iAppServices ); |
96 Release( iAppServices ); |
96 } |
97 } |
97 |
98 |
98 // -------------------------------------------------------------------------- |
99 // -------------------------------------------------------------------------- |
99 // CPbk2DeleteMyCardCmd::ConstructL |
100 // CPbk2DeleteMyCardCmd::ConstructL |
134 void CPbk2DeleteMyCardCmd::ExecuteLD() |
135 void CPbk2DeleteMyCardCmd::ExecuteLD() |
135 { |
136 { |
136 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
137 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
137 ("CPbk2DeleteMyCardCmd::ExecuteLD(0x%x)"), this); |
138 ("CPbk2DeleteMyCardCmd::ExecuteLD(0x%x)"), this); |
138 |
139 |
139 IssueRequest( ERetrieving ); |
140 IssueRequest( EConfirming ); |
140 } |
141 } |
141 |
142 |
142 // -------------------------------------------------------------------------- |
143 // -------------------------------------------------------------------------- |
143 // CPbk2DeleteMyCardCmd::AddObserver |
144 // CPbk2DeleteMyCardCmd::AddObserver |
144 // -------------------------------------------------------------------------- |
145 // -------------------------------------------------------------------------- |
223 // |
217 // |
224 TInt CPbk2DeleteMyCardCmd::RunError( TInt aError ) |
218 TInt CPbk2DeleteMyCardCmd::RunError( TInt aError ) |
225 { |
219 { |
226 ProcessDismissed( aError ); |
220 ProcessDismissed( aError ); |
227 return aError; |
221 return aError; |
228 } |
|
229 |
|
230 // -------------------------------------------------------------------------- |
|
231 // CPbk2DeleteMyCardCmd::VPbkSingleContactOperationComplete |
|
232 // -------------------------------------------------------------------------- |
|
233 // |
|
234 void CPbk2DeleteMyCardCmd::VPbkSingleContactOperationComplete( |
|
235 MVPbkContactOperationBase& aOperation, |
|
236 MVPbkStoreContact* aContact ) |
|
237 { |
|
238 if ( &aOperation == iRetrieveOperation ) |
|
239 { |
|
240 delete iRetrieveOperation; |
|
241 iRetrieveOperation = NULL; |
|
242 |
|
243 // We now have a store contact and we can issue a confirmation |
|
244 iStoreContact = aContact; |
|
245 IssueRequest( EConfirming ); |
|
246 } |
|
247 } |
|
248 |
|
249 // -------------------------------------------------------------------------- |
|
250 // CPbk2DeleteMyCardCmd::VPbkSingleContactOperationFailed |
|
251 // -------------------------------------------------------------------------- |
|
252 // |
|
253 void CPbk2DeleteMyCardCmd::VPbkSingleContactOperationFailed( |
|
254 MVPbkContactOperationBase& aOperation, |
|
255 TInt aError ) |
|
256 { |
|
257 if ( &aOperation == iRetrieveOperation ) |
|
258 { |
|
259 delete iRetrieveOperation; |
|
260 iRetrieveOperation = NULL; |
|
261 |
|
262 // We cannot get the contact, so we have to fail |
|
263 ProcessDismissed( aError ); |
|
264 } |
|
265 } |
222 } |
266 |
223 |
267 // -------------------------------------------------------------------------- |
224 // -------------------------------------------------------------------------- |
268 // CPbk2DeleteMyCardCmd::StepComplete |
225 // CPbk2DeleteMyCardCmd::StepComplete |
269 // -------------------------------------------------------------------------- |
226 // -------------------------------------------------------------------------- |
328 // Notify command owner that the command has finished |
285 // Notify command owner that the command has finished |
329 iCommandObserver->CommandFinished( *this ); |
286 iCommandObserver->CommandFinished( *this ); |
330 } |
287 } |
331 |
288 |
332 // -------------------------------------------------------------------------- |
289 // -------------------------------------------------------------------------- |
333 // CPbk2DeleteMyCardCmd::RetrieveContactL |
|
334 // -------------------------------------------------------------------------- |
|
335 // |
|
336 void CPbk2DeleteMyCardCmd::RetrieveContactL( |
|
337 const MVPbkContactLink& aContactLink ) |
|
338 { |
|
339 // Retrieve the actual store contact from the given link |
|
340 iRetrieveOperation = iAppServices-> |
|
341 ContactManager().RetrieveContactL( aContactLink, *this ); |
|
342 } |
|
343 |
|
344 // -------------------------------------------------------------------------- |
|
345 // CPbk2DeleteMyCardCmd::DeleteContactL |
290 // CPbk2DeleteMyCardCmd::DeleteContactL |
346 // -------------------------------------------------------------------------- |
291 // -------------------------------------------------------------------------- |
347 // |
292 // |
348 void CPbk2DeleteMyCardCmd::DeleteContactL() |
293 void CPbk2DeleteMyCardCmd::DeleteContactL() |
349 { |
294 { |
376 // CPbk2DeleteMyCardCmd::ConfirmDeletionL |
321 // CPbk2DeleteMyCardCmd::ConfirmDeletionL |
377 // -------------------------------------------------------------------------- |
322 // -------------------------------------------------------------------------- |
378 // |
323 // |
379 void CPbk2DeleteMyCardCmd::ConfirmDeletionL() |
324 void CPbk2DeleteMyCardCmd::ConfirmDeletionL() |
380 { |
325 { |
381 CPbk2GeneralConfirmationQuery* query = |
326 HBufC* prompt = |
382 CPbk2GeneralConfirmationQuery::NewL(); |
327 StringLoader::LoadLC( R_QTN_PHOB_MY_CARD_CLEAR_CONFIRM ); |
383 |
328 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
384 if( query->ExecuteLD( *iStoreContact, R_QTN_QUERY_COMMON_CONF_DELETE, |
329 if( dlg->ExecuteLD( R_PBK2_GENERAL_CONFIRMATION_QUERY, *prompt ) ) |
385 MPbk2ContactNameFormatter::EPreserveAllOriginalSpaces ) ) |
|
386 { |
330 { |
387 // Continue with starting the deletion |
331 // Continue with starting the deletion |
388 IssueRequest( EStarting ); |
332 IssueRequest( EStarting ); |
389 } |
333 } |
390 else |
334 else |
391 { |
335 { |
392 IssueRequest( ECanceling ); |
336 IssueRequest( ECanceling ); |
393 } |
337 } |
|
338 CleanupStack::PopAndDestroy( prompt ); |
394 } |
339 } |
395 |
340 |
396 // End of File |
341 // End of File |