phonebookui/Phonebook2/MMCExtension/inc/CPmuCopyFromMmcCmd.h
changeset 0 e686773b3f54
child 57 2666d9724c76
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2005-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:  Phonebook 2 MMC UI extension copy from MMC command.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPMUCOPYFROMMMCCMD_H
       
    20 #define CPMUCOPYFROMMMCCMD_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <s32file.h>
       
    25 #include <MPbk2Command.h>
       
    26 #include <MVPbkContactCopyObserver.h>
       
    27 #include <MPbk2ProcessDecorator.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class MPbk2ContactUiControl;
       
    31 class MVPbkContactLinkArray;
       
    32 class MVPbkContactStore;
       
    33 class CVPbkVCardEng;
       
    34 class MVPbkContactOperationBase;
       
    35 
       
    36 /**
       
    37  * Phonebook 2 MMC UI extension copy from MMC command object.
       
    38  * Responsible for copying contacts from the MMC.
       
    39  */
       
    40 class CPmuCopyFromMmcCmd : public CActive,
       
    41                            public MPbk2Command,
       
    42                            private MVPbkContactCopyObserver,
       
    43                            private MPbk2ProcessDecoratorObserver
       
    44     {
       
    45     public: // Construction and destruction
       
    46 
       
    47         /**
       
    48          * Creates a new instance of this class.
       
    49          *
       
    50          * @param aUiControl    UI control.
       
    51          * @return  A new instance of this class.
       
    52          */
       
    53         static CPmuCopyFromMmcCmd* NewL(
       
    54                 MPbk2ContactUiControl& aUiControl );
       
    55 
       
    56         /**
       
    57          * Destructor.
       
    58          */
       
    59         ~CPmuCopyFromMmcCmd();
       
    60 
       
    61     private: // From CActive
       
    62         void RunL();
       
    63         void DoCancel();
       
    64         TInt RunError(
       
    65                 TInt aError );
       
    66 
       
    67     public:  // From MPbk2Command
       
    68         void ExecuteLD();
       
    69         void AddObserver(
       
    70                 MPbk2CommandObserver& aObserver );
       
    71         void ResetUiControl(
       
    72                 MPbk2ContactUiControl& aUiControl );
       
    73 
       
    74     private: // From MVPbkContactCopyObserver
       
    75         void FieldAddedToContact(
       
    76                 MVPbkContactOperationBase& aOperation );
       
    77         void FieldAddingFailed(
       
    78                 MVPbkContactOperationBase& aOperation,
       
    79                 TInt aError );
       
    80         void ContactsSaved(
       
    81                 MVPbkContactOperationBase& aOperation,
       
    82                 MVPbkContactLinkArray* aResults );
       
    83         void ContactsSavingFailed(
       
    84                 MVPbkContactOperationBase& aOperation,
       
    85                 TInt aError );
       
    86 
       
    87     private: // From MPbk2ProcessDecoratorObserver
       
    88         void ProcessDismissed(
       
    89                 TInt aCancelCode );
       
    90 
       
    91     private: // Implementation
       
    92         CPmuCopyFromMmcCmd(
       
    93                 MPbk2ContactUiControl& aUiControl );
       
    94         void ConstructL();
       
    95         void CopyNextL();
       
    96         void IssueRequest();
       
    97         void ShowResultsL();
       
    98         TBool IsDefaultStorePhoneMemoryL() const;
       
    99         void CommandCompletedL();
       
   100         TBool ShowMemorySelectionDialogL();
       
   101 
       
   102     private: // Data
       
   103         /// Ref: UI control
       
   104         MPbk2ContactUiControl* iUiControl;
       
   105         /// Ref: Command observer
       
   106         MPbk2CommandObserver* iCommandObserver;
       
   107         /// Ref: Target store
       
   108         MVPbkContactStore* iTargetStore;
       
   109         /// Own: Decorator for copying process
       
   110         MPbk2ProcessDecorator* iDecorator;
       
   111         /// Own: VCard engine
       
   112         CVPbkVCardEng* iVCardEngine;
       
   113         /// Own: Current asynchronous import operation
       
   114         MVPbkContactOperationBase* iImportOperation;
       
   115         /// Own: Currently copied contact
       
   116         TInt iCurrentContactIndex;
       
   117         /// Own: Count of copied contacts
       
   118         TInt iCountOfContacts;
       
   119         /// Own: Directory to import from
       
   120         CDir* iDir;
       
   121         /// Own: Stream to read from
       
   122         RFileReadStream iReadStream;
       
   123         /// Own: Command's state
       
   124         TInt iState;
       
   125         /// Own: Path to contacts in memory card
       
   126         TFileName iContactsPath;
       
   127 
       
   128     };
       
   129 
       
   130 #endif // CPMUCOPYFROMMMCCMD_H
       
   131 
       
   132 // End of File