|
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: Phonebook 2 contact image assigner. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2CONTACTIMAGEASSIGNER_H |
|
20 #define CPBK2CONTACTIMAGEASSIGNER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include "MPbk2ContactAssigner.h" |
|
25 #include <MPbk2ImageOperationObservers.h> |
|
26 #include <Pbk2ServerAppIPC.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CVPbkContactManager; |
|
30 class CPbk2ImageManager; |
|
31 class MPbk2ImageOperation; |
|
32 class MPbk2ContactAssignerObserver; |
|
33 class CPbk2DrmManager; |
|
34 class CPbk2FieldPropertyArray; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * Phonebook 2 contact image assigner. |
|
40 * Responsible for: |
|
41 * - Removing previous contact image (thumbnail) |
|
42 * - Saving new contact image (thumbnail) |
|
43 * - If call image feature is on, |
|
44 * saves the name of the image file into a separate contact field |
|
45 */ |
|
46 class CPbk2ContactImageAssigner : public CActive, |
|
47 public MPbk2ContactAssigner, |
|
48 protected MPbk2ImageSetObserver |
|
49 { |
|
50 public: // Construction and destruction |
|
51 |
|
52 /** |
|
53 * Creates a new instance of this class. |
|
54 * |
|
55 * @param aObserver Observer. |
|
56 * @param aContactManager Virtual Phonebook contact manager. |
|
57 * @param aFieldProperties Phonebook field properties. |
|
58 * @return A new instance of this class. |
|
59 */ |
|
60 static CPbk2ContactImageAssigner* NewL( |
|
61 MPbk2ContactAssignerObserver& aObserver, |
|
62 CVPbkContactManager& aContactManager, |
|
63 CPbk2FieldPropertyArray& aFieldProperties ); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 ~CPbk2ContactImageAssigner(); |
|
69 |
|
70 |
|
71 public: // From MPbk2ContactAssigner |
|
72 void AssignDataL( |
|
73 MVPbkStoreContact& aStoreContact, |
|
74 MVPbkStoreContactField* aContactField, |
|
75 const MVPbkFieldType* aFieldType, |
|
76 const HBufC* aDataBuffer ); |
|
77 void AssignAttributeL( |
|
78 MVPbkStoreContact& aStoreContact, |
|
79 MVPbkStoreContactField* aContactField, |
|
80 TPbk2AttributeAssignData aAttributeAssignData ); |
|
81 |
|
82 private: // From CActive |
|
83 void RunL(); |
|
84 void DoCancel(); |
|
85 TInt RunError( |
|
86 TInt aError ); |
|
87 |
|
88 private: // From MPbk2ImageSetObserver |
|
89 void Pbk2ImageSetComplete( |
|
90 MPbk2ImageOperation& aOperation ); |
|
91 void Pbk2ImageSetFailed( |
|
92 MPbk2ImageOperation& aOperation, |
|
93 TInt aError ); |
|
94 |
|
95 private: // Implementation |
|
96 CPbk2ContactImageAssigner( |
|
97 MPbk2ContactAssignerObserver& aObserver, |
|
98 CVPbkContactManager& aContactManager, |
|
99 CPbk2FieldPropertyArray& aFieldProperties ); |
|
100 void ConstructL( |
|
101 CVPbkContactManager& aContactManager ); |
|
102 TInt PassesDrmCheckL( |
|
103 const HBufC* aDataBuffer, |
|
104 TBool& aIsProtected ); |
|
105 void AssignImageL(); |
|
106 void AssignImageFileNameL(); |
|
107 void InsertTextDataL( |
|
108 MVPbkStoreContactField& aField, |
|
109 const HBufC& aDataBuffer ) const; |
|
110 void IssueRequest(); |
|
111 |
|
112 private: // Data structures |
|
113 |
|
114 /** |
|
115 * Process states. |
|
116 */ |
|
117 enum TProcessState |
|
118 { |
|
119 EAssigningImage, |
|
120 EAssigningImageFileName, |
|
121 EStopping, |
|
122 EDrmProtected |
|
123 }; |
|
124 |
|
125 private: // Data |
|
126 /// Ref: Observer |
|
127 MPbk2ContactAssignerObserver& iObserver; |
|
128 /// Own: Image operation |
|
129 MPbk2ImageOperation* iImageOperation; |
|
130 /// Own: Image manager |
|
131 CPbk2ImageManager* iImageManager; |
|
132 /// Own: DRM manager |
|
133 CPbk2DrmManager* iDrmManager; |
|
134 /// Own: Error code |
|
135 TInt iError; |
|
136 /// Ref: Contact to operate with |
|
137 MVPbkStoreContact* iContact; |
|
138 /// Ref: Contact field type of image field |
|
139 const MVPbkFieldType* iFieldType; |
|
140 /// Ref: Data to assign |
|
141 const HBufC* iDataBuffer; |
|
142 /// Ref: Virtual Phonebook contact manager |
|
143 CVPbkContactManager& iContactManager; |
|
144 /// Ref: Phonebook field properties |
|
145 CPbk2FieldPropertyArray& iFieldProperties; |
|
146 /// Own: Current state of process |
|
147 TProcessState iState; |
|
148 /// Own: Index of the added field |
|
149 TInt iIndex; |
|
150 }; |
|
151 |
|
152 #endif // CPBK2CONTACTIMAGEASSIGNER_H |
|
153 |
|
154 // End of File |