phonebookui/Phonebook2/MMCExtension/inc/CPmuCopyToMmcCmd.h
changeset 0 e686773b3f54
child 74 6b5524b4f673
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 to MMC command.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPMUCOPYTOMMCCMD_H
       
    20 #define CPMUCOPYTOMMCCMD_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <s32file.h>
       
    25 #include <MPbk2Command.h>
       
    26 #include <MVPbkSingleContactOperationObserver.h>
       
    27 #include <MPbk2ProcessDecorator.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CFileMan;
       
    31 class MPbk2ContactUiControl;
       
    32 class MVPbkContactLinkArray;
       
    33 class CVPbkVCardEng;
       
    34 class MVPbkContactOperationBase;
       
    35 class MVPbkStoreContact;
       
    36 class CPbk2DriveSpaceCheck;
       
    37 
       
    38 /**
       
    39  * Phonebook 2 MMC UI extension copy to MMC command object.
       
    40  * Responsible for copying selected contacts into the MMC.
       
    41  */
       
    42 class CPmuCopyToMmcCmd : public CActive,
       
    43                          public MPbk2Command,
       
    44                          private MPbk2ProcessDecoratorObserver,
       
    45                          private MVPbkSingleContactOperationObserver,
       
    46                          private MFileManObserver
       
    47 
       
    48     {
       
    49     public: // Construction and destruction
       
    50 
       
    51         /**
       
    52          * Creates a new instance of this class.
       
    53          *
       
    54          * @param aUiControl    UI control.
       
    55          * @return  A new instance of this class.
       
    56          */
       
    57         static CPmuCopyToMmcCmd* NewL(
       
    58                 MPbk2ContactUiControl& aUiControl );
       
    59 
       
    60         /**
       
    61          * Destructor.
       
    62          */
       
    63         ~CPmuCopyToMmcCmd();
       
    64 
       
    65     private: // From CActive
       
    66         void RunL();
       
    67         void DoCancel();
       
    68         TInt RunError(
       
    69                 TInt aError );
       
    70 
       
    71     public: // From MPbk2Command
       
    72         void ExecuteLD();
       
    73         void AddObserver(
       
    74                 MPbk2CommandObserver& aObserver );
       
    75         void ResetUiControl(
       
    76                 MPbk2ContactUiControl& aUiControl );
       
    77 
       
    78     private: // From MPbk2ProcessDecoratorObserver
       
    79         void ProcessDismissed(
       
    80                 TInt aCancelCode );
       
    81 
       
    82     private: // From MVPbkSingleContactOperationObserver
       
    83         void VPbkSingleContactOperationComplete(
       
    84                 MVPbkContactOperationBase& aOperation,
       
    85                 MVPbkStoreContact* aContact );
       
    86         void VPbkSingleContactOperationFailed(
       
    87                 MVPbkContactOperationBase& aOperation,
       
    88                 TInt aError );
       
    89                 
       
    90     private: // From MFileManObserver
       
    91         TControl NotifyFileManStarted();
       
    92 	    TControl NotifyFileManOperation();
       
    93 
       
    94     private: // Implementation
       
    95         CPmuCopyToMmcCmd(
       
    96                 MPbk2ContactUiControl& aUiControl );
       
    97         void ConstructL();
       
    98         void CopyNextL();
       
    99         void IssueRequest();
       
   100         HBufC* CreateFileNameLC(
       
   101                 const MVPbkStoreContact& aContact ) const;
       
   102         void DeleteOldEntriesL();
       
   103         void ShowConfirmationQueryL();
       
   104         TBool ShowMemorySelectionDialogL();
       
   105         void ShowResultsL();
       
   106         TInt HandleError( TInt aError );
       
   107 
       
   108     private:  // Data
       
   109         /// Ref: UI control
       
   110         MPbk2ContactUiControl* iUiControl;
       
   111         /// Ref: Command's state
       
   112         TInt iState;
       
   113         /// Ref: Delete old entries
       
   114         TBool iDeleteOldEntries;
       
   115         /// Ref: Command observer
       
   116         MPbk2CommandObserver* iCommandObserver;
       
   117         /// Own: File manager for deleting the old vCards
       
   118         CFileMan* iFileMan;
       
   119         /// Own: Decorator for copying process
       
   120         MPbk2ProcessDecorator* iDecorator;
       
   121         /// Own: Copied contacts
       
   122         MVPbkContactLinkArray* iContactLinks;
       
   123         /// Own: VCard engine
       
   124         CVPbkVCardEng* iVCardEngine;
       
   125         /// Own: Current asynchronous retrieve operation
       
   126         MVPbkContactOperationBase* iRetrieveOperation;
       
   127         /// Own: Current asynchronous export operation
       
   128         MVPbkContactOperationBase* iExportOperation;
       
   129         /// Own: Retrieved store contact
       
   130         MVPbkStoreContact* iStoreContact;
       
   131         /// Own: Previously copied contact
       
   132         MVPbkStoreContact* iPreviousContact;
       
   133         /// Own: Currently copied contact
       
   134         TInt iCurrentIndex;
       
   135         /// Own: Count of copied contacts
       
   136         TInt iCountOfContacts;
       
   137         /// Own: Write stream
       
   138         RFileWriteStream iWriteStream;
       
   139         /// Own: Path to contacts on memory card
       
   140         TFileName iContactsPath;
       
   141         /// Own: Memory checker
       
   142         CPbk2DriveSpaceCheck* iDriveSpaceCheck;
       
   143         
       
   144     };
       
   145 
       
   146 #endif // CPMUCOPYTOMMCCMD_H
       
   147 
       
   148 // End of File