phonebookui/Phonebook/App/inc/CPbkAssignToGroupCmd.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002 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: 
       
    15 *      Multiple contacts assignation to group command.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __CPbkAssignToGroupCmd_H__
       
    21 #define __CPbkAssignToGroupCmd_H__
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <cntdef.h>
       
    26 #include <AknProgressDialog.h>
       
    27 #include <MPbkCommand.h>
       
    28 #include <MPbkBackgroundProcess.h>
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CPbkContactEngine;
       
    32 class CContactIdArray;
       
    33 class CPbkAssignToGroup;
       
    34 class CPbkContactViewListControl;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39  * Assign multiple contact to a group command.
       
    40  */
       
    41 class CPbkAssignToGroupCmd :
       
    42         public CActive,
       
    43         public MPbkCommand,
       
    44         private MPbkProcessObserver,
       
    45         private MProgressDialogCallback
       
    46     {
       
    47     public: // Interface
       
    48         /**
       
    49          * Creates a new instance of this class.
       
    50          *
       
    51          * @param aEngine reference to a contact engine.
       
    52          * @param aContacts contacts to delete.
       
    53 		 * @param aUiControl the ui control
       
    54 		 * @param aGroupId id of the group to assign to
       
    55          * @return a new delete contacts command object.
       
    56          */
       
    57         static CPbkAssignToGroupCmd* NewL
       
    58             (CPbkContactEngine& aEngine,
       
    59             const CContactIdArray& aContacts,
       
    60             CPbkContactViewListControl& aUiControl,
       
    61             TContactItemId aGroupId);
       
    62 
       
    63         /**
       
    64          * Sets aSelfPtr to NULL when this object is destroyed.
       
    65          * @precond !aSelfPtr || *aSelfPtr==this
       
    66          */
       
    67         void ResetWhenDestroyed(CPbkAssignToGroupCmd** aSelfPtr);
       
    68 
       
    69         /**
       
    70          * Destructor.
       
    71          */
       
    72         ~CPbkAssignToGroupCmd();
       
    73 
       
    74     public:  // from MPbkCommand
       
    75         void ExecuteLD();
       
    76         void AddObserver(MPbkCommandObserver& aObserver);
       
    77 
       
    78     private: // from CActive
       
    79     	void DoCancel();
       
    80 	    void RunL();
       
    81 	    TInt RunError(TInt aError);
       
    82         
       
    83     public:  // from MPbkProcessObserver
       
    84         void ProcessFinished(MPbkBackgroundProcess& aProcess);
       
    85 
       
    86     private: // from MProgressDialogCallback
       
    87         void DialogDismissedL(TInt aButtonId);
       
    88 
       
    89     private:  // Implementation
       
    90         CPbkAssignToGroupCmd(CPbkContactEngine& aEngine, CPbkContactViewListControl& aUiControl);
       
    91         void ConstructL(const CContactIdArray& aContacts, TContactItemId aGroupId);
       
    92         void DeleteProgressNote();
       
    93         void IssueRequest();
       
    94 
       
    95     private:  // Data
       
    96         /// Ref: Phonebook engine
       
    97         CPbkContactEngine& iEngine;
       
    98         /// Ref: UI control
       
    99         CPbkContactViewListControl& iUiControl;
       
   100         /// Own: set to ETrue in destructor entry
       
   101         TBool iDestroyed;
       
   102         /// Own: progress note dialog
       
   103         CAknProgressDialog* iProgressDialog;
       
   104         /// Own: Progress dialog info
       
   105         CEikProgressInfo* iProgressDlgInfo;
       
   106         /// Own: contacts deletion process
       
   107         CPbkAssignToGroup* iAssignToGroupProcess;
       
   108         /// Own: contact to focus after deletion
       
   109         TContactItemId iFocusId;
       
   110         /// Ref: pointer to pointer to reset in destructor
       
   111         CPbkAssignToGroupCmd** iSelfPtr;
       
   112         /// Own: count of contacts succesfully assigned
       
   113         TInt iAssignedCount;
       
   114         /// Ref: command observer
       
   115         MPbkCommandObserver* iCommandObserver;
       
   116         /// Own: dialog dismissed flag
       
   117         TBool iDialogDismissed;
       
   118         /// Own: dialog dismissed with red 'end' button
       
   119         TBool iRedButtonPressed;
       
   120     };
       
   121 
       
   122 
       
   123 #endif // __CPbkAssignToGroupCmd_H__
       
   124 
       
   125 // End of File