mobilemessaging/unieditor/application/inc/UniEditorVCardOperation.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2006,2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   CUniEditorVCardOperation class definition.      
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __UNIEDITORVCARDOPERATION_H
       
    21 #define __UNIEDITORVCARDOPERATION_H
       
    22 
       
    23 // INCLUDES
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <e32std.h>
       
    27 
       
    28 // Virtual phonebook
       
    29 #include <CVPbkVCardEng.h>
       
    30 #include <MVPbkStoreContact.h>
       
    31 #include <MVPbkContactLink.h>
       
    32 #include <MVPbkContactLinkArray.h>
       
    33 #include <MVPbkContactOperationBase.h>
       
    34 #include <MVPbkSingleContactOperationObserver.h>
       
    35 
       
    36 #include <MsgCheckNames.h>
       
    37 
       
    38 #include "UniEditorOperation.h"
       
    39 #include "UniEditorDocument.h"
       
    40 
       
    41 // CONSTANTS
       
    42 
       
    43 // MACROS
       
    44 
       
    45 // FORWARD DECLARATIONS
       
    46 class CContactMatcher;
       
    47 
       
    48 // DATA TYPES
       
    49 
       
    50 // FUNCTION PROTOTYPES
       
    51 
       
    52 // CLASS DECLARATION
       
    53 
       
    54 /**
       
    55 * CUniEditorVCardOperation, Storage for single attachment in presentation. 
       
    56 *
       
    57 * @since 3.2
       
    58 */
       
    59 class CUniEditorVCardOperation : public CUniEditorOperation,
       
    60                                  public MVPbkSingleContactOperationObserver
       
    61     {
       
    62     public:  // New methods
       
    63 
       
    64         /**
       
    65         * Factory method that creates this object.
       
    66         *
       
    67         * @since    3.2
       
    68         * @param    aObserver, reference to application UI.
       
    69         * @param    aDocument, reference to application's document.
       
    70         * @param    aFs, reference to file session
       
    71         * @return   Pointer to instance in cleanup stack
       
    72         */
       
    73         static CUniEditorVCardOperation* NewL(
       
    74             MUniEditorOperationObserver& aObserver,
       
    75             CUniEditorDocument& aDocument,
       
    76             RFs& aFs );
       
    77 
       
    78         /**
       
    79         * Destructor
       
    80         */
       
    81         virtual ~CUniEditorVCardOperation();
       
    82 
       
    83         /**
       
    84         * Starts the operation         
       
    85         */
       
    86         void Start();
       
    87 
       
    88         /**
       
    89         *
       
    90         */
       
    91         void GetContactsL();
       
    92 
       
    93         /**
       
    94         * Start the vCard export and insert operation.
       
    95         */
       
    96         void ExportVCardAndAddAttachmentL();
       
    97    
       
    98         /**
       
    99         * Returns the cound of added vCards.
       
   100         *
       
   101         * @return   Count of the added vCard.
       
   102         */
       
   103         TInt AddedVCardCount();
       
   104 
       
   105     protected: 
       
   106 
       
   107         /**
       
   108         * From CActive
       
   109         */
       
   110         void RunL();
       
   111 
       
   112         /**
       
   113         * From CUniEditorOperation
       
   114         */
       
   115         void DoCancelCleanup();
       
   116     
       
   117         /**
       
   118         * From MVPbkSingleContactOperationObserver
       
   119         */
       
   120         void VPbkSingleContactOperationComplete(
       
   121             MVPbkContactOperationBase& aOperation, 
       
   122             MVPbkStoreContact* aContact);
       
   123         
       
   124         /**
       
   125         * From MVPbkSingleContactOperationObserver
       
   126         */
       
   127         void VPbkSingleContactOperationFailed(
       
   128             MVPbkContactOperationBase& aOperation, 
       
   129             TInt aError);
       
   130     
       
   131     private:
       
   132 
       
   133         /**
       
   134         * Constructor.
       
   135         *
       
   136         * @param    aObserver, reference to application UI.
       
   137         * @param    aDocument, reference to application's document.
       
   138         * @param    aFs, reference to file session
       
   139         */
       
   140         CUniEditorVCardOperation( MUniEditorOperationObserver& aObserver,
       
   141                                   CUniEditorDocument& aDocument,
       
   142                                   RFs& aFs );
       
   143 
       
   144         /**
       
   145         * 2nd phase constructor.        
       
   146         */
       
   147         void ConstructL();
       
   148         
       
   149         /**        
       
   150         *
       
   151         */
       
   152         void Reset();
       
   153 
       
   154         /**
       
   155         *
       
   156         */
       
   157         void ResetAll();
       
   158         
       
   159         /**
       
   160         * Reports events to application UI.
       
   161         */
       
   162         void ReportEvent( TUniEditorOperationEvent aEvent );
       
   163         
       
   164         /**
       
   165         * Creates an empty attachment to message store.
       
   166         */
       
   167         void CreateEmptyVCardAttachmentL();
       
   168 
       
   169         /**
       
   170         * Retrieves contact's data from phonebook.
       
   171         */
       
   172         void RetrieveStoreContactL();
       
   173         
       
   174     private:
       
   175 
       
   176         enum TUniProcessStates
       
   177             {
       
   178             EUniProcessVCardStart,
       
   179             EUniProcessVCardExportNext,
       
   180             EUniProcessVCardCreatingEmptyVCardAttachment,
       
   181             EUniProcessVCardComplete,
       
   182             EUniProcessVCardError,
       
   183             EUniProcessVCardCancel
       
   184             };
       
   185     
       
   186         MVPbkContactLink*           iContact;
       
   187         CMsgCheckNames*             iCheckNames;
       
   188         CVPbkContactLinkArray*      iContacts;
       
   189         MVPbkStoreContact*          iStoreContact;
       
   190         CVPbkVCardEng*              iVCardEng;
       
   191         MVPbkContactOperationBase*  iVCardExportOp;
       
   192         
       
   193         RFileWriteStream            iVCardStream;
       
   194         
       
   195         TMsvAttachmentId            iNewVCardAttaId;
       
   196         CMsvStore*                  iEditStore;
       
   197         TInt                        iLastError;
       
   198         
       
   199         TInt                        iAddedVCardCount;
       
   200         TInt                        iCurrentContactIndex;
       
   201     };
       
   202 
       
   203 #endif // __UNIEDITORVCARDOPERATION_H