|
1 /* |
|
2 * Copyright (c) 2009-2009 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: Implementation of MyCard image loader |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CCAPPMYCARDIMAGELOADER_H |
|
19 #define CCAPPMYCARDIMAGELOADER_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <MPbk2ImageOperationObservers.h> |
|
23 |
|
24 class CVPbkContactManager; |
|
25 class CPbk2ImageManager; |
|
26 class MVPbkStoreContact; |
|
27 class MPbk2ImageOperation; |
|
28 |
|
29 /** |
|
30 * MyCard image loading observer class |
|
31 */ |
|
32 class MMyCardImageLoaderObserver |
|
33 { |
|
34 public: |
|
35 |
|
36 /** |
|
37 * Notification method to report loaded images to observer. |
|
38 * |
|
39 * @param aThumbnail loaded contact thumbnail. Ownership transferred to |
|
40 * observer. |
|
41 */ |
|
42 virtual void ThumbnailReady( CFbsBitmap* aThumbnail ) = 0; |
|
43 |
|
44 /** |
|
45 * Notification method to report failed load requests |
|
46 * |
|
47 * @param aError Generic symbian error code |
|
48 */ |
|
49 virtual void ThumbnailLoadError( TInt aError ) = 0; |
|
50 |
|
51 protected: |
|
52 virtual ~MMyCardImageLoaderObserver() {} |
|
53 }; |
|
54 |
|
55 /** |
|
56 * Contact image loader |
|
57 * |
|
58 * @lib ccappmycardplugin.dll |
|
59 * @since S60 9.2 |
|
60 */ |
|
61 NONSHARABLE_CLASS( CCCAppMyCardImageLoader ) : |
|
62 public CBase, |
|
63 public MPbk2ImageGetObserver |
|
64 { |
|
65 |
|
66 public: |
|
67 |
|
68 /** |
|
69 * Two-phased constructor. |
|
70 */ |
|
71 static CCCAppMyCardImageLoader* NewL( |
|
72 CVPbkContactManager& aContactManager, |
|
73 MMyCardImageLoaderObserver& aObserver ); |
|
74 |
|
75 /** |
|
76 * Destructor. |
|
77 */ |
|
78 ~CCCAppMyCardImageLoader(); |
|
79 |
|
80 |
|
81 public: // Interface |
|
82 |
|
83 /** |
|
84 * Start loading contacts image. Will cancel any previous requests. |
|
85 * Once loading is complete the new image is delivered to observer |
|
86 * with a call to MMyCardImageLoaderObserver::ThumbnailReady. |
|
87 * |
|
88 * @param aContact source contact for the image |
|
89 */ |
|
90 void LoadContactImageL( MVPbkStoreContact& aContact ); |
|
91 |
|
92 |
|
93 private: // From MPbk2ImageGetObserver |
|
94 virtual void Pbk2ImageGetComplete( |
|
95 MPbk2ImageOperation& aOperation, |
|
96 CFbsBitmap* aBitmap ); |
|
97 virtual void Pbk2ImageGetFailed( |
|
98 MPbk2ImageOperation& aOperation, |
|
99 TInt aError ); |
|
100 |
|
101 |
|
102 private: // constructors |
|
103 |
|
104 /** |
|
105 * Constructor |
|
106 */ |
|
107 CCCAppMyCardImageLoader( |
|
108 CVPbkContactManager& aContactManager, |
|
109 MMyCardImageLoaderObserver& aObserver ); |
|
110 |
|
111 /** |
|
112 * Constructor |
|
113 */ |
|
114 void ConstructL(); |
|
115 |
|
116 |
|
117 private: // data |
|
118 |
|
119 /// Not own. Virtual phonebook contact manager |
|
120 CVPbkContactManager& iContactManager; |
|
121 |
|
122 /// Not own. Observer |
|
123 MMyCardImageLoaderObserver& iObserver; |
|
124 |
|
125 /// Own. Phonebook image manager |
|
126 CPbk2ImageManager* iImageManager; |
|
127 |
|
128 /// Own. Image operation |
|
129 MPbk2ImageOperation* iOperation; |
|
130 }; |
|
131 |
|
132 #endif // CCAPPMYCARDIMAGELOADER_H |
|
133 |
|
134 // End of File |