|
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: MyCard class observes the state of MyCard, whether its created |
|
15 * or not. Also responsible for linking the data to MyCard. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CPBK2MYCARD_H_ |
|
21 #define CPBK2MYCARD_H_ |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <MVPbkSingleContactLinkOperationObserver.h> |
|
26 #include <MVPbkContactStoreObserver.h> |
|
27 #include <MPbk2ImageOperationObservers.h> |
|
28 #include <MVPbkSingleContactOperationObserver.h> |
|
29 #include "mpbk2mycardobserver.h" |
|
30 #include <TPbk2IconId.h> |
|
31 |
|
32 class MPbk2CmdItemVisibilityObserver; |
|
33 class MVPbkContactOperationBase; |
|
34 class MVPbkContactStore; |
|
35 class MPbk2MyCardObserver; |
|
36 class CPbk2ImageManager; |
|
37 class MPbk2ImageOperation; |
|
38 class CVPbkContactManager; |
|
39 class CPbk2ApplicationServices; |
|
40 class MVPbkBaseContact; |
|
41 class CFbsBitmap; |
|
42 |
|
43 /** |
|
44 * |
|
45 */ |
|
46 NONSHARABLE_CLASS( CPbk2MyCard ) : public CBase, |
|
47 public MVPbkSingleContactLinkOperationObserver, |
|
48 public MVPbkContactStoreObserver, |
|
49 public MVPbkSingleContactOperationObserver, |
|
50 public MPbk2ImageGetObserver |
|
51 { |
|
52 public: // Construction & destruction |
|
53 |
|
54 static CPbk2MyCard* NewL( MVPbkContactStore& aPhoneStore ); |
|
55 ~CPbk2MyCard(); |
|
56 |
|
57 void SetObserverL(MPbk2MyCardObserver& aObserver); |
|
58 void RemoveObserver(MPbk2MyCardObserver& aObserver); |
|
59 |
|
60 enum{ EUnkown = 0x0, |
|
61 EExisting, |
|
62 ENonExisting }; |
|
63 inline TInt MyCardState() {return iMyCardState;} |
|
64 |
|
65 public: |
|
66 /* |
|
67 * Returns my card link, NULL if it doesn't exist |
|
68 */ |
|
69 MVPbkContactLink* MyCardLink() const; |
|
70 |
|
71 /* |
|
72 * Returns my card thumbnail bitmap, NULL if it doesn't exist. |
|
73 * |
|
74 */ |
|
75 CFbsBitmap* MyCardBitmap() const; |
|
76 |
|
77 /* |
|
78 * Returns MyCard icon id if created, otherwise empty TPbk2IconId |
|
79 */ |
|
80 const TPbk2IconId& MyCardIconId() const; |
|
81 |
|
82 /* |
|
83 * Returns MVPbkStoreContact if available, NULL otherwise |
|
84 */ |
|
85 MVPbkStoreContact* MyCardStoreContact() const; |
|
86 |
|
87 |
|
88 private: // From MVPbkSingleContactLinkOperationObserver |
|
89 void VPbkSingleContactLinkOperationComplete( |
|
90 MVPbkContactOperationBase& aOperation, |
|
91 MVPbkContactLink* aLink ); |
|
92 |
|
93 void VPbkSingleContactLinkOperationFailed( |
|
94 MVPbkContactOperationBase& aOperation, |
|
95 TInt aError ); |
|
96 |
|
97 private: // From MVPbkContactStoreObserver |
|
98 void StoreReady( MVPbkContactStore& aContactStore ); |
|
99 void StoreUnavailable( |
|
100 MVPbkContactStore& aContactStore, |
|
101 TInt aReason ); |
|
102 void HandleStoreEventL( |
|
103 MVPbkContactStore& aContactStore, |
|
104 TVPbkContactStoreEvent aStoreEvent ); |
|
105 |
|
106 private: // From MVPbkSingleContactOperationObserver |
|
107 void VPbkSingleContactOperationComplete( |
|
108 MVPbkContactOperationBase& aOperation, |
|
109 MVPbkStoreContact* aContact ); |
|
110 |
|
111 void VPbkSingleContactOperationFailed( |
|
112 MVPbkContactOperationBase& aOperation, |
|
113 TInt aError ); |
|
114 |
|
115 private: // From MPbk2ImageGetObserver |
|
116 virtual void Pbk2ImageGetComplete( |
|
117 MPbk2ImageOperation& aOperation, |
|
118 CFbsBitmap* aBitmap ); |
|
119 virtual void Pbk2ImageGetFailed( |
|
120 MPbk2ImageOperation& aOperation, |
|
121 TInt aError ); |
|
122 |
|
123 private: |
|
124 CPbk2MyCard( MVPbkContactStore& aPhoneStore ); |
|
125 void ConstructL(); |
|
126 |
|
127 void NotifyObservers( MPbk2MyCardObserver::TMyCardStatusEvent aEvent ); |
|
128 |
|
129 /* |
|
130 * Starts loading thumbnail for the mycard contact if there is one |
|
131 */ |
|
132 void LoadThumbnailL( MVPbkBaseContact& aContact ); |
|
133 |
|
134 private: // data |
|
135 TInt iMyCardState; |
|
136 /// Own |
|
137 MVPbkContactOperationBase* iOperation; |
|
138 /// Ref |
|
139 MVPbkContactStore* iPhoneStore; |
|
140 /// Own |
|
141 MVPbkContactLink* iMyCardLink; |
|
142 /// |
|
143 RPointerArray<MPbk2MyCardObserver> iObserverArray; |
|
144 /// Own. Phonebook image manager |
|
145 CPbk2ImageManager* iImageManager; |
|
146 /// Own. Image operation |
|
147 MPbk2ImageOperation* iImageOperation; |
|
148 /// Own. for the store contact fetching |
|
149 MVPbkContactOperationBase* iRetrieveOperation; |
|
150 // Ref. contact manager |
|
151 CVPbkContactManager* iContactManager; |
|
152 // Own. instance |
|
153 CPbk2ApplicationServices* iAppServices; |
|
154 // Own. MycardStoreContact |
|
155 MVPbkStoreContact* iMyCardStoreContact; |
|
156 /// Ref. Thumbnail bitmap |
|
157 CFbsBitmap* iThumbBitmap; |
|
158 /// default ID for the mycard icon |
|
159 TPbk2IconId iIconId; |
|
160 /// Empty id |
|
161 TPbk2IconId iEmptyId; |
|
162 }; |
|
163 |
|
164 #endif /*CPBK2MYCARD_H_*/ |