34 #include <MMGFetchVerifier.h> // MMGFetchVerifier |
34 #include <MMGFetchVerifier.h> // MMGFetchVerifier |
35 |
35 |
36 #include <RPbk2LocalizedResourceFile.h> |
36 #include <RPbk2LocalizedResourceFile.h> |
37 #include "Pbk2DataCaging.hrh" |
37 #include "Pbk2DataCaging.hrh" |
38 #include "Pbk2PresentationUtils.h" |
38 #include "Pbk2PresentationUtils.h" |
39 #include <pbk2commonui.rsg> |
39 #include <Pbk2CommonUi.rsg> |
40 #include <pbk2uicontrols.rsg> |
40 #include <Pbk2UIControls.rsg> |
41 #include <pbk2commands.rsg> |
41 #include <Pbk2Commands.rsg> |
42 |
42 |
43 #include <MPbk2ImageOperationObservers.h> // MPbk2ImageSetObserver |
43 #include <MPbk2ImageOperationObservers.h> // MPbk2ImageSetObserver |
44 #include <AknServerApp.h> // MAknServerAppExitObserver |
44 #include <AknServerApp.h> // MAknServerAppExitObserver |
45 |
45 |
46 // VPbk includes |
46 // VPbk includes |
47 #include <MVPbkStoreContact.h> |
47 #include <MVPbkStoreContact.h> |
48 #include <MVPbkStoreContactField.h> |
48 #include <MVPbkStoreContactField.h> |
49 #include <CVPbkContactManager.h> |
49 #include <CVPbkContactManager.h> |
50 #include <TVPbkFieldTypeMapping.h> |
50 #include <TVPbkFieldTypeMapping.h> |
51 #include <MVPbkFieldType.h> |
51 #include <MVPbkFieldType.h> |
52 #include <vpbkeng.rsg> |
52 #include <VPbkEng.rsg> |
53 |
53 |
54 // System includes |
54 // System includes |
55 #include <barsread.h> |
55 #include <barsread.h> |
56 #include <coemain.h> |
56 #include <coemain.h> |
57 #include <AknWaitDialog.h> |
57 #include <AknWaitDialog.h> |
58 #include <aknnotewrappers.h> |
58 #include <aknnotewrappers.h> |
59 #include <StringLoader.h> |
59 #include <StringLoader.h> |
60 #include <MGFetch.h> |
60 #include <MGFetch.h> |
61 #include <DocumentHandler.h> // CDocumentHandler |
61 #include <DocumentHandler.h> // CDocumentHandler |
62 #include <apmstd.h> // TDataType |
62 #include <apmstd.h> // TDataType |
63 #include <pbk2cmdextres.rsg> |
63 #include <Pbk2CmdExtRes.rsg> |
64 #include <sysutil.h> |
64 #include <sysutil.h> |
65 #include <CPbk2ApplicationServices.h> |
65 #include <CPbk2ApplicationServices.h> |
66 #include <AknProgressDialog.h> |
66 #include <AknProgressDialog.h> |
67 |
67 |
68 /// Unnamed namespace for local definitions |
68 /// Unnamed namespace for local definitions |
617 |
617 |
618 CPbk2ImageManager* imageManager = CPbk2ImageManager::NewL( |
618 CPbk2ImageManager* imageManager = CPbk2ImageManager::NewL( |
619 services.ContactManager() ); |
619 services.ContactManager() ); |
620 CleanupStack::PushL( imageManager ); |
620 CleanupStack::PushL( imageManager ); |
621 |
621 |
622 const MVPbkFieldType* thumbType = services.ContactManager().FieldTypes().Find( |
622 if( CAknQueryDialog::NewL()->ExecuteLD( |
623 R_VPBK_FIELD_TYPE_THUMBNAILPIC ); |
623 R_PHONEBOOK2_REMOVE_IMAGE_CONFIRMATION_DIALOG ) ) |
624 |
624 { |
625 // show a confirmation query if contact has an image |
625 TPbk2StoreContactAnalyzer analyzer( |
626 if (thumbType && imageManager->HasImage( *aContact, *thumbType ) ) |
626 services.ContactManager(), aContact ); |
627 { |
627 TInt imageIndex = analyzer.HasFieldL( R_PHONEBOOK2_IMAGE_SELECTOR ); |
628 if ( CAknQueryDialog::NewL()->ExecuteLD( |
628 |
629 R_PHONEBOOK2_REMOVE_IMAGE_CONFIRMATION_DIALOG ) ) |
629 if ( imageIndex != KErrNotFound ) |
630 { |
630 { |
631 TPbk2StoreContactAnalyzer analyzer( |
631 //aContact->RemoveField( imageIndex ); |
632 services.ContactManager(), aContact ); |
632 //Instead of above we don't remove the field, just zero it's data |
633 TInt imageIndex = analyzer.HasFieldL( R_PHONEBOOK2_IMAGE_SELECTOR ); |
633 MVPbkContactFieldData& data(aContact->Fields(). |
634 |
634 FieldAt( imageIndex ).FieldData()); |
635 if ( imageIndex != KErrNotFound ) |
635 MVPbkContactFieldTextData::Cast( data ).SetTextL(KNullDesC); |
636 { |
636 } |
637 //aContact->RemoveField( imageIndex ); |
637 |
638 //Instead of above we don't remove the field, just zero it's data |
638 const MVPbkFieldType* thumbFieldType = ThumbnailFieldTypeL(services); |
639 MVPbkContactFieldData& data(aContact->Fields(). |
639 imageManager->RemoveImage( *aContact, *thumbFieldType ); |
640 FieldAt( imageIndex ).FieldData()); |
640 } |
641 MVPbkContactFieldTextData::Cast( data ).SetTextL(KNullDesC); |
|
642 } |
|
643 |
|
644 const MVPbkFieldType* thumbFieldType = ThumbnailFieldTypeL(services); |
|
645 imageManager->RemoveImage( *aContact, *thumbFieldType ); |
|
646 } |
|
647 } |
|
648 |
|
649 CleanupStack::PopAndDestroy( imageManager ); |
641 CleanupStack::PopAndDestroy( imageManager ); |
|
642 |
650 CleanupStack::PopAndDestroy(); // services |
643 CleanupStack::PopAndDestroy(); // services |
651 |
644 |
652 return NULL; // synchronous operation |
645 return NULL; // synchronous operation |
653 } |
646 } |
654 |
647 |