contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp
changeset 83 156f692b1687
parent 80 397d00875918
child 98 d2f833ab7940
equal deleted inserted replaced
80:397d00875918 83:156f692b1687
    20 #include <QString>
    20 #include <QString>
    21 
    21 
    22 #include <usif/scr/scr.h>
    22 #include <usif/scr/scr.h>
    23 #include <usif/scr/screntries.h>
    23 #include <usif/scr/screntries.h>
    24 #include <xqconversions.h>
    24 #include <xqconversions.h>
       
    25 #include <driveinfo.h>
    25 
    26 
    26 #include "casoftwareregistry.h"
    27 #include "casoftwareregistry.h"
    27 #include "casoftwareregistry_p.h"
    28 #include "casoftwareregistry_p.h"
    28 
    29 
    29 using namespace Usif;
    30 using namespace Usif;
    37     }
    38     }
    38 };
    39 };
    39 
    40 
    40 typedef QScopedPointer<RSoftwareComponentRegistry, 
    41 typedef QScopedPointer<RSoftwareComponentRegistry, 
    41     RClassDeleter<RSoftwareComponentRegistry> > ScrScopedPointer;
    42     RClassDeleter<RSoftwareComponentRegistry> > ScrScopedPointer;
       
    43     
       
    44 typedef QScopedPointer<RFs, 
       
    45     RClassDeleter<RFs> > RFSScopedPointer;
    42 /*!
    46 /*!
    43  Constructor
    47  Constructor
    44  \param servicePublic Pointer to object of the public class.
    48  \param servicePublic Pointer to object of the public class.
    45  */
    49  */
    46 CaSoftwareRegistryPrivate::CaSoftwareRegistryPrivate(
    50 CaSoftwareRegistryPrivate::CaSoftwareRegistryPrivate(
    65     int componentId) const
    69     int componentId) const
    66 {
    70 {
    67     CaSoftwareRegistry::DetailMap result;
    71     CaSoftwareRegistry::DetailMap result;
    68 
    72 
    69     if (componentId >= 1) {
    73     if (componentId >= 1) {
    70         ScrScopedPointer scr(new RSoftwareComponentRegistry);
    74         RSoftwareComponentRegistry softwareComponentRegistry;
       
    75         ScrScopedPointer scr(&softwareComponentRegistry);
    71         QT_TRAP_THROWING(User::LeaveIfError(scr->Connect()));
    76         QT_TRAP_THROWING(User::LeaveIfError(scr->Connect()));
    72         
    77         
    73         QScopedPointer<CComponentEntry> entry;
    78         QScopedPointer<CComponentEntry> entry;
    74         
    79         
    75         QT_TRAP_THROWING(entry.reset(CComponentEntry::NewL()));
    80         QT_TRAP_THROWING(entry.reset(CComponentEntry::NewL()));
    97     
   102     
    98     detailMap[CaSoftwareRegistry::componentVendorKey()] = 
   103     detailMap[CaSoftwareRegistry::componentVendorKey()] = 
    99         XQConversions::s60DescToQString(entry.Vendor());
   104         XQConversions::s60DescToQString(entry.Vendor());
   100         
   105         
   101     QString drives;
   106     QString drives;
       
   107     TChar drive;
       
   108     
   102     const TInt driveListLen(entry.InstalledDrives().Length());
   109     const TInt driveListLen(entry.InstalledDrives().Length());
   103     for (TInt i( 0 ); i < driveListLen; ++i) {
   110     for (TInt i( 0 ); i < driveListLen; ++i) {
   104         if (entry.InstalledDrives()[i] != '\0') {
   111         if (entry.InstalledDrives()[i] != '\0') {
       
   112             
   105             if (!drives.isEmpty()) {
   113             if (!drives.isEmpty()) {
   106                 drives = drives.append(",");
   114                 drives = drives.append(",");
   107              }
   115              }  
   108             drives = drives.append(QChar('A'+ i)).append(":");
   116             
       
   117             if(DriveInfo::GetDefaultDrive(DriveInfo::EDefaultPhoneMemory, drive ) == KErrNone 
       
   118                     && QChar('A'+ i) == QChar(drive))
       
   119                 {
       
   120                 drives = drives.append(QChar('A'+ i)).append(":").append(
       
   121                         " txt_applib_dialog_1_device_memory");
       
   122                 }
       
   123             else if(DriveInfo::GetDefaultDrive(DriveInfo::EDefaultMassStorage, drive ) == KErrNone 
       
   124                     && QChar('A'+ i) == QChar(drive))
       
   125                 {
       
   126                 drives = drives.append(QChar('A'+ i)).append(":").append(
       
   127                         " txt_applib_dialog_1_mass_storage");
       
   128                 }
       
   129             else if(DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRemovableMassStorage, drive ) == KErrNone 
       
   130                     && QChar('A'+ i) == QChar(drive))
       
   131                 {
       
   132                 RFs fs;
       
   133                 RFSScopedPointer fSPointer(&fs);
       
   134                 qt_symbian_throwIfError(fs.Connect());
       
   135 
       
   136                 TInt driveNumber;
       
   137                 TVolumeInfo tv;
       
   138                 DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRemovableMassStorage, driveNumber );
       
   139                 
       
   140                 qt_symbian_throwIfError(fs.Volume(tv, driveNumber));
       
   141                 if(tv.iName.Length()) {
       
   142                     drives = drives.append(QChar('A'+ i)).append(": ").append(
       
   143                                 XQConversions::s60DescToQString(tv.iName));                
       
   144                 }
       
   145                 else {
       
   146                     drives = drives.append(QChar('A'+ i)).append(":").append(
       
   147                         " txt_applib_dialog_1_memory_card");                
       
   148                 }
       
   149             }
       
   150             else {
       
   151                 drives = drives.append(QChar('A'+ i)).append(":");   
       
   152             }
   109         }
   153         }
   110     }
   154     }
   111     
   155     
   112     detailMap[CaSoftwareRegistry::componentDriveInfoKey()] = drives;
   156     detailMap[CaSoftwareRegistry::componentDriveInfoKey()] = drives;
   113     detailMap[CaSoftwareRegistry::componentSizeKey()].setNum(
   157     detailMap[CaSoftwareRegistry::componentSizeKey()].setNum(