phonebookui/Phonebook2/GroupExtension/inc/CPguBelongsToGroupsCmd.h
branchRCL_3
changeset 63 f4a778e096c2
parent 0 e686773b3f54
equal deleted inserted replaced
62:5b6f26637ad3 63:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2007-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 belongs to groups command.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPGUBELONGSTOGROUPSCMD_H
       
    20 #define CPGUBELONGSTOGROUPSCMD_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <MPbk2Command.h>
       
    25 #include <MVPbkSingleContactOperationObserver.h>
       
    26 #include <MVPbkContactSelector.h>
       
    27 #include <MVPbkContactViewObserver.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class MPbk2ContactUiControl;
       
    31 class MVPbkContactGroup;
       
    32 class MVPbkContactStore;
       
    33 class MVPbkContactLink;
       
    34 class MVPbkContactLinkArray;
       
    35 class MVPbkContactOperationBase;
       
    36 class MVPbkContactViewBase;
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41  * Contacts belong to group command.
       
    42  */
       
    43 class CPguBelongsToGroupsCmd :
       
    44         public CActive,
       
    45         public MPbk2Command,
       
    46         private MVPbkSingleContactOperationObserver,
       
    47         private MVPbkContactSelector
       
    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 CPguBelongsToGroupsCmd* NewL(
       
    58                 MPbk2ContactUiControl& aUiControl );
       
    59 
       
    60         /**
       
    61          * Destructor.
       
    62          */
       
    63         ~CPguBelongsToGroupsCmd();
       
    64 
       
    65     public:  // From MPbk2Command
       
    66         void ExecuteLD();
       
    67         void AddObserver(
       
    68                 MPbk2CommandObserver& aObserver );
       
    69         void ResetUiControl(
       
    70                 MPbk2ContactUiControl& aUiControl );
       
    71 
       
    72     private: // From CActive
       
    73         void RunL();
       
    74         void DoCancel();
       
    75         TInt RunError(
       
    76                 TInt aError );
       
    77 
       
    78     private: // From MVPbkSingleContactOperationObserver
       
    79         void VPbkSingleContactOperationComplete(
       
    80                 MVPbkContactOperationBase& aOperation,
       
    81                 MVPbkStoreContact* aContact );
       
    82         void VPbkSingleContactOperationFailed(
       
    83                 MVPbkContactOperationBase& aOperation,
       
    84                 TInt aError );
       
    85 
       
    86     private: // From MVPbkContactSelector
       
    87         TBool IsContactIncluded(
       
    88                 const MVPbkBaseContact& aContact );
       
    89 
       
    90     private: // Data types
       
    91 
       
    92         /// Process states
       
    93         enum TProcessState
       
    94             {
       
    95             ELaunchPopup,
       
    96             EFinishCommand
       
    97             };
       
    98 
       
    99     private: // Implementation
       
   100         CPguBelongsToGroupsCmd(
       
   101                 MPbk2ContactUiControl& aUiControl );
       
   102         void ConstructL();
       
   103         void LaunchGroupPopupL();
       
   104         void IssueRequest(
       
   105                 TProcessState aState );
       
   106 
       
   107     private:  // Data
       
   108         /// Ref: Ui control
       
   109         MPbk2ContactUiControl* iUiControl;
       
   110         /// Ref: command observer
       
   111         MPbk2CommandObserver* iCommandObserver;
       
   112         /// Own: Retrieve operation
       
   113         MVPbkContactOperationBase* iRetrieveOperation;
       
   114         /// Own: Contact
       
   115         MVPbkStoreContact* iStoreContact;
       
   116         /// Own: Groups that the iStoreContact belongs to
       
   117         MVPbkContactLinkArray* iGroupsJoined;
       
   118         /// Own: current state of process
       
   119         TProcessState iState;
       
   120     };
       
   121 
       
   122 #endif // CPGUBELONGSTOGROUPSCMD_H
       
   123 
       
   124 // End of File