|
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 thumbnail loader. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include "CPbk2ThumbnailPopup.h" |
|
21 #include <MVPbkSingleContactOperationObserver.h> |
|
22 |
|
23 // FORWARD DECLARATIONS |
|
24 class MVPbkContactOperationBase; |
|
25 class CVPbkContactManager; |
|
26 class MVPbkContactLink; |
|
27 class MVPbkStoreContact; |
|
28 |
|
29 // CLASS DECLARATION |
|
30 |
|
31 NONSHARABLE_CLASS(CPbk2ThumbnailLoader) : |
|
32 public CBase, |
|
33 private MVPbkSingleContactOperationObserver, |
|
34 private MPbk2ThumbnailPopupObserver |
|
35 { |
|
36 public: // Constructor and destructor |
|
37 |
|
38 /** |
|
39 * Creates a new instance of this class. |
|
40 * |
|
41 * @param aContactManager Virtual Phonebook contact manager. |
|
42 */ |
|
43 IMPORT_C static CPbk2ThumbnailLoader* NewL( |
|
44 CVPbkContactManager& aContactManager ); |
|
45 |
|
46 /** |
|
47 * Destructor. |
|
48 */ |
|
49 ~CPbk2ThumbnailLoader(); |
|
50 |
|
51 public: // Interface |
|
52 |
|
53 /** |
|
54 * Loads a contact and shows its thumbnail if it has one. |
|
55 * |
|
56 * @param aContactLink Contact link. |
|
57 * @param aListBox Listbox presenting the contact. |
|
58 * @param aThumbnailLocation Location where thumbnail is drawn. |
|
59 */ |
|
60 IMPORT_C void LoadThumbnailL( |
|
61 MVPbkContactLink* aContactLink, |
|
62 const CEikListBox* aListBox, |
|
63 TPbk2ThumbnailLocation aThumbnailLocation ); |
|
64 |
|
65 /** |
|
66 * Shows given contact's thumbnail if it has one. |
|
67 * |
|
68 * @param aStoreContact Contact. |
|
69 * @param aListBox Listbox presenting the contact. |
|
70 * @param aThumbnailLocation Location where thumbnail is drawn. |
|
71 */ |
|
72 IMPORT_C void LoadThumbnail( |
|
73 MVPbkStoreContact* aStoreContact, |
|
74 const CEikListBox* aListBox, |
|
75 TPbk2ThumbnailLocation aThumbnailLocation ); |
|
76 |
|
77 /** |
|
78 * Hides the current thumbnail and cancels the retrieving of next |
|
79 * contact if it's currently being retrieved. |
|
80 */ |
|
81 IMPORT_C void HideThumbnail(); |
|
82 |
|
83 /** |
|
84 * Redraws the thumbnail. |
|
85 */ |
|
86 IMPORT_C void Refresh(); |
|
87 |
|
88 /** |
|
89 * Resets the loader. Calls HideThumbnail() and deletes |
|
90 * the currently loaded contact. |
|
91 */ |
|
92 IMPORT_C void Reset(); |
|
93 |
|
94 private: // From MVPbkSingleContactOperationObserver |
|
95 void VPbkSingleContactOperationComplete( |
|
96 MVPbkContactOperationBase& aOperation, |
|
97 MVPbkStoreContact* aContact ); |
|
98 void VPbkSingleContactOperationFailed( |
|
99 MVPbkContactOperationBase& aOperation, |
|
100 TInt aError ); |
|
101 |
|
102 private: // From MPbk2ThumbnailPopupObserver |
|
103 void PopupLoadComplete(); |
|
104 void PopupLoadFailed( |
|
105 TInt aError ); |
|
106 |
|
107 private: // Implementation |
|
108 CPbk2ThumbnailLoader( |
|
109 CVPbkContactManager& aContactManager ); |
|
110 void ConstructL(); |
|
111 |
|
112 private: // Data |
|
113 /// Own: Thumbnail popup control |
|
114 CPbk2ThumbnailPopup* iThumbnailPopup; |
|
115 /// Own: Retrieve operation |
|
116 MVPbkContactOperationBase* iRetrieveOperation; |
|
117 /// Own: Store contact |
|
118 MVPbkStoreContact* iStoreContact; |
|
119 /// Ref: Virtual Phonebook contact manager |
|
120 CVPbkContactManager& iContactManager; |
|
121 /// Ref: List box |
|
122 const CEikListBox* iListBox; |
|
123 }; |
|
124 |
|
125 // End of File |