contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp
changeset 102 8b8b34fa9751
parent 99 7aaf39b772ac
child 106 e78d6e055a5b
equal deleted inserted replaced
100:0920c6a9b6c8 102:8b8b34fa9751
    13  *
    13  *
    14  * Description:  ?Description
    14  * Description:  ?Description
    15  *
    15  *
    16  */
    16  */
    17 #include <HbParameterLengthLimiter>
    17 #include <HbParameterLengthLimiter>
       
    18 #include <HbExtendedLocale>
    18 #include <QMetaType>
    19 #include <QMetaType>
    19 #include <QScopedPointer>
    20 #include <QScopedPointer>
    20 #include <QStringList>
    21 #include <QStringList>
    21 
    22 #include <QDateTime>
       
    23 #undef SYMBIAN_ENABLE_SPLIT_HEADERS //TODO this is work around
       
    24 #include <usif/scr/screntries.h>
    22 #include <usif/scr/scr.h>
    25 #include <usif/scr/scr.h>
    23 #include <usif/scr/screntries.h>
       
    24 #include <xqconversions.h>
    26 #include <xqconversions.h>
    25 #include <driveinfo.h>
    27 #include <driveinfo.h>
    26 
    28 
    27 #include "casoftwareregistry.h"
    29 #include "casoftwareregistry.h"
    28 #include "casoftwareregistry_p.h"
    30 #include "casoftwareregistry_p.h"
       
    31 #include "cadefs.h"
       
    32 #include "caarraycleanup.inl"
    29 
    33 
    30 using namespace Usif;
    34 using namespace Usif;
    31 
    35 
    32 _LIT(KConfirmMessageKey, "MIDlet-Delete-Confirm");
    36 _LIT(KConfirmMessageKey, "MIDlet-Delete-Confirm");
    33 
    37 _LIT(KCaScrPropertyDomainCategory, "Domain-Category");
    34 template <typename RClass>
    38 _LIT(KCaScrPropertyMidletDescryption, "MIDlet-Description");
    35 struct RClassDeleter
    39 const int maxLogsCount = 20;
    36 {
    40 
    37     static inline void cleanup(RClass *ptr)
       
    38     {
       
    39         ptr->Close();
       
    40     }
       
    41 };
       
    42 
       
    43 typedef QScopedPointer<RSoftwareComponentRegistry, 
       
    44     RClassDeleter<RSoftwareComponentRegistry> > ScrScopedPointer;
       
    45     
       
    46 typedef QScopedPointer<RFs, 
       
    47     RClassDeleter<RFs> > RFSScopedPointer;
       
    48 /*!
    41 /*!
    49  Constructor
    42  Constructor
    50  \param servicePublic Pointer to object of the public class.
    43  \param servicePublic Pointer to object of the public class.
    51  */
    44  */
    52 CaSoftwareRegistryPrivate::CaSoftwareRegistryPrivate(
    45 CaSoftwareRegistryPrivate::CaSoftwareRegistryPrivate(
    53     CaSoftwareRegistry *servicePublic):
    46         CaSoftwareRegistry *servicePublic):
    54     m_q(servicePublic)
    47     m_q(servicePublic)
    55 {
    48 {
    56 }
    49 }
    57 
    50 
    58 /*!
    51 /*!
    72       null string means the lack of the message.
    65       null string means the lack of the message.
    73  \retval true if there is no error.
    66  \retval true if there is no error.
    74  */
    67  */
    75 
    68 
    76 bool CaSoftwareRegistryPrivate::getUninstallDetails(int componentId,
    69 bool CaSoftwareRegistryPrivate::getUninstallDetails(int componentId,
    77     QString &componentName,
    70         QString &componentName,
    78     QStringList &applicationsUids,
    71         QStringList &applicationsUids,
    79     QString &confirmationMessage)
    72         QString &confirmationMessage)
    80 {
    73 {
    81     TRAPD(error, getUninstallDetailsL(componentId,
    74     TRAPD(error, getUninstallDetailsL(componentId,
    82         componentName,
    75             componentName,
    83         applicationsUids,
    76             applicationsUids,
    84         confirmationMessage)
    77             confirmationMessage)
    85          );
    78              );
    86     return error == KErrNone;
    79     return error == KErrNone;
    87 }
    80 }
    88 
    81 
    89 /*!
    82 /*!
    90  Provides a list of uids of applications installed by the given package.
    83  Provides a list of uids of applications installed by the given package.
    93       of the given component id.
    86       of the given component id.
    94  \retval true if there is no error.
    87  \retval true if there is no error.
    95  */
    88  */
    96 
    89 
    97 bool CaSoftwareRegistryPrivate::getApplicationsUids(int componentId,
    90 bool CaSoftwareRegistryPrivate::getApplicationsUids(int componentId,
    98     QStringList &applicationsUids)
    91         QStringList &applicationsUids)
    99 {
    92 {
   100     TRAPD(error, getApplicationsUidsL(componentId, applicationsUids));
    93     TRAPD(error, getApplicationsUidsL(componentId, applicationsUids));
   101     return error == KErrNone;
    94     return error == KErrNone;
   102 }
    95 }
   103 
    96 
   110       of the given component id.
   103       of the given component id.
   111  \param[out] confirmationMessage optional deletion confirmation message,
   104  \param[out] confirmationMessage optional deletion confirmation message,
   112       null string means the lack of the message.
   105       null string means the lack of the message.
   113  */
   106  */
   114 void CaSoftwareRegistryPrivate::getUninstallDetailsL(int componentId,
   107 void CaSoftwareRegistryPrivate::getUninstallDetailsL(int componentId,
   115     QString &componentName,
   108         QString &componentName,
   116     QStringList &appUids,
   109         QStringList &appUids,
   117     QString &confirmationMessage)
   110         QString &confirmationMessage)
   118 {
   111 {
   119     componentName.clear();
   112     componentName.clear();
   120     appUids.clear();
   113     appUids.clear();
   121     confirmationMessage.clear();
   114     confirmationMessage.clear();
   122 
   115 
   130         CleanupClosePushL(softwareComponentRegistry);
   123         CleanupClosePushL(softwareComponentRegistry);
   131         User::LeaveIfError(softwareComponentRegistry.Connect());
   124         User::LeaveIfError(softwareComponentRegistry.Connect());
   132 
   125 
   133         CComponentEntry *entry = CComponentEntry::NewLC();
   126         CComponentEntry *entry = CComponentEntry::NewLC();
   134         softwareComponentRegistry.GetComponentL(componentId, *entry);
   127         softwareComponentRegistry.GetComponentL(componentId, *entry);
   135         softwareComponentRegistry.GetAppUidsForComponentL(componentIdValue,
   128         softwareComponentRegistry.GetAppUidsForComponentL(
   136             appUidsArray);
   129                 componentIdValue, appUidsArray);
   137 
   130 
   138         CPropertyEntry *confirmationProperty =
   131         CPropertyEntry *confirmationProperty
   139             softwareComponentRegistry.GetComponentPropertyL(componentId,
   132                 = softwareComponentRegistry.GetComponentPropertyL(
   140             KConfirmMessageKey);
   133                         componentId, KConfirmMessageKey);
   141         if (confirmationProperty &&
   134         if (confirmationProperty
   142             confirmationProperty->PropertyType() ==
   135                 && confirmationProperty->PropertyType()
   143                 CPropertyEntry::ELocalizedProperty) {
   136                         == CPropertyEntry::ELocalizedProperty) {
   144             confirmationMessageProperty =
   137             confirmationMessageProperty
   145                 static_cast<CLocalizablePropertyEntry *>(
   138                     = static_cast<CLocalizablePropertyEntry *>(
   146                     confirmationProperty);
   139                             confirmationProperty);
   147         } else {
   140         } else {
   148             delete confirmationProperty;
   141             delete confirmationProperty;
   149             confirmationProperty = NULL;
   142             confirmationProperty = NULL;
   150         }
   143         }
   151 
   144 
   154             for (TInt i = 0; i<appUidsArray.Count(); i++) {
   147             for (TInt i = 0; i<appUidsArray.Count(); i++) {
   155                 appUids.append(QString::number(appUidsArray[i].iUid));
   148                 appUids.append(QString::number(appUidsArray[i].iUid));
   156             }
   149             }
   157             if (confirmationMessageProperty) {
   150             if (confirmationMessageProperty) {
   158                 confirmationMessage = XQConversions::s60DescToQString(
   151                 confirmationMessage = XQConversions::s60DescToQString(
   159                     confirmationMessageProperty->StrValue());
   152                         confirmationMessageProperty->StrValue());
   160             }
   153             }
   161         );
   154         );
   162 
   155 
   163         CleanupStack::PopAndDestroy(3, &appUidsArray);
   156         CleanupStack::PopAndDestroy(3, &appUidsArray);
   164     }
   157     }
   182 
   175 
   183         RSoftwareComponentRegistry softwareComponentRegistry;
   176         RSoftwareComponentRegistry softwareComponentRegistry;
   184         CleanupClosePushL(softwareComponentRegistry);
   177         CleanupClosePushL(softwareComponentRegistry);
   185         User::LeaveIfError(softwareComponentRegistry.Connect());
   178         User::LeaveIfError(softwareComponentRegistry.Connect());
   186 
   179 
   187         softwareComponentRegistry.GetAppUidsForComponentL(componentIdValue,
   180         softwareComponentRegistry.GetAppUidsForComponentL(
   188             appUidsArray);
   181                 componentIdValue, appUidsArray);
   189 
   182 
   190         QT_TRYCATCH_LEAVING(
   183         QT_TRYCATCH_LEAVING(
   191             for (TInt i = 0; i<appUidsArray.Count(); i++) {
   184             for (TInt i = 0; i<appUidsArray.Count(); i++) {
   192                 appUids.append(QString::number(appUidsArray[i].iUid));
   185                 appUids.append(QString::number(appUidsArray[i].iUid));
   193             }
   186             }
   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 }