197 } |
190 } |
198 |
191 |
199 /*! |
192 /*! |
200 \param componentId Component id of the entry which details are requested for. |
193 \param componentId Component id of the entry which details are requested for. |
201 \return Map of component details if component id was greater than 0 or |
194 \return Map of component details if component id was greater than 0 or |
202 empty map otherwise. |
195 empty map otherwise. |
203 */ |
196 */ |
204 CaSoftwareRegistryPrivate::DetailMap CaSoftwareRegistryPrivate::entryDetails( |
197 CaSoftwareRegistryPrivate::DetailMap CaSoftwareRegistryPrivate::entryDetails( |
205 int componentId) const |
198 int componentId) const |
206 { |
199 { |
207 CaSoftwareRegistry::DetailMap result; |
200 CaSoftwareRegistry::DetailMap result; |
|
201 TRAP_IGNORE(result=entryDetailsL(componentId)); |
|
202 return result; |
|
203 } |
|
204 |
|
205 /*! |
|
206 \param componentId Component id of the entry which details are requested for. |
|
207 \return Map of component details if component id was greater than 0 or |
|
208 empty map otherwise. |
|
209 */ |
|
210 CaSoftwareRegistryPrivate::DetailMap CaSoftwareRegistryPrivate::entryDetailsL( |
|
211 int componentId) const |
|
212 { |
|
213 CaSoftwareRegistry::DetailMap result; |
208 |
214 |
209 if (componentId >= 1) { |
215 if (componentId >= 1) { |
210 RSoftwareComponentRegistry softwareComponentRegistry; |
216 RSoftwareComponentRegistry scr; |
211 ScrScopedPointer scr(&softwareComponentRegistry); |
217 CleanupClosePushL(scr); |
212 if (scr->Connect() == KErrNone) { |
218 if (scr.Connect() == KErrNone) { |
213 |
219 CComponentEntry* entry = CComponentEntry::NewLC(); |
214 QScopedPointer<CComponentEntry> entry; |
220 |
215 |
|
216 QT_TRAP_THROWING(entry.reset(CComponentEntry::NewL())); |
|
217 |
|
218 TBool resultCode = EFalse; |
221 TBool resultCode = EFalse; |
219 TRAPD(leaveCode, resultCode = scr->GetComponentL(componentId, *entry)); |
222 resultCode = scr.GetComponentL(componentId, *entry); |
220 if (leaveCode == KErrNone && resultCode) { |
223 if ( resultCode) { |
221 result = entryDetails(*entry); |
224 result = entryDetailsL(*entry); |
222 } |
225 } |
|
226 |
|
227 if (entry->SoftwareType().Compare(KSoftwareTypeJava) == 0) { |
|
228 CPropertyEntry* domainProperty = |
|
229 scr.GetComponentPropertyL(componentId, |
|
230 KCaScrPropertyDomainCategory); |
|
231 CleanupStack::PushL(domainProperty); |
|
232 if (domainProperty && |
|
233 domainProperty->PropertyType() == |
|
234 CPropertyEntry::ELocalizedProperty) { |
|
235 result[CaSoftwareRegistry::componentProtectionDomainKey()] = |
|
236 XQConversions::s60DescToQString( |
|
237 static_cast<CLocalizablePropertyEntry*>( |
|
238 domainProperty)->StrValue()); |
|
239 } |
|
240 |
|
241 CPropertyEntry *midletDescryption = |
|
242 scr.GetComponentPropertyL(componentId, |
|
243 KCaScrPropertyMidletDescryption); |
|
244 CleanupStack::PushL(midletDescryption); |
|
245 if (midletDescryption && |
|
246 midletDescryption->PropertyType() == |
|
247 CPropertyEntry::ELocalizedProperty) { |
|
248 result[CaSoftwareRegistry::componentDescriptionKey()] = |
|
249 XQConversions::s60DescToQString( |
|
250 static_cast<CLocalizablePropertyEntry*>( |
|
251 midletDescryption)->StrValue()); |
|
252 } |
|
253 CleanupStack::PopAndDestroy(midletDescryption); |
|
254 CleanupStack::PopAndDestroy(domainProperty); |
|
255 } |
|
256 CleanupStack::PopAndDestroy(entry); |
223 } |
257 } |
224 } |
258 CleanupStack::PopAndDestroy(&scr); |
225 |
259 } |
226 return result; |
260 return result; |
227 } |
261 } |
228 |
262 |
229 /*! |
263 /*! |
230 \param entry Software registry entry providing details. |
264 \param entry Software registry entry providing details. |
231 \return Map with details for the component represented by \entry. |
265 \return Map with details for the component represented by \entry. |
232 */ |
266 */ |
233 CaSoftwareRegistryPrivate::DetailMap CaSoftwareRegistryPrivate::entryDetails( |
267 CaSoftwareRegistryPrivate::DetailMap CaSoftwareRegistryPrivate::entryDetailsL( |
234 const CComponentEntry& entry) const |
268 const CComponentEntry& entry) const |
235 { |
269 { |
236 CaSoftwareRegistry::DetailMap detailMap; |
270 CaSoftwareRegistry::DetailMap detailMap; |
237 |
271 |
238 detailMap[CaSoftwareRegistry::componentNameKey()] = |
272 detailMap[CaSoftwareRegistry::componentNameKey()] = |
239 XQConversions::s60DescToQString(entry.Name()); |
273 XQConversions::s60DescToQString(entry.Name()); |
240 |
274 |
241 detailMap[CaSoftwareRegistry::componentVersionKey()] = |
275 detailMap[CaSoftwareRegistry::componentVersionKey()] = |
242 XQConversions::s60DescToQString(entry.Version()); |
276 XQConversions::s60DescToQString(entry.Version()); |
243 |
277 |
244 detailMap[CaSoftwareRegistry::componentVendorKey()] = |
278 detailMap[CaSoftwareRegistry::componentVendorKey()] = |
245 XQConversions::s60DescToQString(entry.Vendor()); |
279 XQConversions::s60DescToQString(entry.Vendor()); |
246 |
280 |
247 QString drives; |
281 QString drives; |
248 QString drv; |
282 QString drv; |
249 TChar drive; |
283 TChar drive; |
250 |
284 |
251 const TInt driveListLen(entry.InstalledDrives().Length()); |
285 const TInt driveListLen(entry.InstalledDrives().Length()); |
252 for (TInt i( 0 ); i < driveListLen; ++i) { |
286 for (TInt i( 0 ); i < driveListLen; ++i) { |
253 if (entry.InstalledDrives()[i] != '\0') { |
287 if (entry.InstalledDrives()[i] != '\0') { |
254 |
288 |
255 if (!drives.isEmpty()) { |
289 if (!drives.isEmpty()) { |
256 drives = drives.append(","); |
290 drives = drives.append(","); |
257 } |
291 } |
258 drv = QString(QChar('A'+ i)).append(":"); |
292 drv = QString(QChar('A'+ i)).append(":"); |
259 if(DriveInfo::GetDefaultDrive( |
293 if(DriveInfo::GetDefaultDrive( |
260 DriveInfo::EDefaultPhoneMemory, drive ) == KErrNone |
294 DriveInfo::EDefaultPhoneMemory, drive ) == KErrNone |
261 && QChar('A'+ i) == QChar(drive)) |
295 && QChar('A'+ i) == QChar(drive)) { |
262 { |
296 drives = drives.append(HbParameterLengthLimiter( |
263 drives = drives.append( |
297 "txt_applib_dialog_1_device_memory").arg( |
264 HbParameterLengthLimiter("txt_applib_dialog_1_device_memory").arg( |
298 QString(QChar('A'+ i)))); |
265 QString(QChar('A'+ i)))); |
299 } else if(DriveInfo::GetDefaultDrive( |
266 } |
300 DriveInfo::EDefaultMassStorage, drive ) == KErrNone |
267 else if(DriveInfo::GetDefaultDrive( |
301 && QChar('A'+ i) == QChar(drive)) { |
268 DriveInfo::EDefaultMassStorage, drive ) == KErrNone |
302 drives = drives.append(HbParameterLengthLimiter( |
269 && QChar('A'+ i) == QChar(drive)) |
303 "txt_applib_dialog_1_mass_storage").arg( |
270 { |
304 QString(QChar('A'+ i)))); |
271 drives = drives.append( |
305 } else if(DriveInfo::GetDefaultDrive( |
272 HbParameterLengthLimiter("txt_applib_dialog_1_mass_storage").arg( |
306 DriveInfo::EDefaultRemovableMassStorage, drive ) == KErrNone |
273 QString(QChar('A'+ i)))); |
307 && QChar('A'+ i) == QChar(drive)) { |
274 } |
|
275 else if(DriveInfo::GetDefaultDrive( |
|
276 DriveInfo::EDefaultRemovableMassStorage, drive ) == KErrNone |
|
277 && QChar('A'+ i) == QChar(drive)) |
|
278 { |
|
279 RFs fs; |
308 RFs fs; |
280 RFSScopedPointer fSPointer(&fs); |
309 CleanupClosePushL(fs); |
281 if (fs.Connect() == KErrNone) { |
310 if (fs.Connect() == KErrNone) { |
282 TInt driveNumber; |
311 TInt driveNumber; |
283 TVolumeInfo tv; |
312 TVolumeInfo tv; |
284 DriveInfo::GetDefaultDrive( |
313 DriveInfo::GetDefaultDrive( |
285 DriveInfo::EDefaultRemovableMassStorage, driveNumber ); |
314 DriveInfo::EDefaultRemovableMassStorage, |
286 qt_symbian_throwIfError(fs.Volume(tv, driveNumber)); |
315 driveNumber ); |
287 if(tv.iName.Length()) { |
316 User::LeaveIfError(fs.Volume(tv, driveNumber)); |
288 drives = drives.append( |
317 if(tv.iName.Length()) { |
289 HbParameterLengthLimiter("txt_applib_dialog_1_2").arg( |
318 drives = drives.append(HbParameterLengthLimiter( |
290 QString(QChar('A'+ i))).arg( |
319 "txt_applib_dialog_1_2").arg( |
291 XQConversions::s60DescToQString(tv.iName))); |
320 QString(QChar('A'+ i))).arg( |
292 } |
321 XQConversions::s60DescToQString( |
293 else { |
322 tv.iName))); |
294 drives = drives.append( |
323 } else { |
295 HbParameterLengthLimiter("txt_applib_dialog_1_memory_card").arg( |
324 drives = drives.append(HbParameterLengthLimiter( |
296 QString(QChar('A'+ i)))); |
325 "txt_applib_dialog_1_memory_card").arg( |
|
326 QString(QChar('A'+ i)))); |
297 } |
327 } |
298 } |
328 } |
|
329 CleanupStack::PopAndDestroy(&fs); |
299 } else { |
330 } else { |
300 drives = drives.append(QChar('A'+ i)).append(":"); |
331 drives = drives.append(QChar('A'+ i)).append(":"); |
301 } |
332 } |
302 } |
333 } |
303 } |
334 } |
304 |
|
305 detailMap[CaSoftwareRegistry::componentDriveInfoKey()] = drives; |
335 detailMap[CaSoftwareRegistry::componentDriveInfoKey()] = drives; |
306 |
|
307 |
336 |
308 static const TInt64 KKilo = 1024; |
337 static const TInt64 KKilo = 1024; |
309 static const TInt64 KMega = KKilo * KKilo; |
338 static const TInt64 KMega = KKilo * KKilo; |
310 if(entry.ComponentSize() >= KMega) { |
339 if(entry.ComponentSize() >= KMega) { |
311 detailMap[CaSoftwareRegistry::componentSizeKey()] = |
340 detailMap[CaSoftwareRegistry::componentSizeKey()] |
312 HbParameterLengthLimiter("txt_applib_dialog_l1_mb").arg( |
341 = HbParameterLengthLimiter("txt_applib_dialog_l1_mb").arg( |
313 static_cast<double>(entry.ComponentSize() / KMega)); |
342 static_cast<double>(entry.ComponentSize() / KMega)); |
314 } |
343 } else { |
315 else { |
344 detailMap[CaSoftwareRegistry::componentSizeKey()] |
316 detailMap[CaSoftwareRegistry::componentSizeKey()] = |
345 = HbParameterLengthLimiter("txt_applib_dialog_l1_kb").arg( |
317 HbParameterLengthLimiter("txt_applib_dialog_l1_kb").arg( |
346 static_cast<double>(entry.ComponentSize() / KKilo)); |
318 static_cast<double>(entry.ComponentSize() / KKilo)); |
347 } |
319 } |
348 detailMap[CaSoftwareRegistry::componentTypeKey()] = |
320 |
|
321 |
|
322 detailMap[CaSoftwareRegistry::componentTypeKey()] = |
|
323 XQConversions::s60DescToQString(entry.SoftwareType()); |
349 XQConversions::s60DescToQString(entry.SoftwareType()); |
324 |
350 |
325 return detailMap; |
351 return detailMap; |
326 } |
352 } |
|
353 |
|
354 /*! |
|
355 \param entry Software registry entry providing details. |
|
356 \return Map with details for the component represented by \entry. |
|
357 */ |
|
358 QList<CaSoftwareRegistryPrivate::DetailMap> |
|
359 CaSoftwareRegistryPrivate::retrieveLogEntries() const |
|
360 { |
|
361 QList<CaSoftwareRegistryPrivate::DetailMap> logMap; |
|
362 TRAP_IGNORE(logMap = retrieveLogEntriesL()); |
|
363 return logMap; |
|
364 } |
|
365 |
|
366 /*! |
|
367 \param entry Software registry entry providing installation log. |
|
368 \return List of Maps with installation log. |
|
369 */ |
|
370 QList<CaSoftwareRegistryPrivate::DetailMap> |
|
371 CaSoftwareRegistryPrivate::retrieveLogEntriesL() const |
|
372 { |
|
373 QList<CaSoftwareRegistryPrivate::DetailMap> logList; |
|
374 |
|
375 RSoftwareComponentRegistry scr; |
|
376 CleanupClosePushL(scr); |
|
377 User::LeaveIfError(scr.Connect()); |
|
378 |
|
379 RPointerArray<CScrLogEntry> logEntries; |
|
380 CleanupResetAndDestroyPushL(logEntries); |
|
381 scr.RetrieveLogEntriesL(logEntries); |
|
382 |
|
383 // 50 log items or less - ui spec |
|
384 TInt lastLog(0); |
|
385 if (logEntries.Count() > maxLogsCount) { |
|
386 lastLog = logEntries.Count() - maxLogsCount; |
|
387 } |
|
388 // iteration through most recent log to the last |
|
389 for (TInt i = logEntries.Count() - 1; i >= lastLog; i--) { |
|
390 CScrLogEntry* entry = logEntries[i]; |
|
391 DetailMap logMap; |
|
392 logMap[CaSoftwareRegistry::componentNameKey()] |
|
393 = XQConversions::s60DescToQString(entry->ComponentName()); |
|
394 logMap[CaSoftwareRegistry::componentVersionKey()] |
|
395 = XQConversions::s60DescToQString(entry->ComponentVersion()); |
|
396 logMap[CaSoftwareRegistry::componentTimeKey()] |
|
397 = operationTime(entry->OperationTime()); |
|
398 logMap[CaSoftwareRegistry::componentOperationTypeKey()] |
|
399 = operationTypeL(entry->OperationType()); |
|
400 logList.append(logMap); |
|
401 } |
|
402 CleanupStack::PopAndDestroy(&logEntries); |
|
403 CleanupStack::PopAndDestroy(&scr); |
|
404 |
|
405 return logList; |
|
406 } |
|
407 |
|
408 /*! |
|
409 \param operation type. |
|
410 \return string representing operation type. |
|
411 */ |
|
412 QString CaSoftwareRegistryPrivate::operationTypeL(int operationType) const |
|
413 { |
|
414 QString opType; |
|
415 switch (operationType) { |
|
416 case EScrCompInstall: |
|
417 opType = CaSoftwareRegistry::componentInstallValue(); |
|
418 break; |
|
419 case EScrCompUnInstall: |
|
420 opType = CaSoftwareRegistry::componentUninstallValue(); |
|
421 break; |
|
422 case EScrCompUpgrade: |
|
423 opType = CaSoftwareRegistry::componentUpgradeValue(); |
|
424 break; |
|
425 case EScrCompHidden: |
|
426 opType = CaSoftwareRegistry::componentHiddenValue(); |
|
427 break; |
|
428 default: |
|
429 User::Leave(KErrNotSupported); |
|
430 break; |
|
431 } |
|
432 return opType; |
|
433 } |
|
434 |
|
435 /*! |
|
436 \param operation type. |
|
437 \return string representing operation type. |
|
438 */ |
|
439 QString CaSoftwareRegistryPrivate::operationTime(TTime time) const |
|
440 { |
|
441 TDateTime dt = time.DateTime(); |
|
442 QDate date(dt.Year(), dt.Month()+1, dt.Day()); |
|
443 HbExtendedLocale hbLoc; |
|
444 return hbLoc.format(date, r_qtn_date_usual_with_zero); |
|
445 } |