94 void CGlxCollectionPluginAll::ConstructL() |
94 void CGlxCollectionPluginAll::ConstructL() |
95 { |
95 { |
96 iDataSource = MGlxDataSource::OpenDataSourceL(KGlxDefaultDataSourceUid, *this); |
96 iDataSource = MGlxDataSource::OpenDataSourceL(KGlxDefaultDataSourceUid, *this); |
97 } |
97 } |
98 |
98 |
99 void CGlxCollectionPluginAll::CpiAttributeAdditionalAttributes(const TMPXAttribute& aCpiAttribute, RArray<TMPXAttribute>& aAttributeArray) |
99 void CGlxCollectionPluginAll::CpiAttributeAdditionalAttributesL( |
100 { |
100 const TMPXAttribute& aCpiAttribute, |
101 TRACER("CGlxCollectionPluginAll::CpiAttributeAdditionalAttributes()"); |
101 RArray<TMPXAttribute>& aAttributeArray) |
102 // Only need to process KGlxMediaCollectionPluginSpecificSubTitle here as all the others are reading straight from resource files |
102 { |
|
103 TRACER("CGlxCollectionPluginAll::CpiAttributeAdditionalAttributesL()"); |
|
104 // Only need to process KGlxMediaCollectionPluginSpecificSubTitle here as |
|
105 // all the others are reading straight from resource files |
103 // KGlxMediaCollectionPluginSpecificSubTitle requires a usage count |
106 // KGlxMediaCollectionPluginSpecificSubTitle requires a usage count |
104 if (aCpiAttribute == KGlxMediaCollectionPluginSpecificSubTitle) |
107 if (aCpiAttribute == KGlxMediaCollectionPluginSpecificSubTitle) |
105 { |
108 { |
106 // need to add the usage count. but check first if it is already present |
109 // need to add the usage count. but check first if it is already present |
107 TInt attrCount = aAttributeArray.Count(); |
110 TInt attrCount = aAttributeArray.Count(); |
108 TBool found = EFalse; |
111 TBool found = EFalse; |
109 |
112 |
110 for ( TInt index = 0 ; index < attrCount ; index++) |
113 for (TInt index = 0; index < attrCount; index++) |
111 { |
114 { |
112 if (aAttributeArray[index] == KMPXMediaGeneralCount) |
115 if (aAttributeArray[index] == KMPXMediaGeneralCount) |
113 { |
116 { |
114 found = ETrue; |
117 found = ETrue; |
115 break; |
118 break; |
116 } |
119 } |
117 } |
120 } |
118 |
121 |
119 if (!found) |
122 if (!found) |
120 { |
123 { |
121 aAttributeArray.Append(KMPXMediaGeneralCount); |
124 aAttributeArray.AppendL(KMPXMediaGeneralCount); |
122 } |
125 } |
123 } |
126 } |
124 } |
127 } |
125 |
128 |
126 void CGlxCollectionPluginAll::HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray<TMPXAttribute> aCpiAttributes, TArray<TGlxMediaId> /* aMediaIds */) |
129 void CGlxCollectionPluginAll::HandleCpiAttributeResponseL( |
127 { |
130 CMPXMedia* aResponse, TArray<TMPXAttribute> aCpiAttributes, |
|
131 TArray<TGlxMediaId> /* aMediaIds */) |
|
132 { |
128 TRACER("CGlxCollectionPluginAll::HandleCpiAttributeResponseL"); |
133 TRACER("CGlxCollectionPluginAll::HandleCpiAttributeResponseL"); |
129 _LIT(KResourceFile, "z:glxpluginall.rsc"); |
134 _LIT(KResourceFile, "z:glxpluginall.rsc"); |
130 |
135 |
131 TInt count = aCpiAttributes.Count(); |
136 TInt count = aCpiAttributes.Count(); |
132 |
137 |
140 { |
145 { |
141 User::Leave(KErrNotSupported); |
146 User::Leave(KErrNotSupported); |
142 } |
147 } |
143 else |
148 else |
144 { |
149 { |
145 TInt usageCount = aResponse->ValueTObjectL<TInt>(KMPXMediaGeneralCount); |
150 TInt usageCount = aResponse->ValueTObjectL<TInt> ( |
|
151 KMPXMediaGeneralCount); |
146 HBufC* tempTitle = NULL; |
152 HBufC* tempTitle = NULL; |
147 |
153 |
148 if(0 == usageCount) |
154 if (0 == usageCount) |
149 { |
155 { |
150 tempTitle = LoadLocalizedStringLC(KResourceFile, R_ALL_ITEM_SUB_TITLE_EMPTY); |
156 tempTitle = LoadLocalizedStringLC(KResourceFile, |
151 // Set the title in the response. |
157 R_ALL_ITEM_SUB_TITLE_EMPTY); |
152 aResponse->SetTextValueL(attr, *tempTitle); |
158 // Set the title in the response. |
153 CleanupStack::PopAndDestroy(tempTitle); |
159 aResponse->SetTextValueL(attr, *tempTitle); |
154 continue; |
160 CleanupStack::PopAndDestroy(tempTitle); |
155 } |
161 continue; |
|
162 } |
156 // Get the format string |
163 // Get the format string |
157 else if (1 == usageCount) |
164 else if (1 == usageCount) |
158 { |
165 { |
159 tempTitle = LoadLocalizedStringLC(KResourceFile, R_ALL_SUB_TITLE_SINGLE); |
166 tempTitle = LoadLocalizedStringLC(KResourceFile, |
160 aResponse->SetTextValueL(attr, *tempTitle); |
167 R_ALL_SUB_TITLE_SINGLE); |
|
168 aResponse->SetTextValueL(attr, *tempTitle); |
161 CleanupStack::PopAndDestroy(tempTitle); |
169 CleanupStack::PopAndDestroy(tempTitle); |
162 continue; |
170 continue; |
163 } |
171 } |
164 else |
172 else |
165 { |
173 { |
166 tempTitle = LoadLocalizedStringLC(KResourceFile, R_ALL_SUB_TITLE_MULTI); |
174 tempTitle = LoadLocalizedStringLC(KResourceFile, |
|
175 R_ALL_SUB_TITLE_MULTI); |
167 } |
176 } |
168 TPtr formatString = tempTitle->Des(); |
177 TPtr formatString = tempTitle->Des(); |
169 |
178 |
170 // Now create a buffer that will contain the result. needs to be length of format string plus a few extra for the number |
179 // Now create a buffer that will contain the result. needs to be |
|
180 // length of format string plus a few extra for the number |
171 HBufC* title = HBufC::NewLC(formatString.Length() + 10); |
181 HBufC* title = HBufC::NewLC(formatString.Length() + 10); |
172 TPtr ptr = title->Des(); |
182 TPtr ptr = title->Des(); |
173 StringLoader::Format(ptr, formatString, -1, usageCount); |
183 StringLoader::Format(ptr, formatString, -1, usageCount); |
174 |
184 |
175 // Set the title in the response. |
185 // Set the title in the response. |
176 aResponse->SetTextValueL(attr, *title); |
186 aResponse->SetTextValueL(attr, *title); |
177 |
187 |
178 CleanupStack::PopAndDestroy(title); |
188 CleanupStack::PopAndDestroy(title); |
179 CleanupStack::PopAndDestroy(tempTitle); |
189 CleanupStack::PopAndDestroy(tempTitle); |
180 } |
190 } |
181 } |
191 } |
182 else if (attr == KGlxMediaCollectionPluginSpecificSelectMediaPopupTitle) |
192 else if (attr |
183 { |
193 == KGlxMediaCollectionPluginSpecificSelectMediaPopupTitle) |
184 User::Leave(KErrNotSupported); |
194 { |
185 } |
195 User::Leave(KErrNotSupported); |
186 else if (attr == KGlxMediaCollectionPluginSpecificNewMediaItemTitle) |
196 } |
187 { |
197 else if (attr == KGlxMediaCollectionPluginSpecificNewMediaItemTitle) |
188 User::Leave(KErrNotSupported); |
198 { |
189 } |
199 User::Leave(KErrNotSupported); |
190 else if (attr == KGlxMediaCollectionPluginSpecificDefaultMediaTitle) |
200 } |
191 { |
201 else if (attr == KGlxMediaCollectionPluginSpecificDefaultMediaTitle) |
192 User::Leave(KErrNotSupported); |
202 { |
193 } |
203 User::Leave(KErrNotSupported); |
194 else if (attr == KMPXMediaGeneralTitle) |
204 } |
195 { |
205 else if (attr == KMPXMediaGeneralTitle) |
196 HBufC* title = LoadLocalizedStringLC(KResourceFile, R_ALL_GENERAL_TITLE); |
206 { |
|
207 HBufC* title = LoadLocalizedStringLC(KResourceFile, |
|
208 R_ALL_GENERAL_TITLE); |
197 // Set the title in the response. |
209 // Set the title in the response. |
198 aResponse->SetTextValueL(attr, *title); |
210 aResponse->SetTextValueL(attr, *title); |
199 CleanupStack::PopAndDestroy(title); |
211 CleanupStack::PopAndDestroy(title); |
200 } |
212 } |
201 } |
213 } |
202 } |
214 } |
203 |
215 |
204 TBool CGlxCollectionPluginAll::IsUpdateMessageIgnoredL(CMPXMessage& /*aMessage*/) |
216 TBool CGlxCollectionPluginAll::IsUpdateMessageIgnoredL(CMPXMessage& /*aMessage*/) |
205 { |
217 { |
206 TBool ignore = EFalse; |
218 TBool ignore = EFalse; |
207 return ignore; |
219 return ignore; |