|
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: A operation class for setting/getting speeddial information |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CSPEEDDIALATTRIBUTEOPERATION_H |
|
21 #define CSPEEDDIALATTRIBUTEOPERATION_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <MVPbkContactOperation.h> |
|
26 #include <MVPbkBatchOperationObserver.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class MVPbkStoreContactField; |
|
30 class CVPbkSpeedDialAttribute; |
|
31 class MVPbkSetAttributeObserver; |
|
32 class MVPbkContactFindObserver; |
|
33 class CVPbkBatchOperation; |
|
34 class CVPbkContactLinkArray; |
|
35 |
|
36 namespace VPbkEngUtils { class CVPbkAsyncOperation; } |
|
37 |
|
38 namespace VPbkCntModel { |
|
39 |
|
40 class CContactStore; |
|
41 class TContactField; |
|
42 class CContact; |
|
43 class CContactFilter; |
|
44 class CContactLink; |
|
45 |
|
46 /** |
|
47 * A operation class for setting/getting speed dial information |
|
48 */ |
|
49 NONSHARABLE_CLASS( CSpeedDialAttributeOperation ): |
|
50 public CBase, |
|
51 public MVPbkContactOperation, |
|
52 private MVPbkBatchOperationObserver |
|
53 { |
|
54 public: |
|
55 /** |
|
56 * Creates operation that sets the speed dial |
|
57 * @param aContactStore Store which is used |
|
58 * @param aField The contact field where the speed dial is set |
|
59 * @param aAttribute Speed dial attribute |
|
60 * @param aObserver Observer that is notified when finished |
|
61 * @return asynchronous operation |
|
62 */ |
|
63 static CSpeedDialAttributeOperation* NewSetLC( |
|
64 CContactStore& aContactStore, |
|
65 MVPbkStoreContactField& aField, |
|
66 const CVPbkSpeedDialAttribute& aAttribute, |
|
67 MVPbkSetAttributeObserver& aObserver); |
|
68 |
|
69 /** |
|
70 * Creates operation that removes the speed dial |
|
71 * @param aContactStore Store which is used |
|
72 * @param aField The contact field where the speed dial is removed |
|
73 * @param aAttribute Speed dial attribute |
|
74 * @param aObserver Observer that is notified when finished |
|
75 * @return asynchronous operation |
|
76 */ |
|
77 static CSpeedDialAttributeOperation* NewRemoveLC( |
|
78 CContactStore& aContactStore, |
|
79 MVPbkStoreContactField& aField, |
|
80 const CVPbkSpeedDialAttribute& aAttribute, |
|
81 MVPbkSetAttributeObserver& aObserver); |
|
82 |
|
83 /** |
|
84 * Creates operation that lists all speed dials |
|
85 * @param aContactStore Store which is usedt |
|
86 * @param aAttribute Speed dial attribute |
|
87 * @param aObserver Observer that is notified when finished |
|
88 * @return asynchronous operation |
|
89 */ |
|
90 static CSpeedDialAttributeOperation* NewListLC( |
|
91 CContactStore& aContactStore, |
|
92 const CVPbkSpeedDialAttribute& aAttribute, |
|
93 MVPbkContactFindObserver& aObserver); |
|
94 |
|
95 ~CSpeedDialAttributeOperation(); |
|
96 |
|
97 public: // from base class MVPbkContactOperation |
|
98 |
|
99 void StartL(); |
|
100 void Cancel(); |
|
101 |
|
102 |
|
103 |
|
104 private: // from base class MVPbkBatchOperationObserver |
|
105 void StepComplete(MVPbkContactOperationBase& aOperation, |
|
106 TInt aStepSize); |
|
107 TBool StepFailed( |
|
108 MVPbkContactOperationBase& aOperation, |
|
109 TInt aStepSize, |
|
110 TInt aError); |
|
111 void OperationComplete(MVPbkContactOperationBase& aOperation); |
|
112 |
|
113 // Implementation |
|
114 |
|
115 private: |
|
116 enum TOperationMode { ESet, ERemove, EList }; |
|
117 |
|
118 CSpeedDialAttributeOperation( |
|
119 TOperationMode aOperationMode, |
|
120 CContactStore& aContactStore, |
|
121 MVPbkStoreContactField& aField, |
|
122 MVPbkSetAttributeObserver& aObserver); |
|
123 CSpeedDialAttributeOperation( |
|
124 TOperationMode aOperationMode, |
|
125 CContactStore& aContactStore, |
|
126 MVPbkContactFindObserver& aObserver); |
|
127 void ConstructL(const CVPbkSpeedDialAttribute& aAttribute); |
|
128 |
|
129 void HandleOperationCompleteL(); |
|
130 void DoSetOperationL(MVPbkSetAttributeObserver& aObserver); |
|
131 void SetOperationError(MVPbkSetAttributeObserver& aObserver, TInt aError); |
|
132 void DoListOperationL(MVPbkContactFindObserver& aObserver); |
|
133 void ListOperationError(MVPbkContactFindObserver& aObserver, TInt aError); |
|
134 TInt NativeFieldIndex(CContact& aContact, TContactField& aField) const; |
|
135 void FindSpeedDialsL(); |
|
136 void FindSpeedDialL(); |
|
137 CContactLink* DoFindSpeedDialLC( TInt aIndex ); |
|
138 |
|
139 private: // Data |
|
140 /// Ref: operation mode |
|
141 TOperationMode iOperationMode; |
|
142 /// Ref: contact store |
|
143 CContactStore& iContactStore; |
|
144 /// Ref: store contact field |
|
145 MVPbkStoreContactField* iField; |
|
146 /// Own: speed dial attribute |
|
147 CVPbkSpeedDialAttribute* iAttribute; |
|
148 /// Ref: set attribute observer |
|
149 MVPbkSetAttributeObserver* iSetObserver; |
|
150 /// Ref: contact find observer |
|
151 MVPbkContactFindObserver* iFindObserver; |
|
152 /// Own: VPbk asynchronous operation |
|
153 VPbkEngUtils::CVPbkAsyncOperation* iAsyncOperation; |
|
154 /// Own: empty operation |
|
155 CVPbkBatchOperation* iEmptyOperation; |
|
156 /// Own: contact link array |
|
157 CVPbkContactLinkArray* iLinkArray; |
|
158 }; |
|
159 } // namespace VPbkCntModel |
|
160 |
|
161 #endif // CSPEEDDIALATTRIBUTEOPERATION_H |
|
162 |
|
163 // End of File |