phonebookui/Phonebook2/CommandsExtension/inc/CPbk2SendContactCmd.h
branchRCL_3
changeset 63 f4a778e096c2
child 64 c1e8ba0c2b16
child 85 38bb213f60ba
equal deleted inserted replaced
62:5b6f26637ad3 63:f4a778e096c2
       
     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 send contact command.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2SENDCONTACTCMD_H
       
    20 #define CPBK2SENDCONTACTCMD_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include "MPbk2CommandResourceRelease.h"
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <MPbk2Command.h>
       
    28 #include <MVPbkSingleContactOperationObserver.h>
       
    29 #include "MPbk2vCardConverterObserver.h"
       
    30 #include <MPbk2ProcessDecorator.h>
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CIdle;
       
    34 class MVPbkStoreContactField;
       
    35 class CPbk2vCardConverter;
       
    36 class CEikonEnv;
       
    37 class MVPbkBaseContactField;
       
    38 class MVPbkContactLinkArray;
       
    39 class MPbk2CommandObserver;
       
    40 class CVPbkVCardEng;
       
    41 class MVPbkStoreContact;
       
    42 class CPbk2vCardConverter;
       
    43 class CAknWaitDialog;
       
    44 class MVPbkFieldType;
       
    45 class MPbk2ContactUiControl;
       
    46 class MVPbkContactOperationBase;
       
    47 class MVPbkFieldTypeList;
       
    48 class TPbk2SendingParams;
       
    49 class MVPbkContactLink;
       
    50 class CMessageData;
       
    51 class MPbk2ProcessDecorator;
       
    52 class MPbk2ContactLinkIterator;
       
    53 class CPbk2ApplicationServices;
       
    54 class CSendUi;
       
    55 
       
    56 // CLASS DECLARATION
       
    57 
       
    58 /**
       
    59  * Phonebook 2 send contact command.
       
    60  */
       
    61 NONSHARABLE_CLASS(CPbk2SendContactCmd) :
       
    62         public CActive,
       
    63         public MPbk2Command,
       
    64         public MPbk2vCardConverterObserver,
       
    65         public MVPbkSingleContactOperationObserver,
       
    66         private MPbk2ProcessDecoratorObserver,
       
    67         public MPbk2ResourceRelease
       
    68     {
       
    69     public: // Construction and destruction
       
    70         /**
       
    71          * Creates a new instance of this class.
       
    72          *
       
    73          * @return  A new instance of this class.
       
    74          */
       
    75         static CPbk2SendContactCmd* NewL(
       
    76                 MPbk2ContactUiControl& aUiControl );
       
    77 
       
    78         /**
       
    79          * Destructor.
       
    80          */
       
    81         virtual ~CPbk2SendContactCmd();
       
    82 
       
    83     public: // From MPbk2Command
       
    84         void ExecuteLD();
       
    85         void AddObserver(
       
    86                 MPbk2CommandObserver& aObserver );
       
    87         void ResetUiControl(MPbk2ContactUiControl& aUiControl);
       
    88         TAny* CommandExtension(TUid /*aExtensionUid*/);
       
    89     public: // From MPbk2ResourceRelease
       
    90         /*-
       
    91          * Delete all temp files.
       
    92          * @Remark It not return until finish deleting all files.
       
    93          *         It is non-reentrant.  
       
    94          */
       
    95         void ReleaseResource();
       
    96     private: // From CActive
       
    97         void RunL();
       
    98         TInt RunError(
       
    99                 TInt aError );
       
   100         void DoCancel();
       
   101 
       
   102     private: // From MPbk2vCardConverterObserver
       
   103         void ConversionDone(
       
   104                 TInt aCount );
       
   105         void ConversionError(
       
   106                 TInt aError );
       
   107 
       
   108     private: // From MVPbkSingleContactOperationObserver
       
   109         void VPbkSingleContactOperationComplete(
       
   110                 MVPbkContactOperationBase& aOperation,
       
   111                 MVPbkStoreContact* aContact );
       
   112         void VPbkSingleContactOperationFailed(
       
   113                 MVPbkContactOperationBase& aOperation,
       
   114                 TInt aError );
       
   115 
       
   116     public: // From MPbk2ProcessDecoratorObserver
       
   117         void ProcessDismissed(
       
   118                 TInt aCancelCode );
       
   119 
       
   120     private: // Implementation
       
   121         CPbk2SendContactCmd(
       
   122                 MPbk2ContactUiControl& aUiControl );
       
   123         void ConstructL();
       
   124         void SendvCardsLD();
       
   125         static TInt SendvCardsLD(
       
   126                 TAny* aThis );
       
   127         TBool AnyThumbnailsL() const;
       
   128         TInt SelectionListL() const;
       
   129         void MapSelection(
       
   130                 TInt& aSelection,
       
   131                 TInt aShownMenu );
       
   132         void ProcessDone(
       
   133                 TInt aCancelCode );
       
   134         TInt SelectSentDataL();
       
   135         TUid ShowSendQueryL();
       
   136         TPbk2SendingParams CreateParamsLC();
       
   137         void ConvertContactL(
       
   138                 TInt aSelectionIndex );
       
   139         void RetrieveContactL(
       
   140                 const MVPbkContactLink& aLink );
       
   141         TInt FilterErrors(
       
   142                 TInt aErrorCode);
       
   143         void IssueRequest();
       
   144         void IssueStopRequest();
       
   145         void SendMsgUsingSendUI(
       
   146                 CMessageData* aMsgData );
       
   147         TBool IsMoreThanOneContact();
       
   148         
       
   149     private: // Data structures
       
   150         /// Process states
       
   151         enum TState
       
   152             {
       
   153             EShowingSendQuery = 0,
       
   154             ERetrievingContact,
       
   155             ESelectingSentData,
       
   156             EStopping,
       
   157             ECancelling,
       
   158             EReleaseResource
       
   159             };
       
   160 
       
   161     private: // Data
       
   162         /// Ref: UI control
       
   163         MPbk2ContactUiControl* iUiControl;
       
   164         /// Ref: Command observer
       
   165         MPbk2CommandObserver* iCommandObserver;
       
   166         /// Own: Selected contacts
       
   167         MVPbkContactLinkArray* iSelectedContacts;
       
   168         /// Ref: Focused field
       
   169         const MVPbkBaseContactField* iFocusedField;
       
   170         /// Own: Send command's service uid
       
   171         TUid iMtmUid;
       
   172         /// Own: vCard engine
       
   173         CVPbkVCardEng* iVCardEngine;
       
   174         /// Own: vCard converter
       
   175         CPbk2vCardConverter* iConverter;
       
   176         /// Ref: Eikon enviroment
       
   177         CEikonEnv* iEikEnv;
       
   178         /// Own: vCard sender
       
   179         CIdle* iVCardSender;
       
   180         /// Own: Indicates whether this object is under destruction
       
   181         TBool iUnderDestruction;
       
   182         /// Own: Store contact array
       
   183         RPointerArray<MVPbkStoreContact> iStoreContacts;
       
   184         /// Own: Contact retrieve operation
       
   185         MVPbkContactOperationBase* iRetrieveOperation;
       
   186         /// Ref: Thumbnail field type
       
   187         const MVPbkFieldType* iThumbnailFieldType;
       
   188         /// Own: Decorator for the wait note process
       
   189         MPbk2ProcessDecorator* iDecorator;
       
   190         /// Own: Current index of the contact in an array
       
   191         TInt iCurrentContactLinkIndex;
       
   192         /// Own: State of the process
       
   193         TState iState;
       
   194         /// Own: contact iterator
       
   195         MPbk2ContactLinkIterator* iCntIterator;
       
   196         /// Own: Application Services pointer
       
   197         CPbk2ApplicationServices* iAppServices;
       
   198         /// Own: Send UI
       
   199         CSendUi* iSendUi;
       
   200         /// Own:
       
   201         CActiveSchedulerWait* iWaiter;
       
   202        
       
   203     };
       
   204 
       
   205 #endif // CPBK2SENDCONTACTCMD_H
       
   206 
       
   207 // End of File