phonebookui/Phonebook2/USIMThinExtension/inc/CPsu2CopySimContactsCmd.h
changeset 0 e686773b3f54
child 13 a6539d1e8e43
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002-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 copy "new SIM" contacts to phone memory.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPSU2COPYSIMCONTACTSCMD_H
       
    20 #define CPSU2COPYSIMCONTACTSCMD_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <MPbk2Command.h>
       
    25 #include <MVPbkContactStoreObserver.h>
       
    26 #include <MVPbkContactViewObserver.h>
       
    27 #include <MVPbkBatchOperationObserver.h>
       
    28 #include <MPbk2ProcessDecorator.h>
       
    29 #include <RPbk2LocalizedResourceFile.h>
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class MVPbkContactStore;
       
    33 class MPbk2StartupMonitor;
       
    34 class CVPbkContactStoreUriArray;
       
    35 class MVPbkContactView;
       
    36 class CVPbkContactLinkArray;
       
    37 class CVPbkContactCopier;
       
    38 class CVPbkContactLinkArray;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43  * Phonebook 2 copy "new SIM" contacts to phone memory.
       
    44  */
       
    45 class CPsu2CopySimContactsCmd : public CActive,
       
    46                                 public MPbk2Command,
       
    47                                 private MVPbkContactStoreObserver,
       
    48                                 private MVPbkContactViewObserver,
       
    49                                 private MVPbkBatchOperationObserver,
       
    50                                 private MPbk2ProcessDecoratorObserver
       
    51     {
       
    52     public: // Constructors and destructor
       
    53 
       
    54         /**
       
    55          * Creates a new instance of this class.
       
    56          *
       
    57          * @param aStartupMonitor   Startup monitor.
       
    58          * @return  A new instance of this class.
       
    59          */
       
    60         static CPsu2CopySimContactsCmd* NewL(
       
    61                 MPbk2StartupMonitor& aStartupMonitor );
       
    62 
       
    63         /**
       
    64          * Destructor.
       
    65          */
       
    66         ~CPsu2CopySimContactsCmd();
       
    67 
       
    68     private: // From CActive
       
    69         void RunL();
       
    70         void DoCancel();
       
    71         TInt RunError(
       
    72                 TInt aError );
       
    73 
       
    74     public: // From MPbk2Command
       
    75         void ExecuteLD();
       
    76         void AddObserver(
       
    77                 MPbk2CommandObserver& aObserver );
       
    78         void ResetUiControl(
       
    79                 MPbk2ContactUiControl& aUiControl );
       
    80 
       
    81     private: // From MVPbkContactStoreObserver
       
    82         void StoreReady(
       
    83                 MVPbkContactStore& aContactStore );
       
    84         void StoreUnavailable(
       
    85                 MVPbkContactStore& aContactStore,
       
    86                 TInt aReason );
       
    87         void HandleStoreEventL(
       
    88                 MVPbkContactStore& aContactStore,
       
    89                 TVPbkContactStoreEvent aStoreEvent );
       
    90 
       
    91     private: // From MVPbkContactViewObserver
       
    92         void ContactViewReady(
       
    93                 MVPbkContactViewBase& aView );
       
    94         void ContactViewUnavailable(
       
    95                 MVPbkContactViewBase& aView );
       
    96         void ContactAddedToView(
       
    97                 MVPbkContactViewBase& aView,
       
    98                 TInt aIndex,
       
    99                 const MVPbkContactLink& aContactLink );
       
   100         void ContactRemovedFromView(
       
   101                 MVPbkContactViewBase& aView,
       
   102                 TInt aIndex,
       
   103                 const MVPbkContactLink& aContactLink );
       
   104         void ContactViewError(
       
   105                 MVPbkContactViewBase& aView,
       
   106                 TInt aError,
       
   107                 TBool aErrorNotified );
       
   108 
       
   109     private: // From MVPbkBatchOperationObserver
       
   110         void StepComplete(
       
   111                 MVPbkContactOperationBase& aOperation,
       
   112                 TInt aStepSize );
       
   113         TBool StepFailed(
       
   114                 MVPbkContactOperationBase& aOperation,
       
   115                 TInt aStepSize,
       
   116                 TInt aError );
       
   117         void OperationComplete(
       
   118                 MVPbkContactOperationBase& aOperation );
       
   119 
       
   120     private: // From MPbk2ProcessDecoratorObserver
       
   121         void ProcessDismissed(
       
   122                 TInt aCancelCode );
       
   123 
       
   124     private: // Implementation
       
   125         CPsu2CopySimContactsCmd(
       
   126                 MPbk2StartupMonitor& aStartupMonitor );
       
   127         void ConstructL();
       
   128         void IssueRequest();
       
   129         void IssueRequest(
       
   130                 TInt aResult );
       
   131         void CheckCopyPrerequisitesL();
       
   132         void OpenSimStoresL();
       
   133         void CheckSimStorePrerequisitesL();
       
   134         void LaunchNewSIMInsertedQueryL();
       
   135         void SetShowSIMContactsL( TBool aShow );
       
   136         void CreateSimViewsL();
       
   137         void CopyContactsL();
       
   138         void ShowResultsL();
       
   139         void CompleteL();
       
   140         void CompleteWithError(
       
   141                 TInt aError );
       
   142         TBool ValidStoreConfigurationL();
       
   143         TBool NewSimCardForPhonebook2AppL();
       
   144         void CloseStores();
       
   145         void SetNewSimCardKeyL();
       
   146 
       
   147     private: // Data
       
   148         /// Ref: Startup monitor
       
   149         MPbk2StartupMonitor& iStartupMonitor;
       
   150         /// Ref: Command observer
       
   151         MPbk2CommandObserver* iCommandObserver;
       
   152         /// Own: Decorator for the process
       
   153         MPbk2ProcessDecorator* iDecorator;
       
   154         /// Own: Thin extension resource file
       
   155         RPbk2LocalizedResourceFile iResourceFile;
       
   156         /// Own: Indicates next task
       
   157         TInt iNextTask;
       
   158         /// Own: URI array that contains the SIM source stores
       
   159         CVPbkContactStoreUriArray* iValidSourceStoreUris;
       
   160         /// Ref: Array of source store references
       
   161         RPointerArray<MVPbkContactStore> iSourceStores;
       
   162         /// Own: Counter for opened SIM stores and views
       
   163         TInt iCounter;
       
   164         /// Own: Array of SIM contact views
       
   165         RPointerArray<MVPbkContactView> iSourceViews;
       
   166         /// Own: Source contact links
       
   167         CVPbkContactLinkArray* iSourceContactLinks;
       
   168         /// Own: Copy operation
       
   169         MVPbkContactOperationBase* iCopyOperation;
       
   170         /// Own: Number of successfully copied contacts
       
   171         TInt iCopiedSuccessfully;
       
   172         /// Own: The virtual phonebook contact copier
       
   173         CVPbkContactCopier* iCopier;
       
   174         /// Own: An array for copy results
       
   175         CVPbkContactLinkArray* iCopiedContacts;
       
   176     };
       
   177 
       
   178 #endif // CPSU2COPYSIMCONTACTSCMD_H
       
   179 
       
   180 // End of File