phonebookengines/VirtualPhonebook/VPbkCntModel/inc/CSdndVoiceTagAttributeOperation.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CSDNDVOICETAGATTRIBUTEOPERATION_H
       
    20 #define CSDNDVOICETAGATTRIBUTEOPERATION_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <mvpbkcontactoperation.h>
       
    25 #include "mcontactfilterobserver.h"
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class MVPbkStoreContactField;
       
    29 class CVPbkVoiceTagAttribute;
       
    30 class MVPbkSetAttributeObserver;
       
    31 class MVPbkContactFindObserver;
       
    32 
       
    33 namespace VPbkEngUtils { class CVPbkAsyncOperation; }
       
    34 
       
    35 namespace VPbkCntModel {
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class CContactStore;
       
    39 class CContactFilter;
       
    40 
       
    41 /**
       
    42  * Contact model store Voice tag attribute operation.
       
    43  */
       
    44 NONSHARABLE_CLASS( CSdndVoiceTagAttributeOperation ): 	
       
    45         public CBase,
       
    46 		public MVPbkContactOperation,
       
    47 		public MContactFilterObserver
       
    48     {
       
    49     public:
       
    50         /**
       
    51          * Creates operation that sets the voice tag
       
    52          * @param aContactStore Store which is used
       
    53          * @param aField The contact field where the voice tag is set
       
    54          * @param aAttribute Voice tag attribute 
       
    55          * @param aObserver Observer that is notified when finished
       
    56          * @return Asynchronous operation
       
    57          */
       
    58         static CSdndVoiceTagAttributeOperation* NewSetLC(
       
    59                 CContactStore& aContactStore,
       
    60                 MVPbkStoreContactField& aField, 
       
    61                 const CVPbkVoiceTagAttribute& aAttribute,
       
    62                 MVPbkSetAttributeObserver& aObserver);
       
    63                 
       
    64         /**
       
    65          * Creates operation that removes the voice tag
       
    66          * @param aContactStore Store which is used
       
    67          * @param aField The contact field where the voice tag is removed
       
    68          * @param aAttribute Voice tag attribute 
       
    69          * @param aObserver Observer that is notified when finished
       
    70          * @return Asynchronous operation
       
    71          */
       
    72         static CSdndVoiceTagAttributeOperation* NewRemoveLC(
       
    73                 CContactStore& aContactStore,
       
    74                 MVPbkStoreContactField& aField, 
       
    75                 const CVPbkVoiceTagAttribute& aAttribute,
       
    76                 MVPbkSetAttributeObserver& aObserver);
       
    77         
       
    78         /**
       
    79          * Creates operation that lists all voice tags
       
    80          * @param aContactStore Store which is used
       
    81          * @param aAttribute Voice tag attribute 
       
    82          * @param aObserver Observer that is notified when finished
       
    83          * @return Asynchronous operation
       
    84          */
       
    85         static CSdndVoiceTagAttributeOperation* NewListLC(
       
    86                 CContactStore& aContactStore,
       
    87                 const CVPbkVoiceTagAttribute& aAttribute,
       
    88                 MVPbkContactFindObserver& aObserver);
       
    89                 
       
    90         ~CSdndVoiceTagAttributeOperation();
       
    91         
       
    92     public: // From MVPbkContactOperation
       
    93         void StartL();
       
    94         void Cancel();
       
    95         
       
    96     public: // from MContactFilterObserver
       
    97     	TBool IsIncluded(MVPbkStoreContact& aContact);
       
    98     	void FilteringDoneL(MVPbkContactLinkArray* aLinkArray);
       
    99     	void FilteringError(TInt aError);
       
   100         
       
   101     private: // Implementation
       
   102         enum TOperationMode { ESet, ERemove, EList };
       
   103         
       
   104         CSdndVoiceTagAttributeOperation(
       
   105                 TOperationMode aOperationMode,
       
   106                 CContactStore& aContactStore,
       
   107                 MVPbkStoreContactField& aField, 
       
   108                 MVPbkSetAttributeObserver& aObserver);
       
   109         CSdndVoiceTagAttributeOperation(
       
   110                 TOperationMode aOperationMode,
       
   111                 CContactStore& aContactStore,
       
   112                 MVPbkContactFindObserver& aObserver);
       
   113         void ConstructL(const CVPbkVoiceTagAttribute& aAttribute);
       
   114         void DoSetOperationL(MVPbkSetAttributeObserver& aObserver);
       
   115         void SetOperationError(MVPbkSetAttributeObserver& aObserver, TInt aError);
       
   116         void DoListOperationL(MVPbkContactFindObserver& aObserver);
       
   117         void ListOperationError(MVPbkContactFindObserver& aObserver, TInt aError);
       
   118         
       
   119     private: // Data
       
   120         ///Own: Attribute operation mode
       
   121         TOperationMode iOperationMode;
       
   122         ///Own: Contact store
       
   123         CContactStore& iContactStore;
       
   124         ///Own: contact field
       
   125         MVPbkStoreContactField* iField;
       
   126         ///Own: Voice tag attribute
       
   127         CVPbkVoiceTagAttribute* iAttribute;
       
   128         ///Own: Setting attribute observer
       
   129         MVPbkSetAttributeObserver* iSetObserver;
       
   130         ///Own: Find observer
       
   131         MVPbkContactFindObserver* iFindObserver;
       
   132         ///Own: Asynchronous opereration
       
   133         VPbkEngUtils::CVPbkAsyncOperation* iAsyncOperation;
       
   134         ///Own: Contact filter
       
   135         CContactFilter* iContactFilter;
       
   136     };
       
   137     
       
   138 } // namespace VPbkCntModel
       
   139 
       
   140 #endif // CSDNDVOICETAGATTRIBUTEOPERATION_H
       
   141 
       
   142 // End of File