phonebookui/Phonebook/App/inc/CPbkDeleteContactsCmd.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 deletion command.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __CPbkDeleteContactsCmd_H__
       
    21 #define __CPbkDeleteContactsCmd_H__
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <cntdef.h>
       
    26 #include <MPbkCommand.h>
       
    27 #include <MPbkBackgroundProcess.h>
       
    28 #include <SharedDataClient.h>   // RSharedDataClient
       
    29 #include <AknProgressDialog.h>
       
    30 
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CPbkContactEngine;
       
    34 class CContactIdArray;
       
    35 class CPbkContactViewListControl;
       
    36 class CAknProgressDialog;
       
    37 class CEikProgressInfo;
       
    38 
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43  * Multiple contact deletion command.
       
    44  */
       
    45 class CPbkDeleteContactsCmd :
       
    46         public CActive,
       
    47         public MPbkCommand,
       
    48         private MProgressDialogCallback
       
    49     {
       
    50     public: // Interface
       
    51         /**
       
    52          * Creates a new instance of this class.
       
    53          *
       
    54          * @param aEngine       reference to a contact engine.
       
    55          * @param aContacts     contacts to delete.
       
    56          * @param aUiControl    contact list UI control to update.
       
    57          * @return a new delete contacts command object.
       
    58          */
       
    59         static CPbkDeleteContactsCmd* NewL
       
    60             (CPbkContactEngine& aEngine,
       
    61             const CContactIdArray& aContacts,
       
    62             CPbkContactViewListControl& aUiControl);
       
    63 
       
    64         /**
       
    65          * Sets aSelfPtr to NULL when this object is destroyed.
       
    66          * @precond !aSelfPtr || *aSelfPtr==this
       
    67          */
       
    68         void ResetWhenDestroyed(CPbkDeleteContactsCmd** aSelfPtr);
       
    69 
       
    70         /**
       
    71          * Destructor.
       
    72          */
       
    73         ~CPbkDeleteContactsCmd();
       
    74 
       
    75     public:  // from MPbkCommand
       
    76         void ExecuteLD();
       
    77         void AddObserver(MPbkCommandObserver& aObserver);
       
    78 
       
    79     private: // from CActive
       
    80     	void DoCancel();
       
    81 	    void RunL();
       
    82 	    TInt RunError(TInt aError);
       
    83 
       
    84     private: // from MProgressDialogCallback
       
    85         void DialogDismissedL(TInt aButtonId);
       
    86 
       
    87     private:  // Implementation
       
    88         CPbkDeleteContactsCmd
       
    89             (CPbkContactEngine& aEngine, CPbkContactViewListControl& aUiControl);
       
    90         void ConstructL(const CContactIdArray& aContacts);
       
    91         void DeleteProgressNote();
       
    92         void IssueRequest();
       
    93         void FinishProcess();
       
    94         void DestroySelf();
       
    95         TBool MoreContactsToDelete() const;
       
    96         void CompressIfRequired();
       
    97         TInt64 FreeSpaceOnDbDrive() const;
       
    98 
       
    99     private:  // Data
       
   100         /// Ref: Phonebook engine
       
   101         CPbkContactEngine& iEngine;
       
   102         /// Ref: UI control
       
   103         CPbkContactViewListControl& iUiControl;
       
   104         /// Own: set to ETrue in destructor entry
       
   105         TBool iUnderDestruction;
       
   106         /// Own: ids of contacts to delete
       
   107         CContactIdArray* iContacts;
       
   108         /// Own: progress note dialog
       
   109         CAknProgressDialog* iProgressDialog;
       
   110         /// Own: Progress dialog info
       
   111         CEikProgressInfo* iProgressDlgInfo;
       
   112         /// Own: contact to focus after deletion
       
   113         TContactItemId iFocusId;
       
   114         /// Ref: pointer to pointer to reset in destructor
       
   115         CPbkDeleteContactsCmd** iSelfPtr;
       
   116         /// Own: count of contacts succesfully deleted
       
   117         TInt iDeletedCount;
       
   118         /// Own: shared data client
       
   119         RSharedDataClient iSharedDataClient;
       
   120         /// Own: maximum free space required to delete a contact from the DB
       
   121         TInt iFreeSpaceRequiredToDelete;
       
   122         /// Own: contact database drive
       
   123         TInt iDbDrive;
       
   124         /// Ref: command observer
       
   125         MPbkCommandObserver* iCommandObserver;
       
   126         /// Own: dialog dismissed flag
       
   127         TBool iDialogDismissed;
       
   128     };
       
   129 
       
   130 #endif // __CPbkDeleteContactsCmd_H__
       
   131 
       
   132 // End of File