|
1 /* |
|
2 * Copyright (c) 2002-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CCLFDBITEMPROVIDER_H |
|
20 #define CCLFDBITEMPROVIDER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <CLFContentListing.hrh> |
|
24 #include <CLFContentListing.h> |
|
25 #include <mdesession.h> |
|
26 #include <bamdesca.h> |
|
27 #include <e32base.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class MCLFItem; |
|
31 class MCLFItemProviderObserver; |
|
32 class CCLFDbItemContainer; |
|
33 class CCLFContainerItem; |
|
34 class CCLFQueryAdapter; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * Helper class to get items from CLF server. |
|
40 * |
|
41 * @lib ContentListingFramework.lib |
|
42 * @since Series 60 3.0 |
|
43 */ |
|
44 NONSHARABLE_CLASS( CCLFDbItemProvider ) : public CActive |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 */ |
|
51 static CCLFDbItemProvider* NewL( CCLFDbItemContainer& aDbItemContainer, |
|
52 CCLFQueryAdapter& aQueryAdapter, CMdESession* iMdESession ); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CCLFDbItemProvider(); |
|
58 |
|
59 public: // New functions |
|
60 |
|
61 /** |
|
62 * Async function for fething items from server. |
|
63 * @since Series 60 3.0 |
|
64 * @param aMimeTypeArray |
|
65 * @param aMediaTypeArray |
|
66 * @param aObserver item provider observer |
|
67 */ |
|
68 void PrepareItemsL( const MDesCArray& aMimeTypeArray, |
|
69 const TArray<TInt>& aMediaTypeArray, |
|
70 MCLFItemProviderObserver& aObserver ); |
|
71 |
|
72 void PrepareItemsL( const TArray<TCLFItemId>& aItemIDArray, |
|
73 MCLFItemProviderObserver& aObserver ); |
|
74 |
|
75 /** |
|
76 * Get items. |
|
77 * @since Series 60 3.0 |
|
78 * @param aItemArray |
|
79 * @return system-wide error code |
|
80 */ |
|
81 TInt GetItems( RPointerArray<MCLFItem>& aItemArray ); |
|
82 |
|
83 protected: // New functions |
|
84 |
|
85 /** |
|
86 * From CActive |
|
87 */ |
|
88 void DoRunL(); |
|
89 |
|
90 /** |
|
91 * From CActive |
|
92 */ |
|
93 TInt RunError( TInt aError ); |
|
94 |
|
95 void DoFetchMdSIdDataCachedL(); |
|
96 void DoFetchMdSDataL(); |
|
97 void DoFetchMdSIdDataL( RArray< TCLFItemId >& aItemIDArray ); |
|
98 void CreateCLFItemL( CCLFContainerItem& aCItem ); |
|
99 protected: // Functions from base classes |
|
100 |
|
101 /** |
|
102 * From CActive |
|
103 */ |
|
104 void DoCancel(); |
|
105 |
|
106 /** |
|
107 * From CActive |
|
108 */ |
|
109 void RunL(); |
|
110 |
|
111 private: |
|
112 |
|
113 /** |
|
114 * C++ default constructor. |
|
115 */ |
|
116 CCLFDbItemProvider( CCLFDbItemContainer& aDbItemContainer, |
|
117 CCLFQueryAdapter& aQueryAdapter, CMdESession* aMdESession ); |
|
118 |
|
119 /** |
|
120 * By default Symbian 2nd phase constructor is private. |
|
121 */ |
|
122 void ConstructL(); |
|
123 |
|
124 private: // Data |
|
125 |
|
126 enum TCLFItemProviderState |
|
127 { |
|
128 EPrepareItemIds = 0x1, |
|
129 EPrepareItems, |
|
130 EItemsReady |
|
131 }; |
|
132 |
|
133 // Own |
|
134 TCLFItemProviderState iProviderState; |
|
135 // Ref |
|
136 MCLFItemProviderObserver* iObserver; |
|
137 // Own |
|
138 RPointerArray< MCLFItem > iItemArray; |
|
139 // Ref |
|
140 CCLFDbItemContainer& iDbItemContainer; |
|
141 // Ref |
|
142 CCLFQueryAdapter& iQueryAdapter; |
|
143 // Own |
|
144 CMdEObjectQuery* iObjectQuery; |
|
145 // Ref |
|
146 const TDesC* iObjDefStr; |
|
147 // Ref |
|
148 CMdESession* iMdESession; |
|
149 }; |
|
150 |
|
151 #endif // CCLFDBITEMPROVIDER_H |
|
152 |
|
153 // End of File |